A software engineer discovered roughly 35,000 malicious clones of official GitHub project repositories. The repos were replicated almost entirely, except for one thing: the clones had been spiked with malicious code to compromise unsuspecting developers.
Cloning open-source GitHub repositories is common among developers. Injecting malicious code into popular project clones could break new grounds for cyberattacks, as identifying malware-ridden repos is no easy task.
Software engineer Stephen Lacy yesterday disclosed a “massive widespread malware attack” on GitHub that targeted some 35,000 repositories. The tweet mentioned popular projects seemingly afflicted by the hack, including python, js, docker, k8s, bash, crypto and golang.
However, it turns out that none of the mentioned projects fell prey to the newly discovered threat. Perpetrators likely chose popular, legitimate projects to clone and inject with malicious code in hopes of reaching a broad audience.
Although the hundreds of repositories replicated as part of the attack are pristine, the discovery still holds great significance. Upon being notified by Lacy, GitHub promptly removed most of the malware-laced repo clones from its platform and tweeted a statement:
GitHub is investigating the Tweet published Wed, Aug. 3, 2022:
* No repositories were compromised
* Malicious code was posted to cloned repositories, not the repositories themselves
* The clones were quarantined and there was no evident compromise of GitHub or maintainer accounts
“This attack will send the ENTIRE ENV of the script, application, laptop (electron apps), to the attacker's server,” Lacy warns. “ENVs include security keys, AWS access keys, crypto keys, and much more,” the engineer further clarifies.
To make matters worse, cloned repositories that contain the malicious code also host a one-line backdoor able to inject arbitrary shells on compromised systems, according to developer James Tucker.
Lacy’s proposed mitigation strategy for this attack is GPG-signing commits on GitHub. Although this may sound like a good idea, Go crypto maintainer Filippo Valsorda begs to differ.
“This is something you'd want to solve with SSH signatures or sigstore's gitsign, not age,” Valsorda tweeted. “Not that I believe in commit signing, to be honest, but that's a broader debate. I'll point out that GPG signing didn't stop this attack even in repositories that do it.”