/

CVE-2026-115414

Severity:

HIGH RISK

(7.8)

OS Command Injection (CWE-78) in AWS SAM Terraform

CVE-2026-115414

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

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

A command injection vulnerability in the AWS SAM CLI Terraform hook may allow arbitrary operating system commands to run when a crafted Terraform resource address is processed.

The risk arises when an attacker can influence the Terraform configuration or plan file consumed by a build, potentially enabling command execution with the privileges of the build user on the host.

A command injection vulnerability in the AWS SAM CLI Terraform hook may allow arbitrary operating system commands to run when a crafted Terraform resource address is processed.

The risk arises when an attacker can influence the Terraform configuration or plan file consumed by a build, potentially enabling command execution with the privileges of the build user on the host.

Affected context

The vulnerability occurs in AWS SAM CLI builds that use the Terraform hook to consume Terraform configuration or plan data. It becomes risky when those inputs can be modified or supplied by an untrusted party and the build process interprets a crafted Terraform resource address in a command-execution context.

The vulnerability occurs in AWS SAM CLI builds that use the Terraform hook to consume Terraform configuration or plan data. It becomes risky when those inputs can be modified or supplied by an untrusted party and the build process interprets a crafted Terraform resource address in a command-execution context.

Exploit preconditions

  • Attack surface: The AWS SAM CLI Terraform hook used during a build
  • Required access: Ability to influence the Terraform configuration or plan file consumed by the build
  • Trigger point: Processing of a crafted Terraform resource address
  • Why exploitation is possible: Input-derived resource data reaches an operating system command without sufficient separation from command syntax
  • Attack surface: The AWS SAM CLI Terraform hook used during a build
  • Required access: Ability to influence the Terraform configuration or plan file consumed by the build
  • Trigger point: Processing of a crafted Terraform resource address
  • Why exploitation is possible: Input-derived resource data reaches an operating system command without sufficient separation from command syntax

Why this happens

The underlying bug is an OS command injection condition mapped to CWE-78. The Terraform hook incorporates attacker-influenced resource address data into a command or command-like operation without reliably treating it as data.

This insecure pattern allows shell or operating-system command interpretation to occur where only a resource identifier was expected. The issue is amplified when builds run with broad host permissions or process untrusted infrastructure inputs.

The underlying bug is an OS command injection condition mapped to CWE-78. The Terraform hook incorporates attacker-influenced resource address data into a command or command-like operation without reliably treating it as data.

This insecure pattern allows shell or operating-system command interpretation to occur where only a resource identifier was expected. The issue is amplified when builds run with broad host permissions or process untrusted infrastructure inputs.

Potential impact

  • An attacker may execute arbitrary commands as the build user
  • Build credentials, tokens, or environment data could be exposed
  • The host running the build could be modified or compromised
  • Build artifacts or generated infrastructure outputs could be tampered with
  • The vulnerability could support lateral movement when the build environment has network or cloud privileges
  • An attacker may execute arbitrary commands as the build user
  • Build credentials, tokens, or environment data could be exposed
  • The host running the build could be modified or compromised
  • Build artifacts or generated infrastructure outputs could be tampered with
  • The vulnerability could support lateral movement when the build environment has network or cloud privileges

General mitigation guidance

Mitigation generally focuses on preventing untrusted Terraform-derived values from reaching operating-system command interpreters.

Common defensive patterns include:

  • Passing resource addresses as structured arguments rather than concatenating them into shell commands
  • Avoiding shell evaluation and disabling unnecessary command interpretation
  • Applying strict allowlists and canonical validation to resource identifiers
  • Treating Terraform configuration and plan files as untrusted build inputs
  • Running builds with dedicated, least-privileged identities and isolated workers
  • Limiting access to cloud credentials, host filesystems, and sensitive environment variables
  • Maintaining a supported, remediated AWS SAM CLI release through normal dependency-management processes

Mitigation generally focuses on preventing untrusted Terraform-derived values from reaching operating-system command interpreters.

Common defensive patterns include:

  • Passing resource addresses as structured arguments rather than concatenating them into shell commands
  • Avoiding shell evaluation and disabling unnecessary command interpretation
  • Applying strict allowlists and canonical validation to resource identifiers
  • Treating Terraform configuration and plan files as untrusted build inputs
  • Running builds with dedicated, least-privileged identities and isolated workers
  • Limiting access to cloud credentials, host filesystems, and sensitive environment variables
  • Maintaining a supported, remediated AWS SAM CLI release through normal dependency-management processes

How teams detect issues like this

Detection can include static analysis for shell-command construction involving Terraform-derived values, especially string concatenation, interpolation, shell wrappers, and subprocess calls that do not use argument arrays.

Code review should examine whether resource addresses are validated against an allowlist and whether command execution is necessary at all. CI policies can flag unsafe subprocess patterns, require isolated build workers for untrusted plans, and restrict credentials available to build jobs. Automated security review tools may help identify command construction and tainted-data flows.

Detection can include static analysis for shell-command construction involving Terraform-derived values, especially string concatenation, interpolation, shell wrappers, and subprocess calls that do not use argument arrays.

Code review should examine whether resource addresses are validated against an allowlist and whether command execution is necessary at all. CI policies can flag unsafe subprocess patterns, require isolated build workers for untrusted plans, and restrict credentials available to build jobs. Automated security review tools may help identify command construction and tainted-data flows.

Sources

SourceLink
aws.amazon.comaws.amazon.com/security/security-bulletins/2026-145-aws/
github.comgithub.com/aws/aws-sam-cli/releases/tag/v1.166.2
github.comgithub.com/aws/aws-sam-cli/security/advisories/GHSA-44mq-wjrh-vpj6

Frequently asked

questions

It may be exploitable through a build workflow when an attacker can influence the Terraform configuration or plan file consumed by that workflow. Direct network reachability to the build host is not necessarily required.

The key prerequisite is the ability to modify or supply Terraform input that reaches the AWS SAM CLI Terraform hook. The exact access path depends on repository, artifact, and CI/CD permissions.

Keep Terraform-derived values as structured data, validate resource addresses against a strict allowlist, and avoid passing them through a shell or command interpreter.

Use isolated least-privileged build workers, protect plan and configuration artifacts, apply taint-aware code review and static analysis, and minimize credentials and host access available to build processes.

It may be exploitable through a build workflow when an attacker can influence the Terraform configuration or plan file consumed by that workflow. Direct network reachability to the build host is not necessarily required.

The key prerequisite is the ability to modify or supply Terraform input that reaches the AWS SAM CLI Terraform hook. The exact access path depends on repository, artifact, and CI/CD permissions.

Keep Terraform-derived values as structured data, validate resource addresses against a strict allowlist, and avoid passing them through a shell or command interpreter.

Use isolated least-privileged build workers, protect plan and configuration artifacts, apply taint-aware code review and static analysis, and minimize credentials and host access available to build processes.

Find out what's already
exploitable in your codebase.