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.

Discover strategies for vendor selection, integration to minimize redundancies, and maximizing ROI from your cybersecurity investments. Gain actionable insights to ensure your stack is ready for tomorrow’s challenges.

Register

Dive into critical topics such as incident response, threat intelligence, and attack surface management. Learn how to align cyber resilience plans with business objectives to reduce potential impacts and secure your organization in an ever-evolving threat landscape.

Register

People on the Move

MorganFranklin Cyber has appointed Keith Hollender as CEO and member of the Board of Directors.

Lisa Banks has been named Chief Financial Officer at Abnormal Security.

Threat detection and response company Trellix has appointed Vishal Rao as its new CEO.

More People On The Move

Expert Insights

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest cybersecurity news, threats, and expert insights. Unsubscribe at any time.