# GHSA-733v-p3h5-qpq7: GraphQL Armor Cost-Limit Plugin Bypass via Introspection Query Obfuscation

> Attackers can bypass GraphQL cost limits by naming queries __schema, potentially causing denial of service in applications using the default configuration.

- **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:** 25 Apr 2025

## What is GHSA-733v-p3h5-qpq7?

GHSA-733v-p3h5-qpq7 is a vulnerability in @escape.tech/graphql-armor-cost-limit, published on 25 Apr 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Summary
A query cost restriction using the `cost-limit` can be bypassed if `ignoreIntrospection` is enabled (which is the default configuration) by naming your query/fragment `__schema`.

### Details
At the start of the `computeComplexity` function, we have the following check for `ignoreIntrospection` option:

```ts
    if (this.config.ignoreIntrospection && 'name' in node && node.name?.value === '__schema') {
      return 0;
    }
```

However, the `node` can be `FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode | FragmentSpreadNode`

So, for example, sending the following query

```gql
query hello {
  books {
    title
  }
}
```

would create an `OperationDefinitionNode` with `node.name.value == 'hello'`

The proper way to handle this would be to check for the `__schema` field, which would create a `FieldNode`.

The fix is

```ts
    if (
      this.config.ignoreIntrospection &&
      'name' in node &&
      node.name?.value === '__schema' &&
      node.kind === Kind.FIELD
    ) {
      return 0;
    }
```

to assert that the node must be a `FieldNode`

### PoC
```gql
query  {
  ...__schema
}

fragment __schema on Query {
  books {
    title
    author
  }
}
```

```gql
query __schema {
  books {
    title
    author
  }
}
```

### Impact
Applications using GraphQL Armor Cost Limit plugin with `ignoreIntrospection` enabled.

### Fix:
Fixed on [772](https://github.com/Escape-Technologies/graphql-armor/pull/772). A quick patch would be to set `ignoreIntrospection` to false.

## Which versions are affected by GHSA-733v-p3h5-qpq7?

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


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

## How do I fix GHSA-733v-p3h5-qpq7?

Upgrade @escape.tech/graphql-armor-cost-limit to 2.4.2 or later.

## Is GHSA-733v-p3h5-qpq7 being exploited?

There is no known exploitation of GHSA-733v-p3h5-qpq7 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-733v-p3h5-qpq7 and fix it if it is affected.

What it is: GHSA-733v-p3h5-qpq7 is a vulnerability in @escape.tech/graphql-armor-cost-limit, published on 25 Apr 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-733v-p3h5-qpq7 in the wild and no public exploit code.

Affected packages and fixed versions:
- @escape.tech/graphql-armor-cost-limit (npm): affected all versions; fixed in 2.4.2
- @escape.tech/graphql-armor-cost-limit (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-733v-p3h5-qpq7/ (Markdown: https://insights.sbomify.com/GHSA-733v-p3h5-qpq7/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-733v-p3h5-qpq7

---
From sbomify Insights: https://insights.sbomify.com/GHSA-733v-p3h5-qpq7/
Summaries are generated and may contain mistakes; the official description above is the record.
