Qualys 研究实验室在 GNU C Library(CVE-2017-1000366)的动态链接器中发现了许多问题,它们通过与 Linux 内核内的堆栈冲突来允许本地特权升级。
-- Vivek Gite

本文导航
在 Linux 内核中发现了一个名为 “Stack Clash” 的严重安全问题,攻击者能够利用它来破坏内存数据并执行任意代码。攻击者可以利用这个及另一个漏洞来执行任意代码并获得管理帐户(root)权限。
在 Linux 中该如何解决这个问题?
the-stack-clash-on-linux-openbsd-netbsd-freebsd-solaris
Qualys 研究实验室在 GNU C Library(CVE-2017-1000366)的动态链接器中发现了许多问题,它们通过与 Linux 内核内的堆栈冲突来允许本地特权升级。这个 bug 影响到了 i386 和 amd64 上的 Linux、OpenBSD、NetBSD、FreeBSD 和 Solaris。攻击者可以利用它来破坏内存数据并执行任意代码。
什么是 CVE-2017-1000364 bug?
来自 RHN[1]
在用户空间二进制文件的堆栈中分配内存的方式发现了一个缺陷。如果堆(或不同的内存区域)和堆栈内存区域彼此相邻,则攻击者可以使用此缺陷跳过堆栈保护区域,从而导致进程堆栈或相邻内存区域的受控内存损坏,从而增加其系统权限。有一个在内核中减轻这个漏洞的方法,将堆栈保护区域大小从一页增加到 1 MiB,从而使成功利用这个功能变得困难。
据原研究文章[2]
计算机上运行的每个程序都使用一个称为堆栈的特殊内存区域。这个内存区域是特别的,因为当程序需要更多的堆栈内存时,它会自动增长。但是,如果它增长太多,并且与另一个内存区域太接近,程序可能会将堆栈与其他内存区域混淆。攻击者可以利用这种混乱来覆盖其他内存区域的堆栈,或者反过来。
受到影响的 Linux 发行版
  1. Red Hat Enterprise Linux Server 5.x
  2. Red Hat Enterprise Linux Server 6.x
  3. Red Hat Enterprise Linux Server 7.x
  4. CentOS Linux Server 5.x
  5. CentOS Linux Server 6.x
  6. CentOS Linux Server 7.x
  7. Oracle Enterprise Linux Server 5.x
  8. Oracle Enterprise Linux Server 6.x
  9. Oracle Enterprise Linux Server 7.x
  10. Ubuntu 17.10
  11. Ubuntu 17.04
  12. Ubuntu 16.10
  13. Ubuntu 16.04 LTS
  14. Ubuntu 12.04 ESM (Precise Pangolin)
  15. Debian 9 stretch
  16. Debian 8 jessie
  17. Debian 7 wheezy
  18. Debian unstable
  19. SUSE Linux Enterprise Desktop 12 SP2
  20. SUSE Linux Enterprise High Availability 12 SP2
  21. SUSE Linux Enterprise Live Patching 12
  22. SUSE Linux Enterprise Module for Public Cloud 12
  23. SUSE Linux Enterprise Build System Kit 12 SP2
  24. SUSE Openstack Cloud Magnum Orchestration 7
  25. SUSE Linux Enterprise Server 11 SP3-LTSS
  26. SUSE Linux Enterprise Server 11 SP4
  27. SUSE Linux Enterprise Server 12 SP1-LTSS
  28. SUSE Linux Enterprise Server 12 SP2
  29. SUSE Linux Enterprise Server for Raspberry Pi 12 SP2
我需要重启我的电脑么?
是的,由于大多数服务依赖于 GNU C Library 的动态连接器,并且内核自身需要在内存中重新加载。
我该如何在 Linux 中修复 CVE-2017-1000364?
根据你的 Linux 发行版来输入命令。你需要重启电脑。在应用补丁之前,记下你当前内核的版本:
  1. $ uname-a
  2. $ uname-mrs
示例输出:
  1. Linux4.4.0-78-generic x86_64
Debian 或者 Ubuntu Linux
输入下面的 apt 命令[3] / apt-get 命令[4]来应用更新:
  1. $ sudoapt-get update &&sudoapt-get upgrade &&sudoapt-get dist-upgrade
