Vulnerabilities in pkg:npm/schema-inspector
PACKAGECVE-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.
pkg:npm/schema-inspector
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
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).
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.
npm install schema-inspector@2.0.0
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
CVE-2021-21267 Affected Schema inspector Versions
1 component(s)| 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?
Which Schema inspector versions are affected?
What version fixes CVE-2021-21267?
Is schema-inspector affected?
What is the CVSS score of CVE-2021-21267?
What CWE is associated with CVE-2021-21267?
How can I check npm dependencies for CVE-2021-21267?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}