Attack scenario · Kubernetes & infrastructure

Overprivileged infrastructure automation

Why is infrastructure-as-code automation a high-value target? Terraform or CloudFormation automation runs with administrator rights across every account; whoever controls its inputs controls the organization.

Fictional, educational scenarioPrivilege takeoverUnauthorized actionsLast updated · ATT&CK v20.1

Attack path · 3 stages

  1. 1

    Influence automation inputs

    T1195.002

  2. 2

    Automation applies the change

    T1098.003T1136.003

  3. 3

    Use the backdoor across accounts

    T1078.004

For leadership

Executive summary

Infrastructure-as-code makes cloud environments reproducible and auditable, but the automation that applies it typically holds the keys to every account. If its state files, templates, module sources or runner can be influenced by a broad group, the effective number of administrators is much larger than the list in your access policy. Organizations should treat the automation pipeline, its state storage and its module sources as privileged systems. In practice that means restricting who can change them, pinning external modules to reviewed versions, requiring human approval of production plans, and giving the automation separate, narrower roles per account rather than one identity that can change everything.

For engineers

Technical summary

An automation role with AdministratorAccess in every account (often via an Organizations-wide StackSet or Terraform runner) can be abused by modifying templates, injecting malicious modules, or tampering with remote state (S3 / DynamoDB) to cause destructive or persistence-creating changes on the next apply.

Environment and assumptions

Fictional company: a Terraform runner assumes "iac-admin" (AdministratorAccess) in all accounts. State is stored in an S3 bucket writable by all engineers. Modules are referenced from a Git repository by branch name.

  • The adversary can write to the state bucket or the module repository.
  • Fictional and simplified for education.

Interactive

Attack sequence

Select a stage, or use the arrow keys, to see preconditions, evidence and controls.

Text version of the attack sequence
  1. Influence automation inputs (T1195.002). A malicious change is pushed to an unpinned module branch. Preconditions: Module referenced by mutable branch; Write access to the module repository. Evidence: Repository audit logs. Controls: Pin modules to reviewed commits / versions.
  2. Automation applies the change (T1098.003, T1136.003). On the next apply, the runner creates an IAM role trusting an external account. Preconditions: Apply runs without human review of the plan. Evidence: CloudTrail: CreateRole by iac-admin with an external trust. Controls: Plan review; permission boundary required on IaC-created roles.
  3. Use the backdoor across accounts (T1078.004). The role exists in every account the automation manages. Preconditions: Role created. Evidence: AssumeRole from unknown external account. Controls: SCP restricting trust to organization principals.

Technique mapping

MITRE ATT&CK and ATLAS techniques referenced in this scenario
IDTechniqueTactics (official)Stages
T1195.002Supply Chain Compromise: Compromise Software Supply ChainInitial Access1
T1098.003Account Manipulation: Additional Cloud RolesPersistence, Privilege Escalation2
T1136.003Create Account: Cloud AccountPersistence2
T1078.004Valid Accounts: Cloud AccountsInitial Access, Persistence, Privilege Escalation, Stealth3

Technique names and tactic assignments come from the imported MITRE data. Mapping a stage to a technique is Securitain’s analysis.

Why the attack can succeed

  • Automation runs with standing administrator rights everywhere.
  • Inputs (modules, state) are writable by many.
  • Plans are applied automatically.

What prevents or limits the attack

What may detect the attack

Detection signals and telemetry sources
SignalTelemetry sourceNotes
IAM changes by automation roles that do not match an approved planCloudTrail + pipeline records—
Writes to state storage outside pipeline runsS3 data events on the state bucket—

Telemetry only helps if it is enabled before the incident and someone acts on it. Listing a signal here does not mean it is collected or monitored in your environment.

What Securitain may assess

  • Securitain can assess todayPrivilege-escalation risk analysis for supported combinations such as iam:PassRole with Lambda, EC2, ECS or CloudFormation. Learn more
  • Securitain can assess todayEffective-permission view that considers managed, inline, group, boundary and SCP policies together. Learn more
  • Securitain can assess todayRisky trust relationship analysis, including roles trusted by external accounts and missing or unscoped ExternalId. Learn more

For leadership

Executive implications

integrity
Organization-wide infrastructure changes from a single injected change.
availability
Destructive applies can delete infrastructure at scale.

No financial loss estimates are given; impact depends on the data, contracts and regulation involved.

Next steps

  1. Restrict write access to state and module sources.
  2. Pin module versions.
  3. Require human plan approval for production.

References

MITRE ATT&CK® and ATT&CK® are registered trademarks of The MITRE Corporation. ATT&CK data © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (ATT&CK v20.1). Securitain is not affiliated with or endorsed by MITRE. Explanations, scenarios and control mappings on this page are Securitain’s own analysis. Sources and licensing

Stay in the loop

Cloud security insights, early access & compliance updates

Weekly InsightsEarly AccessExpert Content
No spam, everUnsubscribe anytimeWeekly updates
Chat with Securitain