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.
§ Context
Assumed environment: open-source repo with CI logs left public. At least one PR or merge introduced a debug step that dumped environment variables.
§ Steps
- 01Authenticate to cloudInitial AccessT1078— Valid Accounts
- 02Enumerate IAM / projectDiscoveryT1087— Account Discovery
- 03Search public CI logs for AWS_/AZURE_/GCP_ patternsReconnaissanceW-RECON-GITHUB-DORK— GitHub / GitLab Dorking
- 04Mass data exfilCollectionC-S3-EXFIL— S3 / Blob / GCS Mass Exfil
- 05Privilege escalation (PassRole / SA impersonation)Privilege EscalationC-AWS-IAM-PASSROLE— AWS iam:PassRole Chain
- 06Identify leaked credentialCredential AccessCI-SECRET-IN-LOG— Secret Echo to Build Log
§ References
- T1078Valid Accounts
- T1087Account Discovery
§ Frequently asked
- What is the "Secret echoed to public build log → cloud takeover" attack path?
- 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. It chains 6 steps drawn from real-world offensive-security techniques.
- What starting position does this attack require?
- The first step is Authenticate to cloud (T1078) — a initial access primitive. Assumed environment: open-source repo with CI logs left public.
- What is the final impact of this kill-chain?
- The final step lands on Identify leaked credential (CI-SECRET-IN-LOG), which falls under Credential 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
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 techniques3
Slack token in CI log → DM history → vendor mailbox compromise
A CI run echoed a Slack xoxb-/xoxp- token. Use it to read DMs, harvest password-reset links and vendor invitations, pivot into the corporate mailbox.
- Shared techniques3
Self-hosted runner takeover → persistent CI compromise
A public repo with self-hosted GitHub runners accepts external PRs. First malicious PR runs on the runner; the workflow drops a runner-hook that fires before every future job.
- Shared techniques3
pull_request_target injection → secrets → cloud takeover
A GitHub Actions workflow runs on pull_request_target and checks out the PR's head SHA. The attacker's PR injects code that runs with the base repo's secrets, including a cloud deploy role.
- Shared techniques3
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.
- Shared techniques2
Stolen credentials → no-MFA Snowflake → mass tenant exfil (2024)
Infostealer logs from third-party machines yielded credentials for many Snowflake tenants. Tenants without enforced MFA / IP allow-lists were directly queried; dozens of customer data sets exfiltrated.