Copy As Curl[Windows] - Code Execution [Return ie \r in request body]
A request body containing a carriage return character was not properly filtered when Firefox's 'Copy as cURL (Windows)' feature generated a command, allowing an attacker to inject a command that executes when the copied text is pasted into a Windows command prompt. An attacker could achieve code execution on the victim's machine if the victim copies the request as cURL and pastes it into cmd.
Originally disclosed on Mozilla
- Fixed in 38 days
- Paid in 39 days
- Disclosed after 38 days
Created attachment 9490591
[Firefox] CopyAsCurl(windows)-Return.mp4
HI Team, Firefox nightly latest on windows vulnerable for code execution via copy as curl (windows) which allows the attacker to execute code on victims machine
Tested in Nightly Latest 140.0a1 (2025-05-24) (64-bit)
'''js
fetch("/", {
"credentials": "omit",
"headers": {
"Accept-Language": "en-US",
"Content-Type": "text/plain",
},
"body": "\rcalc.exe \r",
"method": "POST",
});
'''
Steps to reproduce
1. Send the above request directly via console (or) embed it in html
2. Now from network tab copy the request as curl (windows)
3. paste it in cmd and you can find the calc popup
rootcause \r wasn't filtered properly
I have reported the same to chrome and the issue was fixed now i have attached the changeset below, we can adopt the same here too
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6573473/2/front_end/panels/network/NetworkLogView.ts
I have attached the poc video for reference
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 'Copy as cURL (Windows)' feature did not properly escape or filter carriage return characters in the request body, allowing command injection when the generated command is pasted into a Windows shell.
Impact
An attacker could execute arbitrary code on a victim's Windows machine if the victim copies a malicious request as cURL and pastes it into a command prompt; the report does not mention any mitigating factors.
What the attacker needed
Victim uses Firefox on Windows; victim copies request as cURL (Windows); victim pastes into cmd
The fix
The issue should be fixed by properly filtering or escaping carriage return characters in the 'Copy as cURL (Windows)' feature, similar to a fix already applied in Chrome.
How it was found
- Send a crafted POST request with a carriage return in the body via the browser console or embedded in HTML.
- In the network tab, copy the request as cURL (Windows).
- Paste the copied command into a Windows command prompt, which executes the injected command (e.g., calc.exe).
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 the 'Copy as cURL' feature in a browser's developer tools, it creates a command-line instruction to repeat a web request. If a malicious website sends a request with a special hidden character (a carriage return) in the body, that character can break out of the intended command and add a new command. If the user copies that request as cURL and pastes it into a Windows command prompt, the extra command runs, potentially launching a program like the calculator.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.