Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit d24088d

Browse files
committed
README
1 parent 6425ea4 commit d24088d

File tree

7 files changed

+223
-0
lines changed

7 files changed

+223
-0
lines changed

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM maven:3-jdk-8 AS builder
2+
3+
LABEL MAINTAINER="4ra1n"
4+
5+
COPY ./ /usr/src/
6+
COPY ./settings.xml /root/.m2/settings.xml
7+
8+
WORKDIR /usr/src
9+
10+
RUN cd /usr/src; \
11+
mvn -U clean package -Dmaven.test.skip=true
12+
13+
FROM openjdk:8-jre
14+
15+
LABEL MAINTAINER="4ra1n"
16+
17+
COPY --from=builder /usr/src/fake-mysql-cli-0.0.1.jar /cli.jar
18+
19+
EXPOSE 3306
20+
21+
CMD ["java","-jar","/cli.jar","-p","3306"]

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# MySQL Fake Server
2+
3+
![](https://img.shields.io/badge/build-passing-brightgreen)
4+
![](https://img.shields.io/badge/build-Java%208-orange)
5+
![](https://img.shields.io/github/downloads/4ra1n/mysql-fake-server/total)
6+
![](https://img.shields.io/github/v/release/4ra1n/mysql-fake-server)
7+
8+
[English Version](doc/README.md)
9+
10+
## 0x00 介绍
11+
12+
该项目是 [MySQL_Fake_Server](https://github.com/fnmsd/MySQL_Fake_Server) 高级版
13+
14+
`JDBC URL`可控时,特殊的`MySQL`服务端可以读取`JDBC`客户端任意文件或执行反序列化操作
15+
16+
完全使用`Java`实现部分`MySQL`协议,内置常见`ysoserial`链,一键启动,自动生成可用的`payload`用于测试
17+
18+
## 0x01 GUI
19+
20+
使用`GUI`版本一键启动,启动后可以根据自己的环境输入参数,生成`payload`
21+
22+
启动:`java -jar fake-mysql-gui.jar`
23+
24+
![](img/001.png)
25+
26+
## 0x02 CLI
27+
28+
当你的环境不允许使用`GUI`版时,可以使用命令行版启动,同样可以使用`GUI`辅助生成`payload`
29+
30+
启动:`java -jar fake-mysql-cli.jar -p [port]`
31+
32+
![](img/002.png)
33+
34+
## 0x03 Docker
35+
36+
构建:`docker build -t fake-mysql-server .`
37+
38+
启动:`docker run -p 3306:3306 fake-mysql-server -d`
39+
40+
![](img/003.png)
41+
42+
## 0x04 RPC
43+
44+
本项目提供了`GRPC`调用的方式
45+
46+
启动:`java -jar fake-mysql-rpc.jar`(默认启动端口9999)
47+
48+
proto:
49+
50+
```protobuf
51+
syntax = "proto3";
52+
53+
option java_package = "me.n1ar4.fake.rpc";
54+
option java_outer_classname = "FakeServerRPC";
55+
option java_multiple_files = true;
56+
57+
package me.n1ar4.fake.rpc;
58+
59+
service RPCStart {
60+
rpc start (RPCNull) returns (RPCResp) {}
61+
rpc stop (RPCPort) returns(RPCResp) {}
62+
}
63+
64+
message RPCNull{}
65+
66+
message RPCResp {
67+
string status = 1;
68+
int32 port = 2;
69+
}
70+
71+
message RPCPort {
72+
int32 port = 1;
73+
}
74+
```
75+
76+
## 0x05 免责申明
77+
78+
本项目仅面向安全研究与学习,禁止任何非法用途
79+
80+
如您在使用本项目的过程中存在任何非法行为,您需自行承担相应后果
81+
82+
除非您已充分阅读、完全理解并接受本协议,否则,请您不要使用本项目
83+
84+
## 0x06 致谢与参考
85+
86+
- https://github.com/frohoff/ysoserial
87+
- https://github.com/fnmsd/MySQL_Fake_Server
88+
- https://pyn3rd.github.io/2022/06/06/Make-JDBC-Attacks-Brillian-Again-I/

doc/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# MySQL Fake Server
2+
3+
![](https://img.shields.io/badge/build-passing-brightgreen)
4+
![](https://img.shields.io/badge/build-Java%208-orange)
5+
![](https://img.shields.io/github/downloads/4ra1n/mysql-fake-server/total)
6+
![](https://img.shields.io/github/v/release/4ra1n/mysql-fake-server)
7+
8+
## 0x00 Introduction
9+
10+
This project is an advanced version of [MySQL_Fake_Server](https://github.com/fnmsd/MySQL_Fake_Server).
11+
12+
When the `JDBC URL` is controllable, a special `MySQL` server can read any file or perform deserialization operations on the `JDBC` client.
13+
14+
The `MySQL` protocol is partially implemented entirely using `Java`, with built-in common `ysoserial` chains, one-click launch, and automatic generation of usable payloads for testing.
15+
16+
## 0x01 GUI
17+
18+
Use the `GUI` version to start with one click. After starting, you can enter parameters according to your environment to generate a payload.
19+
20+
Launch: `java -jar fake-mysql-gui.jar`
21+
22+
![](../img/001.png)
23+
24+
## 0x02 CLI
25+
26+
When your environment does not allow the use of the `GUI` version, you can use the command line version to start, and also use the `GUI` to generate a payload.
27+
28+
Launch: `java -jar fake-mysql-cli.jar -p [port]`
29+
30+
![](../img/002.png)
31+
32+
## 0x03 Docker
33+
34+
Build: `docker build -t fake-mysql-server .`
35+
36+
Launch: `docker run -p 3306:3306 fake-mysql-server -d`
37+
38+
![](../img/003.png)
39+
40+
## 0x04 RPC
41+
42+
This project provides a `GRPC` call method.
43+
44+
Launch: `java -jar fake-mysql-rpc.jar` (default launch port 9999)
45+
46+
proto:
47+
48+
```protobuf
49+
syntax = "proto3";
50+
51+
option java_package = "me.n1ar4.fake.rpc";
52+
option java_outer_classname = "FakeServerRPC";
53+
option java_multiple_files = true;
54+
55+
package me.n1ar4.fake.rpc;
56+
57+
service RPCStart {
58+
rpc start (RPCNull) returns (RPCResp) {}
59+
rpc stop (RPCPort) returns(RPCResp) {}
60+
}
61+
62+
message RPCNull{}
63+
64+
message RPCResp {
65+
string status = 1;
66+
int32 port = 2;
67+
}
68+
69+
message RPCPort {
70+
int32 port = 1;
71+
}
72+
```
73+
74+
## 0x05 Disclaimer
75+
76+
This project is only for security research and learning purposes. Any illegal use is prohibited.
77+
78+
If you engage in any illegal behavior during the use of this project, you will be responsible for the consequences.
79+
80+
Unless you have fully read, completely understood, and accepted this agreement, please do not use this project.
81+
82+
## 0x06 Acknowledgments and References
83+
84+
- https://github.com/frohoff/ysoserial
85+
- https://github.com/fnmsd/MySQL_Fake_Server
86+
- https://pyn3rd.github.io/2022/06/06/Make-JDBC-Attacks-Brillian-Again-I/

img/001.png

108 KB
Loading

img/002.png

143 KB
Loading

img/003.png

451 KB
Loading

settings.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">
5+
<pluginGroups>
6+
</pluginGroups>
7+
<proxies>
8+
</proxies>
9+
<servers>
10+
</servers>
11+
<mirrors>
12+
<mirror>
13+
<id>aliyunmaven</id>
14+
<mirrorOf>*</mirrorOf>
15+
<name>aliyun</name>
16+
<url>https://maven.aliyun.com/repository/public</url>
17+
</mirror>
18+
<mirror>
19+
<id>maven-default-http-blocker</id>
20+
<mirrorOf>external:http:*</mirrorOf>
21+
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
22+
<url>http://0.0.0.0/</url>
23+
<blocked>true</blocked>
24+
</mirror>
25+
</mirrors>
26+
<profiles>
27+
</profiles>
28+
</settings>

0 commit comments

Comments
 (0)