/

CVE-2026-73505

Severity:

HIGH RISK

(7.8)

Template Injection (CWE-94) in Oh My Posh Path Renderer

CVE-2026-73505

Deferred

Vulnerability type

Category:

Template Injection

CWE:

CWE-94, CWE-1336

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Oh My Posh can interpret attacker-controlled directory names as Go template expressions when rendering its path segment. If a user enters a directory whose name contains such an expression, arbitrary operating system commands may execute with the privileges of the current user when the prompt renders in that directory or a descendant.

Affected context

The vulnerability occurs in Oh My Posh prompt rendering when the path segment passes raw directory names to a template renderer whose function map exposes command execution functionality. It becomes risky when an attacker can create or influence a directory name that the affected user's shell prompt later displays, including through shared workspaces, extracted archives, repositories, or other untrusted filesystem content.

Exploit preconditions

  • Attack surface: Local filesystem content processed by the shell prompt
  • Required access: Ability to create, rename, or otherwise influence a directory visible to the affected user
  • Trigger point: Prompt rendering while the user is inside the crafted directory or one of its descendants
  • Why exploitation is possible: Raw path data is evaluated as a template rather than treated solely as display text, and the template environment exposes command-execution functionality

Why this happens

The underlying bug is a failure to preserve the distinction between data and executable template syntax. The path segment supplies attacker-controlled folder names directly to a template renderer, allowing embedded expressions to be evaluated with access to functions that can invoke operating system commands. This behavior maps to CWE-94: Improper Control of Generation of Code, with CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine describing the template-specific injection mechanism.

Potential impact

  • Arbitrary operating system commands may execute as the current user
  • User credentials, tokens, or local files could be exposed
  • Shell configuration or development environments could be modified
  • Malicious commands could affect repositories, build artifacts, or other accessible data
  • The impact could extend to connected services when the user has elevated permissions

General mitigation guidance

Mitigation centers on treating directory names and other path-derived values strictly as untrusted display data.

Common defensive patterns include:

  • Escaping or quoting dynamic values before placing them into templates
  • Rendering untrusted path components as data rather than re-parsing them as template source
  • Restricting template function maps so display templates cannot invoke operating system commands
  • Separating command-capable functionality from user-controlled rendering contexts
  • Running prompt tools with normal user privileges and limiting access to sensitive resources
  • Applying safer defaults for prompt configurations and reviewing filesystem trust boundaries

How teams detect issues like this

Organizations can look for this vulnerability class through:

  • Static analysis that identifies raw filesystem values passed into template rendering APIs
  • Code review checks for dynamic strings being treated as template source
  • Review of template function maps for command execution, process spawning, or shell access
  • Policy enforcement that prohibits command-capable functions in display-only templates
  • Tests using metacharacters and template syntax in directory names to verify they remain inert
  • Automated security review tools that flag template injection and data-to-code boundary violations

Sources

SourceLink
github.comgithub.com/JanDeDobbeleer/oh-my-posh/commit/88ddbe0b0a4dd13cc345996108c9869493f2c690
github.comgithub.com/JanDeDobbeleer/oh-my-posh/pull/7711
github.comgithub.com/JanDeDobbeleer/oh-my-posh/releases/tag/v29.35.1
github.comgithub.com/JanDeDobbeleer/oh-my-posh/security/advisories/GHSA-6xj8-qv9j-xcjq

Frequently asked

questions

Not as a direct network attack. Exploitation generally requires a way to create or influence filesystem directory names and cause the affected user's prompt to render in that location, although shared workspaces or automated file extraction can provide practical paths to that condition.

The attacker does not necessarily need an interactive shell as the victim, but must be able to influence a directory that the victim will visit or display. Commands execute with the victim's current-user privileges.

Treat path names as inert data: escape them before rendering, prevent them from being interpreted as template source, and remove command-capable functions from contexts that process untrusted values.

Maintain clear data-versus-code boundaries, apply static analysis and review rules to template APIs, limit template capabilities, and test prompt rendering with attacker-controlled filesystem names.

Find out what's already
exploitable in your codebase.