Skip to main content

Loofah CVE-2026-126203

| EUVDEUVD-2026-124615 MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-11-12 GitHub_M GHSA-h6v6-rg66-fqj4
6.1
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Access
    Submit crafted MathML with markup in an allowed attribute
  2. Delivery
    Loofah HTML5 scrubber emits unescaped angle brackets
  3. Exploit
    Victim views stored sanitized content
  4. Execution
    Browser reparses attribute as live HTML
  5. Impact
    Execute script in victim's session

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 the application to sanitize untrusted HTML with Loofah's HTML5 APIs specifically - Loofah.html5_fragment, Loofah.html5_document, or the scrub_html5_* methods - running on Nokogiri before 1.19.5 (which fails to escape '<' and '>' in attribute values), including with the default allowlist. The attacker-supplied payload must use MathML to place markup inside an allowed attribute, and a different user must then view the rendered output (UI:R). Scrubber/browser gating limits reach: the :strip scrubber is affected in every browser, while :prune and :escape are affected only in WebKit browsers such as Safari. Explicitly NOT exploitable via this flaw: Loofah's HTML4 APIs, Loofah::Helpers.sanitize, the :whitewash scrubber, rails-html-sanitizer's default configuration, and JRuby. These preconditions (HTML5 API use, old Nokogiri, specific scrubber, and required victim interaction) materially narrow realistic exposure.

Impact

This is a genuine but moderate-priority web-application vulnerability, not a drop-everything emergency, and the signals are internally consistent. The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N, base 6.1) describes classic stored/mutation XSS: network-reachable, low complexity, no attacker privileges required (PR:N), but it does require victim interaction (UI:R) and yields only Low confidentiality and Low integrity impact with a scope change into the victim's browser. The vuln.today decision label is 'this_month' (not act_now/emergency), it is NOT listed in CISA KEV, and no EPSS score is supplied - so there is no evidence of active or widespread exploitation. The available references are the GHSA advisory, fix PRs and commits in Loofah and Nokogiri, and release tags; these are patch/analysis artifacts, not a weaponized exploit, so there is no public exploit identified at this time. The practical risk is real for any app that sanitizes untrusted HTML with Loofah's HTML5 API and shows it to other users, but it is gated by multiple preconditions (specific HTML5 APIs, Nokogiri < 1.19.5, specific scrubber/browser combinations), which lowers real-world exposure below what the 6.1 score alone suggests. No signals conflict; EPSS and KEV are simply absent rather than contradictory.

Exploit ScenarioDerived

An attacker submits untrusted HTML containing MathML that embeds markup inside an allowed attribute to an application that sanitizes input with Loofah's HTML5 API (e.g. Loofah.html5_fragment) backed by Nokogiri < 1.19.5. Because those Nokogiri versions do not escape angle brackets in attribute values, when a second user views the stored 'sanitized' content their browser reparses the attribute as live HTML and executes the injected script (mutation XSS). No public exploit is identified at time of analysis; exploitation requires a victim to view the content (UI:R) and the :strip scrubber (all browsers) or :prune/:escape on WebKit/Safari.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.3% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Nov 12, 2026

Mutation XSS in Loofah's HTML5 sanitization path (versions 2.21.0 through 2.25.2, running on Nokogiri before 1.19.5) lets scrubber output be reparsed by a browser as markup the sanitizer never approved. Because Nokogiri of that vintage serialized '<' and '>' literally inside attribute values, a MathML payload can hide markup inside an attribute that Loofah's allowlist permits, and that markup becomes live HTML once the victim's browser re-parses the page; remote unauthenticated attackers can therefore run script in a victim's session, though a user must view the crafted output (UI:R). The :strip scrubber is affected in all browsers while :prune and :escape are affected only in WebKit browsers such as Safari, and the HTML4 APIs, Loofah::Helpers.sanitize, :whitewash, rails-html-sanitizer's default configuration and JRuby are explicitly unaffected. Vendor-released patch: Loofah 2.25.3 (paired with Nokogiri 1.19.5); no public exploit identified at time of analysis.

RemediationAI

Upgrade to Loofah 2.25.3, which requires Nokogiri >= 1.19.5 and enforces that floor; alternatively, if you cannot move Loofah yet, upgrade Nokogiri to 1.19.5 alone, since the escaping fix lives in Nokogiri's HTML5 serializer (see https://github.com/flavorjones/loofah/releases/tag/v2.25.3, https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5 and advisory GHSA-h6v6-rg66-fqj4). Be aware that Loofah 2.25.3 also raises the required Ruby version to >= 3.2 (the minimum Nokogiri 1.19.x supports), so applications on older Rubies must either upgrade Ruby or pin Nokogiri 1.19.5 with a Loofah version they can support, and should test scrubbed output against MathML payloads afterwards. If neither upgrade is immediately possible, the advisory's unaffected paths are the concrete fallback: route sanitization through Loofah's HTML4 API / Loofah::Helpers.sanitize, the :whitewash scrubber, or rails-html-sanitizer's default configuration, or run on JRuby - each of which sidesteps the HTML5 serializer path at the cost of HTML5 parsing semantics and, in the HTML4 case, different output handling for modern markup. No vendor-released patch data indicates any other workaround, and upstream guidance centers on upgrading the gem/Nokogiri pair.

