CVE-2022-36077: Electron // Redirect Vulnerability

MODERATE
Advisory Identifier: GHSA-p2jh-44qj-pf2v
CVSS 5.4
CWE-522 CWE-200
Published
Advisory Summary

CVE-2022-36077 is a MODERATE (CVSS 5.4) // redirect vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Electron libraries in the npm ecosystem. The issue involves // redirect. Remediation is available by upgrading affected packages to version 18.3.7, 20.0.1, 19.0.11.

CVE-2022-36077 at a Glance

CVE Identifier CVE-2022-36077
GHSA Identifier GHSA-p2jh-44qj-pf2v
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product Electron
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.4

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

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 Low (C:L)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2022-36077

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: 18.3.7
npm install electron@18.3.7
electron fixed: 20.0.1
npm install electron@20.0.1
electron fixed: 19.0.11
npm install electron@19.0.11
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-36077, 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 18.3.7), 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-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. 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 When following a redirect, Electron delays a check for redirecting to file:// URLs from other schemes. The contents of the file is not available to the renderer following the redirect, but if the redirect target is a SMB URL such as `file://some.website.com/`, then in some cases, Windows will connect to that server and attempt NTLM authentication, which can include sending hashed credentials. ### Patches This issue has been fixed in all current stable versions of Electron. Specifically, these versions contain the fixes: - 21.0.0-beta.1 - 20.0.1 - 19.0.11 - 18.3.7 We recommend all apps upgrade to the latest stable version of Electron. ### Workarounds If upgrading isn't possible, this issue can be addressed without upgrading by preventing redirects to file:// URLs in the `WebContents.on('will-redirect')` event, for all WebContents: ```js app.on('web-contents-created', (e, webContents) => { webContents.on('will-redirect', (e, url) => { if (/^file:/.test(url)) e.preventDefault() }) }) ``` ### For more information If you have any questions or comments about this advisory, email us at [security@electronjs.org](mailto:security@electronjs.org). ### Credit Thanks to user @coolcoolnoworries for reporting this issue.

CVE-2022-36077 Affected Electron Versions

3 component(s)
Fixed Versions:
18.3.720.0.119.0.11
Product / Package Ecosystem Affected Versions Fixed Version
electron
npm
< 18.3.7
18.3.7
electron
npm
≥ 20.0.0-beta.1
< 20.0.1
20.0.1
electron
npm
≥ 19.0.0-beta.1
< 19.0.11
19.0.11

References

Frequently Asked Questions

What is CVE-2022-36077?
CVE-2022-36077 is a security vulnerability in Electron involving // redirect under CWE-522: Insufficiently Protected Credentials.
Which Electron versions are affected?
Affected versions include releases prior to 18.3.7, 20.0.1, 19.0.11 across affected packages: electron.
What version fixes CVE-2022-36077?
Upgrading to 18.3.7, 20.0.1, 19.0.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is electron affected?
Yes, electron is affected in releases prior to 18.3.7, 20.0.1, 19.0.11. Upgrade your dependency to 18.3.7, 20.0.1, 19.0.11 or later.
What is the CVSS score of CVE-2022-36077?
CVE-2022-36077 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:L.
What CWE is associated with CVE-2022-36077?
CVE-2022-36077 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check npm dependencies for CVE-2022-36077?
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-p2jh-44qj-pf2v",
  "modified" : "2022-11-10T12:38:57Z",
  "published" : "2022-11-10T12:38:57Z",
  "aliases" : [ "CVE-2022-36077" ],
  "summary" : "Exfiltration of hashed SMB credentials on Windows via file:// redirect",
  "details" : "### Impact\nWhen following a redirect, Electron delays a check for redirecting to file:// URLs from other schemes. The contents of the file is not available to the renderer following the redirect, but if the redirect target is a SMB URL such as `file://some.website.com/`, then in some cases, Windows will connect to that server and attempt NTLM authentication, which can include sending hashed credentials.\n\n### Patches\nThis issue has been fixed in all current stable versions of Electron. Specifically, these versions contain the fixes:\n\n- 21.0.0-beta.1\n- 20.0.1\n- 19.0.11\n- 18.3.7\n\nWe recommend all apps upgrade to the latest stable version of Electron.\n\n### Workarounds\nIf upgrading isn't possible, this issue can be addressed without upgrading by preventing redirects to file:// URLs in the `WebContents.on('will-redirect')` event, for all WebContents:\n\n```js\napp.on('web-contents-created', (e, webContents) => {\n  webContents.on('will-redirect', (e, url) => {\n    if (/^file:/.test(url)) e.preventDefault()\n  })\n})\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).\n\n### Credit\nThanks to user @coolcoolnoworries for reporting this issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.3.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "20.0.0-beta.1"
      }, {
        "fixed" : "20.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "electron"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "19.0.0-beta.1"
      }, {
        "fixed" : "19.0.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/electron/electron/security/advisories/GHSA-p2jh-44qj-pf2v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36077"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/electron/electron"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-522" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-10T12:38:57Z",
    "nvd_published_at" : "2022-11-08T07:15:00Z"
  }
}