Privilege escalation in Terraform can happen fast, without warning, and often without a clear trail. One wrong IAM policy, one overlooked role assumption, and an attacker can move from limited access to full control over your cloud environment.
Terraform manages infrastructure as code. This means every definition of users, roles, and permissions is executed exactly as scripted. If a configuration grants excessive privileges, even briefly, it can be exploited. Misconfigurations aren’t rare—they are common, especially in large projects with multiple contributors.
Common privilege escalation paths in Terraform:
- Overly broad IAM roles: Granting
*access allows full control over services. - Role chaining: Allowing a role to assume another with greater privileges without strict limits.
- State file leaks: Terraform state files often contain sensitive outputs, including credentials.
- Policy attachment drift: Old roles retaining outdated or insecure policies.
Attackers and insiders both look for these openings. Once they gain a foothold, escalation allows deeper access: creating admin accounts, changing network rules, disabling logs. In many cases, these changes persist beyond detection windows.