Closed Bug 2030044 Opened 7 months ago Closed 6 months ago

libwebrtc upstream investigation

Categories

(Core :: WebRTC, task, P2)

task

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr140 150.0.2+ fixed
firefox150 + fixed
firefox151 + fixed
firefox152 + fixed

People

(Reporter: jimm, Assigned: mjf)

References

Details

(Keywords: sec-high, Whiteboard: [pp1])

libwebrtc Security Vulnerabilities: M145/M146 vs. M144

Date: 2026-04-07
Analyst: Claude Code

Three security vulnerabilities were identified in libwebrtc that are fixed in M146 (branch 7680) but not present in M144 (branch 7559, current Firefox 150) or M145 (branch 7632, planned Firefox 151).

All three bugs share the same Chromium bug cluster filed in late February/early March 2026, suggesting coordinated security research. All three bug IDs are access-restricted.


Fix Status Matrix

Vulnerability File Bug M144 (7559) M145 (7632) M146 (7680)
MaybeResample stack overflow acm_resampler.cc chromium:486349161 NO (CL stuck) NO YES eac26aa4
NullFreeCallback UAF (dav1d) dav1d_decoder.cc chromium:486421953 NO (abandoned) NO (abandoned) YES fe210de7
ProxySink dangling pointer webrtc_voice_engine.cc chromium:486421954 YES 38992ca4 (2026-04-01) NO YES b2a90ac0

Vulnerability 1: Stack Buffer Overflow in MaybeResample

File: third_party/libwebrtc/modules/audio_coding/acm2/acm_resampler.cc
Bug: chromium:486349161

Pattern

MaybeResample() allocates a fixed-size stack buffer and wraps it in an InterleavedView without verifying the total element count fits:

// Line 45-50
std::array<int16_t, AudioFrame::kMaxDataSizeSamples> temp_output;
InterleavedView<int16_t> dst(
    temp_output.data(),
    SampleRateToDefaultChannelSize(desired_sample_rate_hz),
    audio_frame->num_channels_);   // no check: samples_per_ch * num_channels <= kMaxDataSizeSamples
resampler_.Resample(src, dst);

If an attacker can influence num_channels_ or sample rate such that
SampleRateToDefaultChannelSize(rate) Ă— num_channels > kMaxDataSizeSamples, the resampler writes past the end of the stack array.

Fix Commits

Branch Commit Date Status
main ecde302f 2026-03-06 Merged
M146 (7680) eac26aa4 2026-03-12 Merged (CL 456340)
M144 (7559) CL 458262 — NEW — CI failing, not merged
M145 (7632) — — No CL exists

Fix description: "Check maximum buffer size in ResamplerHelper::MaybeResample"
Author: Tomas Gunnarsson (tommi@webrtc.org)

Firefox Impact

  • Firefox 150 (M144): VULNERABLE. The M144 cherry-pick (CL 458262) is blocked on CI failure and has not merged.
  • Firefox 151 (M145): VULNERABLE. No cherry-pick was attempted for M145.
  • Requires manual cherry-pick of ecde302f into Firefox's third_party/libwebrtc.

Vulnerability 2: Use-After-Free in dav1d Decoder (NullFreeCallback)

File: third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder.cc
Bug: chromium:486421953

Pattern

dav1d_data_wrap is called with a no-op free callback and a raw pointer into encoded_image:

// Line 86
void NullFreeCallback(const uint8_t*, void*) {}

// Line 143-147
dav1d_data_wrap(&dav1d_data, encoded_image.data(), encoded_image.size(),
                /*free_callback=*/&NullFreeCallback,
                /*user_data=*/nullptr);

dav1d is configured with n_threads = std::clamp(cores, 1, DAV1D_MAX_THREADS) (line 102), enabling multi-threaded decoding. In multi-threaded mode, dav1d can retain internal references to the bitstream buffer after dav1d_send_data returns. When encoded_image is later freed by the caller, dav1d still holds a raw pointer to the deallocated buffer — a use-after-free.

The fix replaces NullFreeCallback with a real callback that holds a refcount on the EncodedImageBufferInterface and releases it only when dav1d is done with the buffer.

