Summary
A command injection vulnerability in Warp's prompt branch selector allows crafted Git branch names to be interpreted directly by the victim's shell.
If an attacker can publish maliciously named branches to a repository opened in Warp and the victim selects that branch via the UI, arbitrary commands may run under the victim's account.
Affected context
This vulnerability arises when Warp is used with Git repositories whose branch names are surfaced into the interactive prompt or branch selector UI.
The issue is relevant in workflows where developers regularly switch branches from within Warp, and where branch names from a shared or multi-user repository are not treated as untrusted input.
The risk is higher in collaborative environments or CI-related repos where multiple users can push branches that others may later select in Warp.
Exploit preconditions
- Attack surface: Warp prompt branch selector and underlying shell integration.
- Required access: Ability to publish or push branches with attacker-controlled names to a Git repository opened in Warp by the victim.
- User interaction: The victim must select the malicious branch from Warp's branch selector UI, causing the crafted name to be integrated into a shell-related command.
- Why exploitation is possible: The branch name is incorporated into shell commands without adequate sanitization or escaping, allowing shell metacharacters in the branch name to be interpreted by the shell.
Why this happens
The root cause is improper handling of untrusted data (Git branch names) that is later passed to a command interpreter without strict sanitization or escaping.
Warp's branch selector functionality appears to construct shell commands or prompt content using branch names, relying on default shell parsing rather than treating the names strictly as data.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-controlled strings containing shell metacharacters influence command execution.
Potential impact
- Arbitrary command execution in the victim's shell session.
- Unauthorized access to local files and sensitive developer data.
- Exfiltration of SSH keys, API tokens, or other credentials accessible from the developer environment.
- Installation of backdoors or malicious tooling in the development workstation.
- Modification of repository contents or local configuration to enable follow-on attacks.
General mitigation guidance
Mitigation generally focuses on preventing untrusted strings from being interpreted by the shell and tightening how UI-sourced data flows into command construction.
Recommended defensive patterns include:
- Treating branch names and similar repository metadata strictly as data, never as part of executable shell syntax.
- Applying robust escaping or neutralization routines before inserting branch names into shell commands or prompts, aligned with the target shell's quoting rules.
- Using parameterized execution APIs (e.g., subprocess with argument lists) instead of building command strings for the shell to parse.
- Enforcing least-privilege for the shell environment and avoiding unnecessary implicit execution paths from UI interactions.
- Establishing safe defaults where UI actions perform simple, deterministic commands with constrained, validated inputs.
How teams detect issues like this
Detection commonly involves a mix of code-level and workflow-level checks:
- Static analysis rules targeting string concatenation into shell commands, particularly where repository metadata (branch names, tags, remotes) is involved.
- Code reviews focused on UI-to-shell integrations, looking for direct interpolation of untrusted values into command lines or prompt templates.
- Security tests that attempt to use specially crafted branch names containing shell metacharacters to see if they affect execution behavior.
- CI policies requiring automated scanning of shell wrappers, terminal integrations, and developer tooling for potential command injection patterns.

