Skip to content
RCE Disclosed report Intermediate

RCE on build server via misconfigured pip install

A Yelp build server was configured to fetch a Python package from the public PyPI registry instead of the internal registry, and the package name was unclaimed there. The researcher uploaded a package under that name whose install script ran on the server and called back with host details, showing an attacker could have achieved code execution and tampered with builds.

alexbirsan Follow

Originally disclosed on HackerOne

Critical 10.0 View original
  • Triaged in 6 hours
  • Fixed in 58 days
  • Paid in 44 days
  • Disclosed after 6 months

Summary by the researcher

Dependency Confusion: How I Hacked Into Apple, Microsoft and Dozens of Other Companies

The report

The following Python library has been installed on at least one Yelp owned build server directly from the public PyPI registry.

This package should normally be downloaded from the internal Yelp registry, but a misconfiguration appears to have caused it to be downloaded from pypi.org instead.

This package name was previously unclaimed on PyPI. In order to detect such misconfigurations, I have uploaded my own code under the yelp-cgeom name.

Whenever yelp-cgeom is installed, my setup.py script is executed on the machine where it is downloaded. The script sends a callback to my server containing:

  • the originating IP
  • the machine's hostname
  • the current working directory

To avoid breaching the program policy, no further actions are taken.

Vulnerable machine

At Wed jul 29 2020 04:27:23 GMT, and again 20 seconds later, I have received the following callback:

  • originating IP: 54.71.19.248
  • hostname: 10-81-21-60-uswest2bdevc.uswest2-devc.yelpcorp.com
  • home directory: /nail/home/jenkins
  • directory: /ephemeral/tmpdir/pip-install-o6jnSv/yelp-cgeom

This indicates that my preinstall script was executed on the server above.

Impact

If this package had been claimed by an attacker, this would have led to arbitrary code execution on the affected server, as well as allowing the attacker to add backdoors inside the affected project(s) during the build process.

The original report as published on HackerOne, by alexbirsan. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the build server's package manager was configured to resolve dependencies from the public PyPI registry rather than only the internal Yelp registry, so an unclaimed public package name shadowed the internal one.

Impact

If an attacker had claimed the name, this would have allowed arbitrary code execution on the build server and the insertion of backdoors into affected projects during builds.

What the attacker needed

Internal package name unclaimed on PyPI; build server resolves from public PyPI

How it was found

  1. Find a Python package name used internally by Yelp that was unclaimed on public PyPI.
  2. Publish a package under that name whose setup script sends a callback with host details.
  3. Wait for a build server to install the package and receive the callback.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When software is built, a tool like pip downloads libraries by name from a package registry. If the build server looks in the public registry before the company's private one, anyone can publish a library with the same name and have their code run during the build. Here the researcher did exactly that, but only to report back the server's details rather than do damage.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by alexbirsan

View all

11 more disclosed reports, best first.

More from Yelp

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.