Fix Commits

Branch Commit Date Status
main fcea1cf2 2026-03-04 Merged (CL 453200)
M146 (7680) fe210de7 2026-03-09 Merged (CL 454341)
M144 (7559) CL 454301 — ABANDONED
M145 (7632) CL 454340 — ABANDONED

Fix description: "Let dav1d retain references to wrapped bitstream buffers."
Author: Philip Eliasson (philipel@webrtc.org)

Firefox Impact

  • Firefox 150 (M144): VULNERABLE. The M144 cherry-pick was explicitly abandoned. No replacement exists.
  • Firefox 151 (M145): VULNERABLE. The M145 cherry-pick was explicitly abandoned. No replacement exists.
  • This is the most critical item: upstream has no intention of backporting below M146. Firefox must either cherry-pick fcea1cf2 manually or update to M146.

Vulnerability 3: Use-After-Free via ProxySink Dangling Pointer

File: third_party/libwebrtc/media/engine/webrtc_voice_engine.cc
Bug: chromium:486421954

Pattern

ProxySink holds a raw pointer to default_sink_.get():

// Line 130-136
class ProxySink : public AudioSinkInterface {
  explicit ProxySink(AudioSinkInterface* sink) : sink_(sink) { ... }
  void OnData(const Data& audio) override { sink_->OnData(audio); }  // raw ptr call
  AudioSinkInterface* sink_;
};

// Line 2858-2868
void SetDefaultRawAudioSink(std::unique_ptr<AudioSinkInterface> sink) {
  if (!unsignaled_recv_ssrcs_.empty()) {
    SetRawAudioSink(..., new ProxySink(sink.get()));  // ProxySink captures raw ptr
  }
  default_sink_ = std::move(sink);  // if called again, old ProxySink now dangles
}

When SetDefaultRawAudioSink is called a second time (e.g., to change or clear the sink), default_sink_ is destroyed. Any ProxySink already attached to an active receive stream still holds a raw pointer to the destroyed object, and calls OnData through it on the next incoming audio packet.

Fix Commits

Branch Commit Date Status
main af411f52 2026-03-06 Merged (CL 454040)
M146 (7680) b2a90ac0 2026-03-12 Merged (CL 456182)
M144 (7559) 38992ca4 2026-04-01 Merged (CL 458302)
M145 (7632) — — No CL exists

Fix description: "Update raw audio sink management for unsignaled streams"
Author: Tomas Gunnarsson (tommi@webrtc.org)

Firefox Impact

  • Firefox 150 (M144): PARTIALLY ADDRESSED. The M144 cherry-pick merged on 2026-04-01 (6 days ago). The fix is on branch 7559 but has not yet been vendored into Firefox's third_party/libwebrtc. Needs to be picked up in the next update cycle.
  • Firefox 151 (M145): VULNERABLE. No cherry-pick was attempted for M145.

Action Items

Priority Action
HIGH Cherry-pick fcea1cf2 (dav1d UAF) into Firefox's third_party/libwebrtc — upstream will not backport below M146
HIGH Vendor the M144 branch tip update to pick up 38992ca4 (ProxySink fix, merged 2026-04-01)
HIGH Either resolve the CI failure blocking CL 458262 (acm_resampler, M144) upstream, or cherry-pick ecde302f directly
MEDIUM Evaluate accelerating the M146 update into Firefox 151 — it's the only branch that contains all three fixes

Appendix: Upstream Commit URLs

Commits were never parsed, so an agent went off trying to solve the problem using webfetch. Oddly enough it found a few things.

See Also: → 2029430

The chrome bugs were rated as high ("S1") in chrome so I'll start there, but we still needs to see if this is in code we use.

bug 2029247 has imported the these fixes into nightly. We may need to uplift the fixes.

Bug 2029247 covers Vulnerability #2 (for Firefox 151).
Bug 2030139 will cover Vulnerability #1 and #3 providing we can get it merged info Firefox 151 as well.

All three will need to be handled with uplifts to Beta and ESRs.

The bug is marked as tracked for firefox150 (beta) and tracked for firefox151 (nightly). However, the bug still isn't assigned.

