GHSA-hmfr-rx46-4jx2 json
GraphQL Armor Max-Depth Plugin Bypass via Introspection Query Obfuscation
published last yr. modified last yr.
- cvss
- 5.3
- version 3.0, GitHub
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- —
- no score, EPSS covers CVEs only
- public exploits
- 0
- none known
Summary
### Summary A query depth restriction using the `max-depth` property can be bypassed if `ignoreIntrospection` is enabled (which is the default configuration) by naming your query/fragment `__schema`.
### Details At the start of the `countDepth` function, we have the following check for the `ignoreIntrospection` option:
```typescript if (this.config.ignoreIntrospection && 'name' in node && node.name?.value === '__schema') { return 0; } ```
However, the `node` can be one of: `FieldNode`, `FragmentDefinitionNode`, `InlineFragmentNode`, `OperationDefinitionNode`, `FragmentSpreadNode`.
For example, consider sending the following query:
```graphql query hello { books { title } } ```
This would create an `OperationDefinitionNode` where `node.name.value == 'hello'`
The proper way to handle this is to check explicitly for the `__schema` field, which corresponds to a `FieldNode`.
The fix is
```typescript if ( this.config.ignoreIntrospection && 'name' in node && node.name?.value === '__schema' && node.kind === Kind.FIELD ) { return 0; } ```
This ensures that the node is explicitly a `FieldNode`.
### PoC
Max depth: `6`
```graphql query { books { author { books { author { ...__schema } } } } } fragment __schema on Author { books { title } } ```
### Impact
This issue affects applications using the GraphQL Armor Depth Limit plugin with `ignoreIntrospection` enabled.
### Fix
This is fixed in [PR#823](https://github.com/Escape-Technologies/graphql-armor/pull/823)
Patch / fix
- npm @escape.tech/graphql-armor-max-depth 2.4.2
Is GHSA-hmfr-rx46-4jx2 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerCVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| GitHub | 3.0 | 5.3 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| npm | @escape.tech/graphql-armor-max-depth | <2.4.2 |
2.4.2 |
Classification
- Weakness
-
- CWE-400 Uncontrolled Resource Consumption
References
-
github.com
/Escape-Technologies/graphql-armor/pull/823
web
-
github.com
/Escape-Technologies/graphql-armor/commit/1f923bc09f5f053f60b6ba2bd419d4b94cbe1db3
web
-
github.com
/Escape-Technologies/graphql-armor/security/advisories/GHSA-hmfr-rx46-4jx2
web
-
github.com
/Escape-Technologies/graphql-armor
package
Sources
- GitHub Advisory GHSA-hmfr-rx46-4jx2
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.