CVE-2023-51661: Wasmer cli Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-4mq4-7rw3-vm5j
CVSS 8.4
CWE-284
Published
Advisory Summary

CVE-2023-51661 is a HIGH (CVSS 8.4) remote code execution vulnerability (CWE-284: Improper Access Control) affecting Wasmer cli libraries in the crates.io ecosystem. The issue involves wasmer filesystem sandbox not enforced. Remediation is available by upgrading affected packages to version 4.2.4.

CVE-2023-51661 at a Glance

CVE Identifier CVE-2023-51661
GHSA Identifier GHSA-4mq4-7rw3-vm5j
Severity HIGH
CVSS v3.1 Base Score 8.4
CWE Classification CWE-284: Improper Access Control
Affected Product Wasmer cli
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 8.4

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

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

How to Fix CVE-2023-51661

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

wasmer-cli fixed: 4.2.4
Upgrade wasmer-cli to 4.2.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for wasmer-cli

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-51661, inspect your project dependencies for Wasmer cli:

inspect dependencies for wasmer-cli

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Wasmer cli, 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

### Summary As of Wasmer version v4.2.3, Wasm programs can access the filesystem outside of the sandbox. ### Details https://github.com/wasmerio/wasmer/issues/4267 ### PoC A minimal Rust program: ``` fn main() { let f = std::fs::OpenOptions::new() .write(true) .create_new(true) .open("abc") .unwrap(); } ``` This should be compiled with `cargo build --target wasm32-wasi`. The compiled program, when run with wasmer WITHOUT `--dir`, can still create a file in the working directory. ### Impact Service providers running untrusted Wasm code on Wasmer can unexpectedly expose the host filesystem.

CVE-2023-51661 Affected Wasmer cli Versions

1 component(s)
Fixed Versions:
4.2.4
Product / Package Ecosystem Affected Versions Fixed Version
wasmer-cli
crates.io
≥ 3.0.0
< 4.2.4
4.2.4

References

Frequently Asked Questions

What is CVE-2023-51661?
CVE-2023-51661 is a security vulnerability in Wasmer cli involving Wasmer filesystem sandbox not enforced under CWE-284: Improper Access Control.
Which Wasmer cli versions are affected?
Affected versions include releases prior to 4.2.4 across affected packages: wasmer-cli.
What version fixes CVE-2023-51661?
Upgrading to 4.2.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is wasmer-cli affected?
Yes, wasmer-cli is affected in releases prior to 4.2.4. Upgrade your dependency to 4.2.4 or later.
What is the CVSS score of CVE-2023-51661?
CVE-2023-51661 has a CVSS v3.1 base score of 8.4 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-51661?
CVE-2023-51661 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check crates.io dependencies for CVE-2023-51661?
Run the dependency tree command: 'inspect dependencies for wasmer-cli'. 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-4mq4-7rw3-vm5j",
  "modified" : "2024-01-03T16:44:36Z",
  "published" : "2023-12-13T13:32:38Z",
  "aliases" : [ "CVE-2023-51661" ],
  "summary" : "Wasmer filesystem sandbox not enforced",
  "details" : "### Summary\nAs of Wasmer version v4.2.3, Wasm programs can access the filesystem outside of the sandbox.\n\n### Details\nhttps://github.com/wasmerio/wasmer/issues/4267\n\n### PoC\nA minimal Rust program:\n\n```\nfn main() {\n    let f = std::fs::OpenOptions::new()\n        .write(true)\n        .create_new(true)\n        .open(\"abc\")\n        .unwrap();\n}\n```\n\nThis should be compiled with `cargo build --target wasm32-wasi`. The compiled program, when run with wasmer WITHOUT `--dir`, can still create a file in the working directory.\n\n### Impact\nService providers running untrusted Wasm code on Wasmer can unexpectedly expose the host filesystem.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "wasmer-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "4.2.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/wasmerio/wasmer/security/advisories/GHSA-4mq4-7rw3-vm5j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-51661"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/wasmerio/wasmer/issues/4267"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/wasmerio/wasmer/commit/4d63febf9d8b257b0531963b85df48d45d0dbf3c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/wasmerio/wasmer/commit/e3923612c23123025c26f982d390e34df7df030f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/wasmerio/wasmer"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-12-13T13:32:38Z",
    "nvd_published_at" : "2023-12-22T15:15:08Z"
  }
}