:jimm, could you please find an assignee for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(jmathies)
Severity: -- → S2
Flags: needinfo?(jmathies)
Priority: -- → P2
Depends on: 2032189

See D294507 for Vulnerability #3 fix in Fx150.

See D294518 for Vulnerability #1 fix in Fx150.

Vulnerability #2 was uplifted into Fx150 as part of Bug 2029430.

Depends on: 2034119

Assigning this to :mjf based on the "depends on" bugs so it doesn't look like an unowned sec-high bug.

The tracking status is a bit confusing on the three (so far) bugs. will there be additional bugs for the ESRs? will you put the patches here or in the "150" bug instead? Not sure if we should be tracking the landing status here or if this investigation task is now "done" (comment 4) and we should be tracking just the depends on bugs.

Assignee: nobody → mfroman
No longer depends on: 2029247, 2030139
See Also: → 2029247, 2030139
Whiteboard: [pp1]

Dan - sorry this wasn't clear. The patches are only going into the 2 dependent bugs. This is just a place to track uplifts. I don't currently have info on doing the same for the ESRs.

To be more clear, the 3 issues listed in the original description were all fixed in Fx151 by the libwebrtc updates (Bug 2029247 and Bug 2030139) . They will be fixed in Fx150 (along with a few other patches upstream patched) when Bug 2032189 lands.

There is an additional fix from upstream that Fx151 needs - that will be fixed when Bug 2034119 lands.

There is no additional work needed on this bug. It is now just a "meta" bug for tracking issues that upstream has patched, that then need to be patched in release and/or beta. As we identify new security fixes from upstream, we'll create new bugs that block this bug.

Please let me know if you need additional info from me!

Flags: needinfo?(dveditz)

We still need clarity on what the plan is for the ESR branches.

See Also: → 2031503

152 is as fixed as it's going to be by way of bug 2031503 landing (along with the previous libwebrtc updates in previous cycles). Bug 2034119 and bug 2032189 track backporting important security fixes to 151 and 150, respectively, and their status flags will be updated as those bugs land on their target branches.

As noted in the past few comments, the main blocker right now is figuring out what to about ESR140 and ESR115. We want to avoid getting ourselves into a sticky situation where we've addressed what we can on Release but are leaving ESR users out in the cold. That said, the ESR branches (115 in particular) are much further behind upstream and it's not clear how practically we can even audit everything that's landed since their currently-vendored libwebrtc version.

Dan and Michael, this is something I think needs to be decided on between the appsec and webrtc teams. But if we could get a decision on that soon, it would be good as we're only about a week out from building our final planned dot releases prior to pwn2own. Thanks!

Group: media-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 6 months ago
Flags: needinfo?(mfroman)
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch

I've been able to replicate the 5 patches in Bug 2032189 onto ESR140. I'll be cleaning them up, creating a bug, and pushing those to review shortly.

Leaving NI until I know whether the same thing can be done for ESR115.

Depends on: 2035968
QA Whiteboard: [sec] [qa-triage-done-c152/b151]

That said, the ESR branches (115 in particular) are much further behind upstream and it's not clear how practically we can even audit everything that's landed since their currently-vendored libwebrtc version.

Dan and Michael, this is something I think needs to be decided on between the appsec and webrtc teams.

The ESR-115 issue needs to be decided at a higher-level than that. There's no disagreement that ESR-115 is missing lots of security fixes, and we all know it would take a lot of work to bring it up to date. The question is what does "support ESR-115" mean and does Firefox leadership really want to pay the opportunity costs to keep doing it?

ESR-140 is a much easier problem, and we should make sure that branch has all the recent upstream fixes.

Flags: needinfo?(dveditz)

I've created a sub-bug for ESR-115

Let's move all ESR115 tracking into bug 2036229 at this point since that'll be happening independent of this effort.

because the branch versions ended up fixing different sets of bugs we'll put the individual branch bugs in the advisories and not this meta bug.

QA Whiteboard: [sec] [qa-triage-done-c152/b151] → [sec] [qa-triage-done-c152/b151][adv-main150.0.2-][adv-main140.10.2-]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.