Skip to main content

Nokogiri CVE-2026-126063

| EUVDEUVD-2026-122832 LOW
Cross-site Scripting (XSS) (CWE-79)
2026-11-10 https://github.com/sparklemotion/nokogiri GHSA-4p39-36wj-23h4
2.3
CVSS 4.0 · Vendor: https://github.com/sparklemotion/nokogiri
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted HTML containing noscript payload
  2. Delivery
    App sanitizes via Nokogiri::HTML5 with default options allowing noscript
  3. Exploit
    Serializer emits noscript text unescaped
  4. Execution
    Victim's scripting-enabled browser re-parses output into active markup
  5. Impact
    Injected script executes in victim context

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires a specific application design, not just network reach: the application must (1) sanitize untrusted HTML using Nokogiri::HTML5, (2) allow noscript elements to survive sanitization, (3) parse with default options (NOT parse_noscript_content_as_text: true, which is the recommended workaround and available since 1.17.0), and (4) serialize and send the output to a browser with scripting enabled, where the mutation into active markup occurs. Key limiting factors: the common Ruby sanitizers do not expose this by default - Loofah and rails-html-sanitizer disallow noscript, and Sanitize always strips it - so a non-default allow-list is required; JRuby is not affected because it does not implement Nokogiri::HTML5; and the attack depends on a victim rendering the serialized output in a scripting-enabled browser (passive user interaction).

Impact

All decision signals point to genuinely low priority. The vendor (Nokogiri maintainers) scored this CVSS 4.0 2.3 with vector AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N: network-reachable but gated by an attack requirement (AT:P) and passive user interaction (UI:P), with no impact to the Nokogiri host itself (VC:N/VI:N/VA:N) and only low confidentiality/integrity impact to the subsequent system - the victim's browser (SC:L/SI:L). This is consistent with a mutation XSS. The vuln.today decision label is 'monitor,' and there is no CISA KEV listing and no EPSS score provided, so exploitation probability cannot be quantified from the input - absence of EPSS/KEV is a data gap, not evidence of safety, but combined with the 'monitor' label it supports normal-cycle patching rather than emergency action. No public exploit is identified at time of analysis; the issue was responsibly reported by @a-zara-n. The AT:P / 'requires an application that allows noscript in sanitized HTML' condition is the dominant risk limiter: the common Ruby sanitizers (Loofah and rails-html-sanitizer do not allow noscript by default, Sanitize always removes it), so the realistically exploitable population is much smaller than Nokogiri's overall install base. Net: a real but narrow issue to patch in routine maintenance, not a high-urgency item.

Exploit ScenarioDerived

An attacker submits untrusted HTML containing a noscript element (or attribute values with < / >) to an application that sanitizes input with Nokogiri::HTML5 using default parse options and permits noscript in output. Because the serializer emits noscript text unescaped, the stored or reflected output - when rendered by a scripting-enabled browser - is re-parsed into markup Nokogiri never produced, executing attacker-controlled script (mutation XSS). No public exploit identified at time of analysis; the flaw was responsibly disclosed.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.6% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 10, 2026

Mutation XSS in the Nokogiri HTML5 serializer (C extension for CRuby and TruffleRuby, versions 1.12.0 through 1.19.4) lets untrusted HTML that survives sanitization be re-serialized into markup a browser interprets differently, enabling script execution in the victim's session. The flaw only matters for applications that sanitize HTML with Nokogiri::HTML5, permit noscript elements to remain in the allow-list, parse with default options, and then serve the serialized output to a scripting-enabled browser, so unauthenticated remote attackers can exploit it only against that specific, non-default design (CVSS 3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N; vendor rates it CVSS 4.0 2.3). There is no CISA KEV listing and no public exploit identified at time of analysis; the vendor shipped a fix in Nokogiri 1.19.5 and priority signals place this at monitor level.

RemediationAI

Upgrade to Nokogiri 1.19.5 or later (release: https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5), which contains the serializer escaping changes merged via PR https://github.com/sparklemotion/nokogiri/pull/3752 and commits 3e84df6ff7ab4d78f446e3a415430bd69a055d32 and c6c0bffbdcd194694995acafeeed27326b0805f8. Where upgrading immediately is not possible, applications that sanitize untrusted HTML and allow noscript should parse with parse_noscript_content_as_text: true (available since Nokogiri 1.17.0) or strip noscript elements before serialization; the maintainers recommend the parse option on every version, including patched ones, because some content inside noscript is still serialized unchanged as the standard requires. Applications relying on a sanitizer allow-list should also confirm that noscript is not permitted - Loofah and rails-html-sanitizer exclude it by default and Sanitize always removes it - since removing this element from the allow-list eliminates the exposure entirely. Full details are in the vendor advisory at https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-4p39-36wj-23h4.

Affected VersionsENISA

