# GHSA-3h96-34p3-xm76: GraphQL-Ruby's Ruby lexer does not count comment tokens for the purposes of max_query_string_tokens

> Attackers can bypass token limits in GraphQL-Ruby by using comments, potentially causing denial of service if max_query_string_tokens is configured.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 5 May 2026

## What is GHSA-3h96-34p3-xm76?

GHSA-3h96-34p3-xm76 is a denial of service vulnerability in graphql, published on 5 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

GraphQL-Ruby's `max_query_string_tokens` configuration didn't count comment tokens against the limit, allowing strings to be processed even after the configured maximum had actually been reached. 

In patched versions, the Ruby lexer does count these tokens. 

GraphQL-CParser is not affected by this problem. 

`max_query_string_tokens` was introduced in v2.3.1. Each 2.x version has received a new patch release for including a fix.

## Which versions are affected by GHSA-3h96-34p3-xm76?

8 open source packages ship an affected version, including graphql.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `graphql` | RubyGems | From 2.3.1 | 2.3.23 |
| `graphql` | RubyGems | From 2.3.1 | 2.3.23 |
| `graphql` | RubyGems | From 2.4.0 | 2.4.18 |
| `graphql` | RubyGems | From 2.4.0 | 2.4.18 |
| `graphql` | RubyGems | From 2.5.0 | 2.5.26 |
| `graphql` | RubyGems | From 2.5.0 | 2.5.26 |
| `graphql` | RubyGems | From 2.6.0 | 2.6.1 |
| `graphql` | RubyGems | From 2.6.0 | 2.6.1 |

## How do I fix GHSA-3h96-34p3-xm76?

Upgrade graphql to a fixed version for your release line: 2.3.23, 2.4.18, 2.5.26 or 2.6.1.

## Is GHSA-3h96-34p3-xm76 being exploited?

There is no known exploitation of GHSA-3h96-34p3-xm76 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-3h96-34p3-xm76 and fix it if it is affected.

What it is: GHSA-3h96-34p3-xm76 is a denial of service vulnerability in graphql, published on 5 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-3h96-34p3-xm76 in the wild and no public exploit code.

Affected packages and fixed versions:
- graphql (RubyGems): affected from 2.3.1; fixed in 2.3.23
- graphql (RubyGems): affected from 2.3.1; fixed in 2.3.23
- graphql (RubyGems): affected from 2.4.0; fixed in 2.4.18
- graphql (RubyGems): affected from 2.4.0; fixed in 2.4.18
- graphql (RubyGems): affected from 2.5.0; fixed in 2.5.26
- graphql (RubyGems): affected from 2.5.0; fixed in 2.5.26
- graphql (RubyGems): affected from 2.6.0; fixed in 2.6.1
- graphql (RubyGems): affected from 2.6.0; fixed in 2.6.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-3h96-34p3-xm76/ (Markdown: https://insights.sbomify.com/GHSA-3h96-34p3-xm76/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-3h96-34p3-xm76

---
From sbomify Insights: https://insights.sbomify.com/GHSA-3h96-34p3-xm76/
Summaries are generated and may contain mistakes; the official description above is the record.
