Skip to content
RCE Write-up Intermediate

“Day 13: The Phantom Dependency Threat — How an Abandoned npm Package Almost Broke the Web”

An abandoned npm package called image-optimizer-lite passed an unsanitised image path into a shell command, so a crafted filename could run arbitrary commands. The author claims this could have led to remote code execution on over 17,000 sites that depend on the package.

Aman Sharma Follow

Published on infosecwriteups.com

Six months ago, while auditing a client’s website, I stumbled upon a forgotten npm package that hadn’t been updated in 4 years — yet was still installed in 17,000+ projects. What started as a routine check uncovered a time-bomb vulnerability that could have enabled mass remote code execution.

Aman Sharma, on infosecwriteups.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

The package built a shell command by pasting an untrusted image path into it without sanitisation or escaping.

Impact

The author claims this could have allowed remote code execution on more than 17,000 sites, including stealing cloud keys from build pipelines and backdooring deployments; no actual exploitation is shown.

What the attacker needed

Victim uses the abandoned package; attacker controls an image filename

How it was found

  1. Find the abandoned package listed in the project's lockfile.
  2. Read the package source and see the image path passed to a shell command.
  3. Supply a filename containing extra shell commands to trigger command injection.

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.

A website often uses small pieces of code written by other people, called packages. This one took a filename and handed it straight to the computer's command line without checking it, so a filename that contained extra commands would make the server run them. That lets an attacker run their own programs on the server.

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 Aman Sharma

View all

34 more disclosed reports, best first.

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.