CVE-2021-39184: Electron Electron's Sandboxed Renderers Can Obtain Vulnerability

MODERATE
Advisory Identifier: GHSA-mpjm-v997-c4h4
CVSS 6.8
CWE-668 CWE-862
Published
Advisory Summary

CVE-2021-39184 is a MODERATE (CVSS 6.8) electron's sandboxed renderers can obtain vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Electron libraries in the npm ecosystem. The issue involves electron's sandboxed renderers can obtain thumbnails of arbitrary files through the nativeimage api. Remediation is available by upgrading affected packages to version 11.5.0, 12.1.0, 13.3.0.

CVE-2021-39184 at a Glance

CVE Identifier CVE-2021-39184
GHSA Identifier GHSA-mpjm-v997-c4h4
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-668: Exposure of Resource to Wrong Sphere
Affected Product Electron
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.8

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:C/C:H/I:N/A:N).

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

How to Fix CVE-2021-39184

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

electron fixed: 11.5.0
npm install electron@11.5.0
electron fixed: 12.1.0
npm install electron@12.1.0
electron fixed: 13.3.0
npm install electron@13.3.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 electron

How to Check if You Are Affected

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

npm ls electron

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

Note: The npm ls electron 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-668: Exposure of Resource to Wrong Sphere, where the product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource. In Electron, 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

### Impact This vulnerability allows a sandboxed renderer to request a "thumbnail" image of an arbitrary file on the user's system. The thumbnail can potentially include significant parts of the original file, including textual data in many cases. All current stable versions of Electron are affected. ### Patches This was fixed with #30728, and the following Electron versions contain the fix: - 15.0.0-alpha.10 - 14.0.0 - 13.3.0 - 12.1.0 - 11.5.0 ### Workarounds If your app enables `contextIsolation`, this vulnerability is significantly more difficult for an attacker to exploit. Further, if your app does not depend on the `createThumbnailFromPath` API, then you can simply disable the functionality. In the main process, before the 'ready' event: ```js delete require('electron').nativeImage.createThumbnailFromPath ``` ### For more information If you have any questions or comments about this advisory, email us at [security@electronjs.org](mailto:security@electronjs.org).

CVE-2021-39184 Affected Electron Versions

3 component(s)
Fixed Versions:
11.5.012.1.013.3.0
Product / Package Ecosystem Affected Versions Fixed Version
electron
npm
< 11.5.0
11.5.0
electron
npm
≥ 12.0.0
< 12.1.0
12.1.0
electron
npm
≥ 13.0.0
< 13.3.0
13.3.0

References

Frequently Asked Questions

What is CVE-2021-39184?
CVE-2021-39184 is a security vulnerability in Electron involving Electron's sandboxed renderers can obtain thumbnails of arbitrary files through the nativeImage API under CWE-668: Exposure of Resource to Wrong Sphere.
Which Electron versions are affected?
Affected versions include releases prior to 11.5.0, 12.1.0, 13.3.0 across affected packages: electron.
What version fixes CVE-2021-39184?
Upgrading to 11.5.0, 12.1.0, 13.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is electron affected?
Yes, electron is affected in releases prior to 11.5.0, 12.1.0, 13.3.0. Upgrade your dependency to 11.5.0, 12.1.0, 13.3.0 or later.
What is the CVSS score of CVE-2021-39184?
CVE-2021-39184 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2021-39184?
CVE-2021-39184 is classified under CWE-668: Exposure of Resource to Wrong Sphere (The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.).
How can I check npm dependencies for CVE-2021-39184?
Run the dependency tree command: 'npm ls electron'. 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-mpjm-v997-c4h4",
  "modified" : "2022-08-11T16:56:02Z",
  "published" : "2021-10-12T21:59:13Z",
  "aliases" : [ "CVE-2021-39184" ],
  "summary" : "Electron's sandboxed renderers can obtain thumbnails of arbitrary files through the nativeImage API",
  "details" : "### Impact\nThis vulnerability allows a sandboxed renderer to request a \"thumbnail\" image of an arbitrary file on the user's system. The thumbnail can potentially include significant parts of the original file, including textual data in many cases.\n\nAll current stable versions of Electron are affected.\n\n### Patches\nThis was fixed with #30728, and the following Electron versions contain the fix:\n\n- 15.0.0-alpha.10\n- 14.0.0\n- 13.3.0\n- 12.1.0\n- 11.5.0\n\n### Workarounds\nIf your app enables `contextIsolation`, this vulnerability is significantly more difficult for an attacker to exploit.\n\nFurther, if your app does not depend on the `createThumbnailFromPath` API, then you can simply disable the functionality. In the main process, before the 'ready' event:\n```js\ndelete require('electron').nativeImage.createThumbnailFromPath\n```\n\n### For more information\nIf you have any questions or comments about this advisory, email us at [security@electronjs.org](mailto:security@electronjs.org).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "11.5.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "12.0.0"
      }, {
        "fixed" : "12.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "13.0.0"
      }, {
        "fixed" : "13.3.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/electron/electron/security/advisories/GHSA-mpjm-v997-c4h4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-39184"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/electron/electron/pull/30728"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/electron/electron/pull/30728/commits/8fed645bd671f359ee52d806c075ec4e07eda17f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/electron/electron"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-668", "CWE-862" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-12T18:54:44Z",
    "nvd_published_at" : "2021-10-12T19:15:00Z"
  }
}