CVE-2019-15608: Yarn TOCTOU Race Condition Vulnerability

MODERATE
Advisory Identifier: GHSA-hjxc-462x-x77j
CVSS 5.9
CWE-367
Published
Advisory Summary

CVE-2019-15608 is a MODERATE (CVSS 5.9) toctou race condition vulnerability (CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition) affecting Yarn libraries in the npm ecosystem. The issue involves toctou race condition in yarn. Remediation is available by upgrading affected packages to version 1.19.0.

CVE-2019-15608 at a Glance

CVE Identifier CVE-2019-15608
GHSA Identifier GHSA-hjxc-462x-x77j
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
Affected Product Yarn
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2019-15608

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

yarn fixed: 1.19.0
npm install yarn@1.19.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 yarn

How to Check if You Are Affected

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

npm ls yarn

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

Note: The npm ls yarn 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-367: Time-of-check Time-of-use (TOCTOU) Race Condition, where the product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check. In Yarn, 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

The package integrity validation in yarn < 1.19.0 contains a TOCTOU vulnerability where the hash is computed before writing a package to cache. It's not computed again when reading from the cache. This may lead to a cache pollution attack. This issue is fixed in 1.19.0.

CVE-2019-15608 Affected Yarn Versions

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

References

Frequently Asked Questions

What is CVE-2019-15608?
CVE-2019-15608 is a security vulnerability in Yarn involving TOCTOU Race Condition in Yarn under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition.
Which Yarn versions are affected?
Affected versions include releases prior to 1.19.0 across affected packages: yarn.
What version fixes CVE-2019-15608?
Upgrading to 1.19.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is yarn affected?
Yes, yarn is affected in releases prior to 1.19.0. Upgrade your dependency to 1.19.0 or later.
What is the CVSS score of CVE-2019-15608?
CVE-2019-15608 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2019-15608?
CVE-2019-15608 is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition (The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.).
How can I check npm dependencies for CVE-2019-15608?
Run the dependency tree command: 'npm ls yarn'. 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-hjxc-462x-x77j",
  "modified" : "2023-09-08T23:56:07Z",
  "published" : "2022-02-09T22:49:38Z",
  "aliases" : [ "CVE-2019-15608" ],
  "summary" : "TOCTOU Race Condition in Yarn",
  "details" : "The package integrity validation in yarn < 1.19.0 contains a TOCTOU vulnerability where the hash is computed before writing a package to cache. It's not computed again when reading from the cache. This may lead to a cache pollution attack. This issue is fixed in 1.19.0.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "yarn"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.19.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-15608"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yarnpkg/yarn/commit/0474b8c66a8ea298f5e4dedc67b2de464297ad1c"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/703138"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yarnpkg/yarn/blob/master/CHANGELOG.md#1190"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-367" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-08T22:21:40Z",
    "nvd_published_at" : "2020-03-15T18:15:00Z"
  }
}