CVE-2022-21718: Electron Renderers Can Obtain Access To Vulnerability
LOWCVE-2022-21718 is a LOW (CVSS 3.4) renderers can obtain access to vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Electron libraries in the npm ecosystem. The issue involves renderers can obtain access to random bluetooth device without permission in electron. Remediation is available by upgrading affected packages to version 13.6.6, 14.2.4, 15.3.5, 16.0.6, 17.0.0-alpha.6.
CVE-2022-21718 at a Glance
Security Impact
CVSS: 3.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:N/A:N).
How to Fix CVE-2022-21718
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@13.6.6
npm install electron@14.2.4
npm install electron@15.3.5
npm install electron@16.0.6
npm install electron@17.0.0-alpha.6
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-2022-21718, 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 13.6.6), 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
CVE-2022-21718 Affected Electron Versions
5 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
electron
|
npm |
< 13.6.6
|
13.6.6
|
|
electron
|
npm |
≥ 14.0.0-beta.1
< 14.2.4
|
14.2.4
|
|
electron
|
npm |
≥ 15.0.0-beta.1
< 15.3.5
|
15.3.5
|
|
electron
|
npm |
≥ 16.0.0-beta.1
< 16.0.6
|
16.0.6
|
|
electron
|
npm |
≥ 17.0.0-alpha.1
< 17.0.0-alpha.6
|
17.0.0-alpha.6
|
References
Frequently Asked Questions
What is CVE-2022-21718?
Which Electron versions are affected?
What version fixes CVE-2022-21718?
Is electron affected?
What is the CVSS score of CVE-2022-21718?
What CWE is associated with CVE-2022-21718?
How can I check npm dependencies for CVE-2022-21718?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3p22-ghq8-v749",
"modified" : "2022-03-22T18:49:36Z",
"published" : "2022-03-22T18:49:36Z",
"aliases" : [ "CVE-2022-21718" ],
"summary" : "Renderers can obtain access to random bluetooth device without permission in Electron",
"details" : "### Impact\nThis vulnerability allows renderers to obtain access to a random bluetooth device via the [web bluetooth API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API) if the app has not configured a custom `select-bluetooth-device` event handler. The device that is accessed is random and the attacker would have no way of selecting a specific device.\n\nAll current stable versions of Electron are affected.\n\n### Patches\nThis has been patched and the following Electron versions contain the fix:\n* `17.0.0-alpha.6`\n* `16.0.6`\n* `15.3.5`\n* `14.2.4`\n* `13.6.6`\n\n### Workarounds\nAdding this code to your app can workaround the issue.\n\n```js\napp.on('web-contents-created', (event, webContents) => {\n webContents.on('select-bluetooth-device', (event, devices, callback) => {\n // Prevent default behavior\n event.preventDefault();\n // Cancel the request\n callback('');\n });\n});\n```\n\nFor more information\nIf you have any questions or comments about this advisory, email us at security@electronjs.org.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "13.6.6"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "14.0.0-beta.1"
}, {
"fixed" : "14.2.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "15.0.0-beta.1"
}, {
"fixed" : "15.3.5"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "16.0.0-beta.1"
}, {
"fixed" : "16.0.6"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "electron"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "17.0.0-alpha.1"
}, {
"fixed" : "17.0.0-alpha.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 17.0.0-alpha.5"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/electron/electron/security/advisories/GHSA-3p22-ghq8-v749"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21718"
}, {
"type" : "WEB",
"url" : "https://github.com/electron/electron/pull/32178"
}, {
"type" : "WEB",
"url" : "https://github.com/electron/electron/pull/32240"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/electron/electron"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-668", "CWE-862" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2022-03-22T18:49:36Z",
"nvd_published_at" : "2022-03-22T17:15:00Z"
}
}