---
id: "CVE-2026-126203"
page: "https://infrastack.ai/live/CVE-2026-126203"
kind: "vulnerability"
aliases: ["CVE-2026-126203", "GHSA-h6v6-rg66-fqj4"]
title: "Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values"
severity: "medium"
cvss: 6.1
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "loofah", "fixed": ["2.25.3"], "affected": ">= 2.21.0, < 2.25.3", "ecosystem": "rubygems"}]
ecosystems: ["rubygems"]
tags: ["cwe-116", "cwe-79", "loofah", "nokogiri", "package", "rails", "rails-html-sanitizer", "ruby"]
not_affected_if: ["html4-api-only", "jruby", "rails-html-sanitizer-default-config", "whitewash-scrubber"]
published_at: "2026-11-12T19:16:56+00:00"
first_seen_at: "2026-11-12T19:40:13+00:00"
updated_at: "2026-11-12T20:54:13+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-126203", "first_seen_at": "2026-11-12T19:40:13+00:00"}, {"source": "ghsa", "url": "https://github.com/advisories/GHSA-h6v6-rg66-fqj4", "first_seen_at": "2026-11-12T20:53:40+00:00"}]
exploit_sources: []
---

# Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values

Link for people: https://infrastack.ai/live/CVE-2026-126203 (this .md is for agents)

Loofah's HTML5 scrubbers can emit markup that a browser parses differently, so attribute content inside allowed MathML becomes live HTML. An attacker who supplies sanitized input that other users view can run script in their browser.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- rubygems:loofah affected >= 2.21.0, < 2.25.3 fixed 2.25.3

## How to check

- Check the Loofah version in `Gemfile.lock` for `loofah` below `2.25.3`
- Check the Nokogiri version in `Gemfile.lock` for `nokogiri` below `1.19.5`
- Search the code for `Loofah.html5_fragment`, `Loofah.html5_document` and `scrub_html5_` calls whose output is shown to other users

## Fix

- Loofah: upgrade to `2.25.3` or later
- Nokogiri: upgrade to `1.19.5` or later

## Timeline

- 2026-11-12T19:40:13+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-126203
- 2026-11-12T20:53:40+00:00 ghsa https://github.com/advisories/GHSA-h6v6-rg66-fqj4

## Documents

- [advisory] Vendor advisory: github.com https://github.com/flavorjones/loofah/security/advisories/GHSA-h6v6-rg66-fqj4
- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/flavorjones/loofah/security-advisories/GHSA-h6v6-rg66-fqj4
- [fix] Patch: github.com https://github.com/flavorjones/loofah/commit/7ba1e7b77e043fb7dc832ef746fcbf83137135e6
- [fix] Release notes: github.com https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5
- [fix] Patch: github.com https://github.com/sparklemotion/nokogiri/commit/635abc8d65c75d594ddf8957fbfbfd822c2c0dbd
- [fix] Release notes: github.com https://github.com/flavorjones/loofah/releases/tag/v2.25.3
- [fix] Patch: github.com https://github.com/flavorjones/loofah/pull/324

## From the sources

## Summary

Loofah's HTML5 scrubbers could emit output that a browser parses into different markup, allowing mutation XSS. Nokogiri < 1.19.5 did not escape `<` and `>` in attribute values. When the output contained certain MathML, a browser treated markup inside an allowed attribute as live HTML. The `:strip` scrubber is affected in every browser. The `:prune` and `:escape` scrubbers are affected in WebKit browsers such as Safari.

Nokogiri 1.19.5 escapes `<` and `>` in attribute values, as the HTML standard requires. Loofah 2.25.3 requires Nokogiri >= 1.19.5.

## Impact

Applications that sanitize untrusted HTML with Loofah's HTML5 API (`Loofah.html5_fragment`, `Loofah.html5_document` and the `scrub_html5_*` methods) and display the result to other people are affected, including with the default allowlist.

Not affected: Loofah's HTML4 API (including `Loofah::Helpers.sanitize`), the `:whitewash` scrubber, rails-html-sanitizer's default configuration, and JRuby.

## Mitigation

Upgrade to Loofah >= 2.25.3, or upgrade Nokogiri to >= 1.19.5.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
