---
id: "CVE-2026-115414"
kind: "vulnerability"
aliases: ["CVE-2026-115414"]
title: "AWS SAM CLI: Terraform hook lets crafted config run commands during builds"
severity: "high"
cvss: 8.4
epss: 0.00876
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["aws", "ci-cd", "lab-disclosure", "package", "sam-cli", "serverless", "terraform"]
not_affected_if: ["not-using-terraform-hook", "trusted-terraform-inputs", "version-1.166.2-or-later"]
published_at: "2026-10-22T00:00:00+00:00"
first_seen_at: "2026-10-23T21:57:31+00:00"
updated_at: "2026-10-25T03:01:40+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-115414", "first_seen_at": "2026-10-23T21:57:31+00:00"}, {"source": "epss", "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-115414", "first_seen_at": "2026-10-24T07:15:51+00:00"}, {"source": "lab", "url": "https://aws.amazon.com/security/security-bulletins/rss/2026-145-aws/", "first_seen_at": "2026-10-24T18:56:54+00:00"}]
---

# AWS SAM CLI: Terraform hook lets crafted config run commands during builds

The Terraform hook in AWS SAM CLI builds a Makefile recipe that interpolates a Terraform resource address without neutralizing shell metacharacters. An actor who can influence the Terraform configuration or plan file consumed by a build can run arbitrary commands as the build user on the host running the build.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Run `sam --version` and compare against the affected range `>=1.63.0, <=1.166.1`.
- Check whether builds use `sam build --hook-name terraform` in CI or on developer machines.
- Review which Terraform configurations and third-party modules feed those builds.

## Fix

- Upgrade AWS SAM CLI to `v1.166.2` or later.
- Patch any forked or derivative copies of SAM CLI code with the upstream fix.
- Until upgraded, limit Terraform configuration and plan inputs to trusted sources and audit third-party modules.

## Mitigated for you by

- Team (workaround): covers Builds that consume Terraform configuration and plan files only from trusted sources, including audited third-party modules and shared repositories Limits: none stated Still: Restrict Terraform configuration and plan files consumed by sam build --hook-name terraform to trusted sources, audit third-party Terraform modules and shared repositories that supply build input, and upgrade to v1.166.2 https://aws.amazon.com/security/security-bulletins/rss/2026-145-aws/

## Timeline

- 2026-10-23T21:57:31+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-115414
- 2026-10-24T07:15:51+00:00 epss https://api.first.org/data/v1/epss?cve=CVE-2026-115414
- 2026-10-24T18:56:54+00:00 lab https://aws.amazon.com/security/security-bulletins/rss/2026-145-aws/ — AWS: CVE-2026-115414 - OS Command Injection Issue in SAM CLI Terraform Hook

## Documents

- [advisory] AWS: CVE-2026-115414 - OS Command Injection Issue in SAM CLI Terraform Hook https://aws.amazon.com/security/security-bulletins/rss/2026-145-aws/

## From the sources

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

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

Bulletin ID: 2026-145-AWS Scope: AWS Content Type: Important (requires attention) Publication Date: 10/22/2026 11:30 AM PDT

Description:

AWS SAM CLI is an open-source framework for building serverless applications. We identified CVE-2026-115414, an OS command injection issue in the Terraform hook (sam build --hook-name terraform) in AWS SAM CLI. The Terraform hook generates a Makefile recipe that interpolates a Terraform resource address without fully neutralizing shell metacharacters, which could allow an actor who can influence the Terraform configuration or plan file consumed by a build to execute arbitrary commands as the build user on the host running the build.

Impacted versions: >=1.63.0, <=1.166.1

Resolution:

This issue has been addressed in AWS SAM CLI version v1.166.2. We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes..

Workarounds:

Ensure that Terraform configuration files and plan files consumed by sam build --hook-name terraform come only from trusted sources, and audit third-party Terraform modules and shared repositories that supply input to the build. Upgrading to a fixed version is the recommended remediation.

References:

- CVE-2026-115414
- GHSA-44mq-wjrh-vpj6

Acknowledgement:

We would like to thank Shubham Raj of Cipher by Causal Security for collaborating on this issue through the coordinated vulnerability disclosure process.

 Please email aws-security@amazon.com with any security questions or concerns.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
