Attack scenario · AWS identity & access

Compromised deployment pipeline role

What can an attacker do with a compromised CI/CD deployment role in AWS? A CI/CD system that deploys to production with a broad role becomes a path from a code repository to production infrastructure.

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

Attack path · 4 stages

  1. 1

    Run code inside the pipeline

    T1195.002

  2. 2

    Obtain the deployment role

    T1078.004

  3. 3

    Create persistence

    T1098.003T1136.003

  4. 4

    Tamper with production

    T1525T1530

For leadership

Executive summary

Deployment pipelines need powerful access to production, which makes them one of the most valuable targets in a modern engineering organization. If anyone who can open a pull request, change a workflow file or compromise a build dependency can cause the pipeline to run arbitrary commands, then the pipeline’s AWS role effectively belongs to them. The safeguards are well understood — federated short-lived credentials, trust limited to protected branches, separate roles per stage, and review of who can change pipeline definitions — but they are frequently skipped during fast growth.

For engineers

Technical summary

Workflows with stored long-term keys, or OIDC trust policies that accept any branch or repository (wildcard sub claims), allow untrusted code to obtain the deployment role. That role typically holds CloudFormation, IAM and compute permissions sufficient for escalation.

Environment and assumptions

Fictional company: a GitHub-style CI system assumes "prod-deploy" through OIDC. The role trust policy accepts any branch of the repository (sub = repo:org/app:*) and the role has AdministratorAccess so that infrastructure changes "never fail".

  • An adversary can run code in a CI job (malicious pull request from a fork with misconfigured triggers, compromised dependency, or a stolen developer token).
  • The OIDC trust is not limited to protected branches or environments.
  • Fictional and simplified for education.

Interactive

Attack sequence

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

Stage 1

Run code inside the pipeline

A malicious change or dependency executes during a build.

Preconditions
  • Untrusted code can run in a job that can request the deployment role
Required access
  • Ability to trigger a workflow.
Potential evidence
  • CI audit logs; unusual workflow runs on unprotected branches
Defensive controls
  • Restrict which events/branches can access deployment credentials
  • Dependency pinning and review
Text version of the attack sequence
  1. Run code inside the pipeline (T1195.002). A malicious change or dependency executes during a build. Preconditions: Untrusted code can run in a job that can request the deployment role. Evidence: CI audit logs; unusual workflow runs on unprotected branches. Controls: Restrict which events/branches can access deployment credentials; Dependency pinning and review.
  2. Obtain the deployment role (T1078.004). The job exchanges its OIDC token for the production role’s credentials. Preconditions: Trust policy accepts the job’s token claims. Evidence: CloudTrail: AssumeRoleWithWebIdentity with an unexpected sub claim (branch or repository). Controls: Trust policy conditions on exact sub / environment claims.
  3. Create persistence (T1098.003, T1136.003). Using administrator rights, the adversary creates a role trusting their own account. Preconditions: IAM write on the deployment role. Evidence: CloudTrail: CreateRole / UpdateAssumeRolePolicy by the deploy role outside a deployment. Controls: Permission boundaries for pipeline-created roles; Alerting on IAM changes by pipeline identities outside releases.
  4. Tamper with production (T1525, T1530). The adversary pushes a modified container image or reads production data. Preconditions: Write access to ECR / data access. Evidence: ECR PutImage outside releases; data access by the deploy role. Controls: Separate build and deploy roles; Image signing and verification.

Technique mapping

MITRE ATT&CK and ATLAS techniques referenced in this scenario
IDTechniqueTactics (official)Stages
T1195.002Supply Chain Compromise: Compromise Software Supply ChainInitial Access1
T1078.004Valid Accounts: Cloud AccountsInitial Access, Persistence, Privilege Escalation, Stealth2
T1098.003Account Manipulation: Additional Cloud RolesPersistence, Privilege Escalation3
T1136.003Create Account: Cloud AccountPersistence3
T1525Implant Internal ImagePersistence4
T1530Data from Cloud StorageCollection4

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

  • The trust policy authenticates "a job from this repository", not "a reviewed release from the protected branch".
  • One all-powerful role serves every pipeline stage.
  • Pipeline activity is assumed to be legitimate and rarely alerted on.

What prevents or limits the attack

What may detect the attack

Detection signals and telemetry sources
SignalTelemetry sourceNotes
AssumeRoleWithWebIdentity with unexpected sub / ref claimsCloudTrail management events—
IAM or ECR changes by the deploy role outside release windowsCloudTrail management events—
Workflow runs on unprotected branches requesting deploy credentialsCI audit logs—

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 todayEffective-permission view that considers managed, inline, group, boundary and SCP policies together. Learn more
  • 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 todayRisky trust relationship analysis, including roles trusted by external accounts and missing or unscoped ExternalId. Learn more

For leadership

Executive implications

integrity
Production software and infrastructure can be modified, potentially affecting customers.
confidentiality
Production data reachable by the deploy role may be read.
compliance
Change-management controls are bypassed.

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

Next steps

  1. Review every OIDC provider trust policy for wildcard sub claims.
  2. Remove AdministratorAccess from deployment roles; split per stage.
  3. Require protected environments for production deploy credentials.

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