Security researchers at Checkmarx are warning of a new supply chain attack technique that relies on spoofed commit metadata to add legitimacy to malicious GitHub repositories.
Open source software helps developers create applications faster, and many of them may skip proper auditing of the third-party code if they believe it comes from a trustworthy source. For example, they may choose actively maintained GitHub repositories or ones that have reputable individuals as contributors.
According to Checkmarx, threat actors could forge some of the data associated with GitHub repositories to enhance their track record and make them more likely to be selected by application developers.
Specifically, the researchers discovered that one could tamper with commit metadata so that a repository would appear to be older than it actually is, or that reputable contributors have been involved in its maintenance.
Commits are essential to the Git version control system: they record changes made to files, when these changes were made, and who made them. Each commit has a unique ID, or hash.
According to Checkmarx, however, one can manipulate the timestamps associated with commits in such a manner that the timestamps listed on GitHub could predate the creation of both the user committing, and that of the repository the change was made to.
Fake commits can be automatically generated and are automatically added to the user’s GitHub activity graph, which could allow a malicious user to make it look as if they have been active on the code hosting platform for a very long time.
“Since the activity graph displays activity on both public and private repositories, it is impossible to discredit these fake commits and therefore this deception technique can be hard to detect as well,” Checkmarx says.
Furthermore, the researchers discovered that the identity of the committer can be spoofed, to attribute the commit to a real GitHub account, such as a top contributor on the platform.
For that, a malicious user would need to retrieve the target account’s email address – which would normally be hidden, if the developer opted into the feature – and use specific commands to set the username and email in the Git CLI to those of the spoofed user. While this increases the reputation of the GitHub repository, the spoofed user is never notified of their name being used.
“To make their project look reliable, attackers can use this technique once or multiple times and populate their repository’s contributors section with known reliable contributors which in turn make the project looks trustworthy,” Checkmarx notes.
GitHub users can use the Commit Signature Verification feature to cryptographically sign their commits, but unsigned commits are not flagged.
According to Checkmarx, users can enable a ‘vigilant mode’, where the verification status of all of their commits is displayed, thus increasing the effectiveness of the feature.
“Fake metadata can mislead developers to use code they would knowingly not have used and can potentially encompass malicious code. The lack of validation of the committer identity and the commit’s timestamp is an issue by itself, but it also enables ill-wished actors to leverage it to gain credibility to their users and repositories,” Checkmarx concludes.
Related: Researchers Flag ‘Significant Escalation’ in Software Supply Chain Attacks
Related: Checkmarx Finds Threat Actor ‘Fully Automating’ NPM Supply Chain Attacks
Related: Software Supply Chain Attacks Tripled in 2021: Study