Skip to content
RCE Disclosed report Intermediate CVE-2022-0841

OS Command injection in npm-lockfile

npm-lockfile before version 2.0.4 did not sanitise external input before passing it to a command execution API, allowing command injection. An attacker could execute arbitrary commands on the host running the library.

ljharb/npm-lockfile

Originally disclosed on huntr

Critical View original

npm-lockfile safely generates an npm lockfile and output it to the filename of your choice. npm-lockfile before 2.0.4 does not santize unsafe external input and invoke sensitive command execution API with the input, causing command injection vulnerability. A fix was released in version 2.0.5.

From the GitHub Advisory Database (GHSA-cr6m-62pq-hmqh, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

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 library passed unsanitised user-controlled input directly into a command execution function.

Impact

An attacker could execute arbitrary commands on the system running the vulnerable library.

What the attacker needed

Attacker controls input to npm-lockfile

The fix

The vulnerability was fixed in version 2.0.5.

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.

This is a library that creates a lockfile for Node.js projects. It took input from outside and used it in a system command without cleaning it first, so someone could sneak in extra commands. That could let them run their own code on the computer.

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.