GHSA-PQ4G-8RXF-4G29
Vulnerability from github – Published: 2026-10-28 22:42 – Updated: 2026-10-28 22:42Summary
Crass's tokenizer didn't terminate a bad URL token at a ) that followed an escaped backslash (\\). As a result, Crass consumed more input as part of the bad URL than a spec-compliant browser does. CSS sanitizers that parse untrusted CSS with Crass and re-emit it could be tricked into passing through declarations, style rules, or at-rules (including @import) that the sanitizer would otherwise have removed, but that a browser would then parse and apply.
Details
While consuming the remnants of a bad URL (CSS Syntax Level 3, §4.3.15), Crass checked whether the previously consumed code point and the next code point formed a valid escape, in addition to checking the next two unconsumed code points. After an escaped backslash, the previously consumed code point is a backslash, so a following ) was incorrectly treated as escaped and the bad URL token continued until the next unescaped ) or the end of the input.
Browsers terminate the bad URL at that ), so everything Crass treated as part of the bad URL is live CSS to a browser.
This bug has existed in every released version of Crass.
Impact
Crass by itself only mis-tokenizes input. The security impact is on CSS sanitizers that use Crass to make allow/deny decisions and then re-serialize the CSS. Exploitation requires a sanitizer that doesn't reject bad URL tokens wherever they occur. Confirmed examples (verified in Chromium against the sanitizers' output):
- Sanitize (all versions through 7.0.0):
- In
Sanitize::CSS.propertiesandstyleattributes, a bad URL inside a[...]or(...)block in the value of an allowlisted property can smuggle arbitrary declarations, such asposition: fixedor abackground-imageURL with a disallowed protocol. - In
Sanitize::CSS.stylesheetand<style>elements, a bad URL in a selector can smuggle arbitrary style rules and at-rules, including@import. - Loofah (
Loofah::HTML5::Scrub.scrub_css, used forstyleattributes), and therefore rails-html-sanitizer (sanitize_css, andsanitizewhenstyleis a permitted attribute): a bad URL inside an allowlisted function such ascalc()orrgb()can smuggle declarations Loofah normally strips, such asposition: fixedandurl()values.
Smuggled CSS can be used for UI redress (clickjacking or phishing overlays), loading attacker-controlled external resources, and, where rules or @import can be smuggled, CSS-based data exfiltration. This vulnerability doesn't allow script execution in modern browsers.
Patches
Fixed in Crass 1.0.8. Users of Sanitize, Loofah, rails-html-sanitizer, or any other library that uses Crass to sanitize CSS should upgrade Crass to 1.0.8 or later.
Workarounds
There are no practical workarounds other than upgrading. Rejecting any CSS input that contains the character sequence \\ would block the known trigger, but this is a blunt measure and may reject legitimate CSS.
References
- CSS Syntax Module Level 3, "Consume the remnants of a bad url": https://drafts.csswg.org/css-syntax-3/#consume-remnants-of-bad-url
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 1.0.7"
},
"package": {
"ecosystem": "RubyGems",
"name": "crass"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.0.8"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-116695"
],
"database_specific": {
"cwe_ids": [
"CWE-436"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-28T22:42:53Z",
"nvd_published_at": "2026-10-27T21:18:05Z",
"severity": "MODERATE"
},
"details": "## Summary\n\nCrass\u0027s tokenizer didn\u0027t terminate a bad URL token at a `)` that followed an escaped backslash (`\\\\`). As a result, Crass consumed more input as part of the bad URL than a spec-compliant browser does. CSS sanitizers that parse untrusted CSS with Crass and re-emit it could be tricked into passing through declarations, style rules, or at-rules (including `@import`) that the sanitizer would otherwise have removed, but that a browser would then parse and apply.\n\n## Details\n\nWhile consuming the remnants of a bad URL (CSS Syntax Level 3, \u00a74.3.15), Crass checked whether the *previously consumed* code point and the next code point formed a valid escape, in addition to checking the next two unconsumed code points. After an escaped backslash, the previously consumed code point is a backslash, so a following `)` was incorrectly treated as escaped and the bad URL token continued until the next unescaped `)` or the end of the input.\n\nBrowsers terminate the bad URL at that `)`, so everything Crass treated as part of the bad URL is live CSS to a browser.\n\nThis bug has existed in every released version of Crass.\n\n## Impact\n\nCrass by itself only mis-tokenizes input. The security impact is on CSS sanitizers that use Crass to make allow/deny decisions and then re-serialize the CSS. Exploitation requires a sanitizer that doesn\u0027t reject bad URL tokens wherever they occur. Confirmed examples (verified in Chromium against the sanitizers\u0027 output):\n\n- **Sanitize** (all versions through 7.0.0):\n - In `Sanitize::CSS.properties` and `style` attributes, a bad URL inside a `[...]` or `(...)` block in the value of an allowlisted property can smuggle arbitrary declarations, such as `position: fixed` or a `background-image` URL with a disallowed protocol.\n - In `Sanitize::CSS.stylesheet` and `\u003cstyle\u003e` elements, a bad URL in a selector can smuggle arbitrary style rules and at-rules, including `@import`.\n- **Loofah** (`Loofah::HTML5::Scrub.scrub_css`, used for `style` attributes), and therefore **rails-html-sanitizer** (`sanitize_css`, and `sanitize` when `style` is a permitted attribute): a bad URL inside an allowlisted function such as `calc()` or `rgb()` can smuggle declarations Loofah normally strips, such as `position: fixed` and `url()` values.\n\nSmuggled CSS can be used for UI redress (clickjacking or phishing overlays), loading attacker-controlled external resources, and, where rules or `@import` can be smuggled, CSS-based data exfiltration. This vulnerability doesn\u0027t allow script execution in modern browsers.\n\n## Patches\n\nFixed in Crass 1.0.8. Users of Sanitize, Loofah, rails-html-sanitizer, or any other library that uses Crass to sanitize CSS should upgrade Crass to 1.0.8 or later.\n\n## Workarounds\n\nThere are no practical workarounds other than upgrading. Rejecting any CSS input that contains the character sequence `\\\\` would block the known trigger, but this is a blunt measure and may reject legitimate CSS.\n\n## References\n\n- CSS Syntax Module Level 3, \"Consume the remnants of a bad url\": https://drafts.csswg.org/css-syntax-3/#consume-remnants-of-bad-url",
"id": "GHSA-pq4g-8rxf-4g29",
"modified": "2026-10-28T22:42:53Z",
"published": "2026-10-28T22:42:53Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/rgrove/crass/security/advisories/GHSA-pq4g-8rxf-4g29"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-116695"
},
{
"type": "WEB",
"url": "https://github.com/rgrove/crass/commit/689fc45c632fdf3803b2f4e844ffc9cca3b08f34"
},
{
"type": "PACKAGE",
"url": "https://github.com/rgrove/crass"
},
{
"type": "WEB",
"url": "https://github.com/rgrove/crass/releases/tag/v1.0.8"
},
{
"type": "WEB",
"url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/crass/GHSA-pq4g-8rxf-4g29.yml"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Crass: Incorrect tokenization of bad URLs enables CSS sanitizer bypass"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.