---
id: "CVE-2026-61847"
kind: "vulnerability"
aliases: ["CVE-2026-61847", "GHSA-wwpr-jff3-395c"]
title: "Crass: A large number of adjacent CSS comments can trigger a SystemStackError"
severity: "medium"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "crass", "fixed": ["1.0.7"], "affected": "< 1.0.7", "ecosystem": "rubygems"}]
ecosystems: ["rubygems"]
tags: ["crass", "css-parsing", "cwe-674", "package", "ruby", "rubygems"]
not_affected_if: ["preserve-comments-enabled", "trusted-input-only"]
published_at: "2026-10-29T16:35:23+00:00"
first_seen_at: "2026-10-29T16:39:02+00:00"
updated_at: "2026-10-29T16:39:50+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-wwpr-jff3-395c", "first_seen_at": "2026-10-29T16:39:02+00:00"}]
---

# Crass: A large number of adjacent CSS comments can trigger a SystemStackError

Crass is a Ruby CSS parser that, by default, discards comments by recursing once per comment. A crafted stylesheet with a very large number of adjacent comments can exhaust the stack and raise a SystemStackError, crashing the process handling it.

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

## Affected

- rubygems:crass affected < 1.0.7 fixed 1.0.7

## How to check

- Check the installed version with `gem list crass` or `bundle exec gem list crass`, or read the `crass` line in `Gemfile.lock`.
- Look for any code path that passes untrusted CSS to Crass, such as user-supplied stylesheets or sanitizers, and whether `:preserve_comments` is set.

## Fix

- `crass` `1.0.7` (affected versions are below `1.0.7`).

## Timeline

- 2026-10-29T16:39:02+00:00 ghsa https://github.com/advisories/GHSA-wwpr-jff3-395c

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/rgrove/crass/security-advisories/GHSA-wwpr-jff3-395c
- [advisory] Maintainer's advisory: github.com https://github.com/rgrove/crass/security/advisories/GHSA-wwpr-jff3-395c
- [fix] Patch: github.com https://github.com/rgrove/crass/commit/25d78cc607c54262e9d43ea1930f3ba5bb03dfb5
- [fix] Release: github.com https://github.com/rgrove/crass/releases/tag/v1.0.7

## From the sources

### Impact

When the `:preserve_comments` option is not enabled (which is the default behavior), Crass discards CSS comments by recursively consuming the next token. An attacker who provides a stylesheet containing a very large number of adjacent comments can cause excessive recursion and trigger a `SystemStackError`.

### Patches

This is fixed in Crass 1.0.7, which no longer recurses when discarding comments.

### Workarounds

Set the `:preserve_comments` option to `true` if this is acceptable to your use case (recursion doesn't occur when comments are preserved).

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
