CVE-2023-7080: Wrangler Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-f8mp-x433-5wpf
CVSS 9.3
CWE-269
Published
Advisory Summary

CVE-2023-7080 is a CRITICAL (CVSS 9.3) remote code execution vulnerability (CWE-269: Improper Privilege Management) affecting Wrangler libraries in the npm ecosystem. The issue involves arbitrary remote code execution within `wrangler dev` workers sandbox. Remediation is available by upgrading affected packages to version 3.19.0, 2.20.2.

CVE-2023-7080 at a Glance

CVE Identifier CVE-2023-7080
GHSA Identifier GHSA-f8mp-x433-5wpf
Severity CRITICAL
CVSS v3.1 Base Score 9.3
CWE Classification CWE-269: Improper Privilege Management
Affected Product Wrangler
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N).

Attack Vector Adjacent (AV:A)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2023-7080

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

wrangler fixed: 3.19.0
npm install wrangler@3.19.0
wrangler fixed: 2.20.2
npm install wrangler@2.20.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 wrangler

How to Check if You Are Affected

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

npm ls wrangler

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

Note: The npm ls wrangler 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-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In Wrangler, 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 The V8 inspector intentionally allows arbitrary code execution within the Workers sandbox for debugging. `wrangler dev` would previously start an inspector server listening on all network interfaces. This would allow an attacker on the local network to connect to the inspector and run arbitrary code. Additionally, the inspector server did not validate `Origin`/`Host` headers, granting an attacker that can trick any user on the local network into opening a malicious website the ability to run code. If `wrangler dev --remote` was being used, an attacker could access production resources if they were bound to the worker. ### Patches This issue was fixed in `wrangler@3.19.0` and `wrangler@2.20.2`. Whilst `wrangler dev`'s inspector server listens on local interfaces by default as of `wrangler@3.16.0`, an [SSRF vulnerability in `miniflare`](https://github.com/cloudflare/workers-sdk/security/advisories/GHSA-fwvg-2739-22v7) allowed access from the local network until `wrangler@3.18.0`. `wrangler@3.19.0` and `wrangler@2.20.2` introduced validation for the `Origin`/`Host` headers. ### Workarounds Unfortunately, Wrangler doesn't provide any configuration for which host that inspector server should listen on. Please upgrade to at least `wrangler@3.16.0`, and configure Wrangler to listen on local interfaces instead with `wrangler dev --ip 127.0.0.1` to prevent SSRF. This removes the local network as an attack vector, but does not prevent an attack from visiting a malicious website. ### References - https://github.com/cloudflare/workers-sdk/issues/4430 - https://github.com/cloudflare/workers-sdk/pull/4437 - https://github.com/cloudflare/workers-sdk/pull/4535 - https://github.com/cloudflare/workers-sdk/pull/4550

CVE-2023-7080 Affected Wrangler Versions

2 component(s)
Fixed Versions:
3.19.02.20.2
Product / Package Ecosystem Affected Versions Fixed Version
wrangler
npm
≥ 3.0.0
< 3.19.0
3.19.0
wrangler
npm
≥ 2.0.0
< 2.20.2
2.20.2

References

Frequently Asked Questions

What is CVE-2023-7080?
CVE-2023-7080 is a security vulnerability in Wrangler involving Arbitrary remote code execution within `wrangler dev` Workers sandbox under CWE-269: Improper Privilege Management.
Which Wrangler versions are affected?
Affected versions include releases prior to 3.19.0, 2.20.2 across affected packages: wrangler.
What version fixes CVE-2023-7080?
Upgrading to 3.19.0, 2.20.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is wrangler affected?
Yes, wrangler is affected in releases prior to 3.19.0, 2.20.2. Upgrade your dependency to 3.19.0, 2.20.2 or later.
What is the CVSS score of CVE-2023-7080?
CVE-2023-7080 has a CVSS v3.1 base score of 9.3 (CRITICAL) with vector string CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2023-7080?
CVE-2023-7080 is classified under CWE-269: Improper Privilege Management (The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.).
How can I check npm dependencies for CVE-2023-7080?
Run the dependency tree command: 'npm ls wrangler'. 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-f8mp-x433-5wpf",
  "modified" : "2024-01-03T21:26:50Z",
  "published" : "2024-01-03T21:26:50Z",
  "aliases" : [ "CVE-2023-7080" ],
  "summary" : "Arbitrary remote code execution within `wrangler dev` Workers sandbox",
  "details" : "### Impact\nThe V8 inspector intentionally allows arbitrary code execution within the Workers sandbox for debugging. `wrangler dev` would previously start an inspector server listening on all network interfaces. This would allow an attacker on the local network to connect to the inspector and run arbitrary code. Additionally, the inspector server did not validate `Origin`/`Host` headers, granting an attacker that can trick any user on the local network into opening a malicious website the ability to run code. If `wrangler dev --remote` was being used, an attacker could access production resources if they were bound to the worker.\n\n### Patches\nThis issue was fixed in `wrangler@3.19.0` and `wrangler@2.20.2`. Whilst `wrangler dev`'s inspector server listens on local interfaces by default as of `wrangler@3.16.0`, an [SSRF vulnerability in `miniflare`](https://github.com/cloudflare/workers-sdk/security/advisories/GHSA-fwvg-2739-22v7) allowed access from the local network until `wrangler@3.18.0`. `wrangler@3.19.0` and `wrangler@2.20.2` introduced validation for the `Origin`/`Host` headers.\n\n### Workarounds\nUnfortunately, Wrangler doesn't provide any configuration for which host that inspector server should listen on. Please upgrade to at least `wrangler@3.16.0`, and configure Wrangler to listen on local interfaces instead with `wrangler dev --ip 127.0.0.1` to prevent SSRF. This removes the local network as an attack vector, but does not prevent an attack from visiting a malicious website.\n\n### References\n- https://github.com/cloudflare/workers-sdk/issues/4430\n- https://github.com/cloudflare/workers-sdk/pull/4437\n- https://github.com/cloudflare/workers-sdk/pull/4535\n- https://github.com/cloudflare/workers-sdk/pull/4550\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "wrangler"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.19.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "wrangler"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.20.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/security/advisories/GHSA-f8mp-x433-5wpf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-7080"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/issues/4430"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/pull/4437"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/pull/4535"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/pull/4550"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/commit/05b1bbd2f5b8e60268e30c276067c3a3ae1239cf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/commit/29df8e17545bf3926b6d61678b596be809d40c6d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/commit/49a469601adaa9eb9e1f2d6de197c1979d5c6c1b"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudflare/workers-sdk/commit/63708a94fb7a055bf15fa963f2d598b47b11d3c0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cloudflare/workers-sdk"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-269" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-03T21:26:50Z",
    "nvd_published_at" : "2023-12-29T12:15:47Z"
  }
}