DC6 combat (wordpress + nmap provide the right) vulnhub the drone

0x00 environment

dc6 drone Download: https://download.vulnhub.com/dc/DC-6.zip

nat dc6 in open mode in vmware

kali2019 start in nat mode, ip address is 192.168.106.145

0x01 Information Collection

It was found with nmap scan ip host survival

 

 

 We found the target host ip is 192.168.106.148, then port scan

 

 

 

 22 and 80 found the open port, to access web services

 

 

 Access failure but found the domain name should be the resolution fails, then modify the hosts file on the local

hosts file in windows in c: \ windows \ system32 \ drivers \ etc \ hosts

In the \ etc \ hosts under linux

There permissions problem windiws, direct powershell open Notepad to open again to save your changes

 

 

 

 

 

 You can then access the target site

 

 

 Wordpress site is found, then we can use wpscan scan, the first scan prior to scanning for directory

 

 

 After Nothing can be scanned with wpscan, which scans users

wpscan --url http://wordy --enumerate u

 

 

 Five were swept to the user, namely, admin, graham, mark, sarah, jens

0x02 Login Web

These among several users to write to user.txt

 

 

 Then use cewl generate wordpress associated password dictionary wordy-pass.dic

cewl wordy -w wordy-pass.dic

 

 

 Wpscan use brute force user passwords, syntax:

wpscan --url Wordy -U username .txt -P Pass .dic 

 

 

 没找到密码,再回去看看有什么提示,https://www.vulnhub.com/entry/dc-6,315/

 

 

 提示到使用kali里面的rockyou.txt字典

 

 

 先解压,然后将里面的k01的部分导出到dc6目录下面的passwords.txt

gunzip rockyou.txt.gz rockyou.txt

 

 

 

 

 

 再利用wpscan暴力破解的命令

 

 

 得到用户密码为:

用户:mark
密码:helpdesk01

拿到后台去登录:

 

 

0x03插件rce漏洞getshell 

一看是wp5.3的,很新的版本,后台漏洞没有发现,但是可以找插件漏洞,这里安装了一个activity monitor插件,百度了该插件的漏洞

 

 

 发现存在rce漏洞,用kali里面的searchsploit来搜索也能搜出来exp

 

 

 将其复制出来到dc6目录下

 

 

 打开修改一些参数,

 

 将这两个地方修改一下就好了,保存之后,kali先暂时开启web服务

python -m SimpleHTTPServer 80

然后在主机上访问

 

 

 

 先在kali上开启一个nc监听,端口为html中的9999

 

 然后主机上点击这个html的submit request

但这里不知道为什么没反弹成功,那么我们就使用抓包的形式来反弹shell

 

 先进入到该插件的tools部分,打开bp,开启代理,然后点击lookup发送post包,bp即可抓取到

 

 命令执行处在ip变量下面的值12处,

 

 看到可以成功执行命令,那么我们在这儿执行一个反弹命令,将shell反弹到我的vps上

 

 

 

 0x04水平越权

 成功反弹。cd到home下对应的用户下,我是mark登录的,所以只能看普通用户下的根目录,root目录是访问不了的,在home下查找除root用户的其他用户的根目录下的文件

 

 看到了mark目录下的子目录下存在一个txt文件,打开看看

 

 我们看到了graham用户的密码,可以使用ssh直接连接,也可以使用su来切换用户,为了方便我们直接在交互式shell里面来切换用户吧。

 

 查看当前用户可执行操作:sudo -l

 

 发现jens/下面的backups.sh可以在当前用户下执行,那么切换到该目录下面去查看脚本内容

 

 是备份网站根目录的作用,那么既然可以执行脚本,那么我们在脚本里面写入/bin/bash 命令,然后让jens用户运行不就可以获取到jens的shell了吗,反正是在jens目录下的脚本。

echo "/bin/bash" >> backups.sh
sudo -u jens ./backups.sh

 0x05nmap脚本提权

 获取到jens的shell,查看它有哪些执行操作

 

 发现可以执行root的nmap,也就是nmap是root权限

nmap工具是可以执行脚本的,那么我们把弹root用户shell的命令写入到nmap的脚本里面,然后用nmap命令执行即可切换到root用户的shell。

echo 'os.execute("/bin/sh")' > getShell
sudo  nmap  --script=getShell

 

 然后cd到root目录下,发现flag的txt文件

 

 

Guess you like

Origin www.cnblogs.com/-chenxs/p/12060347.html