CVE-2021-43801: Mercurius Uncaught Exception Vulnerability

HIGH
Advisory Identifier: GHSA-273r-rm8g-7f3x
CVSS 7.5
CWE-754
Published
Advisory Summary

CVE-2021-43801 is a HIGH (CVSS 7.5) uncaught exception vulnerability (CWE-754: Improper Check for Unusual or Exceptional Conditions) affecting Mercurius libraries in the npm ecosystem. The issue involves uncaught exception in mercurius. Remediation is available by upgrading affected packages to version 8.11.2.

CVE-2021-43801 at a Glance

CVE Identifier CVE-2021-43801
GHSA Identifier GHSA-273r-rm8g-7f3x
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-754: Improper Check for Unusual or Exceptional Conditions
Affected Product Mercurius
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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:N/S:U/C:N/I:N/A:H).

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

How to Fix CVE-2021-43801

To remediate this vulnerability, upgrade all affected Mercurius dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mercurius fixed: 8.11.2
npm install mercurius@8.11.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 mercurius

How to Check if You Are Affected

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

npm ls mercurius

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

Note: The npm ls mercurius 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-754: Improper Check for Unusual or Exceptional Conditions, where the product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product. In Mercurius, 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 Any users from Mercurius@8.10.0 to 8.11.1 are subjected to a denial of service attack by sending a malformed JSON to `/graphql` unless they are using a custom error handler. ### Patches The vulnerability has been fixed in https://github.com/mercurius-js/mercurius/pull/678 and shipped as v8.11.2. ### Workarounds Use a custom error handler. ### References See https://github.com/mercurius-js/mercurius/issues/677 ### For more information If you have any questions or comments about this advisory: * Open an issue in https://github.com/mercurius-js/mercurius * Email us at [hello@matteocollina.com](mailto:hello@matteocollina.com)

CVE-2021-43801 Affected Mercurius Versions

1 component(s)
Fixed Versions:
8.11.2
Product / Package Ecosystem Affected Versions Fixed Version
mercurius
npm
≥ 8.10.0
< 8.11.2
8.11.2

References

Frequently Asked Questions

What is CVE-2021-43801?
CVE-2021-43801 is a security vulnerability in Mercurius involving Uncaught Exception in mercurius under CWE-754: Improper Check for Unusual or Exceptional Conditions.
Which Mercurius versions are affected?
Affected versions include releases prior to 8.11.2 across affected packages: mercurius.
What version fixes CVE-2021-43801?
Upgrading to 8.11.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mercurius affected?
Yes, mercurius is affected in releases prior to 8.11.2. Upgrade your dependency to 8.11.2 or later.
What is the CVSS score of CVE-2021-43801?
CVE-2021-43801 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-43801?
CVE-2021-43801 is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions (The product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product.).
How can I check npm dependencies for CVE-2021-43801?
Run the dependency tree command: 'npm ls mercurius'. 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-273r-rm8g-7f3x",
  "modified" : "2021-12-13T20:20:28Z",
  "published" : "2021-12-13T21:33:04Z",
  "aliases" : [ "CVE-2021-43801" ],
  "summary" : "Uncaught Exception in mercurius",
  "details" : "### Impact\n\nAny users from Mercurius@8.10.0 to 8.11.1 are subjected to a denial of service attack by sending a malformed JSON to `/graphql` unless they are using a custom error handler.\n\n### Patches\n\nThe vulnerability has been fixed in https://github.com/mercurius-js/mercurius/pull/678 and shipped as v8.11.2.\n\n### Workarounds\n\nUse a custom error handler.\n\n### References\n\nSee https://github.com/mercurius-js/mercurius/issues/677\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in https://github.com/mercurius-js/mercurius\n* Email us at [hello@matteocollina.com](mailto:hello@matteocollina.com)\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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mercurius"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.10.0"
      }, {
        "fixed" : "8.11.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mercurius-js/mercurius/security/advisories/GHSA-273r-rm8g-7f3x"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43801"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mercurius-js/mercurius/issues/677"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mercurius-js/mercurius/pull/678/commits/732b2f895312da8deadd7b173dcd2d141d54b223"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mercurius-js/mercurius"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-754" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-13T20:20:28Z",
    "nvd_published_at" : "2021-12-13T20:15:00Z"
  }
}