Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1310 CNY

100%

CVE-2021-3156 PoC — Sudo 缓冲区错误漏洞

Source
Associated Vulnerability
Title:Sudo 缓冲区错误漏洞 (CVE-2021-3156)
Description:Sudo before 1.9.5p2 contains an off-by-one error that can result in a heap-based buffer overflow, which allows privilege escalation to root via "sudoedit -s" and a command-line argument that ends with a single backslash character.
Readme
# CVE-2021-3156 PoC

## Introduction

This is an exploit for the `CVE-2021-3156` sudo vulnerability (dubbed [Baron Samedit](https://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txt) by Qualys).

## Usage

build:
```
$ make
```


list targets:
```
$ ./sudo-hax-me-a-sandwich
```

run:
```
$ ./sudo-hax-me-a-sandwich <target_number>
```

manual mode:
```
$ ./sudo-hax-me-a-sandwich <smash_len_a> <smash_len_b> <null_stomp_len> <lc_all_len>
```

## Bruteforce target finding (experimental)

Make sure you have [GNU parallel](https://ftpmirror.gnu.org/parallel/parallel-latest.tar.bz2) installed.

```
$ make brute
$ ./brute.sh <smash_start> <smash_end> <null_start> <null_end> <lc_start> <lc_end>
```

some defaults to try:
```
$ ./brute.sh 90 120 50 70 150 300
```

Will eat up all available cores. Don't try to netflix & brute.

## Contributing

Send (sensible) PR's, I might merge.

Some ideas:
* More targets
* Target finding
* Other exploitation strategies
* More self contained functionality:
    * Embed shared library hax.c (Make it small please, ELF golf + asm setuid/execve stub)
    * Add mkdir logic to hax.c
* Directory/shared library cleanup
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →