· Manuel López Pérez · 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.

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 - Poison (HackTheBox)

WriteUp - Poison (HackTheBox)

Write-up de Poison (HackTheBox): máquina FreeBSD sencilla que explota LFI en browse.php para envenenar logs de Apache y obtener RCE, extrae credenciales de pwdbackup.txt y escala a root vía VNC con contraseña filtrada.

WriteUp - Fighter (HackTheBox)

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.

WriteUp - Fighter (HackTheBox)

WriteUp - Fighter (HackTheBox)

Write-up de Fighter (HackTheBox): máquina Windows de nivel medio que explota SQLi time-based para extraer credenciales, obtiene RCE vía xp_cmdshell + msbuild NPS payload y escala a SYSTEM con Capcom.sys (CVE-2019-7253) + bypass de checks.

WriteUp - Celestial (HackTheBox)

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.