GitHub Actions Cache Exposes Credentials to Attackers
Cached files can leak authentication tokens to unauthorized users, including through pull requests from forks.
Updated on Nov. 20, 2026 in Cybersecurity

GitHub Actions cache functionality, which reduces build times, can allow unauthorized access to sensitive credentials stored in cached paths. Attackers can restore a cache containing authentication tokens and exfiltrate them for long-term use.
Why it matters
Developers sometimes include sensitive files such as home directories or workspace folders in cached paths, and many secrets remain valid for years after exposure. Because the cache is shared more broadly than the secrets themselves, a single misconfiguration can extend risk well beyond the original repository.
Docker, the Amazon Web Services command-line interface and various package managers often store authentication tokens in default locations that are frequently cached by mistake. Malicious actors can reach that cached data through a fork's pull request without holding any repository secrets.
The players
GitHub Actions
GitHub Actions is the continuous integration and automation service built into GitHub that runs software build and test workflows.
The details
An attacker can restore a cache containing credentials and exfiltrate them, and pull requests from forks restore caches from the base branch. Developers inadvertently include sensitive files in cached paths, which exposes tokens stored in default locations for tools such as Docker and the AWS CLI.
Under the Hood
The GitHub Actions cache feature, built to shorten build times, now shows how a performance optimization can widen the attack surface for software supply chains. Each cache shared between a base branch and its forks carries the same credential risk as the files developers place in it.
Developers who use GitHub Actions should review which files their workflows cache, especially home directories and tool configuration folders. Removing sensitive token paths from cache configurations reduces the chance that stored credentials are restored by an unauthorized pull request.
The takeaway
Caching speeds up builds, but any file in a cached path should be treated as potentially readable by anyone who can open a pull request. Excluding credential directories from caches and rotating any secrets that may have been stored there are practical steps developers can take now.
Further reading
Explore more Cybersecurity coverage to see how credential leaks like this one are being addressed across developer platforms.
Source note: This article includes information reported by SC Media.



