From dcdacdc3d7d865484c16d0110447292c43ec5e30 Mon Sep 17 00:00:00 2001 From: "advisory-database[bot]" <45398580+advisory-database[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 18:15:18 +0000 Subject: [PATCH] Publish Advisories GHSA-fmj9-77q8-g6c4 GHSA-x6xq-whh3-gg32 --- .../GHSA-fmj9-77q8-g6c4.json | 111 ++++++++++++++++++ .../GHSA-x6xq-whh3-gg32.json | 69 +++++++++++ 2 files changed, 180 insertions(+) create mode 100644 advisories/github-reviewed/2024/08/GHSA-fmj9-77q8-g6c4/GHSA-fmj9-77q8-g6c4.json create mode 100644 advisories/github-reviewed/2024/08/GHSA-x6xq-whh3-gg32/GHSA-x6xq-whh3-gg32.json diff --git a/advisories/github-reviewed/2024/08/GHSA-fmj9-77q8-g6c4/GHSA-fmj9-77q8-g6c4.json b/advisories/github-reviewed/2024/08/GHSA-fmj9-77q8-g6c4/GHSA-fmj9-77q8-g6c4.json new file mode 100644 index 00000000000..b8af79c5752 --- /dev/null +++ b/advisories/github-reviewed/2024/08/GHSA-fmj9-77q8-g6c4/GHSA-fmj9-77q8-g6c4.json @@ -0,0 +1,111 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-fmj9-77q8-g6c4", + "modified": "2024-08-27T18:14:12Z", + "published": "2024-08-27T18:14:12Z", + "aliases": [ + "CVE-2024-43414" + ], + "summary": "Apollo Query Planner and Apollo Gateway may infinitely loop on sufficiently complex queries", + "details": "### Impact\nInstances 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. \n\nIf @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.\n\nThis 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.\n\nYou 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.\n\n**To review Federation 1 subgraphs for impact:**\n\nIn 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: \n\n```graphql\n# Subgraph 1\ntype Query {\n field: Int\n}\n\n# Subgraph 2\ntype Query {\n field: Int\n}\n```\n\n\n**To review Federation 2 subgraphs for impact:**\n\nIn Federation 2 subgraphs, fields must be explicitly defined as shareable across subgraphs. This is done via the `@shareable` directive. For example:\n\n```graphql\n# Subgraph 1\n@link(url: \"https://specs.apollo.dev/federation/v2.0\")\ntype Query {\n field: Int @shareable\n}\n\n# Subgraph 2\n@link(url: \"https://specs.apollo.dev/federation/v2.0\")\ntype Query {\n field: Int @shareable\n}\n```\n\n### Impact Detail\n\nThis issue results from the Apollo query planner attempting to use a `Number` exceeding Javascript’s `Number.MAX_VALUE` in some cases. In Javascript, `Number.MAX_VALUE` is (2^1024 - 2^971).\n\nWhen the query planner receives an inbound graphql request, it breaks the query into pieces and for each piece, generates a list of potential execution steps to solve the piece. These candidates represent the steps that the query planner will take to satisfy the pieces of the larger query. As part of normal operations, the query planner requires and calculates the number of possible query plans for the total query. That is, it needs the product of the number of query plan candidates for each piece of the query. Under normal circumstances, after generating all query plan candidates and calculating the number of all permutations, the query planner moves on to stack rank candidates and prune less-than-optimal options. \n\nIn particularly complex queries, especially those where fields can be solved through multiple subgraphs, this can cause the number of all query plan permutations to balloon. In worst-case scenarios, this can end up being a number larger than `Number.MAX_VALUE`. In Javascript, if `Number.MAX_VALUE` is exceeded, Javascript represents the value as “infinity”. If the count of candidates is evaluated as infinity, the component of the query planner responsible for pruning less-than-optimal query plans does not actually prune candidates, causing the query planner to evaluate many orders of magnitude more query plan candidates than necessary.\n\nA given graph’s exposure to this issue varies based on its complexity. Consider the following Federation 2 subgraphs: \n\n```graphql\n# Subgraph 1\ntype Query {\n field: Int @shareable\n}\n\n# Subgraph 2\ntype Query {\n field: Int @shareable\n}\n```\n\nThe query planner can solve requests for `Query.field` in one of two ways - either by querying subgraph 1 or subgraph 2. \n\nThe following query with 1024 aliased fields would trigger this issue because 2^1024 > `Number.MAX_VALUE`: \n\n```graphql\nquery {\n field_1: field\n field_2: field\n # ...\n field_1023: field\n field_1024: field\n}\n```\n\n\nHowever, in a graph that provided 5 options to solve a given field, the bug could be encountered in a query that aliased the field approximately 440 times.\n\n\n### Patches\n@apollo/query-planner 2.8.5\n@apollo/gateway 2.8.5\nApollo Router 1.52.1\n\n### Workarounds\nThis issue can be avoided by ensuring there are no fields resolvable from multiple subgraphs. If all subgraphs are using Federation 2, you can confirm that you are not impacted by ensuring that none of your subgraph schemas use the `@shareable` directive. If you are using Federation 1 subgraphs, you will need to validate that there are no fields resolvable by multiple subgraphs. \n\nNote that a supergraph can contain a mix of Federation 1 and Federation 2 subgraphs. \n\nIf you do have fields resolvable by multiple subgraphs, changing this behavior in response to this issue may be risky to the operation of your supergraph. We recommend that you update to a patched version of either Apollo Router or Apollo Gateway.\n\nApollo customers with an enterprise entitlement using the Apollo Router can also mitigate much of the risk from this issue by implementing [Apollo’s Persisted Queries (PQ) feature](https://www.apollographql.com/docs/router/configuration/persisted-queries). With PQ enabled, the Apollo Router will only execute safelisted queries. While customers would need to ensure that queries that induce this issue are not added to the safelist, PQs would mitigate the risk of clients submitting ad hoc queries that exploit this issue.\n\n### References\n\n[Additional information on Query Plans](https://www.apollographql.com/docs/federation/query-plans/)\n", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H" + }, + { + "type": "CVSS_V4", + "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N" + } + ], + "affected": [ + { + "package": { + "ecosystem": "crates.io", + "name": "apollo-router" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "0" + }, + { + "fixed": "1.52.1" + } + ] + } + ] + }, + { + "package": { + "ecosystem": "npm", + "name": "@apollo/query-planner" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "2.0.0" + }, + { + "fixed": "2.8.5" + } + ] + } + ] + }, + { + "package": { + "ecosystem": "npm", + "name": "@apollo/gateway" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "2.0.0" + }, + { + "fixed": "2.8.5" + } + ] + } + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/apollographql/federation/security/advisories/GHSA-fmj9-77q8-g6c4" + }, + { + "type": "WEB", + "url": "https://github.com/apollographql/router/commit/e309c9bb5a48c1304ff69c88b7eabdd08c26bf45" + }, + { + "type": "PACKAGE", + "url": "https://github.com/apollographql/federation" + }, + { + "type": "WEB", + "url": "https://www.apollographql.com/docs/federation/query-plans" + }, + { + "type": "WEB", + "url": "https://www.apollographql.com/docs/router/configuration/persisted-queries" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-673" + ], + "severity": "HIGH", + "github_reviewed": true, + "github_reviewed_at": "2024-08-27T18:14:12Z", + "nvd_published_at": null + } +} \ No newline at end of file diff --git a/advisories/github-reviewed/2024/08/GHSA-x6xq-whh3-gg32/GHSA-x6xq-whh3-gg32.json b/advisories/github-reviewed/2024/08/GHSA-x6xq-whh3-gg32/GHSA-x6xq-whh3-gg32.json new file mode 100644 index 00000000000..d8feb929217 --- /dev/null +++ b/advisories/github-reviewed/2024/08/GHSA-x6xq-whh3-gg32/GHSA-x6xq-whh3-gg32.json @@ -0,0 +1,69 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-x6xq-whh3-gg32", + "modified": "2024-08-27T18:14:29Z", + "published": "2024-08-27T18:14:29Z", + "aliases": [ + "CVE-2024-43783" + ], + "summary": "Apollo Router Coprocessors may cause Denial-of-Service when handling request bodies", + "details": "## Impact\n\nInstances of the Apollo Router using either of the following may be impacted by a denial-of-service vulnerability.\n\n1. External Coprocessing with specific configurations; or\n2. Native Rust Plugins accessing the Router request body in the RouterService layer \n\nRouter customizations using Rhai scripts are **not** impacted.\n\n### When using External Coprocessing:\n\nInstances of the Apollo Router running versions >=1.21.0 and <1.52.1 are impacted by a denial-of-service vulnerability if **all** of the following are true:\n\n1. Router has been configured to support External Coprocessing.\n2. Router has been configured to send request bodies to coprocessors. This is a non-default configuration and must be configured intentionally by administrators.\n\nYou can identify if you are impacted by reviewing your router's configuration YAML for the following config:\n\n```yaml\n...\ncoprocessor:\n url: http://localhost:9000 # likely different in your environment\n router:\n request:\n body: true # this must be set to 'true' to be impacted\n...\n```\nExternal Coprocessing was initially made available as an experimental feature with [Router version 1.21.0](https://github.com/apollographql/router/releases/tag/v1.21.0) on 2023-06-20 and was made generally available with [Router version 1.38.0](https://github.com/apollographql/router/releases/tag/v1.38.0) on 2024-01-19. More information about the Router’s [External Coprocessing feature is available here](https://www.apollographql.com/docs/router/customizations/coprocessor).\n\n### When using Native Rust Plugins:\n\nInstances of the Apollo Router running versions >=1.7.0 and <1.52.1 are impacted by a denial-of-service vulnerability if **all** of the following are true:\n\n1. Router has been configured to use a custom-developed Native Rust Plugin\n2. The plugin accesses `Request.router_request` in the `RouterService` layer\n3. You are accumulating the body from `Request.router_request` into memory\n\nTo use a plugin, you need to be running a customized Router binary. Additionally, you need to have a `plugins` section with at least one plugin defined in your Router’s configuration YAML. That plugin would also need to define a custom `router_service` method.\n\nYou can check for a defined plugin by reviewing for the following in your Router’s configuration YAML:\n\n```yaml\n...\nplugins:\n custom_plugin_name:\n # custom config here\n...\n```\n\nYou can check for a custom `router_service` method in a plugin, by reviewing for the following function signature in your plugin’s source:\n\n```rust\nfn router_service(&self, service: router::BoxService) -> router::BoxService\n```\n\nMore information about the Router’s [Native Rust Plugin feature is available here](https://www.apollographql.com/docs/router/customizations/native).\n\n## Impact Detail\n\nIf using an impacted configuration, the Router will load entire HTTP request bodies into memory without respect to other HTTP request size-limiting configurations like `limits.http_max_request_bytes`. This can cause the Router to be out-of-memory (OOM) terminated if a sufficiently large request is sent to the Router.\n\nBy default, the Router sets `limits.http_max_request_bytes` to 2 MB. More information about the Router’s [request limiting features is available here](https://www.apollographql.com/docs/router/configuration/overview/#request-limits).\n\n## Patches\n\n[Apollo Router 1.52.1](https://github.com/apollographql/router/releases/tag/v1.52.1)\n\nIf you have an impacted configuration as defined above, please upgrade to at least Apollo Router 1.52.1.\n\n## Workarounds\nIf you cannot upgrade, you can mitigate the denial-of-service opportunity impacting External Coprocessors by setting the `coprocessor.router.request.body` configuration option to `false`. Please note that changing this configuration option will change the information sent to any coprocessors you have configured and may impact functionality implemented by those coprocessors. \n\nIf you have developed a Native Rust Plugin and cannot upgrade, you can update your plugin to either not accumulate the request body or enforce a maximum body size limit. \n\nYou can also mitigate this issue by limiting HTTP body payload sizes prior to the Router (e.g., in a proxy or web application firewall appliance).\n\n## References\n[Apollo Router 1.52.1 Release Notes](https://github.com/apollographql/router/releases/tag/v1.52.1)\n[External Coprocessing documentation](https://www.apollographql.com/docs/router/customizations/coprocessor)\n[HTTP Request Limiting documentation](https://www.apollographql.com/docs/router/configuration/overview/#request-limits)\n[Native Rust Plugin documentation](https://www.apollographql.com/docs/router/customizations/native)\n", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H" + }, + { + "type": "CVSS_V4", + "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N" + } + ], + "affected": [ + { + "package": { + "ecosystem": "crates.io", + "name": "apollo-router" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "1.7.0" + }, + { + "fixed": "1.52.1" + } + ] + } + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/apollographql/router/security/advisories/GHSA-x6xq-whh3-gg32" + }, + { + "type": "WEB", + "url": "https://github.com/apollographql/router/commit/7a9c020608a62dcaa306b72ed0f6980f15923b14" + }, + { + "type": "PACKAGE", + "url": "https://github.com/apollographql/router" + }, + { + "type": "WEB", + "url": "https://github.com/apollographql/router/releases/tag/v1.52.1" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-770" + ], + "severity": "HIGH", + "github_reviewed": true, + "github_reviewed_at": "2024-08-27T18:14:29Z", + "nvd_published_at": null + } +} \ No newline at end of file