Vulnerabilities in pkg:npm/@apollo/sandbox

PACKAGE
Advisory Identifier: GHSA-w87v-7w53-wwxv
Advisory Summary

CVE-2025-59845 is a HIGH (CVSS 8.2) apollo embedded sandbox and explorer vulnerability (CWE-346: Origin Validation Error) affecting @apollo/sandbox libraries in the npm ecosystem. The issue involves apollo embedded sandbox and explorer vulnerable to csrf via window.postmessage origin-validation bypass. Remediation is available by upgrading affected packages to version 2.7.2, 3.7.3.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@apollo/sandbox

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@apollo/sandbox. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-w87v-7w53-wwxv CVE-2025-59845 HIGH Apollo Embedded Sandbox and Explorer vulnerable to CSRF via window.postMessage origin-validation bypass

CVE-2025-59845 at a Glance

CVE Identifier CVE-2025-59845
GHSA Identifier GHSA-w87v-7w53-wwxv
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-346: Origin Validation Error
Affected Product @apollo/sandbox
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2025-59845

To remediate this vulnerability, upgrade all affected @apollo/sandbox 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/sandbox fixed: 2.7.2
npm install @apollo/sandbox@2.7.2
@apollo/explorer fixed: 3.7.3
npm install @apollo/explorer@3.7.3
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/sandbox

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-59845, inspect your project dependencies using npm:

npm ls @apollo/sandbox

Analyze the terminal output to locate any version of @apollo/sandbox in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.2), your application is affected.

Note: The npm ls @apollo/sandbox 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-346: Origin Validation Error, where the product does not properly verify that the source of data or communication is valid. In @apollo/sandbox, 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 A **Cross-Site Request Forgery (CSRF)** vulnerability was identified in Apollo’s **Embedded Sandbox** and **Embedded Explorer**. The vulnerability arises from missing origin validation in the client-side code that handles `window.postMessage` events. A malicious website can send forged messages to the embedding page, causing the victim’s browser to execute arbitrary GraphQL queries or mutations against their GraphQL server while authenticated with the victim’s cookies. #### Who is impacted Anyone embedding [Apollo Sandbox](https://www.apollographql.com/docs/graphos/platform/sandbox#embedding-sandbox) or [Apollo Explorer](https://www.apollographql.com/docs/graphos/platform/explorer/embed) in their website may have been affected by this vulnerability. - Users who embed Apollo Sandbox or Apollo Explorer in their websites via npm packages (`@apollo/sandbox` and `@apollo/explorer`) or direct links to Apollo’s CDN. - Users running Apollo Router with [embedded Sandbox enabled](https://www.apollographql.com/docs/graphos/routing/configuration/yaml#sandbox). This served the vulnerable code from Apollo’s CDN. - Users running Apollo Server with embedded Sandbox or Explorer enabled. Embedded Sandbox is enabled by default when `NODE_ENV` is not set to `production`, and embedded Sandbox and Explorer can also be enabled in production mode via [landing page plugins](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages). This served the vulnerable code from Apollo’s CDN. While all of the above methods of serving Embedded Sandbox and Explorer were vulnerable, Apollo has already updated its CDN to remove all vulnerable versions. **Unless you install the npm package `@apollo/sandbox` or `@apollo/explorer` directly into your website’s front end code, no action is necessary: the vulnerability has already been mitigated.** Users who do not embed Sandbox/Explorer on their websites, or who only run Apollo Router/Server with production defaults were never impacted. The use of non-embedded Sandbox and Explorer hosted on [studio.apollographql.com](http://studio.apollographql.com/) is not vulnerable. #### Scope of impact The vulnerability allows a malicious website to open the vulnerable website in a new window and force it to send GraphQL requests to its origin. The requests themselves are not "cross-origin" as they are directly issued from the vulnerable website, but their contents are dictated by the malicious website. The malicious website cannot read the responses to the GraphQL operations, but the operations may be mutations with side effects (such as using credentials to update app-specific data access controls). These operations can contain the browser user's cookies, and the vulnerable website may be on a private network otherwise inaccessible to the attacker. Operations sent this way look and exactly like legitimate operations sent by a human interacting with the embedded Sandbox or Explorer. ### Patches The issue has been fixed by adding strict origin validation to DOM message handling. - `@apollo/sandbox`: Patched in v2.7.2 and later - `@apollo/explorer`: Patched in v3.7.3 and later - Apollo’s CDN embeds have been updated to patched versions. This protects embeds based on `<script>` tags pointing to Apollo’s CDN, as well as the Apollo Router and Apollo Server features. No action is necessary to adopt the fix in this case. If you manually edited the `<script>` tag provided by the Explorer or Sandbox UI to replace the version string `_latest`, `v2`, or `v3` with a specific git-style SHA, you may find that the Explorer or Sandbox UI does not currently load. To fix this, use a supported URL instead, as documented for [Sandbox](https://www.apollographql.com/docs/graphos/platform/sandbox#embedding-sandbox) or [Explorer](https://www.apollographql.com/docs/graphos/platform/explorer/embed). (The third-party Go GraphQL server [gqlgen](https://github.com/99designs/gqlgen) provides a function ApolloSandboxHandler which serves an unsupported URL and was broken by our mitigations; upgrading to [gqlgen v0.17.81](https://github.com/99designs/gqlgen/releases/tag/v0.17.81) will resolve this issue.) ### Workarounds - If you are using Apollo Server, ensure `NODE_ENV=production` is set in production to avoid unintentionally serving embedded Sandbox. - Customers not using embedded Sandbox/Explorer are not affected and do not need to take action. ### References - [Apollo Server CSRF Documentation](https://www.apollographql.com/docs/apollo-server/security/cors#preventing-cross-site-request-forgery-csrf) - [Apollo Router Sandbox Configuration](https://www.apollographql.com/docs/graphos/routing/configuration/yaml#sandbox) - [Apollo Explorer Embed Documentation](https://www.apollographql.com/docs/graphos/platform/explorer/embed)