示例输出:
  1. Readingpackage lists...Done
  2. Building dependency tree      
  3. Reading state information...Done
  4. Calculating upgrade...Done
  5. The following packages will be upgraded:
  6.  libc-bin libc-dev-bin libc-l10n libc6 libc6-dev libc6-i386 linux-compiler-gcc-6-x86 linux-headers-4.9.0-3-amd64 linux-headers-4.9.0-3-common linux-image-4.9.0-3-amd64
  7.  linux-kbuild-4.9 linux-libc-dev locales multiarch-support
  8. 14 upgraded,0 newly installed,0 to remove and0not upgraded.
  9. Need to get0 B/62.0 MB of archives.
  10. Afterthis operation,4,096 B of additional disk space will be used.
  11. Do you want to continue?[Y/n] y
  12. Reading changelogs...Done
  13. Preconfiguring packages ...
  14. (Reading database ...115123 files and directories currently installed.)
  15. Preparing to unpack .../libc6-i386_2.24-11+deb9u1_amd64.deb ...
  16. Unpacking libc6-i386 (2.24-11+deb9u1) over (2.24-11)...
  17. Preparing to unpack .../libc6-dev_2.24-11+deb9u1_amd64.deb ...
  18. Unpacking libc6-dev:amd64 (2.24-11+deb9u1) over (2.24-11)...
  19. Preparing to unpack .../libc-dev-bin_2.24-11+deb9u1_amd64.deb ...
  20. Unpacking libc-dev-bin (2.24-11+deb9u1) over (2.24-11)...
  21. Preparing to unpack .../linux-libc-dev_4.9.30-2+deb9u1_amd64.deb ...
  22. Unpacking linux-libc-dev:amd64 (4.9.30-2+deb9u1) over (4.9.30-2)...
  23. Preparing to unpack .../libc6_2.24-11+deb9u1_amd64.deb ...
  24. Unpacking libc6:amd64 (2.24-11+deb9u1) over (2.24-11)...
  25. Setting up libc6:amd64 (2.24-11+deb9u1)...
  26. (Reading database ...115123 files and directories currently installed.)
  27. Preparing to unpack .../libc-bin_2.24-11+deb9u1_amd64.deb ...
  28. Unpacking libc-bin (2.24-11+deb9u1) over (2.24-11)...
  29. Setting up libc-bin (2.24-11+deb9u1)...
  30. (Reading database ...115123 files and directories currently installed.)
  31. Preparing to unpack .../multiarch-support_2.24-11+deb9u1_amd64.deb ...
  32. Unpacking multiarch-support (2.24-11+deb9u1) over (2.24-11)...
  33. Setting up multiarch-support (2.24-11+deb9u1)...
  34. (Reading database ...115123 files and directories currently installed.)
  35. Preparing to unpack .../0-libc-l10n_2.24-11+deb9u1_all.deb ...
  36. Unpacking libc-l10n (2.24-11+deb9u1) over (2.24-11)...
  37. Preparing to unpack .../1-locales_2.24-11+deb9u1_all.deb ...
  38. Unpacking locales (2.24-11+deb9u1) over (2.24-11)...
  39. Preparing to unpack .../2-linux-compiler-gcc-6-x86_4.9.30-2+deb9u1_amd64.deb ...
  40. Unpacking linux-compiler-gcc-6-x86 (4.9.30-2+deb9u1) over (4.9.30-2)...
  41. Preparing to unpack .../3-linux-headers-4.9.0-3-amd64_4.9.30-2+deb9u1_amd64.deb ...
  42. Unpacking linux-headers-4.9.0-3-amd64 (4.9.30-2+deb9u1) over (4.9.30-2)...
  43. Preparing to unpack .../4-linux-headers-4.9.0-3-common_4.9.30-2+deb9u1_all.deb ...
  44. Unpacking linux-headers-4.9.0-3-common (4.9.30-2+deb9u1) over (4.9.30-2)...
  45. Preparing to unpack .../5-linux-kbuild-4.9_4.9.30-2+deb9u1_amd64.deb ...
  46. Unpacking linux-kbuild-4.9(4.9.30-2+deb9u1) over (4.9.30-2)...
  47. Preparing to unpack .../6-linux-image-4.9.0-3-amd64_4.9.30-2+deb9u1_amd64.deb ...
  48. Unpacking linux-image-4.9.0-3-amd64 (4.9.30-2+deb9u1) over (4.9.30-2)...
  49. Setting up linux-libc-dev:amd64 (4.9.30-2+deb9u1)...
  50. Setting up linux-headers-4.9.0-3-common (4.9.30-2+deb9u1)...
  51. Setting up libc6-i386 (2.24-11+deb9u1)...
  52. Setting up linux-compiler-gcc-6-x86 (4.9.30-2+deb9u1)...
  53. Setting up linux-kbuild-4.9(4.9.30-2+deb9u1)...
  54. Setting up libc-l10n (2.24-11+deb9u1)...
  55. Processing triggers forman-db (2.7.6.1-2)...
  56. Setting up libc-dev-bin (2.24-11+deb9u1)...
  57. Setting up linux-image-4.9.0-3-amd64 (4.9.30-2+deb9u1)...
  58. /etc/kernel/postinst.d/initramfs-tools:
  59. update-initramfs:Generating/boot/initrd.img-4.9.0-3-amd64
  60. cryptsetup: WARNING: failed to detect canonical device of /dev/md0
  61. cryptsetup: WARNING: could not determine root device from/etc/fstab
  62. W: initramfs-tools configuration sets RESUME=UUID=054b217a-306b-4c18-b0bf-0ed85af6c6e1
  63. W: but no matching swap device is available.
  64. I:The initramfs will attempt to resume from/dev/md1p1
  65. I:(UUID=bf72f3d4-3be4-4f68-8aae-4edfe5431670)
  66. I:Set the RESUME variable to override this.
  67. /etc/kernel/postinst.d/zz-update-grub:
  68. Searchingfor GRUB installation directory ... found:/boot/grub
  69. Searchingfordefaultfile... found:/boot/grub/default
  70. Testingfor an existing GRUB menu.lst file... found:/boot/grub/menu.lst
  71. Searchingfor splash image ... none found, skipping ...
  72. Found kernel:/boot/vmlinuz-4.9.0-3-amd64
  73. Found kernel:/boot/vmlinuz-3.16.0-4-amd64
  74. Updating/boot/grub/menu.lst ...done
  75. Setting up libc6-dev:amd64 (2.24-11+deb9u1)...
  76. Setting up locales (2.24-11+deb9u1)...
  77. Generating locales (this might take a while)...
  78.  en_IN.UTF-8...done
  79. Generation complete.
  80. Setting up linux-headers-4.9.0-3-amd64 (4.9.30-2+deb9u1)...
  81. Processing triggers for libc-bin (2.24-11+deb9u1)...
