CVE-2026-29783: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in github copilot-cli
The shell tool within GitHub Copilot CLI versions prior to and including 0.0.422 can 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." This has been patched in version 0.0.423. 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 ${var@P}, ${var=value} / ${var:=value}, ${!var}, and nested $(cmd) or <(cmd) inside ${...} expansions. 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, or 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 use only read-only utilities to ultimately trigger write operations. Successful exploitation could lead to data exfiltration, file modification, or further system compromise.
AI Analysis
Technical Summary
CVE-2026-29783 is an OS command injection vulnerability in the GitHub Copilot CLI shell tool affecting versions up to and including 0.0.422. The root cause lies in the CLI's shell safety assessment mechanism, which attempts to classify shell commands as either read-only (safe) or write-capable (requiring user approval) before execution. However, the safety layer fails to properly neutralize special elements used in bash parameter expansion, such as ${var@P}, ${var=value}, ${var:=value}, ${!var}, and nested command substitutions like $(cmd) or <(cmd) inside ${...} expansions. These expansions can embed executable code within arguments to commands that appear read-only, effectively bypassing the safety checks. An attacker who can influence the command text executed by the CLI—via prompt injection through malicious repository content (e.g., README files, code comments, issue bodies), compromised MCP server responses, or crafted user instructions—can exploit this flaw to execute arbitrary commands on the user's workstation. This can lead to unauthorized data access, file modifications, or further system compromise. The vulnerability does not require prior privileges but does require user interaction to trigger the execution. The flaw has been addressed in version 0.0.423 by improving the command classification and neutralization of dangerous bash expansions. No known exploits are currently reported in the wild.
Potential Impact
The impact of this vulnerability is significant for organizations using GitHub Copilot CLI versions up to 0.0.422. Successful exploitation allows attackers to execute arbitrary code on the user's machine, potentially leading to data exfiltration, unauthorized file modifications, or full system compromise. Since the vulnerability can be triggered via repository files or server responses, it poses a risk in collaborative development environments where untrusted or malicious code or metadata can be introduced. This could lead to supply chain attacks or insider threat scenarios. The ability to bypass safety checks and execute hidden commands increases the risk of stealthy attacks that evade detection. Organizations relying on Copilot CLI for development automation or code generation may face operational disruptions and data breaches if exploited. The requirement for user interaction somewhat limits automated exploitation but does not eliminate risk, especially in environments with frequent CLI usage and automated workflows.
Mitigation Recommendations
1. Upgrade GitHub Copilot CLI to version 0.0.423 or later, where the vulnerability is patched. 2. Implement strict code review and validation processes for repository files, especially README files, code comments, and issue bodies, to prevent injection of malicious commands. 3. Restrict or monitor the use of Copilot CLI in environments where untrusted code or metadata can be introduced. 4. Employ runtime monitoring and endpoint detection to identify suspicious shell command executions originating from the CLI. 5. Educate users about the risks of executing commands from untrusted sources and encourage cautious interaction with CLI prompts. 6. If upgrading is not immediately possible, consider disabling or limiting the shell tool functionality within Copilot CLI to reduce exposure. 7. Audit and secure MCP server communications to prevent injection of malicious responses. 8. Use sandboxing or containerization to isolate CLI executions and limit potential damage from exploitation.
Affected Countries
United States, Germany, United Kingdom, Canada, Australia, France, Japan, India, Netherlands, South Korea
CVE-2026-29783: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in github copilot-cli
Description
The shell tool within GitHub Copilot CLI versions prior to and including 0.0.422 can 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." This has been patched in version 0.0.423. 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 ${var@P}, ${var=value} / ${var:=value}, ${!var}, and nested $(cmd) or <(cmd) inside ${...} expansions. 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, or 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 use only read-only utilities to ultimately trigger write operations. Successful exploitation could lead to data exfiltration, file modification, or further system compromise.
AI-Powered Analysis
Technical Analysis
CVE-2026-29783 is an OS command injection vulnerability in the GitHub Copilot CLI shell tool affecting versions up to and including 0.0.422. The root cause lies in the CLI's shell safety assessment mechanism, which attempts to classify shell commands as either read-only (safe) or write-capable (requiring user approval) before execution. However, the safety layer fails to properly neutralize special elements used in bash parameter expansion, such as ${var@P}, ${var=value}, ${var:=value}, ${!var}, and nested command substitutions like $(cmd) or <(cmd) inside ${...} expansions. These expansions can embed executable code within arguments to commands that appear read-only, effectively bypassing the safety checks. An attacker who can influence the command text executed by the CLI—via prompt injection through malicious repository content (e.g., README files, code comments, issue bodies), compromised MCP server responses, or crafted user instructions—can exploit this flaw to execute arbitrary commands on the user's workstation. This can lead to unauthorized data access, file modifications, or further system compromise. The vulnerability does not require prior privileges but does require user interaction to trigger the execution. The flaw has been addressed in version 0.0.423 by improving the command classification and neutralization of dangerous bash expansions. No known exploits are currently reported in the wild.
Potential Impact
The impact of this vulnerability is significant for organizations using GitHub Copilot CLI versions up to 0.0.422. Successful exploitation allows attackers to execute arbitrary code on the user's machine, potentially leading to data exfiltration, unauthorized file modifications, or full system compromise. Since the vulnerability can be triggered via repository files or server responses, it poses a risk in collaborative development environments where untrusted or malicious code or metadata can be introduced. This could lead to supply chain attacks or insider threat scenarios. The ability to bypass safety checks and execute hidden commands increases the risk of stealthy attacks that evade detection. Organizations relying on Copilot CLI for development automation or code generation may face operational disruptions and data breaches if exploited. The requirement for user interaction somewhat limits automated exploitation but does not eliminate risk, especially in environments with frequent CLI usage and automated workflows.
Mitigation Recommendations
1. Upgrade GitHub Copilot CLI to version 0.0.423 or later, where the vulnerability is patched. 2. Implement strict code review and validation processes for repository files, especially README files, code comments, and issue bodies, to prevent injection of malicious commands. 3. Restrict or monitor the use of Copilot CLI in environments where untrusted code or metadata can be introduced. 4. Employ runtime monitoring and endpoint detection to identify suspicious shell command executions originating from the CLI. 5. Educate users about the risks of executing commands from untrusted sources and encourage cautious interaction with CLI prompts. 6. If upgrading is not immediately possible, consider disabling or limiting the shell tool functionality within Copilot CLI to reduce exposure. 7. Audit and secure MCP server communications to prevent injection of malicious responses. 8. Use sandboxing or containerization to isolate CLI executions and limit potential damage from exploitation.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-03-04T16:26:02.898Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 69ab0852c48b3f10ffb0e5bd
Added to database: 3/6/2026, 5:01:06 PM
Last enriched: 3/6/2026, 5:15:23 PM
Last updated: 3/7/2026, 9:15:59 AM
Views: 11
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.