Type Confusion in XML (CVE-2026-11196)
A type confusion in libxslt's xsltParseTemplateContent allows an XML entity declaration to be treated as an xmlNode, causing a heap buffer overflow read. An attacker could trigger a crash or a constrained arbitrary read in the renderer process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 47 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential type confusion vulnerability in libxslt's xsltParseTemplateContent occurs when an xmlEntity (specifically XML_ENTITY_DECL) is processed as an xmlNode. Because the structs share a common memory layout up to offset 64, accessing the ns field of the node actually reads the orig string pointer of the entity. This pointer is then treated as an xmlNs struct, leading to a heap buffer overflow (READ) when the prefix field is accessed and subsequently dereferenced in xmlStrEqual.
Affected files:
third_party/libxslt/src/libxslt/xslt.c
Estimated timestamp from git blame: 2008-07-26
Description
A potential type confusion vulnerability exists in libxslt within the xsltParseTemplateContent function (third_party/libxslt/src/libxslt/xslt.c). When a simplified XSLT stylesheet (Literal Result Element as Stylesheet) is processed, the entire document (doc) is passed to xsltParseTemplateContent to be parsed as template content. This causes the function to traverse the document's children, including the xmlDtd node and its declarations.
While the traversal logic attempts to avoid descending into entity declarations with the check if (cur->children->type != XML_ENTITY_DECL) at line 5053, this check is insufficient. If an internal DTD contains a comment (or any other node type) as its first child, followed by an XML_ENTITY_DECL, the check passes. The traversal then enters the DTD's children list and eventually processes the XML_ENTITY_DECL node.
At line 5022, the code evaluates else if ((cur->ns != NULL) && ...) assuming cur is an xmlNode. However, cur is an xmlEntity. On 64-bit systems, the ns field in struct _xmlNode and the orig field (which stores the raw entity string) in struct _xmlEntity both reside at offset 72. Consequently, cur->ns reads the string pointer provided by the attacker.
Because this pointer is not NULL, the code proceeds to evaluate xsltCheckExtPrefix(style, cur->ns->prefix). It treats the attacker-controlled string as a struct _xmlNs and attempts to read its prefix field, which is located at offset 24. This reads 8 bytes from the string buffer. These 8 bytes are then passed to xsltCheckExtPrefix and dereferenced by xmlStrEqual.
Impact
This results in a heap-buffer-overflow (READ). Depending on the length of the entity string, it either reads out of bounds of the string allocation, or an attacker can fully control the 8-byte value read. This controlled value is then dereferenced, leading to a deterministic crash (Denial of Service) or a constrained arbitrary read primitive within the renderer process.
Potential Reproduction Steps
(Note: These are potential steps based on code analysis; a working Proof of Concept has not been run.)
- Construct a malicious XML document designed to trigger the simplified XSLT stylesheet processing path (e.g., using an
xsl:versionattribute on the root element). - Include an internal DTD in the document:
<!DOCTYPE root [ ... ]>. - Inside the DTD, add a comment as the first child to bypass the entity check:
<!-- bypass -->. - Follow the comment with an entity declaration containing a string longer than 32 bytes:
<!ENTITY exploit "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA">. - Serve this document to the Chrome renderer via an
<?xml-stylesheet ...?>processing instruction.
Suggested Fix
- Modify the traversal logic in
xsltParseTemplateContentto robustly ignore all DTD-related declarations rather than only checking the first child. - Add an explicit check ensuring
cur->type == XML_ELEMENT_NODE(or a macro likeIS_XSLT_ELEM) before accessingcur->ns, preventing type confusion with other node types that overlap struct fields.
Evaluated with Chrome root at commit: 2b349e31cb87959d6a548625986c65e0a2d2e380
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The traversal logic only checks the first child of the DTD to avoid entity declarations, so a comment first allows an entity declaration to be processed as a node, and the code then accesses the ns field without verifying the node type.
Impact
This results in a heap-buffer-overflow (READ), leading to a deterministic crash (Denial of Service) or a constrained arbitrary read primitive within the renderer process.
What the attacker needed
Victim loads a malicious XML document; document uses simplified XSLT stylesheet; internal DTD with comment first
The fix
The traversal logic should robustly ignore all DTD-related declarations and explicitly check that the node type is an element before accessing the ns field.
How it was found
- Construct a malicious XML document designed to trigger the simplified XSLT stylesheet processing path.
- Include an internal DTD in the document.
- Inside the DTD, add a comment as the first child to bypass the entity check.
- Follow the comment with an entity declaration containing a string longer than 32 bytes.
- Serve this document to the Chrome renderer via an xml-stylesheet processing instruction.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The code confuses two different kinds of data structures that happen to look similar in memory. When it reads a field from the wrong structure, it gets a pointer to attacker-controlled text and then treats that text as another structure, causing it to read memory outside the intended buffer. This can crash the browser or leak a small amount of memory.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.