The popular Python package repository PyPI was found hosting AWS keys and malware, putting countless Python developers at risk of serious supply chain attacks.
The results come courtesy of software developer Tom Forbes, who built a tool using Rust which scanned all new packages on PyPI for AWS API keys.
The tool came back with 57 positive results, including some from Amazon, Intel, Stanford, Portland, and Louisiana University, the Australian Government, General Atomics fusion department, Terradata, Delta Lake, and Top Glove.
Minimizing the damage
“This report contains the keys that have been found, as well as a public link to the keys and other metadata about the release,” Forbes said. “Because these keys are committed to a public GitHub repository, Github’s Secret Scanning service kicks in and notifies AWS that the keys are leaked.”
Consequently, AWS notifies the developer of the leak and quarantines it to minimize the damages. The problem is that a tool such as this one was relatively easy to build, and while Forbes might be benign in his intentions, others may not be. Speaking to The Register, he said different keys may cause different levels of pain:
“It depends on the exact permissions given to the key itself,” Forbes explained. “The key I found leaked by InfoSys [in November] had ‘full admin access’ which means it can do anything, and other keys I found in PyPI were ‘root keys’ which are also allowed to do anything. An attacker holding these keys would have full access to the AWS account it is linked to.”
He added that GitHub’s automated key scanning is a positive step forward, but not enough to tackle the problem in its entirety:
“GitHub also cares a lot about supply chain security but they have dug themselves a hole: The way they scan for secrets involves a lot of collaboration with vendors who may disclose internal information about how keys are constructed to GitHub,” he said. “This means that the regular expressions that GitHub uses to scan for secrets cannot be made public and are sensitive, which also means that third parties like PyPI are effectively unable to utilize this awesome infrastructure without sending every bit of code published on PyPI to GitHub.”
While he did blame PyPI, saying the platform could do more to protect its users, he also said developers should take some responsibility for the security of their solutions. What’s more, AWS should be a part of the solution, as well, he added: “AWS has some blame to share here as well: IAM is notoriously difficult to debug and get right which leads to overly wide permissions being granted on keys.”
To protect against supply chain attacks via PyPI, Forbes says organizations should reconsider their security policies.
Check out our rundown of the best endpoint protection tools right now
Via: The Register