Vulnerabilities in pkg:npm/schema-inspector

PACKAGE
Advisory Identifier: GHSA-f38p-c2gq-4pmr
Advisory Summary

CVE-2021-21267 is a HIGH (CVSS 7.5) regular expression denial-of-service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Schema inspector libraries in the npm ecosystem. The issue involves regular expression denial-of-service in npm schema-inspector. Remediation is available by upgrading affected packages to version 2.0.0.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/schema-inspector

2 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-f38p-c2gq-4pmr CVE-2021-21267 HIGH Regular Expression Denial-of-Service in npm schema-inspector
GHSA-r24h-634p-m72x CVE-2019-10781 CRITICAL Validation Bypass in schema-inspector

CVE-2021-21267 at a Glance

CVE Identifier CVE-2021-21267
GHSA Identifier GHSA-f38p-c2gq-4pmr
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Schema inspector
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-21267

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

schema-inspector fixed: 2.0.0
npm install schema-inspector@2.0.0
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 schema-inspector

How to Check if You Are Affected

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

npm ls schema-inspector

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

Note: The npm ls schema-inspector 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Schema inspector, 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 _What kind of vulnerability is it? Who is impacted?_ Email address validation is vulnerable to a denial-of-service attack where some input (for example `a@0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.`) will freeze the program or web browser page executing the code. This affects any current schema-inspector users using any version to validate email addresses. Users who do not do email validation, and instead do other types of validation (like string min or max length, etc), are not affected. ### Patches _Has the problem been patched? What versions should users upgrade to?_ Users should upgrade to version 2.0.0, which uses a regex expression that isn't vulnerable to ReDoS. The new regex expression is more limited in what it can check, so it is more flexible than the one used before. Therefore, this was a new major version instead of a new patch version to warn people upgrading that they should make sure the email validation still works for their use case. ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ If a user chooses to not upgrade, the only known workaround would be to stop using the email validation feature in the library. The user could, for example, accept the email address into their system but save it in a "not yet validated" state in their system until a verification email is sent to it (to determine whether the email is valid and belongs to the form submitter). Note that this is the preferred way of validating email addresses anyways. ### References _Are there any links users can visit to find out more?_ https://gist.github.com/mattwelke/b7f42424680a57b8161794ad1737cd8f ### For more information If you have any questions or comments about this advisory, you can create an issue in this repository.

CVE-2021-21267 Affected Schema inspector Versions

1 component(s)
Fixed Versions:
2.0.0
Product / Package Ecosystem Affected Versions Fixed Version
schema-inspector
npm
< 2.0.0
2.0.0

References

Frequently Asked Questions

What is CVE-2021-21267?
CVE-2021-21267 is a security vulnerability in Schema inspector involving Regular Expression Denial-of-Service in npm schema-inspector under CWE-400: Uncontrolled Resource Consumption.
Which Schema inspector versions are affected?
Affected versions include releases prior to 2.0.0 across affected packages: schema-inspector.
What version fixes CVE-2021-21267?
Upgrading to 2.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is schema-inspector affected?
Yes, schema-inspector is affected in releases prior to 2.0.0. Upgrade your dependency to 2.0.0 or later.
What is the CVSS score of CVE-2021-21267?
CVE-2021-21267 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-21267?
CVE-2021-21267 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2021-21267?
Run the dependency tree command: 'npm ls schema-inspector'. 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-f38p-c2gq-4pmr",
  "modified" : "2022-07-05T18:05:18Z",
  "published" : "2021-03-19T20:14:21Z",
  "aliases" : [ "CVE-2021-21267" ],
  "summary" : "Regular Expression Denial-of-Service in npm schema-inspector",
  "details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\nEmail address validation is vulnerable to a denial-of-service attack where some input (for example `a@0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.`) will freeze the program or web browser page executing the code. This affects any current schema-inspector users using any version to validate email addresses. Users who do not do email validation, and instead do other types of validation (like string min or max length, etc), are not affected.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\nUsers should upgrade to version 2.0.0, which uses a regex expression that isn't vulnerable to ReDoS. The new regex expression is more limited in what it can check, so it is more flexible than the one used before. Therefore, this was a new major version instead of a new patch version to warn people upgrading that they should make sure the email validation still works for their use case. \n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\nIf a user chooses to not upgrade, the only known workaround would be to stop using the email validation feature in the library. The user could, for example, accept the email address into their system but save it in a \"not yet validated\" state in their system until a verification email is sent to it (to determine whether the email is valid and belongs to the form submitter). Note that this is the preferred way of validating email addresses anyways.\n\n### References\n_Are there any links users can visit to find out more?_\nhttps://gist.github.com/mattwelke/b7f42424680a57b8161794ad1737cd8f\n\n### For more information\nIf you have any questions or comments about this advisory, you can create an issue in this repository.",
  "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" : "schema-inspector"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/schema-inspector/schema-inspector/security/advisories/GHSA-f38p-c2gq-4pmr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21267"
  }, {
    "type" : "WEB",
    "url" : "https://gist.github.com/mattwelke/b7f42424680a57b8161794ad1737cd8f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/schema-inspector/schema-inspector/releases/tag/2.0.0"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210528-0006"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/schema-inspector"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-19T20:14:08Z",
    "nvd_published_at" : "2021-03-19T21:15:00Z"
  }
}