GHSA-hmfr-rx46-4jx2

Suggest an improvement
Source
https://github.com/advisories/GHSA-hmfr-rx46-4jx2
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/08/GHSA-hmfr-rx46-4jx2/GHSA-hmfr-rx46-4jx2.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-hmfr-rx46-4jx2
Published
2025-08-26T18:42:37Z
Modified
2025-08-26T18:42:37Z
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 Max-Depth Plugin Bypass via Introspection Query Obfuscation
Details

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:

    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:

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

    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

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

Database specific
{
    "cwe_ids": [
        "CWE-400"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-08-26T18:42:37Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
}
References

Affected packages

npm / @escape.tech/graphql-armor-max-depth

Package

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

Affected ranges

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

Database specific

last_known_affected_version_range
"<= 2.4.1"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/08/GHSA-hmfr-rx46-4jx2/GHSA-hmfr-rx46-4jx2.json"