CVE-2026-115414 in SAM CLI
Summary
by MITRE • 10/23/2026
OS command injection in the Terraform hook in AWS SAM CLI before 1.166.2 might 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 via a crafted Terraform resource address.
To remediate this issue, users should upgrade to version 1.166.2 or later.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 10/23/2026
The vulnerability identified in AWS SAM CLI prior to version 1.166.2 represents a critical OS command injection flaw within the Terraform hook component. This security defect arises from insufficient sanitization of user-supplied input when processing Terraform configuration files and plan outputs during the build process. Specifically, an attacker who possesses the ability to influence or inject content into the Terraform configuration or plan file consumed by the SAM CLI can exploit this weakness to execute arbitrary operating system commands with the privileges of the build user on the host machine where the build is being executed. The root cause lies in how the hook parses and handles resource addresses within the Terraform artifacts, allowing maliciously crafted strings to be interpreted as executable shell commands rather than static configuration data.
From a technical perspective, this vulnerability falls under the category of CWE-78 Improper Neutralization of Special Elements used in an OS Command, commonly known as OS command injection. The flaw is particularly dangerous because it leverages the trusted relationship between the CI/CD pipeline and the build environment. When SAM CLI processes Terraform files to deploy infrastructure-as-code resources, it invokes underlying system commands or scripts that process these configurations. If the input validation logic fails to properly escape or filter special characters such as semicolons, pipes, or backticks within a crafted resource address, the shell interprets these sequences as command terminators and new instructions. This allows an adversary to chain arbitrary commands following the legitimate execution flow of the Terraform hook, effectively bypassing any intended sandboxing or isolation mechanisms provided by the build environment.
The operational impact of this vulnerability is severe, potentially leading to full compromise of the build host and subsequent lateral movement within the organization's infrastructure. An attacker who can inject malicious content into a pull request, branch, or shared configuration repository could trigger the SAM CLI during an automated build process. Upon execution, the injected commands would run with the permissions assigned to the CI/CD service account or user. This access level often includes read and write privileges to sensitive source code repositories, cloud provider credentials stored in environment variables, internal network resources, and other secrets managed by the pipeline. Consequently, this can result in data exfiltration, deployment of backdoors, modification of infrastructure configurations to create persistent access points, or disruption of service availability through destructive commands.
This attack vector aligns with MITRE ATT&CK technique T1059 Command and Scripting Interpreter, specifically sub-techniques involving shell execution such as sh or bash depending on the underlying operating system. It also relates to supply chain attacks where trust in third-party configurations is exploited. The vulnerability highlights the risks associated with integrating infrastructure-as-code tools into automated pipelines without rigorous input validation at every stage of data ingestion. Attackers often target these integration points because they offer high-privilege execution contexts that are difficult to monitor and restrict effectively once compromised.
To remediate this issue, organizations must immediately upgrade AWS SAM CLI to version 1.166.2 or any later release where the input sanitization logic has been corrected. In addition to upgrading, teams should implement strict validation rules for all Terraform configuration files processed by automated pipelines, ensuring that only expected and whitelisted characters are permitted in resource addresses and other dynamic inputs. It is also advisable to enforce least-privilege principles for CI/CD service accounts, limiting their ability to execute arbitrary commands or access sensitive secrets unless explicitly required for specific tasks. Regular auditing of pipeline configurations and dependency updates further reduces the attack surface associated with such integration points.