Inappropriate implementation in MHTML (CVE-2026-11195)
The MHTML serialiser's case-sensitive check for scripting attributes can be bypassed by creating an uppercase attribute such as ONLOAD via DOM APIs. When the saved MHTML file is opened, the HTML parser lowercases the attribute and executes the script, potentially exfiltrating the saved document's contents.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 47 days
Flapjack, 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: FrameSerializer attempts to strip scripting attributes when saving an MHTML archive. However, the filtering logic uses a case-sensitive check, allowing mixed-case attributes (like ONLOAD) created via DOM APIs to bypass the filter and execute when the saved file is opened.
Affected files:
third_party/blink/renderer/core/frame/frame_serializer.ccthird_party/blink/renderer/core/dom/element.ccthird_party/blink/renderer/core/html/html_frame_element_base.ccthird_party/blink/renderer/core/html/html_anchor_element.cc
Estimated timestamp from git blame: 2026-02-24
Summary
When a user saves a webpage as an MHTML archive, FrameSerializer attempts to sanitize the DOM by removing scripting attributes (such as onload) to prevent script execution when the saved file is opened. It also deliberately strips the original document's Content Security Policy (CSP) headers and <meta> tags.
However, the sanitization checks in Element::IsScriptingAttribute and its helper functions perform case-sensitive string matching. An attacker who can inject attributes into the DOM using namespace-aware APIs (like setAttributeNS) can create an uppercase attribute such as ONLOAD. This bypasses the sanitization filter. When the saved MHTML file is opened, the HTML tokenizer lowercases the attribute back to onload, leading to script execution and potential exfiltration of the saved document's contents.
Root Cause Analysis
During MHTML serialization, SerializerMarkupAccumulator::WillProcessAttribute calls element.IsScriptingAttribute(attribute) (in third_party/blink/renderer/core/frame/frame_serializer.cc:562) to determine if an attribute should be ignored.
This eventually calls IsEventHandlerAttribute (third_party/blink/renderer/core/dom/element.cc:4046), which checks the attribute's prefix:
static inline bool IsEventHandlerAttribute(const Attribute& attribute) {
return attribute.GetName().NamespaceURI().IsNull() &&
attribute.GetName().LocalName().starts_with("on");
}
The starts_with method is strictly case-sensitive. Similarly, IsHTMLContentAttribute checks for srcdoc and IsURLAttribute checks for href using case-sensitive equality.
If an attribute is created via element.setAttributeNS(null, "ONLOAD", "payload()"), the DOM preserves the uppercase LocalName as "ONLOAD". Since "ONLOAD" does not start with the lowercase string "on", the case-sensitive check fails. The serializer assumes the attribute is safe and emits it into the MHTML archive verbatim.
When the MHTML archive is later opened by the victim, the text/html portion is parsed by the HTML parser. The HTMLTokenizer (third_party/blink/renderer/core/html/parser/html_tokenizer.cc:856) converts the uppercase "ONLOAD" string back to the lowercase "onload" as required by the HTML5 specification. The browser then registers it as an event handler and executes the payload.
Potential Attack Scenario
- An attacker identifies a vulnerability or gadget (e.g., via a vulnerable JavaScript framework or DOM clobbering) that allows them to control arguments to
setAttributeNSon a live webpage. - The attacker injects an attribute named
ONLOADwith a malicious JavaScript payload. The live site's CSP (lacking'unsafe-inline') prevents the script from executing. - The victim user saves the page as an MHTML archive.
FrameSerializerstrips the site's CSP<meta>tags but allows theONLOADattribute to bypass the case-sensitive filter. - The victim later opens the saved MHTML file. If the
kMHTML_Improvementsfeature is enabled (which permits script execution in MHTML documents), the HTML parser lowercases the attribute toonloadand executes the payload. - The payload, running within the sandboxed MHTML environment, reads sensitive user data from the saved document's DOM and exfiltrates it to an attacker-controlled server.
Suggested Fix
Update the attribute filtering logic to be case-insensitive:
- In
IsEventHandlerAttribute, useStartsWithIgnoringASCIICase("on"). - In
IsHTMLContentAttributeandIsURLAttribute, perform case-insensitive comparisons against the target strings or lowercasedhtml_namesconstants.
(Note: These are suggested steps based on static code analysis; we do not yet have a working proof of concept that has been successfully run.)
Evaluated with Chrome root at commit: c0eb5541aebfa4ea08806eaf6e94bcc69f87ab2f
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 attribute filtering functions use case-sensitive string matching, so uppercase scripting attributes created via DOM APIs are not recognised and are serialised into the MHTML archive.
Impact
If the kMHTML_Improvements feature is enabled, an attacker could execute script when the victim opens the saved MHTML file and exfiltrate the saved document's contents; the report notes no working proof of concept has been run.
What the attacker needed
Attacker can control setAttributeNS arguments; victim saves page as MHTML; victim opens saved MHTML file; kMHTML_Improvements feature enabled
The fix
The attribute filtering logic should be made case-insensitive, for example by using StartsWithIgnoringASCIICase for event handler attributes and case-insensitive comparisons for HTML content and URL attributes.
How it was found
- An attacker finds a way to control arguments to setAttributeNS on a live webpage.
- The attacker injects an attribute named ONLOAD with a malicious JavaScript payload; the live site's CSP prevents execution.
- The victim saves the page as an MHTML archive; FrameSerializer strips CSP meta tags but allows the ONLOAD attribute to bypass the case-sensitive filter.
- The victim opens the saved MHTML file; if the kMHTML_Improvements feature is enabled, the HTML parser lowercases the attribute to onload and executes the payload.
- The payload reads sensitive data from the saved document's DOM and exfiltrates it to an attacker-controlled server.
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.
When you save a webpage as a single file (MHTML), the browser tries to remove dangerous attributes like onload that could run code. This report found that the check only looks for lowercase 'on', so an attacker who can add an uppercase 'ONLOAD' attribute can sneak it past the filter. When the saved file is opened, the browser treats it as a normal onload and runs the attacker's code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.