Severity:

HIGH RISK

(7.2)

OS Command Injection in Amazon ECS Agent FSx Windows File

CVE-2026-7461

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Local Privilege Escalation to SYSTEM via Remote Authenticated Control

Severity:

HIGH RISK

(7.2)

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

An OS command injection vulnerability in the FSx Windows File Server volume mounting component of the Amazon ECS Agent on Windows allows attacker-controlled data from the username field in an ECS task definition to influence shell commands executed on the host.

In environments where an attacker can define or modify FSx-related credentials or task definitions, this flaw may enable execution of arbitrary commands with SYSTEM privileges on the underlying Windows host.

Affected context

This issue affects Windows-based Amazon ECS environments that:

  • Use the Amazon ECS Agent on Windows prior to version 1.103.0
  • Mount FSx for Windows File Server volumes through ECS task definitions
  • Allow task definitions or FSx credential material (e.g., username) to be configured via ECS APIs, AWS Secrets Manager, or SSM Parameter Store

The vulnerability occurs when user-supplied username values for FSx volume configuration are incorporated into OS-level commands during the volume mount process without sufficient neutralization.

Exploit preconditions

  • Attack surface: ECS control plane inputs that influence FSx Windows File Server volume mounting, primarily:
  • ECS task definitions containing FSx volume configuration
  • Secrets or parameters referenced by those task definitions for FSx credentials
  • Required access:
  • Permissions to register or update ECS task definitions that use FSx Windows File Server volumes, or
  • Permissions to create or modify the Secrets Manager or SSM Parameter Store entries used as the FSx username credential
  • Trigger point:
  • The ECS Agent on a Windows host processes a task definition and attempts to mount an FSx Windows File Server volume using the provided username
  • Why exploitation is possible:
  • The FSx username value is concatenated into, or otherwise passed to, an OS command or shell invocation without proper escaping, quoting, or validation
  • The command is executed with SYSTEM privileges by the ECS Agent, so injected metacharacters or command fragments can change the intended command behavior

Why this happens

The root cause aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

The FSx Windows File Server volume mounting logic in the ECS Agent builds or invokes OS commands that incorporate externally influenced data from the username field. Instead of treating this value as opaque data, the implementation allows shell metacharacters or command syntax to be interpreted by the underlying command processor.

Abstractly, this reflects a common insecure pattern:

  • Accepting user-controlled input (here, the FSx username from a task definition or referenced secret)
  • Embedding it directly into a command string (or passing it to an API that ultimately invokes a shell)
  • Relying on the environment or calling code rather than strict validation, canonicalization, and parameterization to enforce safe behavior

Because the ECS Agent runs volume mounting steps with high privilege (SYSTEM on Windows), any deviation from strict command construction and input neutralization significantly increases impact.

Potential impact

  • Execution of arbitrary commands with SYSTEM privileges on the Windows ECS host
  • Complete compromise of the affected ECS container instance, including access to host-level resources
  • Potential pivot to other workloads running on the same host (e.g., credential theft, lateral movement)
  • Tampering with or exfiltration of data accessible via the compromised host (logs, secrets, attached storage)
  • Disruption of services by modifying configurations, stopping critical processes, or installing persistent malicious tooling

General mitigation guidance

Effective mitigation focuses on both secure command construction and hardening configuration workflows:

  • Replace shell-based composition with API- or library-based operations wherever possible, avoiding direct command-line invocation for tasks such as network share mounting.
  • When OS commands are unavoidable, use mechanisms that:
  • Pass untrusted data as discrete parameters (e.g., structured APIs, non-shell exec variants)
  • Enforce strict allowlists for expected username formats (e.g., domain\user or UPN-style, limited character sets)
  • Reject or sanitize characters with special meaning to the command interpreter (such as separators, redirection, and control operators).
  • Treat all configuration-derived credentials as untrusted, even if they come from internal systems like Secrets Manager or SSM; apply validation and normalization before use.
  • Apply least-privilege principles to ECS task and IAM roles so that:
  • Only tightly controlled principals can register or update ECS task definitions involving FSx volumes.
  • Write access to Secrets Manager and SSM parameters used for FSx credentials is restricted and auditable.
  • Implement defense-in-depth at the host layer:
  • Use endpoint security controls and application allowlisting on ECS Windows hosts.
  • Segment hosts used for sensitive workloads and minimize additional services running with SYSTEM privileges.

How teams detect issues like this

Detection can leverage a combination of code- and environment-focused approaches:

  • Static analysis and code review:
  • Flag patterns where user or configuration input is concatenated into command strings or passed into shell-invoking APIs (e.g., process spawns with command-line strings).
  • Require explicit justification and security review for any code paths that invoke OS commands from high-privilege components like agents or daemons.
  • Look for FSx volume mounting code paths that accept usernames or other credentials and ensure they are validated against a constrained format.
  • Configuration and policy enforcement:
  • Enforce IAM policies that restrict who can:
  • Register/modify ECS task definitions using FSx Windows File Server volumes
  • Write to Secrets Manager or SSM parameters referenced as FSx credentials
  • Use policy-as-code tools to require approvals for changes affecting high-privilege host-facing components.
  • Runtime monitoring and logging:
  • Enable detailed command execution logging on Windows ECS hosts (e.g., process creation logs, PowerShell logging) to detect anomalous commands spawned by the ECS Agent.
  • Monitor for unusual changes to ECS task definitions, Secrets Manager entries, and SSM parameters associated with FSx volumes, especially those modifying username fields.
  • Automated review tooling:
  • Integrate security scanners into CI/CD pipelines to identify OS command injection patterns.
  • Use configuration scanners to highlight ECS definitions and IAM policies that provide broad write permissions to FSx-related secrets and parameters.

Sources

SourceLink
aws.amazon.comaws.amazon.com/security/security-bulletins/2026-024-aws/
github.comgithub.com/aws/amazon-ecs-agent/releases/tag/v1.103.0
github.comgithub.com/aws/amazon-ecs-agent/security/advisories/GHSA-fc67-c4hg-q653

Frequently asked

questions

It is not typically exploitable by arbitrary external users. Exploitation requires authenticated access to AWS resources that can influence FSx volume configuration, such as the ability to modify ECS task definitions or the secrets and parameters used for FSx credentials. However, in multi-tenant or poorly segmented environments, this may still be reachable by an internal or compromised principal.

An attacker needs permissions that allow:

  • Registering or updating ECS task definitions that reference FSx Windows File Server volumes and specify a username, or
  • Writing to AWS Secrets Manager or SSM Parameter Store entries that are used as the username value in those FSx configurations.

Without such control over the FSx username field, exploitation is not feasible.

The safest pattern is to avoid building shell commands from external input at all, using dedicated APIs or strongly typed library calls for sensitive operations like network share mounting. When shell use is unavoidable, validate username and credential fields against strict, minimal formats; pass them as separate arguments rather than concatenated command strings; and ensure the calling component runs with the least privilege necessary.

Future designs should treat all configuration- and secret-derived values as untrusted, apply strict input validation and canonicalization, and prefer non-shell mechanisms for interacting with the operating system. Security controls such as mandatory code review for command-invoking code paths, static analysis rules for injection patterns, and tightly scoped IAM permissions for updating task definitions and secrets help prevent similar issues from reaching production.

Find out what's already
exploitable in your codebase.