# GHSA-hmfr-rx46-4jx2: GraphQL Armor Max-Depth Plugin Bypass via Introspection Query Obfuscation

> Attackers can bypass GraphQL depth limits by naming fragments __schema, allowing resource exhaustion or DoS in applications using graphql-armor.

- **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:** 26 Aug 2025

## What is GHSA-hmfr-rx46-4jx2?

GHSA-hmfr-rx46-4jx2 is a vulnerability in @escape.tech/graphql-armor-max-depth, published on 26 Aug 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### 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)

## Which versions are affected by GHSA-hmfr-rx46-4jx2?

2 open source packages ship an affected version, including @escape.tech/graphql-armor-max-depth.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@escape.tech/graphql-armor-max-depth` | npm | All versions | 2.4.2 |
| `@escape.tech/graphql-armor-max-depth` | npm | All versions | 2.4.2 |

## How do I fix GHSA-hmfr-rx46-4jx2?

Upgrade @escape.tech/graphql-armor-max-depth to 2.4.2 or later.

## Is GHSA-hmfr-rx46-4jx2 being exploited?

There is no known exploitation of GHSA-hmfr-rx46-4jx2 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-hmfr-rx46-4jx2 and fix it if it is affected.

What it is: GHSA-hmfr-rx46-4jx2 is a vulnerability in @escape.tech/graphql-armor-max-depth, published on 26 Aug 2025. 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-hmfr-rx46-4jx2 in the wild and no public exploit code.

Affected packages and fixed versions:
- @escape.tech/graphql-armor-max-depth (npm): affected all versions; fixed in 2.4.2
- @escape.tech/graphql-armor-max-depth (npm): affected all versions; fixed in 2.4.2

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-hmfr-rx46-4jx2/ (Markdown: https://insights.sbomify.com/GHSA-hmfr-rx46-4jx2/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-hmfr-rx46-4jx2

---
From sbomify Insights: https://insights.sbomify.com/GHSA-hmfr-rx46-4jx2/
Summaries are generated and may contain mistakes; the official description above is the record.
