@@ -23,241 +23,9 @@ extent.
23
23
<img src =" ./img/main.png " />
24
24
</p >
25
25
26
- ## Quick Start
26
+ ## Get started quickly
27
27
28
- > [ !WARNING]
29
- > Special Note: We only provide random password login protection for port 8011 by default. Other ports may have the risk
30
- > of being counter-exploited. Please remember to close the corresponding ports after using the relevant functions.
31
-
32
- ### Method 1: Docker
33
-
34
- You can start the ` java-chains ` project with a single ` docker ` command (recommended approach).
35
-
36
- ``` shell
37
- docker run -d \
38
- --name java-chains \
39
- --restart=always \
40
- -p 8011:8011 \
41
- -p 58080:58080 \
42
- -p 50389:50389 \
43
- -p 50388:50388 \
44
- -p 13999:13999 \
45
- -p 3308:3308 \
46
- -p 11527:11527 \
47
- -p 50000:50000 \
48
- -e CHAINS_AUTH=true \
49
- -e CHAINS_PASS= \
50
- javachains/javachains:1.4.0
51
- ```
52
-
53
- Authentication or password can be configured through environment variables;
54
-
55
- ** CHAINS_AUTH** : ` true ` to enable authentication, ` false ` to disable authentication. Authentication is enabled by
56
- default.
57
-
58
- ** CHAINS_PASS** : Specify the web password. If this variable is empty, a random password will be generated. Random
59
- password generation is the default.
60
-
61
- Note: Only port ` 8011 ` is required for the generation function. Other ports are used by the ` exploit ` module.
62
-
63
- Use the following command to retrieve the randomly generated strong password from Docker:
64
-
65
- ``` shell
66
- docker logs $( docker ps | grep javachains/javachains | awk ' {print $1}' ) | grep -E ' password'
67
- ```
68
-
69
- Output example:
70
-
71
- ``` text
72
- 11-12 06:59:53.301 INFO [main] c.a.c.w.c.SecurityConfig | | password: XSsWerJFGcCjB8FU
73
- ```
74
-
75
- Login page: ` http://your-ip:8011 `
76
-
77
- ### Method 2: Jar Package Startup
78
-
79
- ⚠️ Only JDK8 is supported. Temurin8/Zulu8 JDK is recommended.
80
-
81
- Use ` java -jar java-chains.jar ` to start. A randomly generated password will be printed after each startup.
82
-
83
- Default listening address is 0.0.0.0. Login page: ` http://your-ip:8011 ` (Use the username and password here to log in).
84
-
85
- You can set the web login password through environment variables, for example:
86
-
87
- Linux:
88
-
89
- ``` bash
90
- export CHAINS_PASS=[your_password] && java -jar java-chains.jar
91
- ```
92
-
93
- Windows:
94
-
95
- ``` cmd
96
- set CHAINS_PASS=[your_password] && java -jar java-chains.jar
97
- ```
98
-
99
- ## Module Introduction
100
-
101
- ` Java-Chains ` comprises the following six major modules:
102
-
103
- ### Generation Module (Generate)
104
-
105
- ` JavaNativePayload ` : Java Native Deserialization Payload Generation
106
-
107
- ` HessianPayload ` : Hessian1 Deserialization Payload Generation, supporting HessianServlet format deserialized data
108
-
109
- ` Hessian2Payload ` : Hessian2 Deserialization Payload Generation
110
-
111
- ` ShiroPayload ` : Shiro Payload Generation, facilitating manual generation and testing in specific environments
112
-
113
- - Supports custom AES KEY
114
- - Supports AES GCM mode
115
- - Supports inserting Base64 obfuscation characters
116
-
117
- ` OtherPayload `
118
-
119
- - ` CharsetJarConvet ` : Generates charsets.jar package, suitable for file upload RCE scenarios under SpringBoot
120
- - ` GroovyJarConvert ` : Generates fastjson-groovy.jar package, suitable for achieving RCE in high versions of Fastjson by
121
- loading specific format Jar packages via Groovy chains.
122
- - ` SnakeyamlJarConvert ` : Generates snakeyaml.jar package, suitable for achieving RCE in SnakeYaml by loading specific
123
- format Jar packages via SPI.
124
-
125
- - ` JDBCPayload ` : JDBC Payload Generation
126
- - H2 JDBC
127
- - PostgresSQL
128
- - ...
129
-
130
- ` ExpressionPayload ` : Expression Payload Generation, essentially replacing the bytecode part in the bytecode template
131
- with the expression. Manual implementation is recommended.
132
-
133
- - ` BcelConvert ` : BCEL format bytecode generation
134
- - ` JsConvert ` : Oracle Nashorn JS expression loading bytecode
135
- - ` VelocityConvert ` : Velocity loading bytecode via bcel
136
- - ...
137
-
138
- ` BytecodePayload ` : Bytecode Generation
139
-
140
- - For example, can generate bytecode for command execution, Sleep, DNSLog, in-memory webshell injection, echo,
141
- middleware detection, file writing, and file downloading.
142
- - Supports custom bytecode version
143
- - Supports custom bytecode class name
144
- - Supports generating TemplatesImpl bytecode format - implementing the AbstractTranslet interface
145
- - Supports bytecode obfuscation using Class-Obf
146
-
147
- ` XStreamPayload ` : XStream data generation, not fully tested yet, some Payloads may not be usable.
148
-
149
- ---
150
-
151
- The Payloads generated by this platform support the following obfuscation scenarios:
152
-
153
- | | JavaNativePayload | HessianPayload | Hessian2Payload |
154
- | --------------------------------------| -------------------| ----------------| -----------------|
155
- | Random Collection Dirty Data Padding | ✅ | ✅ | ✅ |
156
- | Garbage Class Padding | ✅ | ✅ | ✅ |
157
- | UTF-8 Overlong Encoding | ✅ | ✅ | ✅ |
158
- | TC_RESET Padding | ✅ | ❌ | ❌ |
159
-
160
- ---
161
-
162
- Note: If you want to use ` UserCustomByteArrayFromXXX ` to provide custom Java serialized byte stream data for
163
- obfuscation, currently it does not support random collection and garbage class insertion obfuscation. This is related to
164
- the implementation of obfuscation. The specific support is as follows:
165
-
166
- | | JavaNativePayload (Custom Serialization Scenario) |
167
- | -------------------------------| ---------------------------------------------------|
168
- | Random Collection Obfuscation | ❌ |
169
- | Garbage Class Insertion | ❌ |
170
- | UTF-8 Overlong Encoding | ✅ |
171
- | TC_RESET Padding | ✅ |
172
-
173
- ### JNDI Injection Exploitation Module (JNDI)
174
-
175
- Supports six exploitation techniques, plus a ShowHand chain for easy one-click testing of common chains.
176
-
177
- ` JndiBasicPayload ` : LDAP remote bytecode loading
178
-
179
- ` JndiDeserializationPayload ` : Deserialization based on the javaSerializedData field in LDAP
180
-
181
- ` JndiResourceRefPayload ` : LDAP exploitation based on BeanFactory Tomcat EL, Groovy, etc.
182
-
183
- ` JndiReferencePayload ` : LDAP Reference exploitation based on other ObjectFactories, such as various DataSource JDBC
184
- exploits.
185
-
186
- ` JndiRMIDeserializePayload ` : RMI deserialization to bypass high version JDK in LDAP
187
-
188
- ` JndiRefBypassPayload ` : ReferenceBypass to bypass high version JDK in LDAP
189
-
190
- ` JndiShowHandPayload ` : JNDI ShowHand Chain, one-click testing of common exploitation chains to improve testing
191
- efficiency.
192
-
193
- ### MySQL JDBC Deserialization Exploitation Module (Fake MySQL)
194
-
195
- ` FakeMySQLPayload ` : MySQL JDBC deserialization exploitation technique
196
-
197
- ` FakeMySQLReadPayload ` : MySQL JDBC client file read exploitation technique
198
-
199
- ` FakeMySQLSHPayload ` : FakeMySQL deserialization ShowHand Chain, one-click testing of common deserialization chains to
200
- improve testing efficiency.
201
-
202
- ### JRMP Deserialization Exploitation Module (JRMPListener)
203
-
204
- Can be used with JRMPClient deserialization chain to bypass low versions of RMI.
205
-
206
- ### TCP Server
207
-
208
- A simple TCP Server that can mount generated Payload files to a TCP port. Accessing this port will return the specified
209
- content.
210
-
211
- Suitable for Derby deserialization RCE scenarios, can directly obtain deserialization data through the TCP port.
212
-
213
- ### HTTP Server
214
-
215
- A simple HTTP server that mounts generated Payload files to an HTTP port. Accessing the specified port will return the
216
- specified content.
217
-
218
- Suitable for scenarios such as PostgreSQL remote loading of SpringBeanXML files.
219
-
220
- ### Tools
221
-
222
- Underlyingly calls SerializationDumper, which can parse serialized data and manually modify the serialVersionUID field
223
- of classes.
224
-
225
- ![ SerializationDumper.png] ( ./img/SerializationDumper.png )
226
-
227
- ## Detailed use
228
-
229
- Github Wiki: https://github.com/vulhub/java-chains/wiki
230
-
231
- or Documentation: https://www.yuque.com/shenjingwa-leuvd/wpqdhf/war0zkzgzg3c4bzg
232
-
233
- ## Other
234
-
235
- Advantages of this tool:
236
-
237
- 1 . Compared to command-line tools, web interface operations are simpler and easier to use, making it convenient to
238
- generate JNDI injection, MySQL JDBC, and other test Payloads.
239
- 2 . Decouples and reuses various Payloads, with dynamically rendered parameter input boxes on the frontend, facilitating
240
- expansion and maintenance.
241
- 3 . Collects and organizes a comprehensive range of Java, Hessian, and other deserialization Payloads, integrating
242
- various tricks and obfuscation techniques.
243
-
244
- Disadvantages (also points to be improved):
245
-
246
- 1 . Some less common Payload combinations may not work properly. Due to decoupling, the complexity of combinations
247
- increases, and it is currently impossible to cover and test all Payload combinations. To mitigate this, the platform
248
- provides a [ Preset Chain] dropdown option above the Payload output box, offering tested chain combinations for
249
- reference. It is recommended to test less common Payload combinations in advance. If you find Payloads that do not
250
- run properly, you can submit Issues for feedback.
251
- 2 . Due to the need for various dependencies to generate Payloads, the project's jar package is relatively large (
252
- 200+MB).
253
- 3 . Less common Payloads and Payloads with low practical value are not yet integrated.
254
-
255
- Common questions:
256
-
257
- Q: Why use Web instead of Java GUI?
258
-
259
- A: Both have advantages, but I believe Web has a wider range of application scenarios. The main reason is that it is
260
- very convenient to operate on the server to generate JNDI injection and other Payloads.
28
+ https://java-chains.vulhub.org/docs/guide
261
29
262
30
## Updated content
263
31
0 commit comments