CVE-2024-27303: App builder lib Electron-builder's NSIS Installer - Execute Vulnerability

HIGH
Advisory Identifier: GHSA-r4pf-3v7r-hh55
CVSS 7.3
CWE-426 CWE-427
Published
Advisory Summary

CVE-2024-27303 is a HIGH (CVSS 7.3) electron-builder's nsis installer - execute vulnerability (CWE-426: Untrusted Search Path) affecting App builder lib libraries in the npm ecosystem. The issue involves electron-builder's nsis installer - execute arbitrary code on the target machine (windows only). Remediation is available by upgrading affected packages to version 24.13.2.

CVE-2024-27303 at a Glance

CVE Identifier CVE-2024-27303
GHSA Identifier GHSA-r4pf-3v7r-hh55
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-426: Untrusted Search Path
Affected Product App builder lib
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.3

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

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
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-2024-27303

To remediate this vulnerability, upgrade all affected App builder lib dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

app-builder-lib fixed: 24.13.2
npm install app-builder-lib@24.13.2
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 app-builder-lib

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-27303, inspect your project dependencies using npm:

npm ls app-builder-lib

Analyze the terminal output to locate any version of App builder lib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 24.13.2), your application is affected.

Note: The npm ls app-builder-lib 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-426: Untrusted Search Path, where the product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control. In App builder lib, 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 Windows-Only: The NSIS installer makes a system call to open cmd.exe via NSExec in the `.nsh` installer script. NSExec by default searches the current directory of where the installer is located before searching `PATH`. This means that if an attacker can place a malicious executable file named cmd.exe in the same folder as the installer, the installer will run the malicious file. ### Patches Fixed in https://github.com/electron-userland/electron-builder/pull/8059 ### Workarounds None, it executes at the installer-level before the app is present on the system, so there's no way to check if it exists in a current installer. ### References https://cwe.mitre.org/data/definitions/426.html https://cwe.mitre.org/data/definitions/427

CVE-2024-27303 Affected App builder lib Versions

1 component(s)
Fixed Versions:
24.13.2
Product / Package Ecosystem Affected Versions Fixed Version
app-builder-lib
npm
< 24.13.2
24.13.2

References

Frequently Asked Questions

What is CVE-2024-27303?
CVE-2024-27303 is a security vulnerability in App builder lib involving electron-builder's NSIS installer - execute arbitrary code on the target machine (Windows only) under CWE-426: Untrusted Search Path.
Which App builder lib versions are affected?
Affected versions include releases prior to 24.13.2 across affected packages: app-builder-lib.
What version fixes CVE-2024-27303?
Upgrading to 24.13.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is app-builder-lib affected?
Yes, app-builder-lib is affected in releases prior to 24.13.2. Upgrade your dependency to 24.13.2 or later.
What is the CVSS score of CVE-2024-27303?
CVE-2024-27303 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-27303?
CVE-2024-27303 is classified under CWE-426: Untrusted Search Path (The product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control.).
How can I check npm dependencies for CVE-2024-27303?
Run the dependency tree command: 'npm ls app-builder-lib'. 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-r4pf-3v7r-hh55",
  "modified" : "2024-03-06T21:36:08Z",
  "published" : "2024-03-04T20:42:45Z",
  "aliases" : [ "CVE-2024-27303" ],
  "summary" : "electron-builder's NSIS installer - execute arbitrary code on the target machine (Windows only)",
  "details" : "### Impact\nWindows-Only: The NSIS installer makes a system call to open cmd.exe via NSExec in the `.nsh` installer script. NSExec by default searches the current directory of where the installer is located before searching `PATH`. This means that if an attacker can place a malicious executable file named cmd.exe in the same folder as the installer, the installer will run the malicious file.\n\n### Patches\nFixed in https://github.com/electron-userland/electron-builder/pull/8059\n\n### Workarounds\nNone, it executes at the installer-level before the app is present on the system, so there's no way to check if it exists in a current installer.\n\n### References\nhttps://cwe.mitre.org/data/definitions/426.html\nhttps://cwe.mitre.org/data/definitions/427",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "app-builder-lib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "24.13.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/electron-userland/electron-builder/security/advisories/GHSA-r4pf-3v7r-hh55"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27303"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/electron-userland/electron-builder/pull/8059"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/electron-userland/electron-builder/commit/8f4acff3c2d45c1cb07779bb3fe79644408ee387"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/electron-userland/electron-builder"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-426", "CWE-427" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-04T20:42:45Z",
    "nvd_published_at" : "2024-03-06T19:15:08Z"
  }
}