incorrect private browsing status for native Cocoa windows
A logic error in Firefox's Cocoa window handling inverted the private browsing flag when recreating a window after hiding its chrome. As a result, private windows became restorable and could leak window titles to disk via macOS resume, while normal windows became non-restorable.
- Fixed in 42 hours
- Paid in 43 days
- Disclosed after 42 hours
The last argument in the following function communicates whether the window is used for private browsing:
'''
nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect,
BorderStyle aBorderStyle,
bool aRectIsFrameRect,
bool aIsPrivateBrowsing)
'''
This is how that is handled:
'''
// Make sure that window titles don't leak to disk in private browsing mode
// due to macOS' resume feature.
mWindow.restorable = !aIsPrivateBrowsing;
if (aIsPrivateBrowsing) {
[mWindow disableSnapshotRestoration];
}
'''
Note that `mWindow.restorable` is the inverse of private browsing. A window should not be restorable if it is for private browsing.
Now look at what happens in `nsCocoaWindow::HideWindowChrome`:
'''
// Recreate the window with the right border style.
NSRect frameRect = mWindow.frame;
BOOL restorable = mWindow.restorable;
DestroyNativeWindow();
nsresult rv = CreateNativeWindow(
frameRect, aShouldHide ? BorderStyle::None : mBorderStyle, true,
restorable);
'''
This function is attempting to create a new native window based on the previous one. Unfortunately, the last argument it passes to communicate private browsing status is `mWindow.restorable`. This should be the inverse.
Private browsing windows become non-private, and non-private windows become private. This can leak information about private browsing windows to disk.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code passed the window's 'restorable' flag (which is the inverse of private browsing) as the private browsing argument when recreating the window, inverting the intended privacy setting.
Impact
Private browsing window titles could be written to disk through macOS resume, leaking information about private browsing activity; normal windows became non-restorable, which is a functional regression.
What the attacker needed
MacOS with resume feature; Firefox private browsing window; window chrome hidden (e.g., fullscreen)
The fix
The code should pass the inverse of the restorable flag (i.e., the actual private browsing status) when recreating the window.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Private browsing is meant to leave no traces on your computer. Firefox tells macOS not to save window information for private windows, but a mistake in the code swapped the setting when the window was recreated. This meant private window titles could be saved to disk, potentially revealing what you were browsing.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.