Token leak for full access to the project's GitHub repositories.

Researchers from JFrog found a token in the Docker image "cabotage-app" that gives administrator access to the Python, PyPI, and Python Software Foundation repositories on GitHub. The token was found in the binary file "__pycache__/build.cpython-311.pyc" containing cached compiled bytecode.

Token leak for full access to the project's GitHub repositories.

According to representatives from the PyPI repository, the token was created in 2023 for developer ewdurbin (Ee Durbin), who serves as the director of infrastructure at the Python Software Foundation. The token provided administrator access to all repositories and organizations of the project, including all repositories of the organizations pypi, python, psf, and pypa. The problematic Docker image containing the token was published on the Docker Hub catalog on March 3, 2023, and removed on June 11, 2024, meaning it was publicly accessible for 16 months. The token was revoked on June 28.

Notably, in the available source texts on which the problematic bytecode file was generated, there is no mention of the token. The code author explained that during the development of the cabotage-app5 toolkit on their local system, they encountered limitations on API request intensity to GitHub when performing the automated upload of files from GitHub. To bypass the limits set for anonymous requests to GitHub, they temporarily added their working token to the code. Before publishing the written code, the token was removed, but the developer did not consider that the mention of the token was cached in the precompiled bytecode file, which then ended up in the Docker image. def _fetch_github_file( github_repository="owner/repo", ref="main", access_token=None, filename="Dockerfile" + github_repository="owner/repo", + ref="main", + access_token="0d6a9bb5af126f73350a2afc058492765446aaad", + filename="Dockerfile", ):

An audit of activity in the repositories on GitHub conducted by Python developers found no unauthorized access attempts using the disclosed token. Given that GitHub has been the primary platform for the development of CPython since 2017, the token falling into the hands of a malicious actor could have led to a complete compromise of the infrastructure used for Python development and the PyPI repository, and the potential for attempts to integrate backdoors into CPython and the PyPI package manager.

The incident highlights the importance of analyzing leaks not only in source code, configuration files, and environment variables but also in binary files. In the context of Python, users are also advised to pay attention to the presence of pyc files with compiled bytecode in downloaded projects, as these files may contain hidden modifications not present in the source code.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster