POC详情: c9b05737ad71eded989a7dc40a377214a1b91c83

来源
关联漏洞
标题: Sudo 缓冲区错误漏洞 (CVE-2021-3156)
描述:Sudo是一款使用于类Unix系统的,允许用户通过安全的方式使用特殊的权限执行命令的程序。 Sudo 1.9.5p2 之前版本存在缓冲区错误漏洞,攻击者可使用sudoedit -s和一个以单个反斜杠字符结束的命令行参数升级到root。
描述
Sudo Heap Overflow Baron Samedit
介绍
# CVE-2021-3156

## Introduction

>This repository was created for studying purpose. The project contains some tools for studying the sudo Baron Samedit vulnerability and the exploit for it.
>Thanks to [Qualys Team](https://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txt) for discovering such vulnerability, to [Worawit](https://github.com/worawit/CVE-2021-3156) and [0xdevil](https://github.com/0xdevil/CVE-2021-3156) for the interesting writeups.

## Usage

> The Docker directory contains a Docker container used for studying some part of the vulnerability:
- Use ``` make all ``` for starting the container.
- Use ``` make root ``` for open a shell as root.
- Use ``` make user ``` for open a shell as user.

> Care that the exploit will not work on the Docker container, at least not on ```Mac OS Big Sur``` with ```docker-machine```

> The environment directory contains ```debug.py``` and ```gdb_config``` used for debugging sudo. The subdirectory ``` src ``` contains some part of the source code.
> 
> The ``` source ``` directory contains all the sudo code.
> 
> the ``` exploit ``` directory contains the python exploit devolped for this project and the malicious library used for spawn a root shell.
- Compile the C program ``` gcc -shared -o X1234.so.2 -fPIC X1234.c ```
- Run the exploit ``` python3 exploit.py ```
- Enjoi the root shell

> The exploit was tested on :
- ```Ubuntu 20.04 ```
- ```ldd (Ubuntu GLIBC 2.31-0ubuntu9) 2.31 Copyright (C) 2020 Free Software Foundation, Inc.```
- ``` sudo version: 1.8.31```
> it may not work on other versions. In that case just try to change some numbers in the code.




文件快照

[4.0K] /data/pocs/c9b05737ad71eded989a7dc40a377214a1b91c83 ├── [4.0K] Docker │   ├── [ 867] Dockerfile │   └── [ 375] Makefile ├── [4.0K] environment │   ├── [ 332] debug.py │   ├── [ 156] gdb_config │   └── [4.0K] src │   ├── [ 24K] nsswitch.c │   └── [ 37K] sudoers.c ├── [4.0K] exploit │   ├── [1.3K] exploit.py │   └── [4.0K] libnss_X │   └── [ 273] X1234.c ├── [ 34K] LICENSE ├── [1.6K] README.md └── [4.0K] source ├── [ 57] README.md └── [3.7M] sudo-SUDO_1_8_31.zip 6 directories, 12 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。