GHSA-2fvv-qxrq-7jq6: Apollo server core Cross-Site Scripting Vulnerability

MODERATE
CWE-79
Published
Advisory Summary

GHSA-2fvv-qxrq-7jq6 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Apollo server core libraries in the npm ecosystem. The issue involves apollo-server-core vulnerable to url-based xss attack affecting ie11 on default landing page. Remediation is available by upgrading affected packages to version 3.10.1.

GHSA-2fvv-qxrq-7jq6 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-2fvv-qxrq-7jq6
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Apollo server core
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-2fvv-qxrq-7jq6

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.

apollo-server-core fixed: 3.10.1
npm install apollo-server-core@3.10.1
Verify Direct and Transitive Dependencies

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-2fvv-qxrq-7jq6, 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.10.1), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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

### Impact The default landing page contained HTML to display a sample `curl` command which is made visible if the full landing page bundle could not be fetched from Apollo's CDN. The server's URL is directly interpolated into this command inside the browser from `window.location.href`. On some older browsers such as IE11, this value is not URI-encoded. On such browsers, opening a malicious URL pointing at an Apollo Router could cause execution of attacker-controlled JavaScript. This only affects Apollo Server with the [default landing page](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages/) enabled. Old browsers visiting your server may be affected if ANY of these apply: - You do not pass any landing page plugin to the `plugins` option of `new ApolloServer`. - You pass `ApolloServerPluginLandingPageLocalDefault()` or `ApolloServerPluginLandingPageProductionDefault()` to the `plugins` option of `new ApolloServer`. Browsers visiting your server are NOT affected if ANY of these apply: - You pass `ApolloServerPluginLandingPageDisabled()` to the `plugins` option of `new ApolloServer`. - You pass `ApolloServerPluginLandingPageGraphQLPlayground()` to the `plugins` option of `new ApolloServer`. - You pass a custom plugin implementing the `renderLandingPage` hook to the `plugins` option of `new ApolloServer`. This issue was introduced in v3.0.0 when the landing page feature was added. ### Patches To avoid this, the sample `curl` command has been removed in release 3.10.1. ### Workarounds Disabling the landing page removes the possibility of exploit: ```ts import { ApolloServerPluginLandingPageDisabled } from 'apollo-server-core'; new ApolloServer({ plugins: [ApolloServerPluginLandingPageDisabled()], // ... }); ``` ### See also A similar issue exists in the landing page of Apollo Router. See the corresponding [Apollo Router security advisory](https://github.com/apollographql/router/security/advisories/GHSA-p5q6-hhww-f999). ### For more information If you have any questions or comments about this advisory: * Open an issue in [the Apollo Server repository](https://github.com/apollographql/apollo-server/) * Email us at [security@apollographql.com](mailto:security@apollographql.com) ### Credits This issue was discovered by Adrian Denkiewicz of [Doyensec](https://doyensec.com/research.html).

GHSA-2fvv-qxrq-7jq6 Affected Apollo server core Versions

1 component(s)
Fixed Versions:
3.10.1
Product / Package Ecosystem Affected Versions Fixed Version
apollo-server-core
npm
≥ 3.0.0
< 3.10.1
3.10.1

References

Frequently Asked Questions

What is GHSA-2fvv-qxrq-7jq6?
GHSA-2fvv-qxrq-7jq6 is a security vulnerability in Apollo server core involving apollo-server-core vulnerable to URL-based XSS attack affecting IE11 on default landing page under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Apollo server core versions are affected?
Affected versions include releases prior to 3.10.1 across affected packages: apollo-server-core.
What version fixes GHSA-2fvv-qxrq-7jq6?
Upgrading to 3.10.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is apollo-server-core affected?
Yes, apollo-server-core is affected in releases prior to 3.10.1. Upgrade your dependency to 3.10.1 or later.
What CWE is associated with GHSA-2fvv-qxrq-7jq6?
GHSA-2fvv-qxrq-7jq6 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for GHSA-2fvv-qxrq-7jq6?
Run the dependency tree command: 'npm ls apollo-server-core'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2fvv-qxrq-7jq6",
  "modified" : "2022-08-18T18:55:01Z",
  "published" : "2022-08-18T18:55:01Z",
  "aliases" : [ ],
  "summary" : "apollo-server-core vulnerable to URL-based XSS attack affecting IE11 on default landing page",
  "details" : "### Impact\n\nThe default landing page contained HTML to display a sample `curl` command which is made visible if the full landing page bundle could not be fetched from Apollo's CDN. The server's URL is directly interpolated into this command inside the browser from `window.location.href`. On some older browsers such as IE11, this value is not URI-encoded. On such browsers, opening a malicious URL pointing at an Apollo Router could cause execution of attacker-controlled JavaScript.\n\nThis only affects Apollo Server with the [default landing page](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages/) enabled. Old browsers visiting your server may be affected if ANY of these apply:\n- You do not pass any landing page plugin to the `plugins` option of `new ApolloServer`.\n- You pass `ApolloServerPluginLandingPageLocalDefault()` or `ApolloServerPluginLandingPageProductionDefault()` to the `plugins` option of `new ApolloServer`.\n\nBrowsers visiting your server are NOT affected if ANY of these apply:\n- You pass `ApolloServerPluginLandingPageDisabled()` to the `plugins` option of `new ApolloServer`.\n- You pass `ApolloServerPluginLandingPageGraphQLPlayground()` to the `plugins` option of `new ApolloServer`.\n- You pass a custom plugin implementing the `renderLandingPage` hook to the `plugins` option of `new ApolloServer`.\n\nThis issue was introduced in v3.0.0 when the landing page feature was added.\n\n### Patches\nTo avoid this, the sample `curl` command has been removed in release 3.10.1.\n\n### Workarounds\n\nDisabling the landing page removes the possibility of exploit:\n\n```ts\nimport { ApolloServerPluginLandingPageDisabled } from 'apollo-server-core';\n\nnew ApolloServer({\n  plugins: [ApolloServerPluginLandingPageDisabled()],\n  // ...\n});\n```\n\n### See also\nA similar issue exists in the landing page of Apollo Router. See the corresponding [Apollo Router security advisory](https://github.com/apollographql/router/security/advisories/GHSA-p5q6-hhww-f999).\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\n### Credits\n\nThis issue was discovered by Adrian Denkiewicz of [Doyensec](https://doyensec.com/research.html).",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.10.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/apollographql/apollo-server/security/advisories/GHSA-2fvv-qxrq-7jq6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apollographql/apollo-server/commit/68a439b6e3af9edc8a2480092f2d49f058be1e64"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apollographql/apollo-server"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-18T18:55:01Z",
    "nvd_published_at" : null
  }
}