GitHub Actions cache functionality, while designed to improve development efficiency by reducing build times, presents a significant security vulnerability that allows unauthorized access to sensitive credentials, according to a recent report by HackRead.
The vulnerability stems from the way GitHub handles pull requests from forks. Because these requests can restore caches from the base branch, malicious actors can access cached data even without direct access to repository secrets. The risk is compounded when developers inadvertently include sensitive files in cached paths, such as home directories or workspace folders. Common tools like 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. Once an attacker restores a cache containing these credentials, they can exfiltrate them for long-term use, as many secrets remain valid for years after initial exposure. To mitigate these risks, organizations should avoid caching broad directories, implement OpenID Connect for temporary credentials and require manual approval for workflows initiated by external contributors. Treating all cached paths as publicly readable is essential for maintaining a secure development environment, as the cache is shared more broadly than the secrets themselves.
Source: HackRead

