Poisoned Pipeline / Techniques / T0229
Poison the CI build cache
A CI cache is shared state that outlives the job that writes it, and
it is writable by any job in the same repository, including a job
running untrusted pull-request code. An attacker who already has code
execution in a low-value workflow can therefore place files that a
later, more privileged workflow restores — a scheduled dependency bot,
a nightly build, a release job — and have them run with that job's
credentials. Nothing about the second workflow is misconfigured; the
poison arrives through the cache restore it performs by design.
GitHub Actions makes this practical in three ways. Cache entries are
addressed by key, and a restore key matches any entry whose key starts
with it, so an attacker can claim a key that a legitimate build will
ask for later. The per-repository cache is capped at 10 GB and entries
beyond it are evicted on a least-recently-used basis, so an attacker
who writes more than the cap in one run forces the eviction of the
legitimate entries immediately and can then write under their keys —
GitHub began enforcing immediate eviction on 20 November 2025, which
turned a multi-attempt attack that had to wait for a batch job into a
single-run one. And the cache write token is the job's runtime token,
so no separate credential is needed to poison.
The technique converts "read-only token, no secrets, untrusted code in
a workflow that does not matter" into code execution in a workflow
that does have secrets. It is distinct from T0198, where the malicious
build-time code comes from a package registry; here every artifact is
produced inside the repository that consumes it. It is distinct from
T0122 and T0158, which are flaws in a third-party action or a reusable
template; the workflow and the cache are the project's own.
Where this idea came from
From Adnan Khan's 3 March 2026 account of the angular/dev-infra chain, where script injection in a pull_request_target test workflow wrote more than the repository's 10 GB cache cap to force immediate LRU eviction and then claimed the node_modules keys the scheduled ng-renovate job restores, so the attacker's code ran in a job holding a bot PAT. GitHub's 20 November 2025 change to immediate eviction made the flood-and-claim possible in one run. Distinct from T0198, where the malicious build-time code comes from a registry, and from T0122 and T0158, which are flaws in someone else's action.
- https://adnanthekhan.com/posts/angular-compromise-through-dev-infra
- https://adnanthekhan.com/2024/05/06/the-monsters-in-your-build-cache-github-actions-cache-poisoning/
Mitigations
None linked yet.
Detections
None linked yet.