CVE-2026-75508: GraphQL-core: Denial of service via comment tokens bypassing the parser's max_tokens limit

Published Oct 22, 2026
·
Updated

Summary

The parser's maxtokens limit — the documented defence against oversized GraphQL documents — did not count comment tokens. A document padded with comments could therefore pass a maxtokens check of any size while still allocating one Token object per comment, all of which stay reachable for the lifetime of the parsed document. A 38 MB comment-padded payload allocated roughly 92 MB of additional resident memory with maxtokens=5 in force.

Details

Lexer.lookahead() reads tokens one at a time and skips over comments, returning only the first non-comment token. Each skipped comment is nevertheless fully tokenized, allocated as a Token object, and linked into the persistent token list via token.next / token.prev — the chain that powers source-location reporting, and which is retained as long as the document is.

Parser.advancelexer() incremented the token counter only for the tokens the lexer actually returned. Comments were therefore invisible to the accounting, and maxtokens bounded only the non-comment tokens.

The practical consequence is a gap between what users reasonably believe maxtokens protects and what it did protect. The limit was not broken for ordinary documents — real tokens were still capped correctly — so the shortfall was not observable without specifically testing comment padding.

As with the companion issue, the payload compresses extremely well (# c\n repeated), so body-size limits and WAF inspection applied to the compressed request do not see its true size, while the framework decompresses it in memory before the parser is reached.

Proof of concept

python import gc import resource from graphql import parse

100,000 comments, a 5-token query, and maxtokens=5 — accepted. query = "# c\n" 100000 + "{ a }" parse(query, maxtokens=5) # no error raised

Memory amplification. big = "# padding comment used to amplify memory per token\n" 500000 + "{ a }" gc.collect() before = resource.getrusage(resource.RUSAGESELF).rumaxrss parse(big, maxtokens=5) # ~38 MB source after = resource.getrusage(resource.RUSAGESELF).rumaxrss print(f"RSS delta: +{(after - before) / 1024:.0f} MB")

Measured on GraphQL-core 3.2.8 / CPython 3.12 / Linux x8664: the 391 KB payload parsed in 127 ms, and the 38.1 MB payload produced an RSS delta of +92 MB — about 2.4× the source size, on top of the source string itself.

Impact

Denial of service through memory exhaustion. A modest number of concurrent requests can push a worker past a typical 256 MB or 512 MB container limit and trigger an OOM kill. No authentication is required, and no data is disclosed or modified.

Depth limiters and complexity analyzers do not help: they run on the AST after parsing has already succeeded, and the document contains only five real tokens.

Patches

Fixed in 3.2.12 and 3.3.0rc1.

Parser.advancelexer now counts every token consumed, including the comment tokens the lexer skips between the previously focused token and the new one, and including the advance onto EOF so that trailing comments are covered. maxtokens therefore now bounds every Token the parser allocates.

Note the behaviour change: comments now count toward maxtokens. A comment-heavy document that was previously accepted may now be rejected. If you parse documents containing substantial comments — SDL files with documentation comments, for instance — and you set maxtokens, you may need to raise the limit. The tokencount attribute of a parsed document likewise now includes comments.

Workarounds

If you cannot upgrade, apply a request body-size limit to the decompressed body before the document reaches parse().

Such a limit is worth keeping after upgrading as well: maxtokens is one guard among several and bounds the token count, not the overall cost of a request.

References

- GraphQL specification § 2.1.4 — Comments

Credits

Reported by @BZHunt, who also reviewed the fixes before release. In memory of ZaX, who was the driving force behind this discovery.

Other sources

GraphQL-core is a Python port of the GraphQL.js reference implementation. From 3.2.3 until 3.2.12 and 3.3.0rc1, the parser's maxtokens limit in Parser.advancelexer counts only non-comment tokens returned after Lexer.lookahead skips comments. Each skipped comment is still allocated as a Token and retained through token.next and token.prev, allowing a highly compressible comment-padded GraphQL document to pass a low token limit while consuming memory. An unauthenticated remote attacker can exhaust worker memory before AST-based depth or complexity controls run. This issue is fixed in versions 3.2.12 and 3.3.0rc1.

— MITRE

Affected Software

3 affected componentsFixes available
pypi/graphql-core>=3.2.3<3.2.12
pip/graphql-core>=3.3.0a3<3.3.0rc1
3.3.0rc1
pip/graphql-core>=3.2.3<3.2.12
3.2.12

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/graphql-core to a version that resolves this vulnerability.

    Fixed in 3.3.0rc1
  2. Upgrade

    Upgrade pip/graphql-core to a version that resolves this vulnerability.

    Fixed in 3.2.12
  3. Upgrade

    Upgrade graphql-core 3.2.x to a version that resolves this vulnerability.

    Fixed in 3.2.12
  4. Upgrade

    Upgrade graphql-core 3.3.x to a version that resolves this vulnerability.

    Fixed in 3.3.0rc1
  5. Compensating control

    If you cannot upgrade, enforce a request body-size limit on the decompressed request body; retain such a limit after upgrading.

Event History

Oct 22, 2026
CVE Published
via MITRE·04:10 PM
Data Sourced
via MITRE·04:10 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·04:27 PM
Data Sourced
via GitHub·04:27 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed to remote exploitation?

Deployments that use affected GraphQL-core versions to parse GraphQL documents received from remote clients are exposed. The attack can be performed without authentication.

2

What must an attacker send to trigger the issue?

An attacker sends a GraphQL document padded with comments. Comment tokens are skipped when the parser enforces max_tokens, but are still allocated and retained in the lexer token chain.

3

Will AST depth or query-complexity limits prevent this denial of service?

No. Worker memory can be exhausted before AST-based depth or complexity controls run, so those controls do not stop this parser-stage issue.

4

How can I remediate the issue?

Upgrade GraphQL-core to version 3.2.12 or 3.3.0rc1, which are identified as containing the fix.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203