All vulnerabilities
HIGHSupply chainexploited in the wild

SC-GHA-CACHE-POISON-2024

CI/CD · GitHub Actions · GitHub Actions cache poisoning

Summary

GitHub Actions cache poisoning abuses the fact that the Actions cache is shared across a repository's branches and is not integrity-validated against the producer, so a low-privileged context can plant a payload that a trusted context later restores and executes. Cache entries are keyed and versioned only by client-side computation, the branch-scoping boundary is not enforced server-side, and the restore step extracts the cached tarball without verifying that the restored files match what was originally cached. An attacker who gains code execution on a fork or low-privilege branch (commonly via script injection through untrusted inputs like github.head_ref in a pull_request_target workflow) writes a malicious entry under a key that a higher-privilege workflow on a protected branch will restore, gaining code execution in the trusted context and access to its secrets. The runtime cache token remaining valid after job completion and the per-repo eviction limit widen the window, letting the attacker evict legitimate entries and substitute poisoned ones. Adnan Khan documented the class on May 6, 2024 and built the Cacheract tool, with confirmed findings in projects including angular/components, mdn/content, hyperledger/besu and a later full chain in angular/dev-infra that exposed an admin-scoped GitHub App token.

How to avoid it in your code

  • Treat the cache as untrusted input; verify artifact integrity (checksums/signatures) before using restored caches.
  • Do not let untrusted fork or PR workflows write to caches shared with protected branches.
  • Avoid script injection: never interpolate github.head_ref or other untrusted inputs into run steps.
  • Restrict GITHUB_TOKEN to read-only and remove actions:write where cache writes are not required.
  • Isolate or namespace caches per trust boundary and rebuild release dependencies from scratch.

References

Related vulnerabilities

All Supply chain →