nokogiri 1.12.0, < 1.19.5

Affected Packages

rubygems nokogiri fix: 1.19.5

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in rubygems

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Nokogiri's HTML5 support wraps the Gumbo-based HTML5 parser and a serializer that is supposed to follow the HTML standard's serialization algorithm. Two escaping rules were missing: text inside noscript elements was emitted without escaping (unless the document was parsed with parse_noscript_content_as_text: true), and < and > inside attribute values were not encoded. Because a browser with scripting enabled treats the contents of noscript as regular markup (whereas Nokogiri's default parse treats it as raw text), a document that was inert at parse time can be re-interpreted as executable markup after serialization - the classic mutation XSS pattern, mapped to CWE-79 and CWE-116 (improper neutralization of special elements / improper encoding or escaping of output). The change in 1.19.5 makes the serializer escape both cases, aligns fragment parsing of noscript content with its owning document, and raises ArgumentError when a fragment is given a conflicting parse_noscript_content_as_text: value; comments and raw-text elements inside noscript are still serialized unchanged because the standard requires it. Only the C extension (CRuby and TruffleRuby) is affected, since JRuby does not implement Nokogiri::HTML5. The vulnerability class is output-context dependent: the trigger requires the sanitize-then-serialize-then-render pipeline described by the maintainers, and no other trigger path is described in the available sources.

Know when Ruby gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/sparklemotion/nokogiri) PRIMARY 2.3 LOW
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
vuln.today AI 4.7 MEDIUM

Mutation XSS needs a non-default sanitizer configuration that permits noscript (AC:H) and a victim rendering output in a scripting-enabled browser (UI:R); impact crosses into the browser (S:C) with low C/I.

3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Primary rating from Vendor (https://github.com/sparklemotion/nokogiri).

CVSS VectorVendor: https://github.com/sparklemotion/nokogiri

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
None
Subsequent system: Confidentiality
Low
Subsequent system: Integrity
Low
Subsequent system: Availability
None

DescriptionCVE.org

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.

Threat Intelligence Overview

EPSS Score
0.6%
Top 53% exploitable
Prevalence
High
Nokogiri is one of the most widely deployed Ruby HTML/XML libraries
Threat Intel
1
1 sources
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.6%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Low

Priority Score

13
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +12
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

More in Ruby

View all
CVE-2017-17405 HIGH POC
8.8 Dec 15

Ruby before 2.4.3 allows Net::FTP command injection. Rated high severity (CVSS 8.8), this vulnerability is remotely expl

CVE-2017-17790 CRITICAL POC
9.8 Dec 20

The lazy_initialize function in lib/resolv.rb in Ruby through 2.4.3 uses Kernel#open, which might allow Command Injectio

CVE-2017-14064 CRITICAL POC
9.8 Aug 31

Ruby through 2.2.7, 2.3.x through 2.3.4, and 2.4.x through 2.4.1 can expose arbitrary memory during a JSON.generate call

CVE-2016-2336 CRITICAL POC
9.8 Jan 06

Type confusion exists in two methods of Ruby's WIN32OLE class, ole_invoke and ole_query_interface. Rated critical severi

CVE-2026-77602 CRITICAL POC
9.9 Sep 23

Authenticated remote code execution in OpenC3 COSMOS (Ruby gem 'openc3' versions 5.1.0 through 7.2.1) lets any logged-in

CVE-2026-44266 CRITICAL POC
9.8 Nov 03

Ruby code execution in Elo (npm @enspirit/elo) through 1.0.0 lets an attacker who controls Elo source gain arbitrary Rub

CVE-2016-2337 CRITICAL POC
9.8 Jan 06

Type confusion exists in _cancel_eval Ruby's TclTkIp class method. Rated critical severity (CVSS 9.8), this vulnerabilit

CVE-2016-2339 CRITICAL POC
9.8 Jan 06

An exploitable heap overflow vulnerability exists in the Fiddle::Function.new "initialize" function functionality of Rub

CVE-2017-9225 CRITICAL POC
9.8 May 24

An issue was discovered in Oniguruma 6.2.0, as used in Oniguruma-mod in Ruby through 2.4.1 and mbstring in PHP through 7

CVE-2026-27614 CRITICAL POC
9.3 Feb 25

Stored XSS in Bugsink error tracking tool before 2.0.13 allows unauthenticated attackers to inject persistent scripts th

CVE-2017-0898 CRITICAL POC
9.1 Sep 15

Ruby before 2.4.2, 2.3.5, and 2.2.8 is vulnerable to a malicious format string which contains a precious specifier (*) w

CVE-2013-4164 MEDIUM POC
6.8 Nov 23

Heap-based buffer overflow in Ruby 1.8, 1.9 before 1.9.3-p484, 2.0 before 2.0.0-p353, 2.1 before 2.1.0 preview2, and tru

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy