CVE-2018-1000006: Electron Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-w222-53c6-c86p
CVSS 8.8
CWE-78
Published
Advisory Summary

CVE-2018-1000006 is a HIGH (CVSS 8.8) remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Electron libraries in the npm ecosystem. The issue involves remote code execution in electron. Remediation is available by upgrading affected packages to version 1.7.11, 1.6.16, 1.8.2-beta.4.

CVE-2018-1000006 at a Glance

CVE Identifier CVE-2018-1000006
GHSA Identifier GHSA-w222-53c6-c86p
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Electron
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:H/I:H/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 High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2018-1000006

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: 1.7.11
npm install electron@1.7.11
electron fixed: 1.6.16
npm install electron@1.6.16
electron fixed: 1.8.2-beta.4
npm install electron@1.8.2-beta.4
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-2018-1000006, 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 1.7.11), 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. 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

Affected versions of `electron` may be susceptible to a remote code execution flaw when certain conditions are met: 1. The electron application is running on Windows. 2. The electron application registers as the default handler for a protocol, such as `nodeapp://`. This vulnerability is caused by a failure to sanitize additional arguments to chromium in the command line handler for Electron. MacOS and Linux are not vulnerable. ## Recommendation Update electron to a version that is not vulnerable. If updating is not possible, the electron team has provided the following guidance: If for some reason you are unable to upgrade your Electron version, you can append `--` as the last argument when calling `app.setAsDefaultProtocolClient`, which prevents Chromium from parsing further options. The double dash `--` signifies the end of command options, after which only positional parameters are accepted. ``` app.setAsDefaultProtocolClient(protocol, process.execPath, [ '--your-switches-here', '--' ]) ```

CVE-2018-1000006 Affected Electron Versions

3 component(s)
Fixed Versions:
1.7.111.6.161.8.2-beta.4
Product / Package Ecosystem Affected Versions Fixed Version
electron
npm
≥ 1.7.0
< 1.7.11
1.7.11
electron
npm
≥ 1.6.0
< 1.6.16
1.6.16
electron
npm
≥ 1.8.0
< 1.8.2-beta.4
1.8.2-beta.4

References

Frequently Asked Questions

What is CVE-2018-1000006?
CVE-2018-1000006 is a security vulnerability in Electron involving Remote Code Execution in electron under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Electron versions are affected?
Affected versions include releases prior to 1.7.11, 1.6.16, 1.8.2-beta.4 across affected packages: electron.
What version fixes CVE-2018-1000006?
Upgrading to 1.7.11, 1.6.16, 1.8.2-beta.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is electron affected?
Yes, electron is affected in releases prior to 1.7.11, 1.6.16, 1.8.2-beta.4. Upgrade your dependency to 1.7.11, 1.6.16, 1.8.2-beta.4 or later.
What is the CVSS score of CVE-2018-1000006?
CVE-2018-1000006 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2018-1000006?
CVE-2018-1000006 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2018-1000006?
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-w222-53c6-c86p",
  "modified" : "2021-06-10T19:55:43Z",
  "published" : "2018-01-23T03:57:44Z",
  "aliases" : [ "CVE-2018-1000006" ],
  "summary" : "Remote Code Execution in electron",
  "details" : "Affected versions of `electron` may be susceptible to a remote code execution flaw when certain conditions are met:\n1. The electron application is running on Windows.\n2. The electron application registers as the default handler for a protocol, such as `nodeapp://`.\n\nThis vulnerability is caused by a failure to sanitize additional arguments to chromium in the command line handler for Electron.\n\nMacOS and Linux are not vulnerable.\n\n\n## Recommendation\n\nUpdate electron to a version that is not vulnerable. If updating is not possible, the electron team has provided the following guidance:\n\n\nIf for some reason you are unable to upgrade your Electron version, you can append `--` as the last argument when calling `app.setAsDefaultProtocolClient`, which prevents Chromium from parsing further options. The double dash `--` signifies the end of command options, after which only positional parameters are accepted.\n```\napp.setAsDefaultProtocolClient(protocol, process.execPath, [\n  '--your-switches-here',\n  '--'\n])\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.7.0"
      }, {
        "fixed" : "1.7.11"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0"
      }, {
        "fixed" : "1.6.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.8.0"
      }, {
        "fixed" : "1.8.2-beta.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.8.2-beta.3"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-1000006"
  }, {
    "type" : "WEB",
    "url" : "https://electronjs.org/blog/protocol-handler-fix"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-w222-53c6-c86p"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/electron/electron/releases/tag/v1.8.2-beta.4"
  }, {
    "type" : "WEB",
    "url" : "https://medium.com/@Wflki/exploiting-electron-rce-in-exodus-wallet-d9e6db13c374"
  }, {
    "type" : "WEB",
    "url" : "https://www.exploit-db.com/exploits/43899"
  }, {
    "type" : "WEB",
    "url" : "https://www.exploit-db.com/exploits/44357"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/563"
  }, {
    "type" : "WEB",
    "url" : "http://www.securityfocus.com/bid/102796"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:59:07Z",
    "nvd_published_at" : null
  }
}