Public bucket → CI/CD secret leak → cloud takeover
A public S3 bucket hosts a build artefact containing CI tokens / .env files. Use them to push to the prod CI/CD pipeline and gain a deploy role.
§ Context
Assumed environment: attacker found a publicly readable S3 bucket. The org leaks build artefacts and previously embedded secrets in them.
§ Steps
- 01Authenticate to CI/CD (GitHub / GitLab)Initial AccessT1078— Valid Accounts
- 02Grep artefacts for credentialsReconnaissanceW-RECON-JS-SECRETS— Hardcoded Secrets in JS Bundles
- 03Find public bucketReconnaissanceC-PUBLIC-BUCKET-HUNT— Public Bucket Hunting
- 04ListObjects on bucketCollectionC-S3-EXFIL— S3 / Blob / GCS Mass Exfil
- 05Workflow exfils IAM credentialsCredential AccessC-IMDS-V1— IMDSv1 Credential Theft
- 06Escalate to admin via iam:PassRolePrivilege EscalationC-AWS-IAM-PASSROLE— AWS iam:PassRole Chain
- 07Push attacker workflow that runs against AWS roleInitial AccessC-ENV-LEAK-PIPELINE— CI/CD Pipeline Secret Leak
§ References
- T1078Valid Accounts
§ Frequently asked
- What is the "Public bucket → CI/CD secret leak → cloud takeover" attack path?
- A public S3 bucket hosts a build artefact containing CI tokens / .env files. Use them to push to the prod CI/CD pipeline and gain a deploy role. It chains 7 steps drawn from real-world offensive-security techniques.
- What starting position does this attack require?
- The first step is Authenticate to CI/CD (GitHub / GitLab) (T1078) — a initial access primitive. Assumed environment: attacker found a publicly readable S3 bucket.
- What is the final impact of this kill-chain?
- The final step lands on Push attacker workflow that runs against AWS role (C-ENV-LEAK-PIPELINE), which falls under Initial Access. From here, an operator typically pivots into post-exploitation or maintains persistence.
- How can defenders detect or prevent this attack?
- Detection and prevention vary per step. Refer to each linked MITRE ATT&CK entry under "References" — every technique on that page lists defensive controls, detection telemetry, and known threat-actor usage.
§ Related dossiers
- Shared techniques3
Secret echoed to public build log → cloud takeover
A workflow accidentally runs `env` or `set -x` during debugging — the AWS access key is now in public CI logs and indexed by Google Cache / GitHub search.
- Shared techniques2
Dev workstation → cloud backup keys → encrypted vault store (LastPass 2022)
Attacker compromised a single LastPass DevOps engineer's home machine via outdated Plex Media Server, harvested AWS keys for the encrypted-vault backup bucket, exfiltrated production vault data.
- Shared techniques2
WAF SSRF → IMDS → S3 mass exfil (Capital One 2019)
A misconfigured ModSecurity rule on a customer-facing app allowed SSRF; SSRF hit EC2 IMDSv1 for the instance role; the role had ListBucket + GetObject on a major customer-data bucket.
- Shared techniques2
SSRF → IMDS → AssumeRole chain → Org admin
A web SSRF leaks the EC2 instance role; iam:PassRole + sts:AssumeRole hops across two member accounts land you with AdministratorAccess in the organisation's management account.
- Shared techniques2
Source map exposure → API key leak → cloud takeover
Public *.js.map files reveal un-minified source and inline-committed API keys (cloud provider, third-party services). Use the keys directly.