Recent research has uncovered a serious security flaw within GitHub Actions artifacts that poses a risk of unauthorized access to tokens and secrets in CI/CD pipelines.
Misconfigured workflows in public repositories of prominent organizations have inadvertently revealed sensitive information. This exposure not only threatens cloud environments but also opens the door for attackers to inject malicious code into production systems.
The exploitation of leaked GitHub tokens could allow attackers to manipulate repositories and access additional secrets, underscoring the urgent need for stringent security measures regarding artifact management to safeguard software supply chains.
A researcher developed an automated method to download and examine artifacts from well-known open-source projects, revealing that these artifacts might contain sensitive data like secrets. The investigation highlighted a major security issue, with artifacts from significant tech and open-source projects disclosing secrets that could affect millions of users.
Abuse of Leaked GitHub Tokens
It has been revealed that GitHub tokens, notably GITHUB_TOKEN and ACTIONS_RUNTIME_TOKEN, were inadvertently exposed in public artifacts due to common workflow practices. The actions/checkout action, by default, retains the GITHUB_TOKEN in the .git directory, which is frequently uploaded as part of artifacts.
Additionally, the super-linter tool previously recorded environment variables, including tokens, into a file that was also included in artifacts, further exposing these sensitive tokens. Attackers have exploited these vulnerabilities by targeting the temporary GITHUB_TOKEN and the less-documented ACTIONS_RUNTIME_TOKEN, developing methods to extract these tokens from workflow artifacts.
They also automated the replacement of legitimate artifacts with malicious ones to enable remote code execution on active systems. Moreover, a new attack vector was identified with GitHub’s artifact download feature, which permitted the extraction and use of GITHUB_TOKEN before its expiration, enabling unauthorized code pushes to repositories.
By examining open-source projects that used the deprecated upload-artifact@v3 action and their workflow permissions, several instances of exposed GITHUB_TOKEN secrets were found. Although initial attempts were hindered by token expiration, attackers succeeded in exploiting workflows with subsequent steps after artifact upload, allowing them to use a valid token to create branches in projects like Clair, demonstrating the potential for unauthorized code changes in open-source repositories.
An attacker optimized this approach with the development of RepoReaper, a GitHub Actions workflow that monitors repositories for workflow runs, quickly downloads and extracts leaked tokens from artifacts, and then uses them to create malicious branches through the GitHub REST API, compromising target repositories.
This method leverages GitHub’s infrastructure for rapid execution, bypassing rate limits and certificate verification for enhanced impact.
A researcher from Palo Alto Networks identified this vulnerability, revealing how sensitive information leakage through GitHub Actions artifacts has jeopardized numerous high-profile projects. By analyzing artifacts for secrets before their upload, a custom action was created to prevent accidental exposure, emphasizing the critical need for artifact scanning and the adoption of a comprehensive security strategy, including least privilege permissions and thorough CI/CD pipeline reviews to mitigate risks.



