AddressSanitizer: heap-use-after-free on mozilla::a11y::NotificationController::WillRefresh -> get
Categories
(Core :: Disability Access APIs, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox145 | --- | unaffected |
| firefox146 | + | fixed |
| firefox147 | + | verified |
People
(Reporter: sourc7, Assigned: eeejay)
References
(Regression)
Details
(4 keywords, Whiteboard: [client-bounty-form][adv-main146.0.1+])
Attachments
(5 files, 1 external file)
When repeatedly load invalid media src to <embed> element using requestIdleCallback, then after a click to the <embed> element, it able to crash with AddressSanitizer: heap-use-after-free on mozilla::a11y::NotificationController::WillRefresh
Tested on
- Firefox Beta ASan 146.0b4 (64-bit)
- Firefox Nightly ASan 147.0a1 (2025-11-17) (64-bit)
Steps to reproduce
- Open Firefox Nightly or Firefox ASan Nightly
- Make sure Accessibility set to
true(in about:support) - Visit attached testcase1.html
- Click on the
<embed>media element - Firefox tab crashes with
AddressSanitizer: heap-use-after-free on mozilla::a11y::NotificationController::WillRefresh
If it still doesn't crash, try clicking the <embed> media element multiple times.
When using mozregression, I found the crash is possible after commit
Bug 1997773 - Consider hiding the frame loader earlier in nsFrameLoader::Destroy
| Reporter | ||
Comment 1•11 months ago
|
||
| Reporter | ||
Comment 2•11 months ago
|
||
This appears similar to my previously reported Bug 1709976, which required Accessibility Activated set to true (in about:support) and a mouse click to trigger the crash.
| Reporter | ||
Comment 3•11 months ago
|
||
| Reporter | ||
Comment 4•11 months ago
|
||
Updated•11 months ago
|
Comment 5•11 months ago
|
||
I haven't verified this myself, but I'm going to mark it sec-high assuming it is reasonably reproducible, as described.
Comment 6•11 months ago
|
||
I guess a11y::NotificationController::mPresShell died. What I don't understand is how that could happen while a11y::NotificationController is still registered as a refresh observer. Destroying the PresShell should destroy the DocAccessible, which should in turn destroy NotificationController, removing it as a refresh observer and nulling out its mPresShell.
| Reporter | ||
Comment 7•11 months ago
|
||
Here I attached new testcase that reliably causes the tab to crash only after a single click on the <embed> element.
| Reporter | ||
Comment 8•11 months ago
|
||
(In reply to Irvan Kurniawan [:sourc7] from comment #7)
Created attachment 9527382 [details]
testcase2.single-click.htmlHere I attached new testcase that reliably causes the tab to crash only after a single click on the
<embed>element.
When using Tab key to focus the <embed> element can also cause the tab to crash.
| Assignee | ||
Comment 9•11 months ago
|
||
When the DocAccessible is destroyed, following the destruction of the PresShell, we call FocusManager::ActiveItemChanged(null) which in turn tries to fire a focus event on the item's widget by finding the the accessible that is focused. This in turn creates a new DocAccessible with the dying PresShell that skips the PresShell shutdown method and thus creates the condition for a UAF.
| Assignee | ||
Comment 10•11 months ago
|
||
The ideal fix here is moving the setting of mIsDestroying in the PresShell above the DocAccessible shutdown routine. Since then we have checks in place that won't create a new AccDoc if IsDestroying is true.
The problem is that IsDestroying is also checked in 37 other places in layout code, and I don't want to risk changing the behavior of that flag. Maybe I'll push to try with auto and see what happens..
| Assignee | ||
Updated•11 months ago
|
| Assignee | ||
Comment 11•11 months ago
|
||
Comment 12•11 months ago
|
||
(In reply to Eitan Isaacson [:eeejay] from comment #9)
When the DocAccessible is destroyed, following the destruction of the PresShell, we call
FocusManager::ActiveItemChanged(null)which in turn tries to fire a focus event on the item's widget by finding the the accessible that is focused.
Nice find. While I agree we should totally protect against this in DocAccessible as you've done, I'd also argue that the DOM element really shouldn't still have focus while its PresShell is dying. But I guess that doesn't impact anything else...
| Assignee | ||
Updated•11 months ago
|
| Assignee | ||
Comment 13•11 months ago
•
|
||
Comment on attachment 9527499 [details]
(secure)
Security Approval Request
- How easily could an exploit be constructed based on the patch?: Not easy
- Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
- Which branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: beta
- If not all supported branches, which bug introduced the flaw?: bug 1997773
- Do you have backports for the affected branches?: Yes
- If not, how different, hard to create, and risky will they be?: not hard. i think the current patch should apply cleanly
- How likely is this patch to cause regressions; how much testing does it need?: i limited the regressions to the accessibility module. but i think the likelihood is small.
- Is the patch ready to land after security approval is given?: Yes
- Is Android affected?: Yes
Updated•11 months ago
|
Comment 14•11 months ago
|
||
Comment on attachment 9527499 [details]
(secure)
If relman wants to take this as a ridealong, it's approved to land and do so.
| Assignee | ||
Comment 15•11 months ago
|
||
I don't do this often enough. Do I now go and queue this patch in lando, or wait for relman?
Comment 16•11 months ago
|
||
Go ahead and land it. You can request Release approval on the patch when you're ready and we'll consider it for the 146 mid-cycle dot release in a couple weeks.
Comment 17•11 months ago
|
||
The bug is marked as tracked for firefox147 (nightly). We have limited time to fix this, the soft freeze is in 2 days. However, the bug still has low priority.
:fgriffith, could you please increase the priority for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.
For more information, please visit BugBot documentation.
Comment 19•11 months ago
|
||
Comment 20•11 months ago
|
||
Updated•11 months ago
|
Updated•11 months ago
|
Comment 21•10 months ago
|
||
:eeejay did you want to request an uplift for release ? we build the dot release tomorrow
| Assignee | ||
Comment 22•10 months ago
|
||
Comment on attachment 9527499 [details]
(secure)
Beta/Release Uplift Approval Request
- User impact if declined/Reason for urgency: Possible UAF
- 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: Medium
- Why is the change risky/not risky? (and alternatives if risky): This is a change in shutdown order in presshell, so I am slightly nervous about it. The good news is that there seems to be no fallout in beta/nightly.
- String changes made/needed:
- Is Android affected?: Yes
Comment 23•10 months ago
|
||
Comment on attachment 9527499 [details]
(secure)
Approved for 146.0.1 dot release
Updated•10 months ago
|
Comment 24•10 months ago
|
||
| uplift | ||
Updated•10 months ago
|
Updated•10 months ago
|
Comment 25•10 months ago
|
||
Hi, Irvan Kurniawan! Can you please verify if this issue is fixed on latest Nightly 147.0a1 and Release 146.0?
I cannot reproduce this myself using an affected Nightly asan build (2025-11-17) with Win 11 and Ubuntu 24.04.
| Reporter | ||
Comment 26•10 months ago
|
||
(In reply to Ciprian Georgiu, Desktop QA from comment #25)
Hi, Irvan Kurniawan! Can you please verify if this issue is fixed on latest Nightly 147.0a1 and Release 146.0?
I cannot reproduce this myself using an affected Nightly asan build (2025-11-17) with Win 11 and Ubuntu 24.04.
Hi Ciprian, sure. I’m testing this right now.
| Reporter | ||
Comment 27•10 months ago
|
||
Ok, I'm currently testing this on Arch Linux using testcase2.single-click.html.
Before testing, I ensured that Accessibility Activated status was set to true in about:support.
On m-c-20251117095036-asan-opt, and Firefox 146.0 (64-bit) I still able to reproduce the crash.
I confirmed on m-c-20251217162213-asan-opt, Firefox Nightly 148.0a1 (2025-12-17) (64-bit) I no longer able to reproduce the crash.
Updated•10 months ago
|
Comment 28•10 months ago
|
||
Thank you, Irvan!
Updated•9 months ago
|
Updated•5 months ago
|
Description
•