Oh My Posh: Terminal escape sequence injection via unsanitized prompt segment data
Oh My Posh versions prior to 29.35.1 allow terminal escape sequence injection via unsanitized prompt segment data. The software renders dynamic strings such as current directory names and Git commit metadata into the prompt without neutralizing raw terminal control characters. An attacker controlling these values can inject ANSI/OSC escape sequences that the victim's terminal executes on every prompt render. This can lead to clipboard hijacking, prompt spoofing, window-title manipulation, and terminal denial of service. The vulnerability arises because control characters are emitted verbatim in prompt segments without proper filtering. The issue affects local terminal rendering and requires the victim to render the prompt after changing directories or viewing Git data. No official patch or fix is currently confirmed.
AI Analysis
Technical Summary
Oh My Posh renders dynamic, potentially attacker-controlled strings (e.g., current directory name, Git commit metadata) into the terminal prompt without neutralizing raw terminal control characters such as ESC, BEL, CSI, and OSC sequences. These control characters are emitted verbatim in the prompt output, allowing an attacker who controls these values to inject ANSI/OSC escape sequences. These sequences are executed by the victim's terminal on every prompt render. Verified attacker-controlled sources include directory names and Git commit metadata fields (subject, author, upstream URL). The impact includes clipboard hijacking via OSC 52, prompt and screen spoofing, window-title manipulation, and terminal denial of service. The vulnerability affects Oh My Posh versions before 29.35.1. The suggested remediation is to neutralize control characters in untrusted segment data before rendering, extending existing ANSI trimming to prompt segments.
Potential Impact
The injected terminal escape sequences are executed locally on the victim's terminal each time the prompt renders. This can enable clipboard hijacking (inserting attacker-controlled content into the clipboard), spoofing of the prompt or terminal screen, manipulation of the terminal window title, and denial of service conditions in the terminal emulator. The attack requires the victim to render the prompt with attacker-controlled data, such as changing into a directory with a malicious name or viewing Git commit metadata crafted by an attacker. The impact is limited to local terminal effects and depends on the terminal emulator's support for these escape sequences.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The suggested fix is to neutralize C0/C1 control characters in untrusted prompt segment data before it is rendered to the terminal, specifically in the path segment (directory names) and Git segment (commit subject, author, upstream URL). Existing ANSI trimming applied to console titles should be extended to prompt body segments. Filtering control runes in the write function would provide defense in depth. Until an official fix is released, users should avoid rendering untrusted data in their prompt segments or sanitize such data manually.
Oh My Posh: Terminal escape sequence injection via unsanitized prompt segment data
Description
Oh My Posh versions prior to 29.35.1 allow terminal escape sequence injection via unsanitized prompt segment data. The software renders dynamic strings such as current directory names and Git commit metadata into the prompt without neutralizing raw terminal control characters. An attacker controlling these values can inject ANSI/OSC escape sequences that the victim's terminal executes on every prompt render. This can lead to clipboard hijacking, prompt spoofing, window-title manipulation, and terminal denial of service. The vulnerability arises because control characters are emitted verbatim in prompt segments without proper filtering. The issue affects local terminal rendering and requires the victim to render the prompt after changing directories or viewing Git data. No official patch or fix is currently confirmed.
CVSS v3.1
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Oh My Posh renders dynamic, potentially attacker-controlled strings (e.g., current directory name, Git commit metadata) into the terminal prompt without neutralizing raw terminal control characters such as ESC, BEL, CSI, and OSC sequences. These control characters are emitted verbatim in the prompt output, allowing an attacker who controls these values to inject ANSI/OSC escape sequences. These sequences are executed by the victim's terminal on every prompt render. Verified attacker-controlled sources include directory names and Git commit metadata fields (subject, author, upstream URL). The impact includes clipboard hijacking via OSC 52, prompt and screen spoofing, window-title manipulation, and terminal denial of service. The vulnerability affects Oh My Posh versions before 29.35.1. The suggested remediation is to neutralize control characters in untrusted segment data before rendering, extending existing ANSI trimming to prompt segments.
Potential Impact
The injected terminal escape sequences are executed locally on the victim's terminal each time the prompt renders. This can enable clipboard hijacking (inserting attacker-controlled content into the clipboard), spoofing of the prompt or terminal screen, manipulation of the terminal window title, and denial of service conditions in the terminal emulator. The attack requires the victim to render the prompt with attacker-controlled data, such as changing into a directory with a malicious name or viewing Git commit metadata crafted by an attacker. The impact is limited to local terminal effects and depends on the terminal emulator's support for these escape sequences.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The suggested fix is to neutralize C0/C1 control characters in untrusted prompt segment data before it is rendered to the terminal, specifically in the path segment (directory names) and Git segment (commit subject, author, upstream URL). Existing ANSI trimming applied to console titles should be extended to prompt body segments. Filtering control runes in the write function would provide defense in depth. Until an official fix is released, users should avoid rendering untrusted data in their prompt segments or sanitize such data manually.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-fwjx-9p69-h25h
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["Go"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6a6542199c2644c7f8087e3e
Added to database: 07/25/2026, 23:09:13 UTC
Last enriched: 07/25/2026, 23:49:27 UTC
Last updated: 07/25/2026, 23:49:27 UTC
Views: 2
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 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.