Описание
GraphQL Armor Max-Depth Plugin Bypass via Introspection Query Obfuscation
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:
However, the node can be one of: FieldNode, FragmentDefinitionNode, InlineFragmentNode, OperationDefinitionNode, FragmentSpreadNode.
For example, consider sending the following query:
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
This ensures that the node is explicitly a FieldNode.
PoC
Max depth: 6
Impact
This issue affects applications using the GraphQL Armor Depth Limit plugin with ignoreIntrospection enabled.
Fix
This is fixed in PR#823
Пакеты
@escape.tech/graphql-armor-max-depth
<= 2.4.1
2.4.2
5.3 Medium
CVSS3
Дефекты
5.3 Medium
CVSS3