CVE-2025-59845 Affected @apollo/sandbox Versions

2 component(s)
Fixed Versions:
2.7.23.7.3
Product / Package Ecosystem Affected Versions Fixed Version
@apollo/sandbox
npm
< 2.7.2
2.7.2
@apollo/explorer
npm
< 3.7.3
3.7.3

References

Frequently Asked Questions

What is CVE-2025-59845?
CVE-2025-59845 is a security vulnerability in @apollo/sandbox involving Apollo Embedded Sandbox and Explorer vulnerable to CSRF via window.postMessage origin-validation bypass under CWE-346: Origin Validation Error.
Which @apollo/sandbox versions are affected?
Affected versions include releases prior to 2.7.2, 3.7.3 across affected packages: @apollo/sandbox, @apollo/explorer.
What version fixes CVE-2025-59845?
Upgrading to 2.7.2, 3.7.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @apollo/sandbox affected?
Yes, @apollo/sandbox is affected in releases prior to 2.7.2. Upgrade your dependency to 2.7.2 or later.
Is @apollo/explorer affected?
Yes, @apollo/explorer is affected in releases prior to 3.7.3. Upgrade your dependency to 3.7.3 or later.
What is the CVSS score of CVE-2025-59845?
CVE-2025-59845 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N.
What CWE is associated with CVE-2025-59845?
CVE-2025-59845 is classified under CWE-346: Origin Validation Error (The product does not properly verify that the source of data or communication is valid.).
How can I check npm dependencies for CVE-2025-59845?
Run the dependency tree command: 'npm ls @apollo/sandbox'. 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-w87v-7w53-wwxv",
  "modified" : "2025-09-29T14:03:00Z",
  "published" : "2025-09-26T15:00:05Z",
  "aliases" : [ "CVE-2025-59845" ],
  "summary" : "Apollo Embedded Sandbox and Explorer vulnerable to CSRF via window.postMessage origin-validation bypass",
  "details" : "### Impact\n\nA **Cross-Site Request Forgery (CSRF)** vulnerability was identified in Apollo’s **Embedded Sandbox** and **Embedded Explorer**.\n\nThe vulnerability arises from missing origin validation in the client-side code that handles `window.postMessage` events. A malicious website can send forged messages to the embedding page, causing the victim’s browser to execute arbitrary GraphQL queries or mutations against their GraphQL server while authenticated with the victim’s cookies.\n\n#### Who is impacted\n\nAnyone embedding [Apollo Sandbox](https://www.apollographql.com/docs/graphos/platform/sandbox#embedding-sandbox) or [Apollo Explorer](https://www.apollographql.com/docs/graphos/platform/explorer/embed) in their website may have been affected by this vulnerability.\n\n- Users who embed Apollo Sandbox or Apollo Explorer in their websites via npm packages (`@apollo/sandbox` and `@apollo/explorer`) or direct links to Apollo’s CDN.\n- Users running Apollo Router with [embedded Sandbox enabled](https://www.apollographql.com/docs/graphos/routing/configuration/yaml#sandbox). This served the vulnerable code from Apollo’s CDN.\n- Users running Apollo Server with embedded Sandbox or Explorer enabled. Embedded Sandbox is enabled by default when `NODE_ENV` is not set to `production`, and embedded Sandbox and Explorer can also be enabled in production mode via [landing page plugins](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages). This served the vulnerable code from Apollo’s CDN.\n\nWhile all of the above methods of serving Embedded Sandbox and Explorer were vulnerable, Apollo has already updated its CDN to remove all vulnerable versions. **Unless you install the npm package `@apollo/sandbox` or `@apollo/explorer` directly into your website’s front end code, no action is necessary: the vulnerability has already been mitigated.**\n\nUsers who do not embed Sandbox/Explorer on their websites, or who only run Apollo Router/Server with production defaults were never impacted. The use of non-embedded Sandbox and Explorer hosted on [studio.apollographql.com](http://studio.apollographql.com/) is not vulnerable.\n\n\n#### Scope of impact\n\nThe vulnerability allows a malicious website to open the vulnerable website in a new window and force it to send GraphQL requests to its origin. The requests themselves are not \"cross-origin\" as they are directly issued from the vulnerable website, but their contents are dictated by the malicious website.\n\nThe malicious website cannot read the responses to the GraphQL operations, but the operations may be mutations with side effects (such as using credentials to update app-specific data access controls). These operations can contain the browser user's cookies, and the vulnerable website may be on a private network otherwise inaccessible to the attacker. Operations sent this way look and exactly like legitimate operations sent by a human interacting with the embedded Sandbox or Explorer.\n\n### Patches\n\nThe issue has been fixed by adding strict origin validation to DOM message handling.\n\n- `@apollo/sandbox`: Patched in v2.7.2 and later\n- `@apollo/explorer`: Patched in v3.7.3 and later\n- Apollo’s CDN embeds have been updated to patched versions. This protects embeds based on `<script>` tags pointing to Apollo’s CDN, as well as the Apollo Router and Apollo Server features. No action is necessary to adopt the fix in this case.\n\nIf you manually edited the `<script>` tag provided by the Explorer or Sandbox UI to replace the version string `_latest`, `v2`, or `v3` with a specific git-style SHA, you may find that the Explorer or Sandbox UI does not currently load. To fix this, use a supported URL instead, as documented for [Sandbox](https://www.apollographql.com/docs/graphos/platform/sandbox#embedding-sandbox) or [Explorer](https://www.apollographql.com/docs/graphos/platform/explorer/embed). (The third-party Go GraphQL server [gqlgen](https://github.com/99designs/gqlgen) provides a function ApolloSandboxHandler which serves an unsupported URL and was broken by our mitigations; upgrading to [gqlgen v0.17.81](https://github.com/99designs/gqlgen/releases/tag/v0.17.81) will resolve this issue.)\n\n### Workarounds\n\n- If you are using Apollo Server, ensure `NODE_ENV=production` is set in production to avoid unintentionally serving embedded Sandbox.\n- Customers not using embedded Sandbox/Explorer are not affected and do not need to take action.\n\n\n### References\n\n- [Apollo Server CSRF Documentation](https://www.apollographql.com/docs/apollo-server/security/cors#preventing-cross-site-request-forgery-csrf)\n- [Apollo Router Sandbox Configuration](https://www.apollographql.com/docs/graphos/routing/configuration/yaml#sandbox)\n- [Apollo Explorer Embed Documentation](https://www.apollographql.com/docs/graphos/platform/explorer/embed)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@apollo/sandbox"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@apollo/explorer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.7.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/apollographql/embeddable-explorer/security/advisories/GHSA-w87v-7w53-wwxv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-59845"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apollographql/embeddable-explorer"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-346", "CWE-352" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-26T15:00:05Z",
    "nvd_published_at" : "2025-09-26T23:15:31Z"
  }
}