Skip to content
RCE Write-up Advanced

Exploiting developer infrastructure is insanely easy

A malicious actor gained publishing rights to the popular npm package event-stream and added a dependency that contained encrypted payloads. When the Copay wallet application was built, the payload decrypted and injected code into a mobile dependency, which then attempted to steal bitcoin wallet data and send it to attacker-controlled servers.

medium.com

Published on medium.com

In late October, an issue was opened on an extremely popular node.js tool, nodemon, describing a deprecation warning that was being logged to the console.

Jarrod Overson, 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 the maintainer of event-stream handed publishing rights to an unknown user, who then added a malicious dependency that executed during the build of a specific target application.

Impact

The malicious code could have stolen bitcoin wallet data from users of the Copay app, but the attack was limited and quickly caught.

What the attacker needed

Event-stream maintainer grants publishing rights; target uses Copay build pipeline; build runs with specific release argument

How it was found

  1. The attacker requested and received publishing rights to the event-stream package.
  2. The attacker added the flatmap-stream dependency in a patch release of event-stream.
  3. The malicious dependency read an environment variable to identify the target package (Copay).
  4. The payload decrypted and executed only when a build script matching a release pattern ran.
  5. The payload injected code into a dependency used by the Copay mobile app.
  6. The injected code attempted to send wallet data to attacker-controlled servers.

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.

This is a supply-chain attack: instead of breaking into a victim's computer directly, the attacker took over a widely used piece of software that many projects download automatically. When developers built their apps, the malicious code ran and tried to steal cryptocurrency wallet information from users of the Copay app.

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.