CVE-2026-126063: Nokogiri: Mutation XSS through `noscript` content in Nokogiri's HTML5 serializer
Published 2026-11-10 · Updated 2026-11-10 · Also known as GHSA-4p39-36wj-23h4
Summary
Nokogiri's HTML5 serializer fails to properly escape text inside `noscript` elements and certain attribute characters, leading to mutation XSS. Applications using Nokogiri to sanitize untrusted HTML while allowing `noscript` elements should update immediately.
Who is affected
The vulnerability affects deployments using the Nokogiri C extension (CRuby and TruffleRuby) versions 1.12.0 up to 1.19.5. Exploitation requires an application to parse HTML with default options, allow `noscript` elements in its sanitization logic, serialize the output, and render it in a browser with scripting enabled.
Exploitability
The vulnerability has a CVSS 4.0 base score vector of AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N, indicating low severity with network attack vector, low attack complexity, privileged conditions or attack preconditions, no privileges required, and user interaction required. The current EPSS score is 0.006 (0.474th percentile), and it is not listed in the CISA Known Exploited Vulnerabilities catalog.
Remediation
- Upgrade the RubyGems nokogiri package to version 1.19.5 or later.
- Parse with `parse_noscript_content_as_text: true` or remove `noscript` elements entirely if using an earlier version.
How to check your project
- Check the Gemfile.lock or equivalent dependency manifest for the 'nokogiri' gem version falling within the range 1.12.0 to 1.19.4.
- Inspect application codebase configuration to verify whether `Nokogiri::HTML5` is used and if `noscript` elements are allowed during HTML sanitization.
Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| RubyGems | nokogiri |
>= 1.12.0, < 1.19.5 | 1.19.5 | bundle update nokogiri |
CVSS 4.0 vector
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
| Attack vector | Network |
|---|---|
| Attack complexity | Low |
| Attack requirements | Present |
| Privileges required | None |
| User interaction | Passive |
| Confidentiality (vulnerable system) | None |
| Integrity (vulnerable system) | None |
| Availability (vulnerable system) | None |
| Confidentiality (subsequent systems) | Low |
| Integrity (subsequent systems) | Low |
| Availability (subsequent systems) | None |
Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.
FAQ
Which Ruby implementations are affected?
Only the C extension (CRuby and TruffleRuby) is affected. JRuby does not implement `Nokogiri::HTML5` and is unaffected.
Do default configurations of popular sanitizers allow `noscript`?
No. Loofah and rails-html-sanitizer do not allow `noscript` by default, and Sanitize always removes it.
Is this vulnerability actively exploited in the wild?
There is no indication of active exploitation, as it is not present in the CISA Known Exploited Vulnerabilities catalog.
Original advisory description
References
- WEB https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-4p39-36wj-23h4
- WEB https://github.com/sparklemotion/nokogiri/pull/3752
- WEB https://github.com/sparklemotion/nokogiri/commit/3e84df6ff7ab4d78f446e3a415430bd69a055d32
- WEB https://github.com/sparklemotion/nokogiri/commit/c6c0bffbdcd194694995acafeeed27326b0805f8
- WEB https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/GHSA-4p39-36wj-23h4.yml
- PACKAGE https://github.com/sparklemotion/nokogiri
- WEB https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5
Source records: GHSA-4p39-36wj-23h4 (OSV.dev) · EPSS by FIRST, 2026-11-26.