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

GHSA-6xj8-qv9j-xcjq: Oh My Posh: Arbitrary command execution via template injection in the path segment

highCVSS 7.8
Summary Oh My Posh re-renders the resolved path string, which contains the raw folder names taken from the filesystem, through the Go text/template engine. That engine's function map exposes a cmd function that runs arbitrary OS commands. A directory whose name contains a Go template expression is therefore evaluated when the prompt renders, giving arbitrary command execution as the current user as soon as the shell is inside (or below) that directory. The built-in default configuration is affected. Details src/segments/path.go, setStyle(): // make sure we resolve all templates if txt, err := template.Render(pt.Path, pt); err == nil { pt.Path = txt } pt.Path is built from the raw folder-name components of the current working directory (colorizePath inserts each folder name verbatim via fmt.Sprintf(folderFormat, element)). The whole string is then passed to template.Render, which parses and executes it with the full function map from src/template/func_map.go, including: func cmd(command string, args ...string) (string, error) { output, err := env.RunCommand(command, args...) return strings.TrimSpace(output), err } Any template syntax present in an untrusted folder name is evaluated. The render runs after the path-style switch unconditionally, so every path style is affected, and the default config (src/config/default.go) contains a path segment. PoC Config (a single default path segment): { "version":3, "blocks":[{"type":"prompt","alignment":"left","segments":[ {"type":"path","style":"plain","foreground":"#ffffff", "template":"{{ .Path }}","properties":{"style":"full"}}]}]} Command execution reflected into the prompt (--pwd supplies exactly the string env.Pwd() returns for a real directory of that name; on Linux/macOS such a directory is fully creatable, only / and NUL are disallowed): $ oh-my-posh print primary --config p.json --shell fish \ --pwd '/home/v/{{ cmd whoami }}' /home/v/<username> # whoami executed, output substituted Side effect (file write),

Details

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

Original advisory: https://github.com/advisories/GHSA-6xj8-qv9j-xcjq

More from GitHub Security Advisories