CVE-2018-21270: Stringstream Out-of-bounds Read Vulnerability
MODERATECVE-2018-21270 is a MODERATE out-of-bounds read vulnerability (CWE-125: Out-of-bounds Read) affecting Stringstream libraries in the npm ecosystem. The issue involves out-of-bounds read in stringstream. Remediation is available by upgrading affected packages to version 0.0.6.
CVE-2018-21270 at a Glance
How to Fix CVE-2018-21270
To remediate this vulnerability, upgrade all affected Stringstream 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 stringstream@0.0.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls stringstream
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2018-21270, inspect your project dependencies using npm:
npm ls stringstream
Analyze the terminal output to locate any version of Stringstream in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.6), your application is affected.
Note: The npm ls stringstream 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-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Stringstream, 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-2018-21270 Affected Stringstream Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
stringstream
|
npm |
< 0.0.6
|
0.0.6
|
References
Frequently Asked Questions
What is CVE-2018-21270?
Which Stringstream versions are affected?
What version fixes CVE-2018-21270?
Is stringstream affected?
What CWE is associated with CVE-2018-21270?
How can I check npm dependencies for CVE-2018-21270?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mf6x-7mm4-x2g7",
"modified" : "2021-03-19T20:59:51Z",
"published" : "2019-06-20T18:22:32Z",
"aliases" : [ "CVE-2018-21270" ],
"summary" : "Out-of-bounds Read in stringstream",
"details" : "All versions of `stringstream` are vulnerable to out-of-bounds read as it allocates uninitialized Buffers when number is passed in input stream on Node.js 4.x and below.\n\n\n## Recommendation\n\nNo fix is currently available for this vulnerability. It is our recommendation to not install or use this module if user input is being passed in to `stringstream`.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "stringstream"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.0.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://hackerone.com/reports/321670"
}, {
"type" : "WEB",
"url" : "https://github.com/mhart/StringStream/blob/v0.0.5/stringstream.js#L32"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/664"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-125" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2019-06-20T18:22:00Z",
"nvd_published_at" : "2020-12-03T21:15:00Z"
}
}