CVE-2022-21718: Electron Renderers Can Obtain Access To Vulnerability

LOW
Advisory Identifier: GHSA-3p22-ghq8-v749
CVSS 3.4
CWE-668 CWE-862
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2022-21718
GHSA Identifier GHSA-3p22-ghq8-v749
Severity LOW
CVSS v3.1 Base Score 3.4
CWE Classification CWE-668: Exposure of Resource to Wrong Sphere
Affected Product Electron
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (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.

electron fixed: 13.6.6
npm install electron@13.6.6
electron fixed: 14.2.4
npm install electron@14.2.4
electron fixed: 15.3.5
npm install electron@15.3.5
electron fixed: 16.0.6
npm install electron@16.0.6
electron fixed: 17.0.0-alpha.6
npm install electron@17.0.0-alpha.6
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-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

### Impact This 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. All current stable versions of Electron are affected. ### Patches This has been patched and the following Electron versions contain the fix: * `17.0.0-alpha.6` * `16.0.6` * `15.3.5` * `14.2.4` * `13.6.6` ### Workarounds Adding this code to your app can workaround the issue. ```js app.on('web-contents-created', (event, webContents) => { webContents.on('select-bluetooth-device', (event, devices, callback) => { // Prevent default behavior event.preventDefault(); // Cancel the request callback(''); }); }); ``` For more information If you have any questions or comments about this advisory, email us at security@electronjs.org.

CVE-2022-21718 Affected Electron Versions

5 component(s)
Fixed Versions:
13.6.614.2.415.3.516.0.617.0.0-alpha.6
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?
CVE-2022-21718 is a security vulnerability in Electron involving Renderers can obtain access to random bluetooth device without permission in Electron under CWE-668: Exposure of Resource to Wrong Sphere.
Which Electron versions are affected?
Affected versions include releases prior to 13.6.6, 14.2.4, 15.3.5, 16.0.6, 17.0.0-alpha.6 across affected packages: electron.
What version fixes CVE-2022-21718?
Upgrading to 13.6.6, 14.2.4, 15.3.5, 16.0.6, 17.0.0-alpha.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is electron affected?
Yes, electron is affected in releases prior to 13.6.6, 14.2.4, 15.3.5, 16.0.6, 17.0.0-alpha.6. Upgrade your dependency to 13.6.6, 14.2.4, 15.3.5, 16.0.6, 17.0.0-alpha.6 or later.
What is the CVSS score of CVE-2022-21718?
CVE-2022-21718 has a CVSS v3.1 base score of 3.4 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2022-21718?
CVE-2022-21718 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-2022-21718?
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-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"
  }
}