Skip to content
RCE Disclosed report Intermediate CVE-2021-24033

react-dev-utils OS Command Injection in function `getProcessForPort`

The getProcessForPort function in react-dev-utils concatenates an input argument into a command string without sanitisation, allowing command injection if called with user-provided values. An attacker could execute arbitrary commands only when custom code manually invokes this function with untrusted input; normal use via react-scripts is safe.

facebook/create-react-app

Originally disclosed on huntr

react-dev-utils prior to v11.0.4 exposes a function, getProcessForPort, where an input argument is concatenated into a command string to be executed. This function is typically used from react-scripts (in Create React App projects), where the usage is safe. Only when this function is manually invoked with user-provided values (ie: by custom code) is there the potential for command injection. If you're consuming it from react-scripts then this issue does not affect you.

From the GitHub Advisory Database (GHSA-5q6m-3h65-w53x, 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

Impact

An attacker could execute arbitrary commands on the host if the function is manually invoked with user-controlled input; the advisory notes that typical use via react-scripts is safe.

What the attacker needed

Custom code calls getProcessForPort; user input passed to the function

The fix

The issue was fixed in react-dev-utils v11.0.4; users should upgrade and avoid passing untrusted input to getProcessForPort.

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 about a helper function in a JavaScript library that runs a system command to find which process is using a port. If someone passes untrusted input (like a port number from a user) directly into that function, an attacker could sneak in extra commands that the computer would run. However, the normal way this library is used (through Create React App) does not pass user input, so most people are not affected.

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.