Back to all lessons
Awareness Lessons
2 months ago

GitHub Actions Introduces Cache-Mode to Mitigate Cache Poisoning in CI/CD Pipelines

Written by AI from the linked story. Not reviewed by an editor. How this works

Cache poisoning attacks in CI/CD pipelines allow adversaries to inject malicious artifacts into shared build caches, which are then unknowingly consumed by subsequent workflow jobs — as seen in the Ultralytics PyPI and TanStack npm supply chain compromises. The root issue stems from insufficient access controls and configuration defaults that permit untrusted workflows to write to shared caches, creating a vector for software supply chain attacks. GitHub's new 'cache-mode' setting is a critical configuration hardening measure, but its value is only realized when developers actively adopt and configure it correctly. This incident highlights how CI/CD infrastructure, often treated as a development convenience rather than a security boundary, is an increasingly attractive target for threat actors seeking to poison software at the build stage.

Tactical Insight

Immediate actions

  • Enable and configure the new GitHub Actions `cache-mode` setting in all existing workflows to restrict untrusted write access to the Actions cache.
  • Audit current CI/CD pipeline cache configurations to identify workflows that permit cross-job or cross-fork cache writes.
  • Pin all third-party GitHub Actions to a specific commit SHA rather than a mutable tag to prevent dependency substitution.

Long-term improvements

  • Adopt a principle of least privilege for CI/CD pipeline permissions, granting only the minimum required scopes to tokens and workflows.
  • Implement a formal Software Supply Chain security policy that includes regular review of all build dependencies, caching strategies, and third-party actions.
  • Integrate Software Composition Analysis (SCA) tools into pipelines to automatically detect tampered or unexpected build artifacts before deployment.

Detection measures

  • Enable detailed audit logging for all GitHub Actions workflow runs and cache interactions, and forward logs to a centralized SIEM for anomaly detection.
  • Set up alerting for unexpected changes in build artifact hashes or checksums to detect potential cache poisoning attempts early.
  • Monitor public threat intelligence feeds for newly disclosed CI/CD and package registry supply chain compromises affecting your dependency ecosystem.

Back this up with a control

All controls and vendors

Training helps people spot this. These controls make the attack fail even on the day someone does not.