CVE-2024-43414: Apollo Query Planner and Apollo Gateway may infinitely loop on sufficiently complex queries
(updated )
Instances of @apollo/query-planner >=2.0.0 and <2.8.5 are impacted by a denial-of-service vulnerability. @apollo/gateway versions >=2.0.0 and < 2.8.5 and Apollo Router <1.52.1 are also impacted through their use of @apollo/query-planner.
If @apollo/query-planner is asked to plan a sufficiently complex query, it may loop infinitely and never complete. This results in unbounded memory consumption and either a crash or out-of-memory (OOM) termination.
This issue can be triggered if you have at least one non-@key
field that can be resolved by multiple subgraphs. To identify these shared fields, the schema for each subgraph must be reviewed. The mechanism to identify shared fields varies based on the version of Federation your subgraphs are using.
You can check if your subgraphs are using Federation 1 or Federation 2 by reviewing their schemas. Federation 2 subgraph schemas will contain a @link
directive referencing the version of Federation being used while Federation 1 subgraphs will not. For example, in a Federation 2 subgraph, you will find a line like @link(url: "https://specs.apollo.dev/federation/v2.0")
. If a similar @link
directive is not present in your subgraph schema, it is using Federation 1. Note that a supergraph can contain a mix of Federation 1 and Federation 2 subgraphs.
To review Federation 1 subgraphs for impact:
In Federation 1 subgraphs, fields are implicitly shareable across subgraphs. To review for impact, you will need to review for cases where multiple subgraphs can resolve the same field. For example:
References
- github.com/advisories/GHSA-fmj9-77q8-g6c4
- github.com/apollographql/federation
- github.com/apollographql/federation/security/advisories/GHSA-fmj9-77q8-g6c4
- github.com/apollographql/router/commit/e309c9bb5a48c1304ff69c88b7eabdd08c26bf45
- nvd.nist.gov/vuln/detail/CVE-2024-43414
- www.apollographql.com/docs/federation/query-plans
- www.apollographql.com/docs/router/configuration/persisted-queries
Detect and mitigate CVE-2024-43414 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →