Skip to main content
Menu
Advisories

Cross-Request Result Injection and Data Exposure via the nodes and _entities Fields

GHSA-R984-42RQ-C323Published Updated GitHub

Description

The nodes field added by AddGlobalObjectIdentification() and the _entities field added by AddApolloFederation() can complete while node or reference resolvers they started are still running, for example when the request is cancelled or the field fails. Those resolvers then continue on resolver state that other requests reuse.

Through nodes, fields in other requests, including mutations, can return an object that a node resolver loaded for a different request instead of running their own resolver. Through _entities, a reference resolver that uses its IResolverContext after an await can act on another request.

An application is affected through the nodes field when all of the following hold:

  • It uses global object identification with AddGlobalObjectIdentification() and exposes the nodes field. This is the default. In 16.x the field can be removed with AddNodesField = false.
  • At least one node resolver completes asynchronously, for example by awaiting a database query, an HTTP call, or a DataLoader.
  • Clients can send a nodes query with IDs of their choice. This is the default. Applications that only execute persisted operations are affected only if a persisted operation selects nodes with the IDs passed as a variable.

An application is affected through the _entities field when all of the following hold:

  • It is an Apollo Federation subgraph built with AddApolloFederation().
  • A reference resolver uses its IResolverContext after its first await, for example by calling ReportError or by reading services or state from the context.
  • Clients can send _entities requests directly to the subgraph, or _entities requests are cancelled while reference resolvers are still running, for example when the router cancels a subgraph request.

Fixed Versions

  • 16.7.3
  • 15.1.20
  • 14.3.4
  • 13.9.19

Impact

A client that can query nodes, including an unauthenticated one, can make fields in other users' requests, including mutations, return an object it may load instead of running their resolver. It cannot choose which requests are affected and does not receive other users' data this way.

When a user's own nodes request fails or is cancelled, an object loaded for that user can be returned to another request, including an anonymous one. Authorization on the node type does not prevent this; authorization on the object's fields still applies. This depends on other users' traffic.

On an Apollo Federation subgraph, the effect depends on what a reference resolver does with its context after an await, for example reporting an error into another client's response.

This issue is classified as CWE-672: Operation on a Resource after Expiration or Release.

Recommendation

Upgrade to one of the fixed releases. A nodes or _entities field that fails or whose request is cancelled then completes only after all node and reference resolvers it started have finished. Errors and responses are otherwise unchanged. Node and reference resolvers that observe the request's cancellation token finish sooner on cancellation.

Application code that calls IResolverContext.Clone() and starts work on the copy must wait for that work before its resolver completes. The fix does not change such code.

There is no workaround. Applications must upgrade.

Affected versions

References

GitHub · ChilliCream/graphql-platform