Skip to content

Malicious hackers inserting destructive scripts into GitHub Actions flowcharts, aiming to appropriate PyPI publishing credentials.

Hackers introdced harmful software into the GitHub Actions workflows in a widespread operation, aiming to pilfer Python Package Index (PyPI) publishing credentials.

Malicious hackers inserting destructive software into GitHub Actions workflows, with the intention...
Malicious hackers inserting destructive software into GitHub Actions workflows, with the intention of stealing PyPI publishing tokens for nefarious purposes.

Malicious hackers inserting destructive scripts into GitHub Actions flowcharts, aiming to appropriate PyPI publishing credentials.

On September 5th, security researchers at GitGuardian discovered a malicious campaign targeting Python Package Index (PyPI) publishing tokens. The attack was aimed at stealing these tokens, which are crucial for publishing packages on the platform.

The malware in question was found to be injected into GitHub Actions workflows, affecting a wide variety of repositories. PyPI administrators, upon learning about the incident, collaborated closely with GitGuardian, sharing an additional Indicator of Compromise (IoC) in the form of a URL to aid the investigation.

On September 15th, PyPI invalidated all affected tokens and formally notified the project maintainers. Many maintainers proactively rotated their tokens in response to the malicious activity, and many affected projects have since reverted the changes or removed compromised workflows.

Despite the successful exfiltration of some tokens, PyPI has found no evidence of them being used to publish malicious packages or compromise accounts on the platform. This successful containment of the incident was credited to the collaboration between PyPI and the security researchers at GitGuardian.

As a precautionary measure, PyPI is strongly recommending developers to transition away from using long-lived API tokens for publishing packages. Instead, they should adopt Trusted Publishers, which utilize short-lived tokens that are automatically generated for a specific workflow run and are scoped to a particular repository. This is considered the most effective defense against such attacks.

In light of this incident, PyPI administrators have also advised all users who publish packages via GitHub Actions to implement Trusted Publishers immediately. Developers are encouraged to review their account security history on the PyPI website for any suspicious activity.

The report was submitted through PyPI's malware reporting tool. The malware in GitHub Actions was discovered by multiple security researchers who traced the vulnerability to a faulty GitHub Actions workflow using pull_request_target without proper sanitization. A more detailed email from a GitGuardian researcher was mistakenly routed to a spam folder, delaying the response until September 10th.

In conclusion, while this incident highlighted a vulnerability in the PyPI system, the swift and collaborative response from PyPI and the security researchers at GitGuardian ensured that the impact was minimised. As always, vigilance and proactive measures remain key in maintaining the security of our digital ecosystems.

Read also:

Latest