INCIDENT MAP

Browse / Tool and Agent Misuse / CVE-2026-29783

GitHub Copilot CLI Dangerous Shell Expansion Patterns Enable Arbitrary Code Execution

CVE-2026-29783 · 2026-03-06 high

Class
Tool and Agent Misuse (filed by a model that read the advisory)
Technique
Code and command execution
Also involves
Indirect Prompt Injection
Affected
@github/copilot (npm)
Gets past
Approval or confirmation prompt
CVSS
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
EPSS
0.5% chance of exploitation in 30 days

How it works, in short

Bash parameter expansion operators hide command substitutions inside arguments the safety check treats as read-only, so the agent runs them without approval. (Our summary, written by a model. The source text is below.)

Details

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:

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 substitution

Prior 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:
- Prompt injection via malicious repository content (README files, code comments, issue bodies)
- Compromised or malicious MCP server responses
- Crafted user instructions containing obfuscated commands

— 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:

User Actions

References

Source: GitHub Advisory Database, used under CC BY 4.0.