GHSA-733v-p3h5-qpq7

Suggest an improvement
Source
https://github.com/advisories/GHSA-733v-p3h5-qpq7
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/04/GHSA-733v-p3h5-qpq7/GHSA-733v-p3h5-qpq7.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-733v-p3h5-qpq7
Published
2025-04-25T15:14:36Z
Modified
2025-04-29T16:45:56Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L CVSS Calculator
Summary
GraphQL Armor Cost-Limit Plugin Bypass via Introspection Query Obfuscation
Details

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:

    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

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

    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

query  {
  ...__schema
}

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

Impact

Applications using GraphQL Armor Cost Limit plugin with ignoreIntrospection enabled.

Fix:

Fixed on 772. A quick patch would be to set ignoreIntrospection to false.

Database specific
{
    "cwe_ids":  [
        "CWE-400",
        "CWE-770"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2025-04-25T15:14:36Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

npm / @escape.tech/graphql-armor-cost-limit

Package

Name
@escape.tech/graphql-armor-cost-limit
View open source insights on deps.dev
Purl
pkg:npm/%40escape.tech/graphql-armor-cost-limit

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
2.4.2

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/04/GHSA-733v-p3h5-qpq7/GHSA-733v-p3h5-qpq7.json"