mediumCVSS 6.1Vulnerability

GHSA-fwjx-9p69-h25h

### 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

Properties

ghsa_id
GHSA-fwjx-9p69-h25h
severity
medium
summary
Oh My Posh: Terminal escape sequence injection via unsanitized prompt segment data
cvss_score
6.1
cve_id
GHSA-fwjx-9p69-h25h
cvss_vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L
is_ghsa_only
true
ghsa_published
2026-07-24T22:35:52Z
source_url
https://github.com/advisories/GHSA-fwjx-9p69-h25h
ghsa_updated
2026-07-24T22:35:54Z

Related Entities (4)

VULNERABLE_TO (1)

[Software]go/github.com/jandedobbeleer/oh-my-posh

AFFECTS (1)

[Software]go/github.com/jandedobbeleer/oh-my-posh

HAS_WEAKNESS (1)

[Weakness]Improper Neutralization of Escape, Meta, or Control Sequences

REPORTED_BY (1)

[Source]GitHub Advisory Database

Explore deeper with Ninja Signal's threat intelligence graph