GHSA-4P39-36WJ-23H4
Possible Mutation XSS when serializing `noscript` content in `Nokogiri::HTML5` documents
Overview
Description
Summary
Nokogiri's HTML5 serializer did not escape text inside noscript elements, or
< and > inside attribute values. When a document parsed with the default
options is serialized, a browser with scripting enabled can parse the output
into markup that Nokogiri's parser never produced. This is a mutation XSS for
applications that sanitize untrusted HTML with Nokogiri::HTML5, allow
noscript elements, and send the serialized output to browsers.
Nokogiri 1.19.5 escapes both, as the HTML standard's serialization algorithm
requires. Text inside noscript is still emitted unescaped for documents
parsed with parse_noscript_content_as_text: true.
Only the C extension (CRuby and TruffleRuby) is affected. JRuby does not
implement Nokogiri::HTML5.
Severity
The Nokogiri maintainers have evaluated this as low severity (CVSS 2.3,
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).
Exploitation requires an application that allows noscript in sanitized HTML.
Loofah and rails-html-sanitizer do not allow it by default, and Sanitize
always removes it.
Mitigation
Upgrade to Nokogiri 1.19.5 or later.
Applications that sanitize HTML and allow noscript should parse with
parse_noscript_content_as_text: true (available since Nokogiri 1.17.0), or
remove noscript elements. This is the workaround for earlier versions, and
it is recommended on every version: some content inside noscript is
serialized unchanged, as the standard requires.
Credit
This issue was responsibly reported by @a-zara-n.
Source: OX vulnerability database
Severity
UNKNOWN
No CVSS vector in the source. Severity comes from the advisory.
Affected packages · 1
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| RubyGems | nokogiri | — | 1.19.5 |
Open a package to see all its vulnerabilities.
Operating systems
No Linux distribution reports this ID.
References
- github.com https://github.com/flavorjones/loofah/security/advisories/GHSA-h6v6-rg66-fqj4
- github.com https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md#v1195--2026-11-01
- github.com https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5
- github.com https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-4p39-36wj-23h4
- rubygems.org https://rubygems.org/gems/nokogiri/versions/1.19.5
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.