@github/copilot
Affected
- introduced
0, fixed0.0.423(semver)
Fixed versions
0.0.423
Fix
- Fixed version
0.0.423npm install @github/[email protected]
Advisory
Also known as: CVE-2026-29783
GitHub Copilot CLI Dangerous Shell Expansion Patterns Enable Arbitrary Code Execution
Summary
A security vulnerability has been identified in GitHub Copilot CLI's shell tool that could allow arbitrary code execution through crafted bash parameter expansion patterns. An attacker who can influence the commands executed by the agent (e.g., via prompt injection through repository files, MCP server responses, or user instructions) can exploit bash parameter transformation operators to execute hidden commands, bypassing the safety assessment that classifies commands as "read-only."
Details
The vulnerability stems from how the CLI's shell safety assessment evaluates commands before execution. The safety layer parses and classifies shell commands as either read-only (safe) or write-capable (requires user approval). However, several bash parameter expansion features can embed executable code within arguments to otherwise read-only commands, causing them to appear safe while actually performing arbitrary operations.
The specific dangerous patterns are:
@P parameter transformation operator evaluates its value as a prompt string, which interprets embedded command substitutions. This allows hidden command execution inside what appears to be a simple variable reference.@P, an attacker can progressively build up a command substitution string across multiple expansions.${HOME:-$(whoami)}) executes the nested command.Proof of Concept
The following command appears to run a harmless echo, but actually executes touch /tmp/pwned through chained parameter expansion:
echo ${a="$"}${b="$a(touch /tmp/pwned)"}${b@P}
How it works:
${a="$"} assigns the literal $ character to variable a${b="$a(touch /tmp/pwned)"} expands $a to $, constructing the string $(touch /tmp/pwned) and assigning it to b${b@P} applies prompt expansion to b, which evaluates the embedded $(touch /tmp/pwned) command substitutionPrior to the fix, the safety assessment would classify echo as a read-only command and allow execution without user confirmation — even in modes that normally require approval for write operations.
Impact
An attacker who can influence command text sent to the shell tool — for example, through:
— could achieve arbitrary code execution on the user's workstation. This is possible even in permission modes that require user approval for write operations, since the commands can appear to be using only read-only utilities to ultimately trigger write operations.
Successful exploitation could lead to data exfiltration, file modification, or further system compromise.
Affected Versions
Remediation and Mitigation
Fix
The fix adds three layers of defense:
${...} expansion nodes within bash commands, detecting dangerous operators (@P, =, :=, !) and nested command/process substitutions. Commands containing these patterns are downgraded from read-only to write-capable, ensuring they require user approval.--yolo / autopilot). This prevents exploitation even when all commands are auto-approved.User Actions
High Basis: The source's own band: HIGH
0, fixed 0.0.423 (semver)0.0.423
0.0.423npm install @github/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0