Summary
A command injection flaw in Fleet's software installer pipeline allows malicious package metadata to be embedded into auto-generated uninstall scripts without proper sanitization.
On affected versions, a crafted software package uploaded to Fleet can cause arbitrary commands to execute as root (macOS/Linux) or SYSTEM (Windows) on managed endpoints when an uninstall is triggered.
Affected context
This vulnerability appears in Fleet deployments that:
- Use the software management feature to upload and distribute packages (.pkg, .deb, .rpm, .exe, .msi)
- Automatically generate uninstall scripts from package metadata
- Deploy and execute these uninstall scripts on managed macOS, Linux, or Windows endpoints
The risk materializes when uploaded package binaries come from sources whose metadata fields are not fully trusted or validated.
Exploit preconditions
- Attack surface: Fleet server software management interface or API where packages are uploaded.
- Required access: Ability to upload or register a software package in Fleet (e.g., admin or operator role, compromised admin account, or misconfigured automation).
- Trigger point: Execution of the auto-generated uninstall script on managed endpoints (e.g., when an admin initiates uninstall or a policy-driven removal occurs).
- Why exploitation is possible: Metadata extracted from the uploaded package is interpolated into uninstall script commands without adequate sanitization or escaping, permitting attacker-controlled shell syntax to be executed with elevated privileges.
Why this happens
The core issue is improper handling of untrusted input when constructing shell commands in uninstall scripts.
Fleet extracts metadata fields from uploaded package binaries and incorporates them directly into uninstall script templates.
Because these values are not normalized, validated, or safely escaped for the target shell, an attacker can embed shell metacharacters or command sequences in the metadata.
When the uninstall script runs, the shell interprets this crafted content as executable commands, matching CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Potential impact
- Remote execution of arbitrary commands as root on macOS and Linux endpoints.
- Remote execution of arbitrary commands as SYSTEM on Windows endpoints.
- Installation of additional malware or backdoors across the managed fleet.
- Exfiltration or destruction of sensitive data stored on endpoints.
- Lateral movement inside the organization's network from compromised endpoints.
- Tampering with endpoint configuration, security tooling, or logging.
General mitigation guidance
Effective mitigation focuses on treating package metadata as untrusted input and on hardening script generation:
- Use strict input validation and canonicalization for all metadata fields before using them in scripts (e.g., length limits, allowed character sets, rejecting unexpected control or shell metacharacters).
- Properly escape or quote all metadata values when interpolating into shell commands, or avoid direct shell concatenation by passing arguments as safer structured parameters where possible.
- Prefer non-shell execution mechanisms where feasible (e.g., dedicated APIs, configuration management tools, or language-native process execution with argument arrays).
- Apply least-privilege principles to uninstall operations, limiting the scope and permissions of the processes that run generated scripts.
- Establish a review process for auto-generated uninstall scripts, including manual or automated checks before deployment to endpoints.
- Limit the use of auto-generated scripts to packages from trusted, verified sources and ensure supply chain validation (e.g., signatures, checksums, provenance policies).
How teams detect issues like this
Detection is best approached through both code-level and operational controls:
- Static analysis: Configure SAST rules to detect string concatenation into shell commands, unsanitized interpolation of external data, and script template code paths that consume metadata-derived values.
- Code review signals: Flag any logic that:
- Reads metadata from uploaded binaries and passes it into command strings.
- Builds uninstall or lifecycle scripts dynamically using user-controlled or externally sourced fields.
- Runtime monitoring: On endpoints, monitor for uninstall scripts executing unexpected commands or spawning unusual subprocesses, especially under root or SYSTEM accounts.
- Policy enforcement: Implement CI/CD policies that block changes introducing new shell command templates using unvalidated variables, and require security review for changes to software install/uninstall pipelines.
- Automated tooling: Use security linters and automated code review systems to surface OS command injection patterns as part of regular development workflows.

