BACK TO THE WIRE
SW-000361AMAZON WEB SERVICES · AWS SAM CLI · TERRAFORM HOOK (SAM BUILD --HOOK-NAME TERRAFORM)HIGHACTION REQUIRED

CVE-2026-115414: OS command injection in AWS SAM CLI Terraform hook

AWS disclosed CVE-2026-115414, an OS command injection vulnerability in the SAM CLI Terraform hook (sam build --hook-name terraform), affecting versions 1.63.0 through 1.166.1. The issue stems from unsanitized interpolation of a Terraform resource address into a generated Makefile recipe, allowing command execution as the build user if an attacker can influence the Terraform configuration or plan file. The issue is fixed in v1.166.2.

DEVOPS · SECURITY · VULNERABILITY · SECURITY ADVISORY

PUBLISHED OCT 23, 2026 19:46 UTC

WHAT CHANGED

AWS SAM CLI's Terraform hook generates a Makefile recipe that interpolates a Terraform resource address without fully neutralizing shell metacharacters. An actor able to influence the Terraform configuration or plan file consumed by a 'sam build --hook-name terraform' invocation could execute arbitrary commands as the build user on the host running the build. The flaw affects versions >=1.63.0 and <=1.166.1 and is resolved in version v1.166.2.

WHY IT MATTERS

Administrators using the SAM CLI Terraform hook in build pipelines could have arbitrary commands executed on build hosts if untrusted or compromised Terraform configurations, plan files, or third-party modules are consumed during the build process. This could lead to compromise of build infrastructure, credential theft, or supply-chain attacks via tampered Terraform inputs.

WHO IS AFFECTED

PRODUCTS
AWS SAM CLI
FEATURES
Terraform hook (sam build --hook-name terraform)
CONFIGURATIONS
Builds using sam build --hook-name terraform with Terraform configuration or plan files
ENVIRONMENTS
AWS SAM CLI versions >=1.63.0, <=1.166.1

WHAT TO DO

  1. 01
    CRITICALAUTOMATABLE

    Upgrade AWS SAM CLI to version v1.166.2 or later.

    DOCUMENTATION
  2. 02
    HIGH

    Patch any forked or derivative code of SAM CLI to incorporate the fix for CVE-2026-115414.

  3. 03
    HIGH

    Ensure Terraform configuration files and plan files consumed by sam build --hook-name terraform originate only from trusted sources.

  4. 04
    MEDIUM

    Audit third-party Terraform modules and shared repositories that supply input to the SAM build process.

TIMELINE

ANNOUNCED
OCT 22, 2026

SOURCES

  • PRIMARY SOURCEAMAZON WEB SERVICES, INC.

    CVE-2026-115414 - OS Command Injection Issue in SAM CLI Terraform Hook

    PUBLISHED OCT 22, 2026VIEW SOURCE

VERIFICATION

HUMAN VERIFIEDLAST VERIFIED OCT 23, 2026 19:46 UTCREVISION 2

ShiftWire summarizes and analyzes changes from the cited sources. Always review the primary source before implementing material changes.

WAS THIS USEFUL?