CVE-2019-5786: Puppeteer Use-After-Free Vulnerability

MODERATE
Advisory Identifier: GHSA-c2gp-86p4-5935
CVSS 6.5
CWE-416
Published
Advisory Summary

CVE-2019-5786 is a MODERATE (CVSS 6.5) use-after-free vulnerability (CWE-416: Use After Free) affecting Puppeteer libraries in the npm ecosystem. The issue involves use-after-free in puppeteer. Remediation is available by upgrading affected packages to version 1.13.0.

CVE-2019-5786 at a Glance

CVE Identifier CVE-2019-5786
GHSA Identifier GHSA-c2gp-86p4-5935
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-416: Use After Free
Affected Product Puppeteer
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2019-5786

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

puppeteer fixed: 1.13.0
npm install puppeteer@1.13.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 puppeteer

How to Check if You Are Affected

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

npm ls puppeteer

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

Note: The npm ls puppeteer 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-416: Use After Free, where the product reuses or references memory after it has been freed. at some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer. In Puppeteer, 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

Versions of `puppeteer` prior to 1.13.0 are vulnerable to the Use-After-Free vulnerability in Chromium (CVE-2019-5786). The Chromium FileReader API is vulnerable to Use-After-Free which may lead to Remote Code Execution. ## Recommendation Upgrade to version 1.13.0 or later.

CVE-2019-5786 Affected Puppeteer Versions

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

References

Frequently Asked Questions

What is CVE-2019-5786?
CVE-2019-5786 is a security vulnerability in Puppeteer involving Use-After-Free in puppeteer under CWE-416: Use After Free.
Which Puppeteer versions are affected?
Affected versions include releases prior to 1.13.0 across affected packages: puppeteer.
What version fixes CVE-2019-5786?
Upgrading to 1.13.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is puppeteer affected?
Yes, puppeteer is affected in releases prior to 1.13.0. Upgrade your dependency to 1.13.0 or later.
What is the CVSS score of CVE-2019-5786?
CVE-2019-5786 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2019-5786?
CVE-2019-5786 is classified under CWE-416: Use After Free (The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.).
How can I check npm dependencies for CVE-2019-5786?
Run the dependency tree command: 'npm ls puppeteer'. 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-c2gp-86p4-5935",
  "modified" : "2021-09-27T16:20:33Z",
  "published" : "2020-09-02T18:25:43Z",
  "aliases" : [ "CVE-2019-5786" ],
  "summary" : "Use-After-Free in puppeteer",
  "details" : "Versions of `puppeteer` prior to 1.13.0 are vulnerable to the Use-After-Free vulnerability in Chromium (CVE-2019-5786). The Chromium FileReader API is vulnerable to Use-After-Free which may lead to Remote Code Execution.\n\n\n## Recommendation\n\nUpgrade to version 1.13.0 or later.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "puppeteer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-5786"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/GoogleChrome/puppeteer/issues/4141"
  }, {
    "type" : "WEB",
    "url" : "https://blog.exodusintel.com/2019/03/20/cve-2019-5786-analysis-and-exploitation"
  }, {
    "type" : "WEB",
    "url" : "https://chromereleases.googleblog.com/2019/03/stable-channel-update-for-desktop.html"
  }, {
    "type" : "WEB",
    "url" : "https://crbug.com/936448"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/GoogleChrome/puppeteer"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-PUPPETEER-174321"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/824"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-416" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:37:09Z",
    "nvd_published_at" : "2019-06-27T17:15:13Z"
  }
}