Closed Bug 1868314 Opened 2 years ago Closed 2 years ago

Possible UAF in nsGlobalWindowInner::TryToObserveRefresh

Categories

(Core :: Layout, defect)

Desktop
Linux
defect

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox-esr115 122+ fixed
firefox122 --- fixed

People

(Reporter: pierov, Assigned: dholbert)

References

Details

(Keywords: csectype-uaf, reporter-external, sec-moderate, Whiteboard: [fixed in bug 1868456])

Attachments

(2 files)

In Tor Browser we found a possible use-after-free in the lambda defined in nsGlobalWindowInner::TryToObserveRefresh.
The UAF was caused by a patch we added, so we haven't found a way for users to reproduce the problem in Firefox, but we still wanted to open this Bug because maybe a similar condition could be triggered in another way.

In our case, MaybeCallDocumentFlushedResolvers made the code of our patch that interacts with the clipboard run.
The Wayland implementation called gtk_main_iteration, which in turn at a certain point called the the lambda again.
After the nested run, the observer was deleted, and mRawPtr of win was set to 0xe5e5e5e5e5e5e5e5. Therefore, the win->mObservingRefresh = false; in the first run resulted in a segmentation fault.

I've attached a reduced version of the patch that enables the crash.
To reproduce it, apply the patch, run Firefox on Linux with Wayland, pin an extension such as NoScript or uBlockOrigin, and click on its icon.
The browser should crash immediately. Otherwise, try to click again.

Group: core-security → layout-core-security

It looks like we have an intermittent crash on file (bug 1857056) for the TryToObserveRefresh lambda. 2 of the 3 recent crashes have a poison-y value in rax (0xe5e5e5e500000004 and 0xe5e5e5e5ffffffff), so maybe it is a real issue for regular Firefox.

Keywords: csectype-uaf
See Also: → 1857056

Yeah, this looks the same as bug 1857056. As noted in bug 1857056 comment 14, I can reproduce locally when running a particular browser-chrome mochitest; and that test seems to be doing similar things to what was described in comment 0 here (clicking/manipulating toolbar buttons).

Depends on: 1868456

Fixed by bug 1868456.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

No need for a separate rating here. Also the crash seems to only be triggered by doing specific things with privileged chrome code, so sec-high is probably too high of a rating.

Keywords: sec-high
Group: layout-core-security → core-security-release
Duplicate of bug: 1868456
Resolution: FIXED → DUPLICATE

Flagging for bounty; recipient would be the original person who reported it to Tor Project.

Flags: sec-bounty?
No longer duplicate of bug: 1868456
Flags: sec-bounty? → sec-bounty+
Resolution: DUPLICATE → FIXED
Whiteboard: [fixed in bug 1868456
Assignee: nobody → dholbert
Whiteboard: [fixed in bug 1868456 → [fixed in bug 1868456]
Target Milestone: --- → 122 Branch
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: