Skip to content
RCE Advisory Intermediate CVE-2024-9965

Insufficient data validation in DevTools (CVE-2024-9965)

The DevTools 'Copy as cURL (cmd)' feature did not properly escape newline characters in request bodies, allowing an attacker to craft a request that, when copied and pasted into cmd.exe, would execute arbitrary commands. An attacker could trick a user into copying such a request and running it, leading to command execution on the user's machine.

Shaheen Fazim Follow

Originally disclosed on Chrome VRP

Bounty$1,000 Low View original
  • Fix shipped in 3 months

Security Bug


VULNERABILITY DETAILS

It is possible to construct a request that, when copied as a cURL command for cmd on Windows, will automatically execute arbitrary commands when pasted into cmd.exe.

Proof of Concept:

HTML
<script>
    fetch("https://example.com/postit", {
        credentials: "omit",
        headers: {
            "Accept-Language": "en-US",
            "Content-Type": "text/plain",
        },
        body: "query=evil\n\n & cmd /c calc.exe \n\n",
        method: "POST",
    });
</script>

In the above example, the body "body": "query=evil\n\n & cmd /c calc.exe \n\n" is not properly filtered. As a result, using special JavaScript characters, malicious code can break the intended execution flow and run arbitrary commands. For instance, the command "cmd /c calc.exe" will be executed on the computer.

This demonstrates the potential for significant security risks if input is not properly sanitized, allowing an attacker to execute arbitrary code on the target system.

VERSION

Chrome Version: 126.0.6478.127 (Official Build) (64-bit) + [stable]

Operating System: Windows 11

REPRODUCTION CASE

  1. Download the curl.html file below or create one using the above-mentioned proof-of-concept HTML code.
  2. Using the above webpage open developer tools' network section, copy the request as Copy as cURL (cmd) and paste it into a Windows command prompt. Run the curl command just coppied using Copy as cURL (cmd) to see that the calculator app opens.

Expected:

  • The cURL command copied for the cmd application should be properly filtered to prevent arbitrary code execution.

Actual:

  • Arbitrary code is executed when the cURL command copied from the code is run in cmd.

CREDIT INFORMATION

Reporter credit: Shaheen Fazim

The original report as published on the Chromium issue tracker, by Shaheen Fazim. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 DevTools cURL command generator for cmd did not properly escape newline characters in the request body, allowing command injection.

Impact

An attacker could execute arbitrary commands on a victim's Windows machine if the victim copies a malicious request as a cURL command and runs it in cmd.exe.

What the attacker needed

Victim uses Chrome DevTools; Victim copies request as cURL (cmd); Victim pastes and runs in cmd.exe

The fix

The cURL command generator should properly escape newline characters and other special characters to prevent command injection.

How it was found

  1. Create an HTML file with the proof-of-concept code that sends a POST request with a malicious body.
  2. Open the HTML file in Chrome and open DevTools' Network tab.
  3. Copy the request as 'Copy as cURL (cmd)'.
  4. Paste the copied command into a Windows command prompt and run it.
  5. Observe that the calculator app opens, indicating arbitrary command execution.

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.

When you use a browser's developer tools to copy a network request as a cURL command for Windows, the tool should make sure the command is safe to paste into the command prompt. Here, it didn't escape special characters like line breaks, so a malicious request could include extra commands that would run when you paste the copied text. This means an attacker could make you run harmful commands just by getting you to copy and paste a request.

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 Shaheen Fazim

View all

38 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

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.