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


 读者福利!2 TB 各类技术资源免费赠送 

最近,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的版本信息。

$ 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字样则说明已启用否则没有;

$ 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.

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.

 $ perl -e 'print(("A" x 100 . chr(0)) x 50)' | sudo -S -k id    Password: Segmentation fault (core dumped)

3.解决方法

1、临时解决方法:

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

Defaults pwfeedback

改为

Defaults !pwfeedback

我们检查一下我们系统:

2、彻底解决方法:

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

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

关注「 民工哥技术之路」微信公众号对话框回复关键字:1024 可以获取一份最新整理的 2TB 技术干货:包括系统运维、数据库、redis、MogoDB、电子书、Java基础课程、Java实战项目、架构师综合教程、架构师实战项目、大数据、Docker容器、ELK Stack、机器学习、BAT面试精讲视频等。

☆ END ☆

精彩文章推荐:


微软又出阴招!五亿用户无家可归,将1.7亿中国人置于巨大风险中
微信上线新功能,只需30S,直接对话国务院!

华为2月3日正常上班,遭网友疯狂吐槽

微软CEO发邮件表示:员工及其家人健康高于一切

点击【阅读原文】发现更多精彩

觉得好看,请点这

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值