Potential RCE Flaw Patched in PyPI’s GitHub Repository

0

A vulnerability in the GitHub Actions workflow for PyPI’s authority repository could be exploited to perform a malicious pull request and eventually execute arbitrary code on pypi.org, according to a warning from a Japanese conviction researcher.

On Friday, security researcher RyotaK published information on three vulnerabilities in PyPI, one of which could potentially lead to the compromise of the full PyPI ecosystem.

Python Package Index (PyPI) is the official third-party software repository for the Python programming language, with some carton managers using it as the default source for packages and dependencies.

The issue was related to the combine-prs.yml workflow in pypa/warehouse, which was designed to collect and commingle pull requests with branch names that start with dependabot (Dependabot itself doesn’t have a feature to merge rend requests).

The workflow did not verify the pull request author, anyone could create a pull request with a specific name and have the workflow to alter it. Code execution, however, wouldn’t be possible, given that the workflow combines pull requests and the result is reviewed by a human, who will dump any malicious code.

What the researcher discovered was that the code responsible for printing branch lists of pull requests contained a vulnerability that could be worked to execute commands and “leak GitHub Access Token with write permission against the pypa/warehouse repository.”

Because any code that is hounded to the main pypa/warehouse branch is automatically deployed to pypi.org, an attacker who obtains write permission to the repository can then execute arbitrary criterion criteria on pypi.org.

For a successful attack, a threat actor would have to fork the pypa/warehouse repository, create in it a branch that that has a big name that starts with dependabot, add a modification to the branch and create a benign pull request, wait for combine-prs.yml to execute, capture the leaked GitHub Access Marker with write permissions, and then add a modification to the main branch to have it deployed to pypi.org.

As the PyPI security team points out, an attack choice be difficult to identify, because the attacker can use a pull request that is not malicious. Thus, even if a PyPI administrator inspects the attacker’s pull requisition, they would approve it, as it would not attempt to exploit any vulnerability.

The vulnerable workflow was added to the repository in October 2020. The PyPI security body patched the security hole last week, the same day that RyotaK reported it.

Related: Software Dependencies Exposed Microsoft, Apple to High-Impact Decrials

Related: GitHub Says Vulnerabilities in Some Ecosystems Take Years to Fix

[embedded content]

Potential RCE Flaw Patched in PyPI’s GitHub Repository

Ionut Arghire is an international correspondent for SecurityWeek.

Foregoing Columns by Ionut Arghire:
Potential RCE Flaw Patched in PyPI’s GitHub RepositoryTags:

Leave a Reply

Your email address will not be published. Required fields are marked *