Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Email Security

Potential RCE Flaw Patched in PyPI’s GitHub Repository

A vulnerability in the GitHub Actions workflow for PyPI’s source 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 security researcher.

A vulnerability in the GitHub Actions workflow for PyPI’s source 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 security researcher.

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

Python Package Index (PyPI) is the official third-party software repository for the Python programming language, with some package 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 merge pull requests with branch names that start with dependabot (Dependabot itself doesn’t have a feature to merge pull 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 process 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 discard 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 exploited to execute commands and “leak GitHub Access Token with write permission against the pypa/warehouse repository.”

Because any code that is pushed 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 code 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 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 Token with write permissions, and then add a modification to the main branch to have it deployed to pypi.org.

Advertisement. Scroll to continue reading.

As the PyPI security team points out, an attack would 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 request, 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 team patched the security hole last week, the same day that RyotaK reported it.

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

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

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Click to comment

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Join the session as we discuss the challenges and best practices for cybersecurity leaders managing cloud identities.

Register

SecurityWeek’s Ransomware Resilience and Recovery Summit helps businesses to plan, prepare, and recover from a ransomware incident.

Register

People on the Move

Mike Dube has joined cloud security company Aqua Security as CRO.

Cody Barrow has been appointed as CEO of threat intelligence company EclecticIQ.

Shay Mowlem has been named CMO of runtime and application security company Contrast Security.

More People On The Move

Expert Insights

Related Content

Vulnerabilities

Less than a week after announcing that it would suspended service indefinitely due to a conflict with an (at the time) unnamed security researcher...

Cybercrime

A recently disclosed vBulletin vulnerability, which had a zero-day status for roughly two days last week, was exploited in a hacker attack targeting the...

Cybercrime

The changing nature of what we still generally call ransomware will continue through 2023, driven by three primary conditions.

Data Breaches

OpenAI has confirmed a ChatGPT data breach on the same day a security firm reported seeing the use of a component affected by an...

IoT Security

A group of seven security researchers have discovered numerous vulnerabilities in vehicles from 16 car makers, including bugs that allowed them to control car...

Vulnerabilities

A researcher at IOActive discovered that home security systems from SimpliSafe are plagued by a vulnerability that allows tech savvy burglars to remotely disable...

Risk Management

The supply chain threat is directly linked to attack surface management, but the supply chain must be known and understood before it can be...

Cybercrime

Patch Tuesday: Microsoft calls attention to a series of zero-day remote code execution attacks hitting its Office productivity suite.