Closed Bug 1769572 Opened 2 years ago Closed 2 years ago

Firefox crashes if a request is resent from the devtools with a CONNECT method.

Categories

(DevTools :: Netmonitor, defect, P2)

defect

Tracking

(firefox-esr91 verified, firefox100 wontfix, firefox101 verified, firefox102 verified)

VERIFIED FIXED
102 Branch
Tracking Status
firefox-esr91 --- verified
firefox100 --- wontfix
firefox101 --- verified
firefox102 --- verified

People

(Reporter: juhana.hirvilahti, Assigned: bomsy)

References

(Blocks 1 open bug)

Details

(Keywords: crash, csectype-nullptr, Whiteboard: [reporter-external] [client-bounty-form] [verif?])

Attachments

(1 file)

I tried this on a Linux system with Firefox and TorBrowser.

OS: Ubuntu 20.04.4 LTS
Firefox: v100.0
TorBrowser: v91.9.0esr

Steps to reproduce:

  1. navigate to any page
  2. open the devtools network tab
  3. right click on the first GET request
  4. select "Edit and resend"
  5. change the method from GET to CONNECT
  6. click "Send"

At this point it completely crashes the whole browser for some reason.
I tried all the other http methods too but only CONNECT will crash it.
I even tried to break the method name like CONNEC and CONNECTT,
however only the valid CONNECT seems to do the trick. Clearly a nasty
bug there.

Flags: sec-bounty?
Group: firefox-core-security → core-security
Component: Security → Networking
Product: Firefox → Core
Group: core-security → network-core-security

CONNECT method should be forbidden in devTools. CONNECT has a special meaning and necko assumes the request is created by necko for a proxy or websocket.

Group: network-core-security → firefox-core-security
Component: Networking → Netmonitor
Product: Core → DevTools

(In reply to Dragana Damjanovic [:dragana] from comment #2)

CONNECT method should be forbidden in devTools. CONNECT has a special meaning and necko assumes the request is created by necko for a proxy or websocket.

Can we make SetRequestMethod just throw if you try setting it to CONNECT ? I'm worried that even if we fix this here there will be other cases where we allow for this method.

I'm not convinced it's useful to keep this bug security-sensitive/secret - it looks like the crash is a near-null crash, and this requires so much initiative on the user's side that I don't see how a malicious attacker would exploit it anyway.

Flags: needinfo?(dveditz)
Flags: needinfo?(dd.mozilla)

At least it doesn't crash if I run the same CONNECT query from the devtools console with javascript and fetch.
There it was displaying a correct looking error message.

The http method in the "Edit and resend" form could also be a predefined list instead of the text input field imo.

This doesn't look particularly exploitable (a null deref with a fixed offset) and doesn't seem all that likely you could socially-engineer someone into doing this.

Group: firefox-core-security
Flags: needinfo?(dveditz)

Thanks for reporting!

I can reproduce the issue with CONNECT.

(In reply to Jaxca from comment #4)

The http method in the "Edit and resend" form could also be a predefined list instead of the text input field imo.

Yes i agree.
We have a new Edit and Resend panel currently behind a flag devtools.netmonitor.features.newEditAndResend where the METHOD is a list and not editable. We should enable by default soon .

(In reply to :Gijs (he/him) from comment #3)

(In reply to Dragana Damjanovic [:dragana] from comment #2)

CONNECT method should be forbidden in devTools. CONNECT has a special meaning and necko assumes the request is created by necko for a proxy or websocket.

Can we make SetRequestMethod just throw if you try setting it to CONNECT ? I'm worried that even if we fix this here there will be other cases where we allow for this method.

I agree! this should fix the current Edit and Resend panel .We would also remove connect from https://searchfox.org/mozilla-central/rev/7f729f601c0b738f870ae0ed49098f9268e250f9/devtools/client/netmonitor/src/components/new-request/HTTPCustomRequestPanel.js#76 for the new Edit and Resend panel.

Assignee: nobody → hmanilla
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2

Adding an STR for the new Edit and Resend panel which repros the issue.

  1. Set devtools.netmonitor.features.newEditAndResend to true
  2. Navigate to https://blackbox-example.glitch.me/
  3. Open the devtools network tab
  4. Right click on the first GET request (with a 304 status)
  5. Select "Resend"
  6. Select CONNECT method from the list
  7. Click Send

ER
Does not crash firefox

AR
Crashes firefox

The CONNECT method sent on Edit & Resend of certain requests crashes firefox
based on https://bugzilla.mozilla.org/show_bug.cgi?id=1769572#c2, Necko uses CONNECT in a special way, so lets restrict
the devtools from selecting and sending it.

The crash happens with both the current and new edit and resend panels, so this patch
needs to be tested for both.

Use the devtools.netmonitor.features.newEditAndResend and set it to true to enable the new edit and resend panel.

Note: The new edit and resend panel is enabled by default in Nightly.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1769572#c0 for the STR for the current Edit and Resend panel
See https://bugzilla.mozilla.org/show_bug.cgi?id=1769572#c7 for the STR for the new Edit and Resend

Pushed by hmanilla@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f4a7323a316e
[devtools] The CONNECT method should no longer be sent on request resend r=nchevobbe
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch

Seems like a pretty low-risk uplift if you want to nominate it for Beta and ESR approval.

Flags: needinfo?(hmanilla)

Comment on attachment 9277315 [details]
Bug 1769572 - [devtools] The CONNECT method should no longer be sent on request resend r=nchevobbe

Beta/Release Uplift Approval Request

  • User impact if declined: Crashes Firefox for developers
  • Is this code covered by automated tests?: No
  • 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 Javascript change. Remove's the CONNECT from the list for the new edit and resend and stop sending CONNECT request for the old panel.
  • String changes made/needed:
  • Is Android affected?: No
Flags: needinfo?(hmanilla)
Attachment #9277315 - Flags: approval-mozilla-beta?

Comment on attachment 9277315 [details]
Bug 1769572 - [devtools] The CONNECT method should no longer be sent on request resend r=nchevobbe

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Crashes firefox for developers.
  • User impact if declined: Crashes firefox for developers.
  • Fix Landed on Version: 102
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Small JS change, removes CONNECT from being sent by devtools
Attachment #9277315 - Flags: approval-mozilla-esr102?

Comment on attachment 9277315 [details]
Bug 1769572 - [devtools] The CONNECT method should no longer be sent on request resend r=nchevobbe

Approved for 101.0rc1 and 91.10esr.

Attachment #9277315 - Flags: approval-mozilla-esr91+
Attachment #9277315 - Flags: approval-mozilla-esr102?
Attachment #9277315 - Flags: approval-mozilla-beta?
Attachment #9277315 - Flags: approval-mozilla-beta+
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Hi,

I've reproduced the issue using Firefox Beta 101.0b9 (20220519220322) and verified the fix on all of the following Firefox versions:

  • Firefox Nightly 102.0a1 (20220522190601)
  • Firefox Beta 101.0 (20220523135024)
  • Firefox 91.10.0esr (20220520202401)
Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+

All crashes are nasty.

Summary: Firefox crashes nastily if a request is resent from the devtools with a CONNECT method. → Firefox crashes if a request is resent from the devtools with a CONNECT method.
Flags: sec-bounty? → sec-bounty-

Good work guys! That input field will have a special meaning for me from now on :)

Flags: needinfo?(dd.mozilla)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: