Closed Bug 1875701 (CVE-2024-2613) Opened 2 years ago Closed 2 years ago

firefox/neqo: unbounded mem alloc based on unsanitized network input

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox122 --- wontfix
firefox123 --- wontfix
firefox124 --- fixed

People

(Reporter: mail, Assigned: kershaw)

References

(Blocks 1 open bug)

Details

(Keywords: csectype-dos, reporter-external, sec-low, Whiteboard: [Fixed in bug 1877942][reporter-external] [client-bounty-form] [verif?][necko-triaged][adv-main124+])

Attachments

(2 files)

Hi there,

This is Max Inden (https://github.com/mxinden).

I believe I found a security vulnerability affecting Firefox.

Summary

A malicious remote server can send a tampered QUIC ACK frame, causing a Firefox instance to attempt an effectively unbounded memory allocation and thus OOM.

Details

When decoding a QUIC ACK frame, Neqo will first read the ACK range count (nr) and then allocate a Vec with a capacity of the count (arr). It does not enforce an upper bound on the count. Thus an attacker can choose an arbitrarily large ACK range count and thus cause Neqo to attempt an effectively infinite memory allocation.

FRAME_TYPE_ACK | FRAME_TYPE_ACK_ECN => {
let la = dv(dec)?;
let ad = dv(dec)?;
let nr = dv(dec)?;
let fa = dv(dec)?;
let mut arr: Vec<AckRange> = Vec::with_capacity(nr as usize);

https://github.com/mozilla/neqo/blob/4de3279b8ac881ef4683a8331fc33c2917019562/neqo-transport/src/frame.rs#L410-L415

Next steps

I have attached a patch to this email. You can apply the patch onto latest Neqo main brach via:

git apply 0001-fix-transport-bound-ACK-range-count-in-ACK-frame.patch

I suggest looping in the Neqo maintainers.

I am happy to open a GitHub advisory on the Neqo GitHub repository directly to ease the process.

Hope this is of some help!
Max

Flags: sec-bounty?

Moving to right component and adding cc's. Thanks!

Group: firefox-core-security → core-security
Component: Security → Networking
Product: Firefox → Core

Hi Max,

Thanks for filing this bug.
Could you open a github PR for the attached patch?

Thanks.

Flags: needinfo?(mail)

Could you open a github PR for the attached patch?

Yes, of course. Though wouldn't a GitHub advisory with a private pull request be more appropriate, given that this is security sensitive? I am fine either way.

Flags: needinfo?(mail) → needinfo?(kershaw)
Group: core-security → network-core-security
Comment on attachment 9375675 [details] [diff] [review] 0001-fix-transport-bound-ACK-range-count-in-ACK-frame.patch Review of attachment 9375675 [details] [diff] [review]: ----------------------------------------------------------------- This looks like a fine fix. I might go smaller, but we're still talking kB, not whatever it was before, which is good. ::: neqo-transport/src/frame.rs @@ +59,5 @@ > +/// > the number of ACK blocks possible. > +// > +// Taken from > +// [msquic](https://github.com/microsoft/msquic/blob/7d7a792d088abb80186a2fa20070ad82092e9736/src/core/frame.c#L257-L261). > +const MAX_ACK_RANGE_COUNT: u64 = u16::MAX as u64; Let's see. An ACK range could be as little as two varints, each of which are one octet. If the UDP payload is 64k, we really have at most 32k ranges. That suggests that the cap could be 32k, not 64.

A smaller limit sounds good. I will make the adjustment.

Could you open a github PR for the attached patch?

Yes, of course. Though wouldn't a GitHub advisory with a private pull request be more appropriate, given that this is security sensitive? I am fine either way.

It is hard for me to judge what impact an OOM in a Neqo connection has on a running Firefox instance, thus the caution. I am fine with a public pull request. Can you please confirm that a public pull request is preferred, Kershaw? I am sorry for the back-and-forth.

(In reply to Max Inden from comment #5)

A smaller limit sounds good. I will make the adjustment.

Could you open a github PR for the attached patch?

Yes, of course. Though wouldn't a GitHub advisory with a private pull request be more appropriate, given that this is security sensitive? I am fine either way.

It is hard for me to judge what impact an OOM in a Neqo connection has on a running Firefox instance, thus the caution. I am fine with a public pull request. Can you please confirm that a public pull request is preferred, Kershaw? I am sorry for the back-and-forth.

Let's go with an advisory. Thanks!

Flags: needinfo?(kershaw)

I created an advisory and a private pull request with the above suggestions incorporated.

https://github.com/mozilla/neqo/security/advisories/GHSA-5m9j-vr32-g7j5

https://github.com/mozilla/neqo-ghsa-5m9j-vr32-g7j5/pull/1

Status: UNCONFIRMED → NEW
Ever confirmed: true

We should get this fix into neqo; not high severity due to there being many ways to DOS a browser that can't be blocked. Thanks!

Severity: -- → S3
Priority: -- → P2

This bug is tracked here and will be fixed with a new lease of neqo.

Blocks: QUIC
Whiteboard: [reporter-external] [client-bounty-form] [verif?] → [reporter-external] [client-bounty-form] [verif?][necko-triaged]

Fixed by bug 1877942.
Thank you, Max!

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Assignee: nobody → kershaw
Group: network-core-security → core-security-release
Depends on: 1877942
Target Milestone: --- → 124 Branch

Unfortunately DOS bugs are generally excluded from our bug bounty program

Flags: sec-bounty? → sec-bounty-
Whiteboard: [reporter-external] [client-bounty-form] [verif?][necko-triaged] → [Fixed in bug 1877942][reporter-external] [client-bounty-form] [verif?][necko-triaged]

Unfortunately DOS bugs are generally excluded from our bug bounty program

Totally fine! Thank you for all the help getting this into Firefox.

Flags: qe-verify-
QA Whiteboard: [post-critsmash-triage]
Whiteboard: [Fixed in bug 1877942][reporter-external] [client-bounty-form] [verif?][necko-triaged] → [Fixed in bug 1877942][reporter-external] [client-bounty-form] [verif?][necko-triaged][adv-main124+]
Attached file advisory.txt
Alias: CVE-2024-2613
Flags: sec-bounty-hof+
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: