{"description":"Trending threats, MITRE ATT\u0026CK coverage, and detection metadata — refreshed continuously.","feed_url":"https://feed.craftedsignal.io/products/@xmldom/xmldom/","home_page_url":"https://feed.craftedsignal.io/","items":[{"_cs_actors":[],"_cs_cves":[],"_cs_exploited":false,"_cs_products":["@xmldom/xmldom","xmldom"],"_cs_severities":["high"],"_cs_tags":["xml-injection","xxe","dom","xmldom"],"_cs_type":"advisory","_cs_vendors":["npm"],"content_html":"\u003cp\u003eThe \u003ccode\u003e@xmldom/xmldom\u003c/code\u003e and \u003ccode\u003exmldom\u003c/code\u003e packages are vulnerable to XML injection due to the lack of validation when serializing \u003ccode\u003eDocumentType\u003c/code\u003e node fields. Specifically, the \u003ccode\u003einternalSubset\u003c/code\u003e, \u003ccode\u003epublicId\u003c/code\u003e, and \u003ccode\u003esystemId\u003c/code\u003e fields are serialized verbatim without any escaping or validation. This vulnerability affects \u003ccode\u003e@xmldom/xmldom\u003c/code\u003e versions prior to 0.8.13 and versions 0.9.0 to 0.9.9, as well as \u003ccode\u003exmldom\u003c/code\u003e versions up to 0.6.0. The vulnerability is triggered when these fields are programmatically set to attacker-controlled strings, leading to potential arbitrary markup injection outside the DOCTYPE declaration during serialization using \u003ccode\u003eXMLSerializer.serializeToString\u003c/code\u003e. This can lead to downstream XML parsers being susceptible to XXE attacks. Defenders should audit serializeToString() call sites and add \u003ccode\u003e{ requireWellFormed: true }\u003c/code\u003e to mitigate this vulnerability.\u003c/p\u003e\n\u003ch2 id=\"attack-chain\"\u003eAttack Chain\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eThe attacker identifies an application using a vulnerable version of \u003ccode\u003e@xmldom/xmldom\u003c/code\u003e or \u003ccode\u003exmldom\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eThe attacker finds a code path where they can control the \u003ccode\u003epublicId\u003c/code\u003e, \u003ccode\u003esystemId\u003c/code\u003e, or \u003ccode\u003einternalSubset\u003c/code\u003e properties of a \u003ccode\u003eDocumentType\u003c/code\u003e node.\u003c/li\u003e\n\u003cli\u003eThe attacker crafts a malicious string containing XML injection payloads (e.g., closing DOCTYPE tags or injecting SYSTEM entities).\u003c/li\u003e\n\u003cli\u003eThe attacker uses programmatic calls to \u003ccode\u003ecreateDocumentType\u003c/code\u003e or direct property writes to set the malicious string as the value of the \u003ccode\u003epublicId\u003c/code\u003e, \u003ccode\u003esystemId\u003c/code\u003e, or \u003ccode\u003einternalSubset\u003c/code\u003e field.\u003c/li\u003e\n\u003cli\u003eThe application calls \u003ccode\u003eXMLSerializer.serializeToString\u003c/code\u003e on the document, without the \u003ccode\u003e{ requireWellFormed: true }\u003c/code\u003e option.\u003c/li\u003e\n\u003cli\u003eThe vulnerable serializer emits a DOCTYPE declaration where the injected malicious string is included verbatim, causing the DOCTYPE declaration to be terminated early or to include injected entities.\u003c/li\u003e\n\u003cli\u003eThe serialized XML is passed to a downstream XML parser that performs entity expansion.\u003c/li\u003e\n\u003cli\u003eThe downstream XML parser expands the injected entities, leading to potential XXE attacks, information disclosure, or other malicious actions.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"impact\"\u003eImpact\u003c/h2\u003e\n\u003cp\u003eSuccessful exploitation of this vulnerability can lead to the injection of arbitrary XML markup, potentially enabling XXE attacks against downstream XML parsers. The impact includes potential information disclosure, arbitrary code execution, or denial-of-service if the downstream parser expands external entities. This vulnerability impacts applications using vulnerable versions of \u003ccode\u003e@xmldom/xmldom\u003c/code\u003e and \u003ccode\u003exmldom\u003c/code\u003e that construct \u003ccode\u003eDocumentType\u003c/code\u003e nodes from user-controlled data and serialize the document without proper validation.\u003c/p\u003e\n\u003ch2 id=\"recommendation\"\u003eRecommendation\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eUpgrade to \u003ccode\u003e@xmldom/xmldom\u003c/code\u003e version 0.8.13 or later, or version 0.9.10 or later, to receive the fix.\u003c/li\u003e\n\u003cli\u003eUpgrade to a version of \u003ccode\u003exmldom\u003c/code\u003e greater than 0.6.0.\u003c/li\u003e\n\u003cli\u003eAudit all calls to \u003ccode\u003eXMLSerializer.serializeToString()\u003c/code\u003e and add the option \u003ccode\u003e{ requireWellFormed: true }\u003c/code\u003e to enforce validation of \u003ccode\u003eDocumentType\u003c/code\u003e node fields, as described in the advisory.\u003c/li\u003e\n\u003cli\u003eApplications that pass untrusted data to \u003ccode\u003ecreateDocumentType()\u003c/code\u003e or write untrusted values directly to a \u003ccode\u003eDocumentType\u003c/code\u003e node\u0026rsquo;s \u003ccode\u003epublicId\u003c/code\u003e, \u003ccode\u003esystemId\u003c/code\u003e, or \u003ccode\u003einternalSubset\u003c/code\u003e properties should audit all \u003ccode\u003eserializeToString()\u003c/code\u003e call sites and add the option.\u003c/li\u003e\n\u003c/ul\u003e\n","date_modified":"2024-01-03T12:00:00Z","date_published":"2024-01-03T12:00:00Z","id":"/briefs/2024-01-xmldom-xml-injection/","summary":"The xmldom package is vulnerable to XML injection. The package serializes DocumentType node fields (internalSubset, publicId, systemId) verbatim without any escaping or validation. When these fields are set programmatically to attacker-controlled strings, XMLSerializer.serializeToString can produce output where the DOCTYPE declaration is terminated early and arbitrary markup appears outside it. To address this applications that pass untrusted data to createDocumentType() or write untrusted values directly to a DocumentType node's publicId, systemId, or internalSubset properties should audit all serializeToString() call sites and add the option.","title":"xmldom XML Injection Vulnerability","url":"https://feed.craftedsignal.io/briefs/2024-01-xmldom-xml-injection/"}],"language":"en","title":"CraftedSignal Threat Feed — @Xmldom/Xmldom","version":"https://jsonfeed.org/version/1.1"}