Description
Zigbee2MQTT's ExternalJSExtension.getFilePath() (lib/extension/externalJS.ts) joins a `name` parameter received via an MQTT message (topic zigbee2mqtt/bridge/request/extension/save) into the extensions base path using path.join(basePath, name) with no sanitization. Because path.join() resolves `../` sequences, a name such as `../../tmp/evil.js` escapes the intended extensions directory. The extension handler only validates that the name ends in .js/.mjs/.cjs, writes the file, and then dynamically imports it via Node.js import(), achieving remote code execution. Requires the `enable_external_js` config option (off by default, but commonly enabled in legacy installs) and MQTT broker access, which is frequently unauthenticated in real deployments. The identical unsanitized getFilePath() is also used by the extension-removal handler, enabling arbitrary file deletion.
Published: 2026-08-05
Score: 8.1 High
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Zigbee2MQTT's ExternalJSExtension.getFilePath() function concatenates a user supplied file name from an MQTT message into the extensions directory without sanitization. The use of path.join allows a crafted name containing "../" segments to escape to any location. An attacker can therefore submit a file name such as "../../tmp/evil.js", causing the gateway to write the malicious script to an arbitrary directory and then dynamically import it with Node.js import(), executing arbitrary code. The extension removal handler shares the same vulnerable logic, allowing arbitrary file deletion. The weakness is a classic Path Traversal flaw, identified as CWE-22, which directly enables remote code execution and data compromise. Affected Systems: The vulnerable code resides in the Koenkk:zigbee2mqtt project, specifically the Zigbee2MQTT application. All installations that enable the "enable_external_js" configuration option – which is off by default but was commonly left on in legacy deployments – are susceptible. The vulnerability is independent of a particular release version; however, newer releases have addressed the issue. The application typically receives MQTT messages on the "zigbee2mqtt/bridge/request/extension/save" topic.

Affected Systems

The undocumented vulnerable logic exists in all Koenkk:zigbee2mqtt application releases where the external JavaScript extension feature is enabled. Any environment running Zigbee2MQTT with enable_external_js set to true, regardless of the host operating system, is at risk. This includes legacy installations that have not applied the recent fix or have not disabled the feature. The exploit targets the gateway component that handles MQTT traffic and can affect connected smart home devices through the bridge.

Risk and Exploitability

The CVSS score of 8.1 indicates a high severity condition for this vulnerability. No EPSS data is available, and the vulnerability is not listed in the CISA KEV catalog. The exploitation requires an attacker to publish a specially crafted MQTT message to a broker that the gateway subscribes to. In many real deployments the broker is unauthenticated or has weak access controls, which makes the attack vector highly feasible. If successful, the attacker gains full remote code execution on the host running Zigbee2MQTT, compromising confidentiality, integrity, and availability of both the gateway and any connected devices.

Generated by OpenCVE AI on August 5, 2026 at 15:24 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Disable the "enable_external_js" configuration option unless it is absolutely required for your deployment.
  • Update Zigbee2MQTT to the latest stable release that includes the path traversal fix.
  • Configure the MQTT broker to require authentication and restrict the bridge request topic to trusted clients only.

Generated by OpenCVE AI on August 5, 2026 at 15:24 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 05 Aug 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Wed, 05 Aug 2026 13:15:00 +0000

Type Values Removed Values Added
Description Zigbee2MQTT's ExternalJSExtension.getFilePath() (lib/extension/externalJS.ts) joins a `name` parameter received via an MQTT message (topic zigbee2mqtt/bridge/request/extension/save) into the extensions base path using path.join(basePath, name) with no sanitization. Because path.join() resolves `../` sequences, a name such as `../../tmp/evil.js` escapes the intended extensions directory. The extension handler only validates that the name ends in .js/.mjs/.cjs, writes the file, and then dynamically imports it via Node.js import(), achieving remote code execution. Requires the `enable_external_js` config option (off by default, but commonly enabled in legacy installs) and MQTT broker access, which is frequently unauthenticated in real deployments. The identical unsanitized getFilePath() is also used by the extension-removal handler, enabling arbitrary file deletion.
Title Zigbee2MQTT External JS Extension Path Traversal Leading to Remote Code Execution
Weaknesses CWE-22
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: TuranSec

Published:

Updated: 2026-08-05T15:55:11.665Z

Reserved: 2026-08-05T12:23:34.967Z

Link: CVE-2026-71279

cve-icon Vulnrichment

Updated: 2026-08-05T15:55:07.728Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-05T15:30:17Z

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')