Skip to content
RCE Write-up Intermediate

Finding Remote Code Execution in Google: A Bug Hunter’s Story

A missing dependency in a Google open-source project allowed an attacker to claim the package name and upload a malicious version with a preinstall script. When the package was installed, the script executed arbitrary commands, achieving remote code execution.

medium.com

Published on medium.com

Hey everyone, this is Zabit Majeed. I’m an ethical hacker and a part-time bug bounty hunter, and this story is about persistence more than luck.

zabit majeed, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

Likely a dependency confusion vulnerability: the project referenced a package name that was not published in the public registry, allowing an attacker to register it.

Impact

The attacker could execute arbitrary commands on systems that installed the malicious package, potentially leading to full compromise, though the affected project was a non-rewardable, already offline asset.

What the attacker needed

Access to the open-source repository; ability to publish packages to the public registry; the project installs dependencies from the public registry

How it was found

  1. Scan repositories to extract dependencies from package.json and check for missing or unpublished packages.
  2. Identify a package that does not exist in the public registry.
  3. Claim the missing dependency and upload it with a preinstall script that executes a command and sends output back.
  4. When the system installs the package, the code executes, achieving remote code execution.

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 write-up has not been written yet. The Original tab links to the source.

Software projects often rely on other packages from public registries. If a project lists a package that does not exist, an attacker can create it with harmful code. When the project installs dependencies, the harmful code runs on the developer's or build system's machine.

What is RCE?

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

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.