Skip to content
RCE Write-up Intermediate

How it can impact you

The article describes command injection in Composer's browse command, argument injection in Bundler and Poetry, and untrusted search path issues in several package managers. An attacker could achieve code execution on a developer's machine by tricking them into using a malicious package or handling untrusted files.

blog.sonarsource.com

Published on blog.sonarsource.com

Developers are an attractive target for cybercriminals because they have access to the core intellectual property assets of a company: source code. Compromising them allows attackers to conduct espionage or to embed malicious code into a company's products.

The author, on blog.sonarsource.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 vulnerabilities stem from insecure construction of command strings, insufficient validation of user-controlled arguments, and on Windows, searching for executables in the current directory before the system PATH.

Impact

If any of these attacks succeed, the attacker can run any commands on the victim's machine, potentially stealing or modifying sensitive data such as source code or access tokens.

What the attacker needed

Victim uses a vulnerable package manager; attacker publishes a malicious package or crafts a…; victim is tricked into using the malicious package or file

The fix

The vulnerabilities were fixed in most package managers by using argument lists, adding a `--` delimiter, or resolving executables via the `where` command; Composer, pip, and pipenv were not fixed.

How it was found

  1. Attacker publishes a malicious package with a crafted source URL to the Composer registry.
  2. Victim runs the browse command with the malicious package name.
  3. The crafted URL causes a payload to be downloaded and executed on the victim's machine.

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.

Package managers are tools that download and install other software libraries for developers. This article shows that if a developer is tricked into using a malicious package or opening a project from an untrusted source, the package manager itself can be abused to run harmful commands on their computer. The root causes are mistakes in how these tools build and run system commands.

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.