Skip to content

In-depth lesson · Mutation XSS and sanitiser bypass

Root causes

Every point the Mutation XSS and sanitiser bypass reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 39 of 39
  1. The SVG sanitiser did not correctly handle XML entities, so the element and attribute whitelist was not applied to the resulting SVG content.

    Seen in 2 reports
  2. The cleanup that removes style when select is allowed was applied only to the per-call options tag list and not to the class-level allowed_tags list.

    Seen in 2 reports
  3. The sanitiser allowed the SVG use element to reference a data URI without inspecting the embedded SVG content, so an event handler inside it survived filtering.

    Seen in 2 reports
  4. The wpautop() regex used a pattern that stopped at the first closing angle bracket, including one inside an HTML comment placeholder, so a paragraph tag leaked into an attribute value.

    Seen in 2 reports
  5. Mention and reference linkification ran as a post-processing step on already-rendered HTML rather than during Markdown parsing, so it inserted markup inside existing attribute values.

    Seen in 1 report
  6. The sanitiser's attribute allow or deny logic did not account for attributes such as data-* that browsers can still act on, so they were left in the cleaned output.

    Seen in 1 report
  7. The Markdown sanitiser did not strip control characters inside link URLs, so a javascript scheme could be smuggled past the filter and stored.

    Seen in 1 report
  8. The bad-protocol sanitiser only recognised HTML-encoded colons that ended with a semicolon, so encoded colons without one slipped past the check.

    Seen in 1 report
  9. The export wrapped user input in a CDATA section without stripping or encoding the CDATA closing sequence, so the input could terminate the section and inject markup.

    Seen in 1 report
  10. The HTML sanitiser failed to decode and filter CSS url() values containing escaped characters, allowing encoded HTML tags to be injected.

    Seen in 1 report
  11. The name sanitiser only removed complete tags, so an unclosed tag survived and was later rendered as an anchor that a JavaScript gadget used as a request target.

    Seen in 1 report
  12. The reference filter used a regular expression replacement that could be tricked into expanding references inside HTML attributes, which combined with mutation XSS allowed injection.

    Seen in 1 report
  13. The sanitiser validated pasted HTML before the browser's parser mutated it into a different, executable DOM structure, so the sanitised output no longer matched what was rendered.

    Seen in 1 report
  14. The code read an element's textContent and wrote it into another element's innerHTML, so HTML entities in the text were decoded and became live markup.

    Seen in 1 report
  15. The sanitiser did not decode CSS character escapes before checking for dangerous CSS properties, allowing a string to close a CSS string token and inject arbitrary CSS.

    Seen in 1 report
  16. The helper removed literal control characters before decoding HTML entities, so control characters introduced by entity decoding were not stripped before protocol validation.

    Seen in 1 report
  17. A flawed regex in the html4inline function that strips legacy attributes from the body tag could break already-sanitised HTML, turning a harmless payload into an active event handler.

    Seen in 1 report
  18. The fragment parser was given the live document's custom element registry, so custom element callbacks fired synchronously during parsing before sanitisation ran.

    Seen in 1 report
  19. The serializer emitted the custom-element is value from internal data without entity encoding, and the sanitiser stripped the DOM attribute but not that internal data.

    Seen in 1 report
  20. The attribute filtering functions used case-sensitive string matching, so uppercase scripting attributes created via DOM APIs were serialised into the archive.

    Seen in 1 report
  21. The throw-on-dynamic-markup-insertion counter was only incremented in one element creation path and not in the custom element reaction path, so document.write was allowed during connectedCallback.

    Seen in 1 report
  22. The fragment parser did not copy attributes of the context element into its internal stack representation, so MathML annotation-xml elements with an encoding attribute were not recognised as HTML integration points.

    Seen in 1 report
  23. The sanitiser used a prefix-sensitive equality check on element names instead of a prefix-insensitive match, so prefixed elements were not recognised and their javascript URLs were not stripped.

    Seen in 1 report
  24. The streaming code path did not call the same guard that the non-streaming fragment parser uses, so safe-mode setters could mutate a script element.

    Seen in 1 report
  25. A case-sensitive prefix check for the lowercase data scheme returned early and skipped setting the potentially-dangling-markup flag.

    Seen in 1 report
  26. The rendering pipeline sanitised with DOMPurify before decoding HTML entities, so a second decode after sanitisation turned harmless text into live markup; the server also failed to restrict reaction values to a known set.

    Seen in 1 report
  27. The serialiser appended the decoded custom-property variable name straight to the output instead of using the standard CSS identifier serialisation routine, and the JavaScript constructor only checked part of the name.

    Seen in 1 report
  28. Browser anti-XSS filters did not model how classic ASP parses request parameters, so crafted inputs slipped past the filters.

    Seen in 1 report
  29. The sanitiser matched the literal javascript: string before the browser decoded HTML entities, so an encoded colon bypassed the check and was decoded later.

    Seen in 1 report
  30. The server trusted client-supplied attachment content, a legacy behaviour inserted it via innerHTML, the sanitiser allowed dangerous data attributes and the framework copied the CSP nonce to injected elements.

    Seen in 1 report
  31. User input was inserted into an HTML attribute without encoding, and the filter blocking parentheses was bypassed with HTML entity encoding using extra zeroes.

    Seen in 1 report
  32. The sanitiser processed SVG content in SVG context then renamed the outer element to a non-standard tag, causing the browser to re-parse the content in HTML context and interpret hidden markup differently.

    Seen in 1 report
  33. The MathJax library's handling of backslashes and curly braces let HTML tags bypass the markdown sanitisation filters.

    Seen in 1 report
  34. The Edge translator inserted page text into the DOM without sanitising it or converting it to plain text before translation.

    Seen in 1 report
  35. The input filter only encoded parameters when it detected a less-than sign immediately followed by a greater-than sign, allowing a closing script tag to be assembled from two separate parameters.

    Seen in 1 report
  36. The card renderer reflected user input into an inline JSON block without safely escaping the closing script tag, and the CSP allowed a JSONP endpoint on a whitelisted domain.

    Seen in 1 report
  37. The application saved user input and rendered it back without adequate output encoding or sanitisation, and its filters only checked the first tag or a narrow set of characters.

    Seen in 1 report
  38. The server returned attacker-influenced binary map data with a text/html content type, so the browser interpreted injected strings as HTML and executed script.

    Seen in 1 report
  39. The sanitisers failed to account for browser-specific parsing quirks such as namespace switching, case sensitivity, animation attributes, XSLT processing instructions and Safari's image import behaviour.

    Seen in 1 report