/

CVE-2026-45322

Severity:

HIGH RISK

(7.8)

OS Command Injection in Microsoft UFO Shell Action Replay

CVE-2026-45322

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code 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

Microsoft UFO's shell action replay logic allows OS command injection when action parameters are passed directly to PowerShell via subprocess with shell execution enabled.

If an attacker can create or modify UFO session/action JSON records, they can plant a malicious shell action that will run with the UFO process user's privileges when the session is resumed or replayed.

Affected context

This vulnerability affects Microsoft UFO deployments that:

  • Use shell-based actions such as RunShellCommand or ExecuteCommand
  • Persist planned and executed actions in per-session JSON records on disk or in shared storage
  • Trust or expose session/action JSON files to external systems, automation, or users
  • Replay or resume sessions that may contain shell actions without re-validating stored parameters

The issue is present where ShellReceiver.run_shell() or ShellReceiver.execute_command() are reachable and execute commands via PowerShell.

Exploit preconditions

  • Attack surface: File or storage layer where UFO session and action JSON records are stored.
  • Required access: Ability to create, write, or modify a UFO session/action JSON file that will later be processed by the framework.
  • Trigger point: Session replay or resume logic that deserializes stored actions and invokes:
  • ShellReceiver.run_shell()
  • ShellReceiver.execute_command()
  • RunShellCommand.execute()
  • ExecuteCommand.execute()
  • Why exploitation is possible: ShellReceiver passes command strings from action parameters directly into subprocess.Popen() with shell=True and executable=powershell.exe, allowing the attacker-controlled command to be executed by the OS shell without sanitization or strict argument handling.

Why this happens

The core issue is the direct interpolation of untrusted command strings into an operating system shell with command parsing enabled.

In the vulnerable code path, action parameters stored in JSON are treated as fully trusted and forwarded to subprocess.Popen() using shell=True, delegating parsing and execution to PowerShell.

This pattern aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command, where user-controlled input is used to construct shell commands without robust validation or constrained invocation interfaces.

Because stored session data can be influenced by an attacker with write access, the shell invocation becomes a powerful execution primitive when those sessions are later replayed.

Potential impact

  • Execution of arbitrary PowerShell commands as the UFO process user
  • Reading, modifying, or deleting files accessible to the UFO service account
  • Installing backdoors or persistence mechanisms on the host where UFO runs
  • Lateral movement within the environment using the UFO host as a pivot
  • Tampering with automation workflows, device configurations, or orchestration logic managed by UFO

General mitigation guidance

Mitigation should focus on eliminating direct shell invocation with raw, untrusted command strings and reducing trust in stored session data.

Common defensive patterns include:

  • Avoiding shell=True in subprocess calls and instead using argument lists that bypass shell parsing.
  • Designing shell execution helpers that only allow pre-defined, parameterized commands with strict whitelists and type-checked arguments.
  • Treating session/action JSON as untrusted input on replay, applying validation and normalization before any action is executed.
  • Implementing a clear separation between data (parameters) and control (command templates), ensuring parameters cannot alter the command structure.
  • Running the UFO service under a least-privilege account with minimal filesystem and network permissions.
  • Restricting access to session and action storage locations via OS-level permissions and, where applicable, storage ACLs.

How teams detect issues like this

Detection efforts can target both code-level patterns and runtime behavior:

  • Static analysis: Rules that flag use of subprocess.Popen() or related APIs with shell=True, especially when arguments originate from deserialized data structures (e.g., JSON, databases, message queues).
  • Code review signals: Paths where session or action metadata is read from disk or external sources and forwarded into shell execution helpers without validation or canonicalization.
  • Configuration and policy checks: CI/CD policies that disallow new shell-based helpers unless they use safe argument lists and controlled templates.
  • Runtime monitoring: Logging and alerting on unusual PowerShell invocations initiated by the UFO process, including commands that deviate from expected automation patterns.
  • Automated security review tools can be integrated into the development workflow to flag risky subprocess usage and shell injection patterns early.

Sources

SourceLink
github.comgithub.com/microsoft/UFO/security/advisories/GHSA-wj72-7w8h-695f

Frequently asked

questions

It can be, depending on how UFO session/action JSON files are managed. If an attacker can reach the storage layer remotely—for example, via an API, shared storage, or another service that writes those JSON files—they may trigger remote code execution when sessions are replayed.

The attacker needs the ability to create, modify, or replace UFO session or action JSON records that will later be processed. This could involve filesystem write access, control over an upstream service that persists these files, or exploitation of another vulnerability that allows tampering with session data.

The most robust fix is to eliminate shell-based execution with shell=True and move to parameterized subprocess calls that never pass user-controlled strings directly to a shell. Additionally, treat all stored session/action data as untrusted and validate it before executing any corresponding actions.

Adopt secure coding guidelines for command execution: avoid shell invocation when possible, enforce strict whitelists for allowed operations, validate all data loaded from persistent storage as if it came from an external user, and incorporate static analysis and security reviews aimed specifically at command construction and subprocess usage.

Find out what's already
exploitable in your codebase.