CSIRTS // UNIFIED SECURITY ADVISORY FEEDSYS ● ONLINE · POWERED BY INTELFUSIONS.COM

GHSA-fwjx-9p69-h25h: Oh My Posh: Terminal escape sequence injection via unsanitized prompt segment data

mediumCVSS 6.1
Summary Oh My Posh renders dynamic, potentially attacker-controlled strings (the current directory name, Git commit metadata, environment variable values, command output) into the prompt without neutralizing raw terminal control characters. An attacker who controls one of these values can inject ANSI/OSC escape sequences that the victim's terminal executes on every prompt render. (This is separate from the path-segment command-execution report; it has a different root cause and fix.) Details src/terminal/writer.go, write(s rune): the literal characters of rendered segment content are emitted to the output buffer, and the only neutralization is a lookup in formats.EscapeSequences, which per shell contains only the shell's prompt-length markers (\ for bash, % for zsh, nothing for fish/pwsh/cmd/nu). Raw C0/C1 control bytes (ESC 0x1b, BEL 0x07, CSI, OSC) are written verbatim. Oh My Posh's own styling is emitted through separate paths (writeEscapedAnsiString, writeColorise, builder.WriteString(formats.Hyperlink...)), so any control rune reaching write(s rune) originates from rendered data. trimAnsi is already applied to the console title (FormatTitle) but not to the prompt body. Attacker-controlled sources (both verified) 1. Current directory name (default config, Linux/macOS). Directory names may contain any byte except / and NUL, including 0x1b. The path segment renders the working directory in every theme. 2. Git commit subject / author / upstream URL (cross-platform, including Windows). Git.Commit() runs git log -1 --pretty=format:...su:%s... and exposes .Commit.Subject, .Commit.Author.Name/.Email and .RawUpstreamURL; Git imposes no restriction on these, so they can carry raw escape sequences. PoC Git commit-subject vector (config: a single git segment with template {{ .Commit.Subject }}): printf 'feat: \033]0;HACKED\007\033]52;c;ZWNobyBQV05FRA==\007 update' > msg.txt git commit --allow-empty -F msg.txt oh-my-posh print primary --config poc.omp.json --shell fish

Details

Source
GitHub Security Advisories (INTL · database · site)
Severity
medium — CVSS 6.1
Published
2026-07-24
Last updated
2026-07-24
Exploitation
Not in CISA KEV at last sync

Original advisory: https://github.com/advisories/GHSA-fwjx-9p69-h25h

More from GitHub Security Advisories