{
  "id": "security/saml-xml-external-entity-xxe",
  "signature": "SAML response parsing vulnerable to XXE allowing arbitrary file read",
  "signature_zh": "SAML响应解析易受XXE攻击，允许任意文件读取",
  "regex": "XXE|SAML.*XML.*parser|DOCTYPE.*SYSTEM",
  "domain": "security",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The XML parser used to process SAML assertions is configured with external entity resolution enabled, allowing an attacker to inject a malicious DOCTYPE that reads local files or performs SSRF.",
  "root_cause_type": "generic",
  "root_cause_zh": "用于处理SAML断言的XML解析器配置为启用外部实体解析，允许攻击者注入恶意DOCTYPE来读取本地文件或执行SSRF。",
  "versions": [
    {
      "version": "Shibboleth 3.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OpenSAML 4.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "SimpleSAMLphp 1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Disabling DTD processing globally may break legitimate SAML responses that use DTDs for signature validation.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using a regex to filter out DOCTYPE declarations is unreliable and can be bypassed with encoding tricks.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Upgrading the SAML library without checking its XML parser configuration may not fix the issue if the library uses a vulnerable parser by default.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Explicitly disable external entities in the XML parser. In Java with DocumentBuilderFactory: factory.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);",
      "success_rate": 0.95,
      "how": "Explicitly disable external entities in the XML parser. In Java with DocumentBuilderFactory: factory.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a secure XML parser that rejects DTDs by default, such as the one provided by OWASP's XML Security library.",
      "success_rate": 0.9,
      "how": "Use a secure XML parser that rejects DTDs by default, such as the one provided by OWASP's XML Security library.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Validate the SAML response against an XSD schema before parsing, and reject any document that contains a DOCTYPE declaration.",
      "success_rate": 0.85,
      "how": "Validate the SAML response against an XSD schema before parsing, and reject any document that contains a DOCTYPE declaration.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在XML解析器中显式禁用外部实体。在Java中使用DocumentBuilderFactory：factory.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);",
    "使用默认拒绝DTD的安全XML解析器，例如OWASP XML安全库提供的解析器。",
    "在解析之前，根据XSD模式验证SAML响应，并拒绝任何包含DOCTYPE声明的文档。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-12-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}