使用 reboot 命令[5]重启桌面/服务器:
  1. $ sudoreboot
Oracle/RHEL/CentOS/Scientific Linux
输入下面的 yum 命令[6]
  1. $ sudoyum update
  2. $ sudoreboot
Fedora Linux
输入下面的 dnf 命令:
  1. $ sudo dnf update
  2. $ sudoreboot
Suse Enterprise Linux 或者 Opensuse Linux
输入下面的 zypper 命令:
  1. $ sudo zypper patch
  2. $ sudoreboot
SUSE OpenStack Cloud 6
  1. $ sudo zypper in-t patch SUSE-OpenStack-Cloud-6-2017-996=1
  2. $ sudoreboot
SUSE Linux Enterprise Server for SAP 12-SP1
  1. $ sudo zypper in-t patch SUSE-SLE-SAP-12-SP1-2017-996=1
  2. $ sudoreboot
SUSE Linux Enterprise Server 12-SP1-LTSS
  1. $ sudo zypper in-t patch SUSE-SLE-SERVER-12-SP1-2017-996=1
  2. $ sudoreboot
SUSE Linux Enterprise Module for Public Cloud 12
  1. $ sudo zypper in-t patch SUSE-SLE-Module-Public-Cloud-12-2017-996=1
  2. $ sudoreboot
验证
你需要确认你的版本号在 reboot 命令[7]之后改变了。
  1. $ uname-a
  2. $ uname-r
  3. $ uname-mrs
示例输出:
  1. Linux4.4.0-81-generic x86_64
给 OpenBSD 用户的注意事项
此页[8]获取更多信息。
给 Oracle Solaris 的注意事项
见此页[9]获取更多信息。
参考
  • 堆栈冲突[10]

作者简介:
Vivek Gite
作者是 nixCraft 的创始人,对于 Linux 操作系统/Unix shell脚本有经验丰富的系统管理员和培训师。他曾与全球客户及各行各业,包括 IT、教育、国防和空间研究以及非营利部门合作。在 Twitter[11]Facebook[12]Google +[13] 上关注他。

via: https://www.cyberciti.biz/faq/howto-patch-linux-kernel-stack-clash-vulnerability-cve-2017-1000364/
作者:Vivek Gite[14] 译者:geekpi 校对:wxy
本文由 LCTT 原创编译,Linux中国 荣誉推出
LCTT 译者
geekpi
共计翻译:489 篇
贡献时间:1148 天
推荐文章
< 左右滑动查看相关文章 >
点击图片、输入文章 ID 或识别二维码直达
继续阅读
阅读原文