logo

Terraform Cloud token abuse turns speculative plan into remote code execution

ID: fe4ba1f6-02d3-526a-8ad0-707c806bf7e0

STIX ID: report--fe4ba1f6-02d3-526a-8ad0-707c806bf7e0

Feed Name: Pen Test Partners Blog

Threat Score

Date Published: 2025-08-15

Date Updated: 2026-03-24

Author: Alex Wallace

...
...

This report explains how attackers (or red teams) can leverage Terraform Cloud speculative plan runs with custom external data sources to gain remote code execution on Terraform runners, harvest injected short‑lived cloud credentials (e.g., GCP tfc-google-application-credentials/tfc-gcp-token and AWS tfc-aws-shared-config/tfc-aws-token or static IAM keys), and bypass VCS-only workflows to alter AWS/GCP infrastructure. It outlines querying workspace settings, executing a reverse shell during a plan run, exporting credentials to cloud CLIs, and recommends defenses including tightly scoped Terraform token permissions, minimizing owner roles, and enforcing Sentinel allow-lists for providers and data sources to block untrusted code execution.

Your team is not currently subscribed to this feed. You must subscribe to it in order to see this post.