RSS
Логотип
Баннер в шапке 1
Баннер в шапке 2

PyPI (Python Package Index)

Product
Developers: Python Software Foundation
Last Release Date: 2023/04/23
Branches: Internet services
Technology: Application Development Tools

Content

The main articles are:

The Python Package Index (PyPI) storage software is for the language. programming Python PyPI helps to find and install, software developed and distributed by the Python community.

2023: Ability to publish packages without binding to API passwords and tokens

April 23, 2023 it became known that in the repository of Python PyPI packages (Python Package Index) provides the ability to use a secure method of publishing packages, which allows you to do without saving to external systems (for example, GitHub in Actions) fixed passwords and tokens of access to. API This method authentications is called Trusted Publishers and is designed to solve the problem with the publication of malicious updates carried out as a result of compromising external systems and falling into the hands of intruders of predetermined passwords or tokens.

The authentication method is based on the OpenID Connect (OIDC) standard, which implies the use of time-limited authentication tokens exchanged between external services and the PyPI directory to confirm the packet publishing operation instead of using the traditional login/password or manually generated permanent API access tokens. The ability to use the Trusted Publishers mechanism has already been implemented for handlers running in GitHub Actions. In the future, support for Trusted Publishers is expected to be implemented for other external services.

Accompanying packets can on the PyPI side display a sign of trust in the identifiers provided to external OpenID providers (IdP, OpenID Connect Identity Provider), which the external service will use to request short-lived tokens from PyPI. The generated OpenID Connect tokens confirm the relationship between the project and the handler, which allows PyPI to perform additional metadata verification, for example, to verify that the published package relates to a specific repository. Tokens are not saved, bound to specific APIs and automatically cease to operate after a short lifetime has elapsed.

Additionally, we can note the Sonatype report with information on the detection of 6933 malicious packets in the PyPI directory in March 2023. In total, since 2019, the number of malicious packets detected in PyPI has exceeded 115 thousand. Most malicious packages are disguised as popular libraries using typesquoting (assigning similar names that differ in individual characters, for example, exampl instead of example, djangoo instead of django, pyhton instead of python, etc.) - attackers count on inattentive users who made a typo or did not notice any differences in the name when searching. Malicious actions usually boil down to sending confidential data found on the local system as a result of determining typical files with passwords, access keys, crypto wallets, tokens, session Cookies and other confidential information[1].

2022

Distribute phishing packets through the repository

On December 15, 2022, it was reported that a campaign to distribute phishing packets was discovered by analysts from Checkmarx and Illustria, who worked together to investigate the incident. According to experts, the packages were downloaded from accounts using a certain naming scheme, had similar descriptions and led to the same cluster of 90 domains, on which more than 65,000 phishing pages were posted. The sites had fake apps, polls, promo codes and more. In some cases, there were referral links for AliExpress.

More phishing packets were downloaded to NuGet - 136,258, to PyPI - 7,894 packets, and to NPM - only 212.

Malware Download Statistics (Checkmarx)
Illustration: securitylab.ru

The URLs of phishing sites were inserted into the package description in order for links to raise phishing sites in the issue. Package descriptions urge users to click on links to get more information about applications, various tools for generating codes, applications, etc.

Description of one of the phishing packets (Checkmarx)
Illustration: securitylab.ru

In some cases, attackers advertised fake Steam gift card generators, Playstation Network electronic gift card codes, subscriber cheating services on various platforms. But to use them, the victim must enter his email, as well as the login and password for his account on the service/site. This is how cybercriminals collect victim data in order to later sell it on hacker forums.

Attackers also make money on this by redirecting users via referral links to various marketplaces.

Information security specialists who discovered this campaign have already informed NuGet, PyPI and NPM of the infection, so all malicious packets have already been removed from the sites.[2]

Distribution of infostilers in 29 PyPI packages

Phylum researchers have found 29 convoluted code packets in the PyPI registry Python that mimic known libraries, but instead drop the W4SP infostiler on infected machines, and other packages use harmful ON GyruzPIP, supposedly created only for "educational purposes." This became known on November 3, 2022.

Illustration: securitylab.ru

The packages contain intentional typos in the name (Typosquatting) in order to be similar to well-known Python libraries in the hope that developers trying to find the real library will make a spelling error and inadvertently download one of the malicious ones.

The attack begins with copying existing known libraries and injecting the malicious "__ import __" operator into a healthy package code base.

The peculiarity from copying this package is that the PyPI landing page for the package is created from "setup.py" and "README.md," so cybercriminals immediately receive a real landing page with working links. If the user does not check the page carefully, he may think that this is a legitimate package.

Phylum researchers said all the packages were downloaded more than 5,700 times.

During the study, they had to analyze confusing code spanning more than 71,000 characters, experts said.

Earlier it became known about a malicious campaign using a network of more than 200 domains that mimic 27 brands that force users to download malware for Windows and Android. The domains in this campaign were created with intentional errors in the name using the typosquatting technique[3].

Notes