Vulnerabilities in pkg:npm/apollo-server-lambda

PACKAGE
Advisory Summary

GHSA-w42g-7vfc-xf37 is a MODERATE introspection vulnerability (General Security Weakness) affecting Apollo server libraries in the npm ecosystem. The issue involves introspection in schema validation in apollo server. Remediation is available by upgrading affected packages to version 2.14.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/apollo-server-lambda

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-w42g-7vfc-xf37 - MODERATE Introspection in schema validation in Apollo Server

GHSA-w42g-7vfc-xf37 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-w42g-7vfc-xf37
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Apollo server
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-w42g-7vfc-xf37

To remediate this vulnerability, upgrade all affected Apollo server 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 fixed: 2.14.2
npm install apollo-server@2.14.2
apollo-server-azure-functions fixed: 2.14.2
npm install apollo-server-azure-functions@2.14.2
apollo-server-cache-memcached fixed: 2.14.2
npm install apollo-server-cache-memcached@2.14.2
apollo-server-core fixed: 2.14.2
npm install apollo-server-core@2.14.2
apollo-server-cloud-functions fixed: 2.14.2
npm install apollo-server-cloud-functions@2.14.2
apollo-server-cloudflare fixed: 2.14.2
npm install apollo-server-cloudflare@2.14.2
apollo-server-express fixed: 2.14.2
npm install apollo-server-express@2.14.2
apollo-server-fastify fixed: 2.14.2
npm install apollo-server-fastify@2.14.2
apollo-server-hapi fixed: 2.14.2
npm install apollo-server-hapi@2.14.2
apollo-server-koa fixed: 2.14.2
npm install apollo-server-koa@2.14.2
apollo-server-lambda fixed: 2.14.2
npm install apollo-server-lambda@2.14.2
apollo-server-micro fixed: 2.14.2
npm install apollo-server-micro@2.14.2
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

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-w42g-7vfc-xf37, inspect your project dependencies using npm:

npm ls apollo-server

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

Note: The npm ls apollo-server 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 General Security Weakness. In Apollo server, 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

We encourage all users of Apollo Server to read this advisory in its entirety to understand the impact. The _Resolution_ section contains details on patched versions. ### Impact If `subscriptions: false` is passed to the `ApolloServer` constructor options, there is no impact. If implementors were not expecting validation rules to be enforced on the WebSocket subscriptions transport **and** are unconcerned about introspection being enabled on the WebSocket subscriptions transport (or were not expecting that), then this advisory is not applicable. If `introspection: true` is passed to the `ApolloServer` constructor options, the impact is limited to user-provided validation rules (i.e., using `validationRules`) since there would be no expectation that introspection was disabled. The enforcement of user-provided validation rules on the HTTP transport is working as intended and is unaffected by this advisory. Similarly, disabling introspection on the HTTP transport is working as intended and is unaffected by this advisory. > **Note:** Unless `subscriptions: false` is explicitly passed to the constructor parameters of `new ApolloServer({ ... })`, **subscriptions are enabled by default, whether or not there is a `Subscription` type present in the schema.** As an alternative to upgrading to a patched version, see the _Workarounds_ section below to disable subscriptions if it is not necessary. In cases where `subscriptions: false` is **not** explicitly set, the subscription server **is impacted** since validation rules which are enforced on the main request pipeline within Apollo Server were not being passed to the `SubscriptionServer.create` invocation ([seen here, prior to the patch](https://github.com/apollographql/apollo-server/blob/7d6f23443e52a90deb74f152f34bb76eea78ee19/packages/apollo-server-core/src/ApolloServer.ts#L677-L726)). The omitted validation rules for the subscription server include any `validationRules` passed by implementors to the `ApolloServer` constructor which were expected to be enforced on the subscriptions WebSocket endpoint. **Additionally**, because an internal [`NoIntrospection`](https://github.com/apollographql/apollo-server/blob/7d6f23443/packages/apollo-server-core/src/ApolloServer.ts#L77-L88) validation rule is used to disable introspection, it would have been possible to introspect a server on the WebSocket endpoint that the `SubscriptionServer` creates even though it was not possible on other transports (e.g. HTTP). **The severity of risk depends on whether sensitive information is being stored in the schema itself.** The contents of schema descriptions, or secrets which might be revealed by the names of types or field names within those types, will determine the risk to individual implementors. ### Affected packages The bug existed in `apollo-server-core` versions prior to version 2.14.2, however, this means all integration packages (e.g., `apollo-server-express`, etc.) prior to version 2.14.2 which depend on `apollo-server-core` for their subscriptions support are affected. This includes the `apollo-server` package that automatically provides an Express server. Therefore, for officially published Apollo Server packages, the full list of affected packages includes: `apollo-server`, `apollo-server-azure-functions`, `apollo-server-cache-memcached`, `apollo-server-core`, `apollo-server-cloud-functions`, `apollo-server-cloudflare`, `apollo-server-express`, `apollo-server-fastify`, `apollo-server-hapi`, `apollo-server-koa`, `apollo-server-lambda`, and `apollo-server-micro`. > Note: The full list included here doesn't fit into the box provided by the GitHub Security Advisories form. ### Resolution The problem is resolved in Apollo Server versions 2.14.2 or higher. If upgrading is not an option, see _Workarounds_ below. When upgrading, ensure that the affected integration package (e.g., `apollo-server-express`) **and** the `apollo-server-core` package are both updated to the patched versions. (The version numbers should both be 2.14.2.) ### Workarounds Upgrading to a patched version is the recommended solution. If upgrading is not an option, subscriptions can be disabled with `subscriptions: false` to resolve the impact. **Disabling subscriptions in this way will disable _all_ subscriptions support and the WebSocket transport**: ```js const server = new ApolloServer({ subscriptions: false, /* Other options, such as typeDefs, resolvers, schema, etc. */ }); ``` ### For more information If you have any questions or comments about this advisory, please [open an issue](https://github.com/apollographql/apollo-server/issues/new) and the maintainers will try to assist. ### Credit and appreciation Apollo fully believes in ethical disclosure of vulnerabilities by security researchers who notify us with details and provide us time to address and fix the issues before publicly disclosing. Credit for this discovery goes to the team at [Bitwala](https://www.bitwala.com/), who reported the concern to us responsibly after discovering it during their own auditing.

