GHSA-6xj8-qv9j-xcjq
### 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()`: ```go // 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: ```go 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): ```json { "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/{{ cm
Properties
- ghsa_id
- GHSA-6xj8-qv9j-xcjq
- severity
- high
- summary
- Oh My Posh: Arbitrary command execution via template injection in the path segment
- cvss_score
- 7.8
- cve_id
- GHSA-6xj8-qv9j-xcjq
- cvss_vector
- CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- is_ghsa_only
- true
- ghsa_published
- 2026-07-24T22:36:11Z
- source_url
- https://github.com/advisories/GHSA-6xj8-qv9j-xcjq
- ghsa_updated
- 2026-07-24T22:36:12Z
Related Entities (5)
VULNERABLE_TO (1)
AFFECTS (1)
HAS_WEAKNESS (2)
REPORTED_BY (1)
Explore deeper with Ninja Signal's threat intelligence graph