Argument injection in the Copy as cURL for Windows allows arbitrary file read/write upon execution of the copied command
Categories
(DevTools :: Netmonitor, defect, P2)
Tracking
(firefox-esr115 unaffected, firefox-esr140148+ fixed, firefox147 wontfix, firefox148+ fixed, firefox149+ fixed)
People
(Reporter: ryotak.sec, Assigned: bomsy)
Details
(Keywords: csectype-priv-escalation, reporter-external, sec-moderate, Whiteboard: [client-bounty-form][adv-main148+] [adv-esr140.8+])
Attachments
(1 file, 2 external files, 2 obsolete files)
|
515 bytes,
text/html
|
Details |
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)
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
| Assignee | ||
Comment 1•10 months ago
|
||
Updated•10 months ago
|
Comment 3•9 months ago
|
||
Comment 4•9 months ago
|
||
:bomsy, please add uplift requests when you have a moment. It grafts cleanly for ESR140 and Beta.
Comment 5•9 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Security vulnerability for devtools users
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Small JS string replace to escape slashes
- String changes made/needed: None
- Is Android affected?: no
| Assignee | ||
Comment 6•9 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D278460
| Assignee | ||
Comment 8•9 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D278460
Updated•9 months ago
|
Comment 9•9 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined: Security vulnerability for devtools users
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Small JS string replace to escape slashes
- String changes made/needed: None
- Is Android affected?: no
Updated•9 months ago
|
Updated•9 months ago
|
Comment 10•9 months ago
|
||
| uplift | ||
Comment 11•9 months ago
|
||
| uplift | ||
Updated•9 months ago
|
Updated•9 months ago
|
| Assignee | ||
Comment 12•9 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D278460
Updated•9 months ago
|
Comment 13•9 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined: Security vulnerability for devtools users
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Small JS string replace to escape slashes
- String changes made/needed: None
- Is Android affected?: no
Comment 14•9 months ago
|
||
Comment on attachment 9536600 [details]
(secure)
Approved for 140.8esr
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•5 months ago
|
Description
•