CVE-2026-61846: Crass: Deeply nested CSS blocks and functions can trigger a SystemStackError or excessive memory usage
The Ruby CSS parser Crass parsed nested simple blocks and functions recursively with no depth limit. A value with many nested blocks can raise `SystemStackError: stack level too deep` or use excessive memory. Versions before 1.0.7 are affected. Upgrade to Crass 1.0.7.
Published Oct 29, 2026 · Analysis Oct 31, 2026
What an attacker can do
Crass is a CSS parser used by libraries that sanitize or process stylesheets. When it meets a block or function inside another block, it calls itself again. Without a guard on depth, input such as thousands of nested parentheses or brackets pushes the Ruby stack past its limit, or allocates large amounts of memory while building the parse tree. The error is SystemStackError, which a plain rescue does not catch because it is not a StandardError.
The attacker needs an application that passes attacker-controlled CSS to Crass, such as user-supplied styles in a profile, an email or an HTML sanitizer. No account is needed. The outcome is a failed request, a crashed worker or memory pressure, which is a denial of service on the Ruby process doing the parsing. There is no code execution and no data exposure. The CVSS 4.0 vector reflects low availability impact and an attack requirement.
Who is affected
The crass gem below 1.0.7 is affected. Crass often arrives as a dependency, for example through HTML sanitizers, so check the bundle:
bundle list | grep crassAlso run bundle exec gem dependency crass --reverse-dependencies to see which gems pull it in. Your app is exposed if any of that code parses CSS from untrusted sources.
crass
- Ecosystem
- RubyGems
- Affected
- < 1.0.7
- Fixed in
- 1.0.7
- Check
bundle info crass
How to fix it
Upgrade to Crass 1.0.7, which adds a configurable depth limit with a conservative default.
bundle update crassThe advisory's workaround is to add SystemStackError handling around Crass calls in your application. That helps with the stack error but not with the memory growth, so upgrade.
How to tell if you were hit
Search application logs and error trackers for SystemStackError: stack level too deep with Crass in the backtrace, and for worker restarts or memory spikes after requests that carried CSS. Inspect the request payloads that triggered them for long runs of nested brackets or parentheses.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
Crass recursively parses CSS simple blocks and functions without a depth guard. An attacker-controlled value containing many deeply nested blocks can recurse until Ruby raises SystemStackError: stack level too deep, or can cause excessive memory usage.
Patches
This is fixed in Crass 1.0.7, which adds a configurable depth limit with a conservative default.
Workarounds
Add SystemStackError handling around Crass calls in your application. Buy more RAM.
Credited to hourianto, rgrove.
Questions
- How is this different from the Crass comment issue?
This one is about deeply nested blocks and functions, and can also exhaust memory. The other advisory, CVE-2026-61847, is about many adjacent comments. Version 1.0.7 fixes both.
- Can I catch the error instead of upgrading?
The advisory suggests handling
SystemStackErroraround Crass calls, but that does not cover excessive memory usage. Upgrading is the fix.- Is CVE-2026-61846 exploited in the wild?
No source reports exploitation, and it is not in CISA's KEV catalog.
References
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. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More RubyGems vulnerabilities
All RubyGems entriesCVE-2026-61847
Crass: A large number of adjacent CSS comments can trigger a SystemStackError
medium6.3Oct 29, 2026CVE-2026-61848
Crass: Non-ASCII characters cause superlinear CPU consumption
medium6.3Oct 29, 2026CVE-2026-116695
Crass: Incorrect tokenization of bad URLs enables CSS sanitizer bypass
medium5.3Oct 28, 2026CVE-2026-61845
Crass : Large numeric exponents cause CPU and memory denial of service
high8.9Oct 20, 2026
