[
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing SecXMLExternalEntity/XXE 1",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
        "Content-Type": "text/xml",
        "Content-Length": "162"
      },
      "uri": "/?key=value&key=other_value",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book (#PCDATA)>",
        "<!ENTITY js \"Jo Smith\">",
        "]>",
        "<bookstore>",
        "<book category=\"WEB\"> &js;</book>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "debug_log": "Target value: \" jo smith\"",
      "http_code": 200
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecXMLExternalEntity Off",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500005,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule XML:/bookstore/book[text()] \".*\" \"id:500006,phase:3,t:none,t:lowercase,nolog,pass\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing SecXMLExternalEntity/XXE 2",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
        "Content-Type": "text/xml",
        "Content-Length": "166"
      },
      "uri": "/?key=value&key=other_value",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<book category=\"WEB\"> &js;</book>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "debug_log": "XML: Failed to load DTD: test-cases/data/SoapEnvelope.dtd",
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecXMLExternalEntity Off",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500005,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule XML:/bookstore/book \".*\" \"id:500006,phase:3,t:none,t:lowercase,nolog,pass,xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'\"",
      "SecRule XML \"@validateDTD test-cases/data/SoapEnvelope.dtd\" \"id:500007,phase:3,deny\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing SecXMLExternalEntity/XXE 3",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
        "Content-Type": "text/xml",
        "Content-Length": "166"
      },
      "uri": "/?key=value&key=other_value",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<book category=\"WEB\"> &js;</book>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "debug_log": "XML Error: No declaration for element bookstore",
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecXMLExternalEntity On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500005,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule XML:/bookstore/book \".*\" \"id:500006,phase:3,t:none,t:lowercase,nolog,pass,xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'\"",
      "SecRule XML \"@validateDTD test-cases/data/SoapEnvelope.dtd\" \"id:500007,phase:3,deny\""
    ]
  }
]
