CVE-2026-116695 in Crass
Summary
by MITRE • 10/27/2026
Crass is a Ruby CSS parser that is compliant with the CSS Syntax Level 3 specification. Prior to 1.0.8, Crass incorrectly treats a closing parenthesis after an escaped backslash as escaped while consuming the remnants of a bad URL. Crass therefore keeps declarations, style rules, or at-rules inside a bad URL token even though a browser treats them as live CSS. A sanitizer that parses untrusted CSS with Crass and reserializes it without rejecting the bad URL can allow CSS used for UI redress, external resource loading, or CSS-based data exfiltration, but this issue does not enable script execution in modern browsers. This issue is fixed in version 1.0.8.
If you want to get the best quality for vulnerability data then you always have to consider VulDB.
Analysis
by VulDB Data Team • 10/27/2026
Crass is a Ruby library designed to parse Cascading Style Sheets (CSS) with strict compliance to the CSS Syntax Level 3 specification. It serves as a foundational component for many web application frameworks and security tools that need to analyze, transform, or sanitize CSS content. The vulnerability identified in versions prior to 1.0.8 stems from an incorrect handling of escape sequences within URL tokens during the parsing process. Specifically, when Crass encounters a closing parenthesis immediately following an escaped backslash inside a malformed URL declaration, it misinterprets this sequence as part of the string literal rather than recognizing it as a delimiter that should terminate the token or trigger an error state consistent with browser behavior. This logical flaw causes the parser to retain subsequent CSS declarations, style rules, or at-rules within what is technically considered a bad URL token.
From a technical perspective, this discrepancy creates a significant divergence between how Crass parses CSS and how modern web browsers interpret it. Browsers adhere strictly to the CSS specification regarding error recovery in malformed URLs; they typically discard invalid tokens and treat subsequent content as valid, executable CSS. In contrast, Crass continues to consume these subsequent rules as if they were part of the broken URL structure. This parsing inconsistency is particularly dangerous when Crass is employed by Content Security Policy (CSP) implementations or custom sanitizers that rely on its output to determine which styles are safe for inclusion in a web page. If such a sanitizer fails to detect and reject the malformed URL, it may inadvertently allow malicious CSS constructs to pass through the filtering process because they were incorrectly encapsulated within the invalid token by the parser.
The operational impact of this vulnerability centers on potential security bypasses related to UI redress attacks, external resource loading, and data exfiltration. An attacker could craft a specially designed CSS payload that exploits this parsing flaw to inject malicious styles into an application's output. For instance, through UI redressing, the injected CSS might overlay transparent elements over legitimate interface components to trick users into interacting with deceptive controls or entering credentials on phishing pages disguised as part of the trusted site. Furthermore, attackers could leverage external resource loading mechanisms by manipulating background images or other URL-based properties within the hidden rules to force the victim's browser to make requests to attacker-controlled domains, potentially facilitating cross-site request forgery (CSRF) attacks or beaconing for command and control communications. Additionally, CSS-based data exfiltration techniques can be employed where sensitive information is encoded into style properties that trigger network requests when applied, allowing attackers to steal session tokens or other confidential data from the victim's browser context.
It is important to note a critical limitation of this vulnerability: it does not enable direct script execution in modern browsers. Since CSS itself cannot execute JavaScript code directly, the risk profile is distinct from cross-site scripting (XSS) vulnerabilities. However, the ability to manipulate visual presentation and network behavior remains highly significant for social engineering attacks and data theft. The attack vector typically involves supplying untrusted CSS input to a system that uses Crass for sanitization or transformation without adequate validation of URL syntax integrity. This highlights the importance of ensuring that parsing libraries used in security-critical paths accurately reflect browser rendering engines, as discrepancies can lead to false negatives in filtering logic.
To mitigate this vulnerability, organizations using versions of Crass prior to 1.0.8 must upgrade immediately to version 1.0.8 or later, where the issue has been resolved by correcting the handling of escaped characters within URL tokens. For systems that cannot be updated instantly, defensive measures should include implementing additional validation layers for CSS content before it is processed by Crass. This may involve pre-sanitizing input using more robust parsers or applying strict allow-listing strategies to restrict which CSS properties and values are permitted. Security teams should also review their CSP configurations to ensure they do not rely solely on client-side sanitization that might be bypassed via such parsing inconsistencies. Regular security audits of third-party dependencies are essential to maintain the integrity of web application defenses against evolving attack techniques.
This vulnerability aligns with CWE-20, which refers to Improper Input Validation, as the parser failed to correctly validate and handle malformed input structures according to established standards. It also relates to CWE-798, involving the use of hardcoded credentials or default configurations that may not account for edge cases in parsing logic, although here it is more accurately described as a logical error in state management during tokenization. In terms of MITRE ATT&CK mapping, this flaw facilitates techniques associated with T1053, Scheduled Task/Job, if used to persist malicious stylesheets, or more commonly T1071, Application Layer Protocol, for data exfiltration via CSS-based channels. Understanding these mappings helps in categorizing the risk within broader threat intelligence frameworks and prioritizing remediation efforts based on potential impact vectors such as UI redressing (T1653) and resource hijacking.