GraphQL aliases are a known DoS primitive. Strawberry, the most-installed pure-Python GraphQL server, ships an extension called MaxAliasesLimiter to stop them: it walks the query document and counts aliases. The executor resolves aliases at runtime. A fragment spread is one selection in the AST and N resolutions at runtime, and the pre-patch walker did not handle FragmentSpreadNode at all. CVE-2026-47707 is the gap between what the walker counts and what the executor pays.
CVE-2026-47707: Strawberry's Alias Limiter Counted The AST. The Executor Counted The Spreads.
vendor
pattern
cve
proof of concept
FragmentSpreadNode is one selection in the AST. The executor resolves it once per spread.
The MaxAliasesLimiter extension is registered like any other Strawberry extension:
schema = strawberry.Schema(
Query,
extensions=[MaxAliasesLimiter(max_alias_count=20)],
)The limiter exists to bound the cost of GraphQL aliases. Aliases are the primitive that lets a caller dispatch the same resolver multiple times under different output keys: { a: user, b: user, c: user } is three calls to user. The published mitigation, named in every GraphQL hardening guide, is to cap the number of aliases the validator will accept before the executor runs.
Pre-patch, the walker lived in strawberry/extensions/max_aliases.py, and its core function was eleven lines:
def count_fields_with_alias(
selection_set_owner: ExecutableDefinitionNode | FieldNode | InlineFragmentNode,
) -> int:
if selection_set_owner.selection_set is None:
return 0
result = 0
for selection in selection_set_owner.selection_set.selections:
if isinstance(selection, FieldNode) and selection.alias:
result += 1
if (
isinstance(selection, (FieldNode, InlineFragmentNode))
and selection.selection_set
):
result += count_fields_with_alias(selection)
return resultThe selection-set loop has two isinstance branches. A FieldNode carrying an alias contributes 1. A FieldNode or InlineFragmentNode with its own selection set is recursed into. There is no third branch. A FragmentSpreadNode selection passes both isinstance checks without matching and contributes 0.
The call site fed every executable definition in the document into this function:
def_that_can_contain_alias = (
def_
for def_ in document.definitions
if isinstance(def_, (ExecutableDefinitionNode))
)
total_aliases = sum(
count_fields_with_alias(def_node)
for def_node in def_that_can_contain_alias
)ExecutableDefinitionNode is the abstract base class of both OperationDefinitionNode and FragmentDefinitionNode in graphql-core. The walker therefore iterated query operations AND fragment definitions, summing each definition's static alias count exactly once. A fragment definition was counted once. A fragment spread referencing that definition contributed zero.
What the executor counts
The executor does not iterate top-level definitions. It begins at the operation, descends into its selection set, and resolves each selection. When it encounters a FragmentSpreadNode, it inlines the named fragment's selection set and resolves the fields it contains. Each spread is a full inline. Ten spreads of a fragment containing ten aliased fields produce one hundred resolver calls.
The cost the extension was named to bound is the cost the executor pays. The walker measured the document. These are not the same number when fragments are involved.
The bypass
The following query passes MaxAliasesLimiter(max_alias_count=20) on every Strawberry release from 0.172.0 through 0.315.6:
fragment leak on Human {
a01: email a02: email a03: email a04: email a05: email
a06: email a07: email a08: email a09: email a10: email
}
query attack {
s01: user(name: "x") { ...leak }
s02: user(name: "x") { ...leak }
s03: user(name: "x") { ...leak }
s04: user(name: "x") { ...leak }
s05: user(name: "x") { ...leak }
s06: user(name: "x") { ...leak }
s07: user(name: "x") { ...leak }
s08: user(name: "x") { ...leak }
s09: user(name: "x") { ...leak }
s10: user(name: "x") { ...leak }
}Pre-patch arithmetic: the attack operation contributes ten outer aliases (s01 through s10), plus ten spreads contributing zero each. The leak fragment definition is iterated as an ExecutableDefinitionNode and contributes ten inner aliases, counted once. Total: twenty. Equal to the configured cap; the validator passes.
Executor arithmetic: ten outer resolutions, plus ten spreads expanded to ten resolutions each. Total: one hundred and ten. The limiter's promise to the operator was that the executor would not be asked to resolve more than twenty aliases. The executor is asked to resolve one hundred and ten.
The amplification factor scales with the number of spreads and the alias count inside the fragment. The cap is the wrong shape to bound either.
The patch reads the bug
The fix landed as commit a69221f on 2026-05-19 in Strawberry 0.315.7. The diff is short and names both errors at once:
+from collections.abc import Mapping
+
from graphql import (
- ExecutableDefinitionNode,
FieldNode,
+ FragmentDefinitionNode,
+ FragmentSpreadNode,
GraphQLError,
InlineFragmentNode,
+ OperationDefinitionNode,
ValidationContext,
ValidationRule,
)The call site swaps ExecutableDefinitionNode for OperationDefinitionNode. Fragment definitions are no longer iterated directly. They only contribute through the spread that names them, inside the operation that contains the spread. The walker collects a fragments map before counting:
fragments = {
definition.name.value: definition
for definition in document.definitions
if isinstance(definition, FragmentDefinitionNode)
}And count_fields_with_alias gains the third branch it was missing:
if isinstance(selection, FragmentSpreadNode) and fragments:
fragment_name = selection.name.value
fragment = fragments.get(fragment_name)
if fragment is None or fragment_name in visited_fragments:
continue
result += count_fields_with_alias(
fragment,
fragments,
visited_fragments | {fragment_name},
)A visited_fragments frozenset is threaded through the recursion. Without it, a fragment that spreads itself, directly or through another fragment, would walk the counter into unbounded recursion the same shape as the executor's would face. The third branch is the count the executor performs. The frozenset is the guard the walker now installs for itself rather than borrowing from the order of validation rules graphql-core happens to run.
Apply the patched walker to the bypass query: ten outer aliases plus ten spreads at ten each. One hundred and ten. The cap of twenty rejects.
The same commit closed a quieter one in QueryDepthLimiter
The pull request that fixed CVE-2026-47707 is titled "fix fragment issues." It changes two files. The CVE names one of them.
QueryDepthLimiter is the depth equivalent of MaxAliasesLimiter: shipped in the same strawberry/extensions/ directory, registered the same way, intended to bound the same class of DoS. Unlike the alias walker, it did handle FragmentSpreadNode. It just did not track visited fragments. A circular fragment caused the depth-counting recursion to walk forever:
if isinstance(node, FragmentSpreadNode):
+ fragment_name = node.name.value
+ if fragment_name in visited_fragments:
+ return 0
+
return determine_depth(
- node=fragments[node.name.value],
+ node=fragments[fragment_name],
...
+ visited_fragments=visited_fragments | {fragment_name},
)graphql-core rejects circular fragments via a separate validation rule. Whether the limiter's recursion blew up before the circular-fragment rule fired depended on the order rules ran. The fix removes that dependency.
Two extensions in the same directory. Both shipped as DoS mitigations. Both DoS-able. The alias limiter was bypassable; an attacker could trigger the resource exhaustion the limiter was named to prevent. The depth limiter was self-DoS-able; the validator itself recursed indefinitely on a circular fragment, exhausting resources before deciding whether to reject. Same commit, same author, same release.
gate-narrower-than-sink
This is what the gate-narrower-than-sink pattern looks like when the gate is parse-time and the sink is runtime. The other exhibits in the catalog pair two parsers: two regexes disagreeing on whitespace inside the same template syntax; two URL parsers disagreeing on what the path of a request is; a regex character class disagreeing with POSIX sh about which bytes need escaping. In every case the gate and the sink ran a matcher over the same syntactic object, the matchers disagreed, and the inputs the sink accepted but the gate did not match flowed through.
Strawberry's pair are an AST walker and an executor. The walker counts at validation time. The executor resolves at runtime. Both operate over the same GraphQL document. They disagreed on what a FragmentSpreadNode is. To the pre-patch walker, it was a selection node carrying nothing it knew how to count. To the executor, it is a placeholder for the fragment's selection set, expanded once per occurrence. One selection in the AST. N resolutions at runtime.
The catalog so far had this pattern only across same-tier parsers. The Strawberry exhibit extends it into the parse-time-gate-against-runtime-sink dimension. Any static analyzer applied to limit a runtime cost carries the same risk: the gate sees one representation, the cost is paid in another, the two grow apart whenever the language has macros, includes, expansions, fragments, or any other mechanism that decouples the lexical form from the executed form.
What the limiter promised, and what it could see
Every published GraphQL hardening guide names alias limiting as a DoS mitigation. Apollo's, Hasura's, OWASP's. The mitigation is shipped by Strawberry as MaxAliasesLimiter, by graphene-django as MaxAliasesValidator, by graphql-armor as MaxAliasesRule. The class names are nearly identical because the mitigation is well-known.
An operator who registered MaxAliasesLimiter from 0.172.0 onward received the protection the AST walker could express. The protection the documentation implied was a bound on the executor's work. The two were equal when no query used a fragment spread. They diverged on any query that used one.
GraphQL fragments are not exotic syntax. They are the recommended factoring for any selection that recurs across queries, and they are the standard way to express the "same fields on multiple objects" shape that alias-abuse DoS exploits. The bypass shape and the mitigation shape converged on the same primitive. The limiter watched only one side of the convergence.
The limiter is named for what it counts. The DoS lives in what it didn't.