GHSA-w42g-7vfc-xf37 Affected Apollo server Versions

12 component(s)
Fixed Versions:
2.14.2
Product / Package Ecosystem Affected Versions Fixed Version
apollo-server
npm
< 2.14.2
2.14.2
apollo-server-azure-functions
npm
< 2.14.2
2.14.2
apollo-server-cache-memcached
npm
< 2.14.2
2.14.2
apollo-server-core
npm
< 2.14.2
2.14.2
apollo-server-cloud-functions
npm
< 2.14.2
2.14.2
apollo-server-cloudflare
npm
< 2.14.2
2.14.2
apollo-server-express
npm
< 2.14.2
2.14.2
apollo-server-fastify
npm
< 2.14.2
2.14.2
apollo-server-hapi
npm
< 2.14.2
2.14.2
apollo-server-koa
npm
< 2.14.2
2.14.2
apollo-server-lambda
npm
< 2.14.2
2.14.2
apollo-server-micro
npm
< 2.14.2
2.14.2

References

Frequently Asked Questions

What is GHSA-w42g-7vfc-xf37?
GHSA-w42g-7vfc-xf37 is a security vulnerability in Apollo server involving Introspection in schema validation in Apollo Server under General Security Weakness.
Which Apollo server versions are affected?
Affected versions include releases prior to 2.14.2 across affected packages: apollo-server, apollo-server-azure-functions, apollo-server-cache-memcached, apollo-server-core, apollo-server-cloud-functions, apollo-server-cloudflare, apollo-server-express, apollo-server-fastify, apollo-server-hapi, apollo-server-koa, apollo-server-lambda, apollo-server-micro.
What version fixes GHSA-w42g-7vfc-xf37?
Upgrading to 2.14.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is apollo-server affected?
Yes, apollo-server is affected in releases prior to 2.14.2. Upgrade your dependency to 2.14.2 or later.
Is apollo-server-azure-functions affected?
Yes, apollo-server-azure-functions is affected in releases prior to 2.14.2. Upgrade your dependency to 2.14.2 or later.
What CWE is associated with GHSA-w42g-7vfc-xf37?
GHSA-w42g-7vfc-xf37 is classified under General Security Weakness.
How can I check npm dependencies for GHSA-w42g-7vfc-xf37?
Run the dependency tree command: 'npm ls apollo-server'. 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-w42g-7vfc-xf37",
  "modified" : "2020-08-31T19:02:14Z",
  "published" : "2020-06-05T19:38:14Z",
  "aliases" : [ ],
  "summary" : "Introspection in schema validation in Apollo Server",
  "details" : "We encourage all users of Apollo Server to read this advisory in its entirety to understand the impact.  The _Resolution_ section contains details on patched versions.\n\n### Impact\n\nIf `subscriptions: false` is passed to the `ApolloServer` constructor options, there is no impact.  If implementors were not expecting validation rules to be enforced on the WebSocket subscriptions transport **and** are unconcerned about introspection being enabled on the WebSocket subscriptions transport (or were not expecting that), then this advisory is not applicable.  If `introspection: true` is passed to the `ApolloServer` constructor options, the impact is limited to user-provided validation rules (i.e., using `validationRules`) since there would be no expectation that introspection was disabled.\n\nThe enforcement of user-provided validation rules on the HTTP transport is working as intended and is unaffected by this advisory.  Similarly, disabling introspection on the HTTP transport is working as intended and is unaffected by this advisory.\n\n> **Note:** Unless `subscriptions: false` is explicitly passed to the constructor parameters of `new ApolloServer({ ... })`, **subscriptions are enabled by default, whether or not there is a `Subscription` type present in the schema.**  As an alternative to upgrading to a patched version, see the _Workarounds_ section below to disable subscriptions if it is not necessary.\n\nIn cases where `subscriptions: false` is **not** explicitly set, the subscription server **is impacted** since validation rules which are enforced on the main request pipeline within Apollo Server were not being passed to the `SubscriptionServer.create` invocation ([seen here, prior to the patch](https://github.com/apollographql/apollo-server/blob/7d6f23443e52a90deb74f152f34bb76eea78ee19/packages/apollo-server-core/src/ApolloServer.ts#L677-L726)). \n\nThe omitted validation rules for the subscription server include any `validationRules` passed by implementors to the `ApolloServer` constructor which were expected to be enforced on the subscriptions WebSocket endpoint.  **Additionally**, because an internal [`NoIntrospection`](https://github.com/apollographql/apollo-server/blob/7d6f23443/packages/apollo-server-core/src/ApolloServer.ts#L77-L88) validation rule is used to disable introspection, it would have been possible to introspect a server on the WebSocket endpoint that the `SubscriptionServer` creates even though it was not possible on other transports (e.g. HTTP).\n\n**The severity of risk depends on whether sensitive information is being stored in the schema itself.**  The contents of schema descriptions, or secrets which might be revealed by the names of types or field names within those types, will determine the risk to individual implementors.\n\n### Affected packages\n\nThe bug existed in `apollo-server-core` versions prior to version 2.14.2, however, this means all integration packages (e.g., `apollo-server-express`, etc.) prior to version 2.14.2 which depend on `apollo-server-core` for their subscriptions support are affected.  This includes the `apollo-server` package that automatically provides an Express server.\n\nTherefore, for officially published Apollo Server packages, the full list of affected packages includes: `apollo-server`, `apollo-server-azure-functions`, `apollo-server-cache-memcached`, `apollo-server-core`, `apollo-server-cloud-functions`, `apollo-server-cloudflare`, `apollo-server-express`, `apollo-server-fastify`, `apollo-server-hapi`, `apollo-server-koa`, `apollo-server-lambda`, and `apollo-server-micro`.\n\n> Note: The full list included here doesn't fit into the box provided by the GitHub Security Advisories form.\n\n### Resolution\n\nThe problem is resolved in Apollo Server versions 2.14.2 or higher.  If upgrading is not an option, see _Workarounds_ below.  When upgrading, ensure that the affected integration package (e.g., `apollo-server-express`) **and** the `apollo-server-core` package are both updated to the patched versions.  (The version numbers should both be  2.14.2.)\n\n### Workarounds\n\nUpgrading to a patched version is the recommended solution.  If upgrading is not an option, subscriptions can be disabled with `subscriptions: false` to resolve the impact.  **Disabling subscriptions in this way will disable _all_ subscriptions support and the WebSocket transport**:\n\n```js\nconst server = new ApolloServer({\n  subscriptions: false,\n  /* Other options, such as typeDefs, resolvers, schema, etc. */\n});\n```\n\n### For more information\nIf you have any questions or comments about this advisory, please [open an issue](https://github.com/apollographql/apollo-server/issues/new) and the maintainers will try to assist.\n\n### Credit and appreciation\n\nApollo fully believes in ethical disclosure of vulnerabilities by security researchers who notify us with details and provide us time to address and fix the issues before publicly disclosing.\n\nCredit for this discovery goes to the team at [Bitwala](https://www.bitwala.com/), who reported the concern to us responsibly after discovering it during their own auditing.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-azure-functions"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-cache-memcached"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-cloud-functions"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-cloudflare"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-express"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-fastify"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-hapi"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-koa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-lambda"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "apollo-server-micro"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/apollographql/apollo-server/security/advisories/GHSA-w42g-7vfc-xf37"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apollographql/apollo-server/commit/e2e816316f5c28a03de2ee1589edb2b10c358114"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-w42g-7vfc-xf37"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1525"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1526"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1527"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1528"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1529"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1530"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1531"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1532"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1533"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1534"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1535"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1536"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-05T19:37:38Z",
    "nvd_published_at" : null
  }
}