Skip to content
Back to Blog

writeups · 2 min read

WriteUp - Poison (HackTheBox)

Poison write-up (HackTheBox): simple FreeBSD machine that exploits LFI in browse.php to poison Apache logs and obtain RCE, extracts credentials from pwdbackup.txt, and escalates to root via VNC with leaked password.

· Manuel López Pérez · writeups

Poison write-up (HackTheBox): simple FreeBSD machine that exploits LFI in browse.php to poison Apache logs and obtain RCE, extracts credentials from pwdbackup.txt, and escalates to root via VNC with leaked password.

In this post we will resolve the machine Poison from HackTheBox. It’s a low-level FreeBSD Machine. My nick in HackTheBox is: manulqwerty. If you have any proposal or correction do not hesitate to leave a comment.

Write-Up

Enumeration

As always, the first thing will be a port scan with Nmap:

nmap -sC -sV 10.10.10.84

Let’s review the Web; We have LFI in /browse.php : In this case the name of the machine seems to give us a clue and to get shell we will try to poison the logs.

Exploitation

For this we will use the tutorial we wrote a few months ago: https://ironhackers.es/en/tutoriales/lfi-to-rce-envenenando-ssh-y-apache-logs/ As a FreeBSD, the log file will be:

/var/log/httpd-access.log

As you can see we’ve obtained RCE easily poisoning the Apache logs. Let’s get reverse shell: In the Web server we found the file pwdbackup. txt, although we didn’t need this shell to read it. As we read, the content looks like an encrypted password at least 13 times in base 64. Let’s decrypt it:

for((i=0;i<13;i++)) do cat salida$i | base64 -d > salida$((i+1)) done

In the file /etc/passwd we see that there is an user Charix. Let’s access via SSH with the credentials charix:Charix!2#4%6&8(0

Post-Exploitation

In the directory /home/charix we find the file secret.zip, we will decrypt it with the previous password: Charix!2#4%6&8(0 In addition to revising the processes we see that VNC Server is running: Let’s check the local ports with Sockstat which is the alternative to netstat for FreeBDS We will redirect the port through an SSH Tunnel and use the secret file contained in the secret. Zip:

ssh -L 5901:localhost:5901 charix@10.10.10.84 vncviewer localhost:5901 -passwd secret

Back to Blog

Related Posts

View All Posts »
WriteUp - Fighter (HackTheBox)

writeups · 3 min

WriteUp - Fighter (HackTheBox)

Write-up of Fighter (HackTheBox): medium-level Windows machine exploiting time-based SQLi to extract credentials, gets RCE via xp_cmdshell + msbuild NPS payload, and escalates to SYSTEM with Capcom.sys (CVE-2019-7253) + bypass of checks.

· Manuel López Pérez

WriteUp - Celestial (HackTheBox)

writeups · 2 min

WriteUp - Celestial (HackTheBox)

Write-up of Celestial (HackTheBox). Low-level Linux machine that exploits an insecure cookie deserialisation in Node.js (CVE-2017-16137) to obtain RCE, then escalates to root by abusing a cron job that executes an editable script.

· Manuel López Pérez

WriteUp – Rabbit (HackTheBox)

writeups · 2 min

WriteUp – Rabbit (HackTheBox)

Rabbit write-up (HackTheBox): Windows machine that exploits time-based SQLi in Complain Management System for RCE via xp_cmdshell + msbuild NPS payload, and escalates to SYSTEM by abusing WAMP64 running as SYSTEM.

· Manuel López Pérez