Oh My Posh Terminal Escape Sequence Injection via Unsanitized Git Metadata
First seen Aug 13, 2026 · Updated Aug 13, 2026 · CVSS 6.1
This CVE describes a terminal escape sequence injection vulnerability in the Oh My Posh shell prompt renderer, not an AI agent-specific prompt injection despite the matched keyword. Attacker-controlled Git metadata (commit messages, author names, repo URLs) and directory names could contain unsanitized control characters that manipulate the terminal, spoof the display, or overwrite the clipboard when a victim's shell prompt renders that data. This is a legitimate but conventional software vulnerability with no direct relevance to AI agent architectures, LLM prompt injection, or inter-agent protocols.
Technical Analysis
The vulnerability resides in write(s rune) within src/terminal/writer.go, which renders shell prompt segments including current directory names and Git metadata (Commit.Subject, Commit.Author.Name, Commit.Author.Email, RawUpstreamURL) without stripping C0/C1 control characters such as ESC, BEL, CSI, and OSC sequences. An attacker who controls a Git repository (via commit metadata, branch names, or remote URLs) that a victim clones or navigates into can embed terminal escape sequences that execute when Oh My Posh renders the prompt. This allows clipboard overwrite (OSC 52), prompt/screen spoofing, window title manipulation, or terminal disruption purely through terminal control-sequence interpretation by the user's terminal emulator, not through any AI model or agent reasoning process. The entry point is untrusted repository data flowing into a human-facing rendering pipeline; there is no LLM, tool-calling agent, or inter-agent protocol involved.
Affected Systems
Oh My Posh
Detection Signatures
- Prompt or terminal output containing raw ESC (0x1B), BEL (0x07), CSI (ESC [), or OSC (ESC ]) sequences originating from git log, git remote, or directory name fields
- Unexpected clipboard content changes correlated with shell prompt rendering or `cd` into untrusted repositories
- Git commit subjects/author fields containing non-printable control characters when inspected with `cat -v` or `od -c`
- Sudden window title changes not initiated by the user
- Oh My Posh versions prior to 29.35.1
Remediation Steps
- 1
Upgrade Oh My Posh
Update to version 29.35.1 or later, which sanitizes C0/C1 control characters from Git metadata and directory names before rendering.
- 2
Sanitize untrusted Git metadata
If maintaining a fork or custom prompt renderer, strip or escape ESC/BEL/CSI/OSC control sequences from any data sourced from repository content before terminal output.
- 3
Audit repositories before navigation
Exercise caution when cloning or cd'ing into untrusted repositories, especially those with unusual commit messages, author fields, or remote URLs.
- 4
Use terminal emulator protections
Enable terminal emulator settings that restrict or confirm risky OSC sequences such as clipboard write (OSC 52) and window title changes.
CVE / Advisory IDs
Industries Most Exposed
Respond to this threat
Pro subscribers get a full AI-generated incident-response playbook for this threat — detection, containment, eradication, and recovery steps — plus an unlimited AI Threat Advisor for questions about your environment.