A newly found assault vector in GitHub Actions artifacts dubbed ArtiPACKED might be exploited to take over repositories and acquire entry to organizations’ cloud environments.
“A mix of misconfigurations and security flaws could make artifacts leak tokens, each of third get together cloud providers and GitHub tokens, making them out there for anybody with learn entry to the repository to devour,” Palo Alto Networks Unit 42 researcher Yaron Avital stated in a report printed this week.
“This permits malicious actors with entry to those artifacts the potential of compromising the providers to which these secrets and techniques grant entry.”
The cybersecurity firm stated it primarily noticed the leakage of GitHub tokens (e.g., GITHUB_TOKEN and ACTIONS_RUNTIME_TOKEN), which couldn’t solely give malicious actors unauthorized entry to the repositories, but additionally grant them the flexibility to poison the supply code and get it pushed to manufacturing through CI/CD workflows.
Artifacts in GitHub enable customers to share information between jobs in a workflow and persist that data after it has been accomplished for 90 days. This could embrace builds, log recordsdata, core dumps, take a look at outputs, and deployment packages.
The security drawback right here is that these artifacts are publicly out there for anybody within the case of open-source initiatives, making them a precious useful resource for extracting secrets and techniques like GitHub entry tokens.
Significantly, the artifacts have been discovered to reveal an undocumented surroundings variable known as ACTIONS_RUNTIME_TOKEN, which has a lifespan of about six hours and might be used to substitute an artifact with a malicious model earlier than it expires.
This might then open an assault window for distant code execution when builders straight obtain and execute the rogue artifact or there exists a subsequent workflow job that is configured to run based mostly on beforehand uploaded artifacts.
Whereas GITHUB_TOKEN expires when the job ends, enhancements made to the artifacts characteristic with model 4 meant that an attacker might exploit race situation situations to steal and use the token by downloading an artifact whereas a workflow run is in progress.
The pilfered token might be subsequently used to push malicious code to the repository by creating a brand new department earlier than the pipeline job ends and the token is invalidated. Nonetheless, this assault banks on the workflow having the “contents: write” permission.
Quite a few open-source repositories associated to Amazon Internet Companies (AWS), Google, Microsoft, Pink Hat, and Ubuntu have been discovered vulnerable to the assault. GitHub, for its half, has categorized the problem as informational, requiring that customers take it upon themselves to safe their uploaded artifacts.
“GitHub’s deprecation of Artifacts V3 ought to immediate organizations utilizing the artifacts mechanism to reevaluate the best way they use it,” Avital stated. “Neglected components like construct artifacts usually change into prime targets for attackers.”