Argument injection in the Copy as cURL for Windows allows arbitrary file read/write upon execution of the copied command
Firefox's 'Copy as cURL (Windows)' feature failed to properly escape backslashes, allowing an attacker to inject arbitrary cURL arguments via a crafted request. If a victim copies and executes the generated command, the attacker could read or write arbitrary files using cURL options like --output or --upload-file.
- Fixed in 17 days
- Paid in 25 days
- Disclosed after 17 days
Created attachment 9534993 test.html
Summary
Firefox has a feature to copy the cURL command that reproduces the request sent in the browser. Two types of cURL commands can be generated on Windows; Windows and POSIX.
The Windows type of cURL command is expected to be executed in the command prompt, which has the separated parser from the cURL's argument parser (The one from Microsoft CRT).
To escape the request for both parsers, Firefox implements a complicated escape function in the following place:
While it attempts to escape the string for the Microsoft CRT parser by replacing the " into \", it doesn't escape the \ character itself.
Therefore, by embedding the \" into the request, the above escape function escapes it into \\", which fails to escape the double quote character.
For example, if the request body is \" --help, it will generate the following command:
--data-raw "\\" --help "
Once the above command is parsed by cURL, it will recognize the --help argument and shows the help instead of sending the request.
Impact
An attacker who can trick the victim into copying the cURL command for a malicious request is able to inject arbitrary cURL arguments. By using the --output option or --upload-file option, an attacker can achieve arbitrary file read/write.
Steps to reproduce
This PoC will send the content of C:\Windows\win.ini to ryotak.net.
- Download test.html attached.
- Open it in the Firefox.
- Open DevTools and navigate to the Network tab.
- Click the
Send a requestbutton. - Copy the request with
Copy as cURL (Windows). - Execute it in the command prompt and observe that the content of
C:\Windows\win.iniis sent toryotak.net.
Tested version
Firefox Nightly 148.0a1 (2025-12-27) (64-bit)
Windows 11 24H2 (OS Build 26100.4652)
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
The escape function for Windows cURL commands did not escape backslash characters, so a backslash followed by a double quote could break out of the quoted string and inject arguments.
Impact
An attacker who can trick the victim into copying the cURL command for a malicious request is able to inject arbitrary cURL arguments, potentially achieving arbitrary file read/write.
What the attacker needed
Victim uses Firefox on Windows; victim copies cURL command from malicious request; victim executes the copied command
How it was found
- Download the provided test.html file.
- Open it in Firefox.
- Open DevTools and go to the Network tab.
- Click the 'Send a request' button.
- Copy the request using 'Copy as cURL (Windows)'.
- Execute the copied command in the command prompt and observe that the content of C:\Windows\win.ini is sent to ryotak.net.
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, it creates a command that should safely reproduce your request. However, a mistake in how Firefox handled backslashes meant that a malicious request could sneak in extra options to the cURL program. If you ran that command, those options could let an attacker read or write files 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.