Skip to main content

Check Sudo Permissions

Look for:
  • NOPASSWD — no password required
  • (ALL) or (root) — runs as root
  • Specific binaries — check GTFOBins

GTFOBins — Sudo

Common Entries

vim

find

python

perl

less

awk

nmap

env

tar

zip

man

apache2

Leaks first line of file in error output.

LD_PRELOAD

If sudo -l shows env_keep+=LD_PRELOAD:

Malicious Shared Library

Compile:
Execute with any allowed sudo command:

LD_LIBRARY_PATH

If env_keep+=LD_LIBRARY_PATH:

Find Shared Libraries

Hijack Library


Sudo CVEs

CVE-2021-3156 — Baron Samedit (sudo < 1.9.5p2)

Heap buffer overflow in sudo. Any user → root. Check version:
Check vulnerable:
If segfault → vulnerable. Exploits:

CVE-2019-14287 — Sudo Bypass (sudo < 1.8.28)

If sudoers has (ALL, !root) NOPASSWD: /bin/bash:
-1 wraps to UID 0 (root).

CVE-2019-18634 — Sudo pwfeedback (sudo < 1.8.31)

If pwfeedback is enabled in /etc/sudoers:

Sudo Shell Escape Sequences

Some programs allow shell escape: