GHSA-8r69-3cvp-wxc3: Apollo server core Batched HTTP Requests May Set Vulnerability
MODERATEGHSA-8r69-3cvp-wxc3 is a MODERATE batched http requests may set vulnerability (CWE-524: Use of Cache Containing Sensitive Information) affecting Apollo server core libraries in the npm ecosystem. The issue involves batched http requests may set incorrect `cache-control` response header. Remediation is available by upgrading affected packages to version 3.11.0, 4.1.0.
GHSA-8r69-3cvp-wxc3 at a Glance
How to Fix GHSA-8r69-3cvp-wxc3
To remediate this vulnerability, upgrade all affected Apollo server core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install apollo-server-core@3.11.0
npm install @apollo/server@4.1.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls apollo-server-core
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-8r69-3cvp-wxc3, inspect your project dependencies using npm:
npm ls apollo-server-core
Analyze the terminal output to locate any version of Apollo server core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.11.0), your application is affected.
Note: The npm ls apollo-server-core command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-524: Use of Cache Containing Sensitive Information, where the code uses a cache that contains sensitive information, but the cache can be read by an actor outside of the intended control sphere. In Apollo server core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-8r69-3cvp-wxc3 Affected Apollo server core Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
apollo-server-core
|
npm |
≥ 3.0.0
< 3.11.0
|
3.11.0
|
|
@apollo/server
|
npm |
< 4.1.0
|
4.1.0
|
References
Frequently Asked Questions
What is GHSA-8r69-3cvp-wxc3?
Which Apollo server core versions are affected?
What version fixes GHSA-8r69-3cvp-wxc3?
Is apollo-server-core affected?
Is @apollo/server affected?
What CWE is associated with GHSA-8r69-3cvp-wxc3?
How can I check npm dependencies for GHSA-8r69-3cvp-wxc3?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-8r69-3cvp-wxc3",
"modified" : "2022-11-02T18:18:50Z",
"published" : "2022-11-02T18:18:10Z",
"aliases" : [ ],
"summary" : "Batched HTTP requests may set incorrect `cache-control` response header",
"details" : "### Impact\nIn Apollo Server 3 and 4, the `cache-control` HTTP response header may not reflect the cache policy that should apply to an HTTP request when that HTTP request contains multiple operations using HTTP batching. This could lead to data being inappropriately cached and shared.\n\nApollo Server allows clients to send multiple operations in a single HTTP request. The results of these operations are returned in a single HTTP response, with a single set of headers. Apollo Client Web and Apollo Kotlin both have opt-in features to use batched requests.\n\nApollo Server has several features relating to caching. This advisory is about the ability to set the `cache-control` response header based on field- and operation-specific cache hints. (It is not about the \"response cache plugin\".) This header can be interpreted by a reverse proxy such as a CDN in front of your server, or by a browser.\n\nIn Apollo Server 2, plugins such as the cache control plugin could not control the HTTP headers of responses to batch requests. This meant that batch requests never got the `cache-control` response header.\n\nIn Apollo Server 3 and 4, plugins can set HTTP response headers. But for batched requests, plugins essentially assemble a separate set of response headers in parallel for each operation, and then the header sets are merged together. If plugins set the same header on multiple operations, one value is chosen arbitrarily.\n\nThis meant that if a client sent a batched HTTP request with two operations with different cache policies, Apollo Server 3 and 4 would return a `cache-control` header that only applies to one of the operations. If one operation is allowed to be cached and the other operation is not allowed to be cached, the full response including both results could still end up being cached in a CDN or other reverse proxy cache.\n\nNote that valid batched requests must be POST requests. (There's no defined format for sending batched requests over GET.) So in order for this incorrect `cache-control` header to have a harmful effect, a cache must allow caching POST requests. This means this bug is unlikely to cause incorrect caching in browser or mobile client caches, or in many reverse proxy/CDN caches.\n\nThis issue could lead to cache poisoning attacks. For example, if a client app regularly sends an operation that should not be cached due to its dependency on session-specific information in the same HTTP request as an operation that can be cached in a shared cache, an attacker could send its own version of the request to the server and manage to get the response to its request stored in the shared cache; other users would then see the response specific to the attacker for the first operation rather than the response for their own session. That said, we expect that in a system where this cache poisoning attack is feasible, normal operation would also run into the issue and users may have already disabled one of the features in order for their system to function properly.\n\n### Patches\n\nThis issue is patched in Apollo Server v3.11.0 and v4.1.0. The issue resolved differently in the two versions.\n\nIf you are using Apollo Server 3, upgrade the package you depend on (eg `apollo-server` or `apollo-server-express`) to v3.11.0. This will restore the Apollo Server 2 behavior where the cache control plugin *never* sets the `cache-control` HTTP response header on batched requests. (Other cache-related features, like the response cache plugin, still function.)\n\nIf you are using Apollo Server 4, upgrade `@apollo/server` to v4.1.0. This upgrade makes the response HTTP header object seen by plugins shared among all plugins processing *all operations* on a request, and makes the cache control plugin merge `cache-control` header values across operations in a request. (Note that if you set the `cache-control` response header in your own plugin, Apollo Server v4.1.0's cache control plugin will not try to overwrite the value you set.)\n\n\n### Workarounds\nAs a workaround, you can disable either the HTTP batching feature or the `cache-control` header feature.\n\nTo disable HTTP batching in Apollo Server 3 (v3.5.0 or newer), pass `allowBatchedHttpRequests: false` to `new ApolloServer`.This is the default behavior for Apollo Server 4; in AS4, just make sure you're not passing `allowBatchedHttpRequests: true`. (You cannot disable batching in versions of Apollo Server 3 older than v3.5.0.)\n\nTo disable the `cache-control` header feature, add `ApolloServerPluginCacheControl({ calculateHttpHeaders: false })` to the `plugins` list in `new ApolloServer()`.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [the `apollo-server` repository](https://github.com/apollographql/apollo-server)\n* Email us at [security@apollographql.com](mailto:security@apollographql.com)\n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "apollo-server-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.11.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@apollo/server"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.1.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/apollographql/apollo-server/security/advisories/GHSA-8r69-3cvp-wxc3"
}, {
"type" : "WEB",
"url" : "https://github.com/apollographql/apollo-server/commit/2a2d1e3b4bbb1f2802b09004444029bd1adb9c19"
}, {
"type" : "WEB",
"url" : "https://github.com/apollographql/apollo-server/commit/69be2f75d05c7044086a869d915b965ada033850"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/apollographql/apollo-server"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-524" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-11-02T18:18:10Z",
"nvd_published_at" : null
}
}