Closed Bug 1949994 (CVE-2025-4084) Opened 1 year ago Closed 1 year ago

Copy As Curl(posix) Lead to Code Execution in windows

Categories

(DevTools :: Netmonitor, defect)

defect

Tracking

(firefox-esr115138+ fixed, firefox-esr128138+ fixed, firefox136 wontfix, firefox137 wontfix, firefox138 fixed)

RESOLVED FIXED
138 Branch
Tracking Status
firefox-esr115 138+ fixed
firefox-esr128 138+ 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

  1. Send the request with malicious code in he body
  2. Now from network tab copy the request as curl
  3. 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

Flags: sec-bounty?

Copy as curl (both windows & bash methods) are sanitized and doesnt trigger calc on windows now, In firefox copy as curl(posix) is vulnerable

Attached video Firefox-copyascurl.mp4 —

Poc Video

issue tested on latest version of firefox on windows 11 pro

(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

Duplicate of this bug: CVE-2025-5264
Duplicate of this bug: 1949993
Component: Security → Netmonitor
Product: Firefox → DevTools

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.

Keywords: sec-moderate

Thanks for the update frederik

Kindly check my comment on #1950001 regarding duplication clarification and kindly reopen the bug

No longer duplicate of this bug: CVE-2025-5264

The severity field is not set for this bug.
:Honza, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(odvarko)

Bomsy, you were werking on various "Copy As" actions in the Network panel. Could you please take a look, thank you.

Flags: needinfo?(odvarko) → needinfo?(hmanilla)
Assignee: nobody → hmanilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

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.

Flags: needinfo?(hmanilla)
Attachment #9473891 - Attachment is obsolete: true
Pushed by hmanilla@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1aeb6e2200c1 [devtools] Properly escape the ampersand for Copy as cURL (POSIX) r=devtools-reviewers,ochameau

FWIW, I think we could save ourselves a lot of work if we aligned our escaping with Chrome

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

Group: firefox-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
No longer blocks: CVE-2025-5264
See Also: → CVE-2025-5264

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-firefox137 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(hmanilla)

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
Flags: needinfo?(hmanilla)
Attachment #9473892 - Flags: approval-mozilla-beta?

dumb bot -- don't ask people to uplift to beta after we've already built the release candidates!

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

Attachment #9473892 - Flags: approval-mozilla-esr128?
Attachment #9473892 - Flags: approval-mozilla-esr115?
Attachment #9473892 - Flags: approval-mozilla-beta?
QA Whiteboard: [post-critsmash-triage]
Flags: qe-verify-
Flags: sec-bounty? → sec-bounty+

Comment on attachment 9473892 [details]
Bug 1949994 - [devtools] Properly escape the ampersand for Copy as cURL (POSIX) r=#devtools

Approved for 115.23esr

Attachment #9473892 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+

Comment on attachment 9473892 [details]
Bug 1949994 - [devtools] Properly escape the ampersand for Copy as cURL (POSIX) r=#devtools

Approved for 128.10esr

Attachment #9473892 - Flags: approval-mozilla-esr128? → approval-mozilla-esr128+
See Also: → 1960198
Whiteboard: [client-bounty-form] → [client-bounty-form][adv-main138+]
Whiteboard: [client-bounty-form][adv-main138+] → [client-bounty-form][adv-main138+][adv-main115.23+]
Whiteboard: [client-bounty-form][adv-main138+][adv-main115.23+] → [client-bounty-form][adv-main138+][adv-esr115.23+]
Whiteboard: [client-bounty-form][adv-main138+][adv-esr115.23+] → [client-bounty-form][adv-main138+][adv-esr115.23+][adv-esr128.23+]
Whiteboard: [client-bounty-form][adv-main138+][adv-esr115.23+][adv-esr128.23+] → [client-bounty-form][adv-main138+][adv-esr115.23+][adv-esr128.10+]
Attached file advisory.txt (obsolete) —
Attached file advisory.txt (obsolete) —
Attachment #9480695 - Attachment is obsolete: true
Attached file advisory.txt —
Attachment #9480699 - Attachment is obsolete: true
Group: core-security-release
Alias: CVE-2025-4084
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: