Copy As Curl (Windows) - Code Execution via body \n injection
The 'Copy as Curl' feature in Firefox on Windows did not properly escape tab and newline characters in the request body, allowing an attacker to inject arbitrary commands. A victim who copied a crafted request as a curl command and pasted it into cmd.exe would execute the attacker's command.
Originally disclosed on Mozilla
- Fixed in 26 days
- Paid in 29 days
- Disclosed after 26 days
Created attachment 9522812
Firefox-CopyAsCurl-Windows-tabcharacter.mp4
Hi Team, Firefox latest on windows is vulnerable for code execution via copy as curl (windows) feature on windows, which allows attacker to execute arbitrary command on victim machine
Payload:
'''
fetch("/", {
"credentials": "omit",
"headers": {
"Accept-Language": "en-US",
"Content-Type": "text/plain",
},
"body": '\t \rcalc.exe "\t \n',
"method": "POST",
});
'''
Note: It also have impact of sharing LOCAL FILE NAME with attacker by using consecutive tab chaarcters
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
3. paste it in cmd and you can find the calc popup
Tested in Nightly 146.0a1 (2025-10-27) (64-bit) on windows 11 pro
I have attached the poc video too 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 curl command generator failed to properly escape tab and newline characters in the request body, allowing command injection when the generated command is pasted into a Windows shell.
Impact
An attacker could execute arbitrary commands on a victim's Windows machine if the victim copies a malicious request as curl and pastes it into cmd.exe.
What the attacker needed
Victim uses Firefox on Windows; victim copies request as curl; victim pastes into cmd.exe
How it was found
- Send the crafted request via the browser console or embed it in an HTML page.
- In the network tab, copy the request as a curl command.
- Paste the copied command into cmd.exe and observe the calculator popup.
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 'Copy as Curl' in Firefox's network tools, it creates a command you can paste into a terminal to repeat the request. The bug is that special characters like tabs and newlines in the request body were not escaped, so they could break out of the intended command and run something else. An attacker could make a request that, when copied and pasted, runs their own program on your computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.