There is now an attack campaign out there targeting the Python software supply chain, with evidence of successful exploitation that could affect over 170,000 users.

Victims include Top.gg GitHub organization, which has a community of over 170,000 users) and several individual developers, said researchers at Checkmarx Research.

The threat actors used multiple tactics, techniques and procedures (TTPs) in this attack, including account takeover via stolen browser cookies, contributing malicious code with verified commits, setting up a custom Python mirror, and publishing malicious packages to the PyPi registry.

Among the important points the Checkmarx researchers found in the attack include:

  • An attacker combined multiple TTPs to launch a silent software supply chain attack, stealing sensitive information from victims.
  • Multiple malicious open-source tools with clickbait descriptions ended up created by the threat actors to trick victims, most likely coming from search engines.
  • An attacker distributed a malicious dependency hosted on a fake Python infrastructure, linking it to popular projects on GitHub and to legitimate Python packages. GitHub accounts ended up taken over, malicious Python packages published, and social engineering schemes used by the threat actors.
  • The multi-stage and evasive malicious payload harvests passwords, credentials, and more dumps of valuable data from infected systems and exfiltrates them to the attacker’s infrastructure.
  • In this attack, the threat actors deployed a fake Python packages mirror, which was successfully used to deploy a poisoned copy of the popular package “colorama.”

In the advisory, the researchers said a Python developer named Mohammed Dief fell victim to a sophisticated malware attack while cloning the repository “maleduque/Valorant-Checker.”

Schneider Bold

Dief’s story is just one example of the far-reaching impact of this malware campaign. The attacker behind the campaign employed a devious strategy to spread the malware through malicious GitHub repositories.

The attack infrastructure included a website that appeared to be a Python package mirror and ended up registered under the domain “files[.]pypihosted[.]org”.

This domain selection is a clever Typosquat of the official Python mirror “files.pythonhosted.org,” as the latter is where the official artifact files of PyPi packages typically end up stored, the researchers said.

Utilize a Feature
In the attacker’s footprints, the researchers found the attackers utilized a feature in pip (package manager for Python) where you can specify a URL to grab your package dependency and use their fake Python mirror to download packages.

As a part of the attack, the threat actors took Colorama (a popular tool with 150+ million monthly downloads), copied it, and inserted malicious code. They then concealed the harmful payload within Colorama using space-padding and hosted this modified version on their typosquatted-domain fake-mirror. This strategy makes it considerably more challenging to identify the package’s harmful nature with the naked eye, as it initially appears to be a legitimate dependency.

The attacker’s reach extended beyond creating malicious repositories through their own accounts. They managed to hijack GitHub accounts with high reputations and use the resources under those accounts to contribute malicious commits, the researchers said.

One of the victims is the GitHub account editor-syntax who is also a maintainer of Top.gg GitHub organization and has write permissions to Top.gg’s git repositories.

With control over this trusted account, the attacker made a malicious commit to the top-gg/python-sdk repository using the stolen GitHub identity of editor-syntax. They added to the requirements.txt instructions to download the poisoned version of colorama from their fake Python mirror.

They also used that account to star multiple malicious GitHub repositories to increase their visibility and credibility.

‘Editor-Syntax’ Highjacked
It appears the GitHub account of “editor-syntax” appeared to end up hijacked through stolen cookies. The attacker gained access to the account’s session cookies, allowing them to bypass authentication and perform malicious activities using the GitHub UI. This method of account takeover is particularly concerning, as it does not require the attacker to know the account’s password.

The Top.gg community (which boasts over 170K members) was also a victim of this attack.

This campaign is a prime example of the sophisticated tactics employed by malicious actors to distribute malware through trusted platforms like PyPI and GitHub, the researchers said.

This incident highlights the importance of vigilance when installing packages and repositories even from trusted sources. It is crucial to thoroughly vet dependencies, monitor for suspicious network activity, and maintain robust security practices to mitigate the risk of falling victim to such attacks.

Click here for more details on the advisory.

Pin It on Pinterest

Share This