Copy As Curl (Posix) - Code Execution - Headers
The 'Copy as cURL' feature in Firefox did not properly sanitise HTTP header values, allowing an attacker to inject shell commands. When a victim copied a crafted request as a cURL command and pasted it into a Windows command prompt, the injected command executed.
Originally disclosed on Mozilla
- Fixed in 5 days
- Paid in 7 days
- Disclosed after 5 days
Created attachment 9480766
Firefox-CopyAsCurl(Posix)-Headers-CodeExec.mp4
HI Team, While testing the copy as curl - code execution issues fix in latest nightly it was found that headers are unsanitized and still vulnerable for Code execution on windows machine
Tested in latest nightly 139.0a1 (2025-04-23) (64-bit) on windows
'''js
fetch('', {method: 'temp',headers: {
'Temp': '&calc.exe&'
}});
'''
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
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 code that generates the cURL command did not escape or quote header values, so shell metacharacters in a header value were interpreted as commands when the generated command was pasted into a shell.
Impact
An attacker could execute arbitrary commands on a victim's Windows machine if the victim copies a crafted request as cURL and pastes it into a command prompt.
What the attacker needed
Victim uses Firefox on Windows; victim copies request as cURL; victim pastes into cmd
How it was found
- Send a request with a malicious header value via the browser console or an HTML page.
- In the Network tab, copy the request as cURL.
- Paste the copied command into a Windows command prompt, which triggers the calculator to open.
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' option in a browser's developer tools, it creates a text command that you can paste into a terminal to repeat the request. This report shows that if a website sends a special header value, that text command can include extra commands that run on your computer when you paste it. The attacker doesn't need to hack the browser directly; they just need you to copy and paste the generated command.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.