CVE-2023-39956: Electron Electron Vulnerable To Out-of-package Code Vulnerability
MODERATECVE-2023-39956 is a MODERATE (CVSS 6.1) electron vulnerable to out-of-package code vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Electron libraries in the npm ecosystem. The issue involves electron vulnerable to out-of-package code execution when launched with arbitrary cwd. Remediation is available by upgrading affected packages to version 22.3.19, 23.3.13, 24.7.1, 25.5.0, 26.0.0-beta.13.
CVE-2023-39956 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:H/A:L).
How to Fix CVE-2023-39956
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.
npm install electron@22.3.19
npm install electron@23.3.13
npm install electron@24.7.1
npm install electron@25.5.0
npm install electron@26.0.0-beta.13
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-2023-39956, 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 22.3.19), 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. 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
CVE-2023-39956 Affected Electron Versions
5 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
electron
|
npm |
< 22.3.19
|
22.3.19
|
|
electron
|
npm |
≥ 23.0.0-alpha.1
< 23.3.13
|
23.3.13
|
|
electron
|
npm |
≥ 24.0.0-alpha.1
< 24.7.1
|
24.7.1
|
|
electron
|
npm |
≥ 25.0.0-alpha.1
< 25.5.0
|
25.5.0
|
|
electron
|
npm |
≥ 26.0.0-alpha.1
< 26.0.0-beta.13
|
26.0.0-beta.13
|
References
Frequently Asked Questions
What is CVE-2023-39956?
Which Electron versions are affected?
What version fixes CVE-2023-39956?
Is electron affected?
What is the CVSS score of CVE-2023-39956?
What CWE is associated with CVE-2023-39956?
How can I check npm dependencies for CVE-2023-39956?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7x97-j373-85x5",
"modified" : "2023-09-06T19:51:33Z",
"published" : "2023-09-06T19:51:33Z",
"aliases" : [ "CVE-2023-39956" ],
"summary" : "Electron vulnerable to out-of-package code execution when launched with arbitrary cwd",
"details" : "### Impact\nApps that are launched as command line executables are impacted. E.g. if your app exposes itself in the path as `myapp --help`\n\nSpecifically this issue can only be exploited if the following conditions are met:\n* Your app is launched with an attacker-controlled working directory\n* The attacker has the ability to write files to that working directory\n\nThis makes the risk quite low, in fact normally issues of this kind are considered outside of our threat model as similar to Chromium we exclude [Physically Local Attacks](https://github.com/electron/electron/security/advisories/GHSA-7x97-j373-85x5#:~:text=Physically%20Local%20Attacks) but given the ability for this issue to bypass certain protections like ASAR Integrity it is being treated with higher importance. Please bear this in mind when reporting similar issues in the future.\n\n### Workarounds\nThere are no app side workarounds, you must update to a patched version of Electron.\n\n### Fixed Versions\n* `26.0.0-beta.13`\n* `25.5.0`\n* `24.7.1`\n* `23.3.13`\n* `22.3.19`\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:L/AC:L/PR:L/UI:R/S:U/C:L/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "22.3.19"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "23.0.0-alpha.1"
}, {
"fixed" : "23.3.13"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "24.0.0-alpha.1"
}, {
"fixed" : "24.7.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "25.0.0-alpha.1"
}, {
"fixed" : "25.5.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "26.0.0-alpha.1"
}, {
"fixed" : "26.0.0-beta.13"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/electron/electron/security/advisories/GHSA-7x97-j373-85x5"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-39956"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/electron/electron"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-09-06T19:51:33Z",
"nvd_published_at" : "2023-09-06T21:15:13Z"
}
}