Am I affected?
Description
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') vulnerability in dashbitco lazy_html allows mutation XSS via a parse and serialize round-trip of attacker-supplied HTML.
LazyHTML.to_html/2 and LazyHTML.Tree.to_html/2 decide whether to escape an element's text from its tag name alone. A style or script element inside SVG or MathML foreign content is parsed with character references decoded, but is serialized as an HTML raw-text element, so its text is emitted unescaped. Encoded markup such as </style><img src=x onerror=...> inside <svg><style> therefore closes the element on re-parse and becomes live markup. Applications that parse untrusted HTML with lazy_html, filter the document or tree, and serialize it for display are affected, since the payload is a plain text node that no element or attribute filter sees.
This issue affects lazy_html: from 0.1.0 before 0.1.13.
Weaknesses & attack patterns
Weakness
CWE-79
·
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
in catalog →
MITRE ↗
Attack patterns
CAPEC-63
·
Cross-Site Scripting (XSS)
MITRE ↗
An attacker who can submit HTML to an application that sanitizes it with lazy_html can run script in the browsers of users who view the sanitized output.
Affected — Hex / lazy_html Hex.pm ↗ Repository ↗
modules · source files · routines
Affected — GitHub / dashbitco/lazy_html Repository ↗
modules · source files · routines
References
Credits
CVSS breakdown
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N