前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >高危漏洞!黑客可利用sudo获得 root权限

高危漏洞!黑客可利用sudo获得 root权限

作者头像
民工哥
发布2020-09-15 11:08:23
1.6K0
发布2020-09-15 11:08:23
举报
文章被收录于专栏:民工哥技术之路

最近,sudo官网爆出目前sudo工具的一个高危漏洞,漏洞编号为:CVE-2019-18634,黑客可通过工具获得Linux的root权限(root具有Linux操作系统的最高权限)。

sudo 是Unix和Linux操作系统广泛使用的工具,这次漏洞是一个是一个堆栈缓冲溢出 bug,这个漏洞在启用了 pwfeedback 的系统中很容易利用,该漏洞让非特权用户很容易通过缓冲溢出获得 root 权限,不需要攻击者有 Sudo 使用权限。

在 Sudo 上游版本中,pwfeedback 没有默认启用,但在下游发行版如 Linux Mint 和 Elementary OS 中,pwfeedback 被默认启用了。主要影响的版本:从v1.7.1 到 1.8.25p1,ubuntu版本不受该漏洞影响,最新的1.8.31已修复了该漏洞,请大家及时更新到最新的版本。

1.查看自己系统是否存在该漏洞

1、先通过sudo --version命令查看当前sudo的版本信息。

代码语言:javascript
复制
$ sudo --version
Sudo version 1.8.25p1Sudoers policy plugin version 1.8.25p1Sudoers file grammar version 46Sudoers I/O plugin version 1.8.25p1

2、通过sudo -l查看 pwfeedback是否启用,如果存在pwfeedback字样则说明已启用否则没有;

代码语言:javascript
复制
$ sudo -l    Matching Defaults entries for millert on linux-build:insults, pwfeedback, mail_badpass, mailerpath=/usr/sbin/sendmail    User millert may run the following commands on linux-build:(ALL : ALL) ALL

2.如何利用该漏洞

1、在1.8.26之前的版本

利用该漏洞,不需要登录的用户有sudo权限,可以利用无法写入的伪终端,向sudo -k 传入超长字符串。原文为:The bug can be reproduced by passing a large input with embedded terminal kill characters to sudo from a pseudo-terminal that cannot be written to.

代码语言:javascript
复制
For example, using the socat utility and assuming the terminal kill character is set to control-U (0x15):    $ socat pty,link=/tmp/pty,waitslave exec:"perl -e 'print((\"A\" x 100 . chr(0x15)) x 50)'" &    $ sudo -S -k id < /tmp/pty    Password: Segmentation fault (core dumped)

2.在1.8.26之后的版本,只要向sudo 传输一个超长字符串

For sudo versions prior to 1.8.26, and on systems with uni-directional pipes, reproducing the bug is simpler. Here, the terminal kill character is set to the NUL character (0x00) since sudo is not reading from a terminal. This method is not effective in newer versions of sudo due to a change in EOF handling introduced in 1.8.26.

代码语言:javascript
复制
 $ perl -e 'print(("A" x 100 . chr(0)) x 50)' | sudo -S -k id    Password: Segmentation fault (core dumped)

3.解决方法

1、临时解决方法:

修改/etc/sudoers 文件,关闭pwfeedback 功能,把该文件中下面这行:

代码语言:javascript
复制
Defaults pwfeedback

改为

代码语言:javascript
复制
Defaults !pwfeedback

我们检查一下我们系统:

2、彻底解决方法:

升级系统的sudo,升级到最新的版本1.8.31以上即可.

为了保证安全,请大家尽快修复该漏洞!

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-02-07,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 民工哥技术之路 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.查看自己系统是否存在该漏洞
  • 2.如何利用该漏洞
  • 3.解决方法
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档