Affected VersionsENISA

loofah 2.21.0, < 2.25.3

Affected Packages

rubygems loofah fix: 2.25.3

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

Loofah is a Ruby HTML/XML transformation and sanitization library built on Nokogiri, and this is a classic mutation-XSS (CWE-79, with an encoding root cause tracked as CWE-116) arising from a serializer/parser mismatch rather than from a bad allowlist entry. The HTML5 parsing and serialization rules require that '<' and '>' be escaped as entities inside attribute values (whatwg/html#6362); Nokogiri before 1.19.5 wrote them literally when serializing HTML5 fragments, its escaping routine having been gated on non-attribute context. An attacker who supplies MathML content - a namespace where markup can appear inside an attribute value that Loofah's safelist regards as ordinary data - can therefore get a string through the scrubber that the first parse treats as inert text but a second browser parse treats as element boundaries and executable markup. The upstream fix lands in Nokogiri's serializer (escaping angle brackets in attributes unconditionally) and Loofah 2.25.3 pins the dependency to Nokogiri >= 1.19.5, a dependency bump that also raises Loofah's Ruby floor to 3.2 because that is the minimum Nokogiri 1.19.x supports. The same release carries unrelated hardening (character-reference decoding before URI scheme checks, CSS escape handling, SVG textPath/mpath local-href restrictions, escaped CDATA output, and a quadratic-time href fix), which is useful context but not part of this CVE's trigger, and the trigger conditions for :strip versus :prune/:escape differ by browser engine as the advisory states.

Know when Loofah 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 (GitHub_M) PRIMARY 6.1 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
vuln.today AI 6.1 MEDIUM

Remote unauthenticated injection (PR:N) that only fires when a victim views the output (UI:R); stored markup crosses into the browser context (S:C) with limited C/I and no availability impact.

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

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

Lifecycle Timeline

2
Patch available
Nov 12, 2026 - 19:19 EUVD
CVE Published
Nov 12, 2026 - 18:06 cve.org
MEDIUM 6.1

DescriptionCVE.org

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. From 2.21.0 until 2.25.3, Loofah's HTML5 APIs Loofah.html5_fragment, Loofah.html5_document, and the scrub_html5_* methods can emit sanitized output that a browser reparses as different markup when used with Nokogiri before 1.19.5, because those Nokogiri versions do not escape angle brackets in attribute values. MathML can place markup inside an allowed attribute so the reparsed output becomes live HTML. The :strip scrubber is affected in every browser, while :prune and :escape are affected in WebKit browsers. Loofah's HTML4 APIs, Loofah::Helpers.sanitize, :whitewash, rails-html-sanitizer's default configuration, and JRuby are not affected. This issue is fixed in version 2.25.3.

Threat Intelligence Overview

EPSS Score
0.3%
Top 80% exploitable
Prevalence
Medium
popular Ruby HTML sanitization gem, common in Rails/Ruby web apps
Threat Intel
1
1 sources
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

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 MEDIUM
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.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
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
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 Loofah

View all
CVE-2022-23518 MEDIUM POC
6.1 Dec 14

rails-html-sanitizer is responsible for sanitizing HTML fragments in Rails applications. Rated medium severity (CVSS 6.1

CVE-2026-126206 MEDIUM POC
5.3 Nov 12

A sanitizer bypass in the Ruby gem Loofah 2.25.2 lets a crafted data: URI slip past Loofah::HTML5::Scrub.allowed_uri? (a

CVE-2022-23516 HIGH
7.5 Dec 14

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri

CVE-2022-23514 HIGH
7.5 Dec 14

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri

CVE-2022-23515 MEDIUM
6.1 Dec 14

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri

CVE-2018-8048 MEDIUM
6.1 Mar 27

In the Loofah gem through 2.2.0 for Ruby, non-whitelisted HTML attributes may occur in sanitized output by republishing

CVE-2019-15587 MEDIUM
5.4 Oct 22

In the Loofah gem for Ruby through v2.3.0 unsanitized JavaScript may occur in sanitized output when a crafted SVG elemen

CVE-2018-16468 MEDIUM
5.4 Oct 30

In the Loofah gem for Ruby, through v2.2.2, unsanitized JavaScript may occur in sanitized output when a crafted SVG elem

CVE-2026-126205 MEDIUM
5.3 Nov 12

Quadratic-time regular-expression processing in Loofah's SVG local-reference check allows attacker-supplied HTML to cons

CVE-2026-126207 MEDIUM
4.7 Nov 12

Loofah versions before 2.25.3 can emit a live CSS url() from a sanitized style attribute, causing a viewer's browser to

CVE-2026-73490 MEDIUM
4.7 Aug 12

SVG href attribute bypass in Loofah prior to 2.25.2 allows a crafted sanitized SVG to reference arbitrary same-origin ex

CVE-2026-73492 LOW
2.3 Aug 12

Cross-site scripting in Loofah 2.25.0-2.25.1 is possible when applications call `Loofah::HTML5::Scrub.allowed_uri?` dire

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