CVE-2018-21270: Stringstream Out-of-bounds Read Vulnerability

MODERATE
Advisory Identifier: GHSA-mf6x-7mm4-x2g7
CWE-125
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2018-21270
GHSA Identifier GHSA-mf6x-7mm4-x2g7
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-125: Out-of-bounds Read
Affected Product Stringstream
Package Ecosystem npm
Published Date
Last Updated

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.

stringstream fixed: 0.0.6
npm install stringstream@0.0.6
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 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

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. ## Recommendation No 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`.

CVE-2018-21270 Affected Stringstream Versions

1 component(s)
Fixed Versions:
0.0.6
Product / Package Ecosystem Affected Versions Fixed Version
stringstream
npm
< 0.0.6
0.0.6

References

Frequently Asked Questions

What is CVE-2018-21270?
CVE-2018-21270 is a security vulnerability in Stringstream involving Out-of-bounds Read in stringstream under CWE-125: Out-of-bounds Read.
Which Stringstream versions are affected?
Affected versions include releases prior to 0.0.6 across affected packages: stringstream.
What version fixes CVE-2018-21270?
Upgrading to 0.0.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is stringstream affected?
Yes, stringstream is affected in releases prior to 0.0.6. Upgrade your dependency to 0.0.6 or later.
What CWE is associated with CVE-2018-21270?
CVE-2018-21270 is classified under CWE-125: Out-of-bounds Read (The product reads data past the end, or before the beginning, of the intended buffer.).
How can I check npm dependencies for CVE-2018-21270?
Run the dependency tree command: 'npm ls stringstream'. 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-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"
  }
}