CVE-2026-126207: Loofah: CSS url() sanitization bypass via escaped parentheses
Summary Loofah::HTML5::Scrub.scrubcss rejected any property whose top-level Crass tokens included a :url or :badurl, and left url out of the allowed CSS functions. Both checks ran only against the first parse of the style attribute.
Published Nov 12, 2026
Affected packages
loofah
- Ecosystem
- RubyGems
- Affected
- < 2.25.3
- Fixed in
- 2.25.3
- Check
bundle info loofah
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
Loofah::HTML5::Scrub.scrub_css rejected any property whose top-level Crass tokens included a :url or :bad_url, and left url out of the allowed CSS functions. Both checks ran only against the first parse of the style attribute. When scrub_css rebuilt each property it emitted identifiers with their CSS escapes decoded, so parentheses written as escapes — url\28 …\29 — hid the url token from the checks, and the rebuilt value was re-parsed into a live url() that nothing checked again. An escaped property name, six-digit escapes, escaped comments and escaped quotes all reached the same place.
Impact
A sanitized style attribute could make a viewer's browser issue a request to an attacker-chosen URL. list-style fetches on render with no interaction, cursor on hover. That leaks the viewer's IP address, user agent and access timing, and can reach hosts routable only from the viewer's network. No script survives sanitization and the attacker cannot read the response, so the request itself is the whole impact.
Applications that sanitize user-supplied HTML with Loofah's default allowlist and display it to other people are affected.
Mitigation
Upgrade to Loofah >= 2.25.3.
Credit
Reported by NotAFlightRisk through GitHub's private vulnerability reporting.
Credited to NotAFlightRisk.
References
- https://github.com/flavorjones/loofah/security/advisories/GHSA-m3x9-938q-5767
- https://github.com/flavorjones/loofah/pull/324
- https://github.com/flavorjones/loofah/commit/b198a36e44c9c5408163ac50787825e8ca0b166b
- https://github.com/flavorjones/loofah/releases/tag/v2.25.3
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-m3x9-938q-5767.yml
- https://github.com/advisories/GHSA-m3x9-938q-5767
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More RubyGems vulnerabilities
All RubyGems entriesCVE-2026-126203
Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values
medium6.1Nov 12, 2026CVE-2026-126205
Loofah: Regular expression denial of service in the SVG local-reference check
medium5.3Nov 12, 2026CVE-2026-126206
Loofah allowed_uri? treats data:text/html as safe text/plain
medium5.3Nov 12, 2026CVE-2026-126208
Loofah: SVG `<textPath>` and `<mpath>` bypass local-reference restriction
medium4.7Nov 12, 2026CVE-2026-126209
Loofah allowed_uri? treats javascript: alert(1) as safe
medium5.3Nov 12, 2026CVE-2026-73490
Loofah: SVG `href` attribute bypasses local-reference restriction
medium4.7Jul 21, 2026
