BackupUIParent Authorization Bypass Vulnerability Report
The BackupUI actor lacks a remoteTypes restriction and the parent process does not verify that the sender of a WindowGlobalParent message owns the target browsing context. A compromised web content child with arbitrary IPC could bypass the BackupUIParent guard and reach backup restore functionality, potentially restoring a malicious xulstore.json that injects event handlers into privileged chrome documents.
- Fixed in 28 hours
- Paid in 9 days
- Disclosed after 28 hours
Created attachment 9585024 build.sh
Backup Restore Authorization Bypass Enables XULStore Event Handler Injection
Summary
The Backup UI architecture intentionally allows a child actor to send requests to a parent actor, and the parent process intentionally performs the actual backup and restore work. The existence of the BackupUI actor registration in DesktopActorRegistry.sys.mjs is also expected functionality.
The issue arises from the combination of the following conditions:
- The
BackupUIactor registration does not specifyremoteTypes: ["privilegedabout"]. RecvNewWindowGlobalcreates aWindowGlobalParentfrom a child-suppliedWindowGlobalInitbrowsing context id, without verifying that the sender process is the legitimate owner of the target browsing context.BackupUIParent.receiveMessageauthorizes messages based onthis.browsingContext.currentRemoteType, rather than the provenance of the sendingWindowGlobalParentor content process.
Under a threat model where a web content child can send arbitrary IPC, a web content process can construct a WindowGlobalParent / JSActor path that appears to be associated with a privilegedabout browsing context such as about:welcome, and can bypass the BackupUIParent guard.
This is not reachable from ordinary web JavaScript alone. It requires a compromised content child or an arbitrary IPC primitive. The security boundary involved is the content-to-parent process boundary.
Affected Components
The main source files involved are:
browser/components/DesktopActorRegistry.sys.mjsbrowser/components/about/AboutRedirector.cppbrowser/components/backup/actors/BackupUIParent.sys.mjsdom/ipc/BrowserParent.cppdom/ipc/WindowGlobalParent.cppdom/ipc/WindowGlobalActor.cppdom/ipc/jsactor/JSWindowActorProtocol.cppdom/ipc/jsactor/JSActorService.cppdocshell/base/CanonicalBrowsingContext.cppbrowser/components/backup/resources/PreferencesBackupResource.sys.mjsdom/xul/XULPersist.cpptoolkit/components/xulstore/XULStore.sys.mjsbrowser/components/preferences/dialogs/translationExceptions.xhtml
1. BackupUI Actor Lacks a remoteTypes Restriction
File: browser/components/DesktopActorRegistry.sys.mjs
BackupUI matches multiple Firefox UI surfaces, including about:welcome*, but it does not define remoteTypes.
BackupUI: {
parent: {
esModuleURI: "resource:///actors/BackupUIParent.sys.mjs",
},
child: {
esModuleURI: "resource:///actors/BackupUIChild.sys.mjs",
events: {
"BackupUI:RestoreFromBackupFile": { wantUntrusted: true },
"BackupUI:EnableScheduledBackups": { wantUntrusted: true },
"BackupUI:EnableEncryption": { wantUntrusted: true },
"BackupUI:EditBackupLocation": { wantUntrusted: true },
},
},
includeChrome: true,
allFrames: true,
matches: [
"about:preferences*",
"about:settings*",
"about:welcome*",
"chrome://browser/content/spotlight.html",
"about:newtab*",
"about:home*",
],
},
Other privilegedabout actors in the same registry do define the expected restriction:
AboutWelcome: {
...
matches: ["about:welcome"],
remoteTypes: ["privilegedabout"],
},
Thus the AboutWelcome actor is restricted to privilegedabout, while BackupUI, which also matches about:welcome*, is not.
2. about:welcome Is a privilegedabout-Capable Child Page
File: browser/components/about/AboutRedirector.cpp
about:welcome must load in a child process and can load in the privilegedabout process.
{"welcome", "about:blank",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT},
This matches the policy implied by the BackupUIParent guard: BackupUI messages from content are expected to come from the privilegedabout process type.
3. JSActor Matching Uses the WindowGlobal URI and Remote Type
File: dom/ipc/WindowGlobalActor.cpp
if (!proto->Matches(BrowsingContext(), GetDocumentURI(), GetRemoteType(),
aRv)) {
MOZ_ASSERT(aRv.Failed());
return nullptr;
}
File: dom/ipc/jsactor/JSWindowActorProtocol.cpp
if (!RemoteTypePrefixMatches(aRemoteType)) {
aRv.ThrowNotSupportedError(
nsPrintfCString("Window protocol '%s' doesn't match remote type '%s'",
mName.get(), PromiseFlatCString(aRemoteType).get()));
return false;
}
File: dom/ipc/jsactor/JSActorService.cpp
bool JSActorProtocol::RemoteTypePrefixMatches(const nsACString& aRemoteType) {
if (mRemoteTypes.IsEmpty()) {
return true;
}
...
}
For an actor such as BackupUI, where remoteTypes is empty, the remote type check always succeeds. If the URI matches about:welcome*, JSActor matching does not reject the actor based on remote type.
4. RecvNewWindowGlobal Does Not Verify Target Browsing Context Ownership
File: dom/ipc/BrowserParent.cpp
IPCResult BrowserParent::RecvNewWindowGlobal(
ManagedEndpoint<PWindowGlobalParent>&& aEndpoint,
const WindowGlobalInit& aInit) {
RefPtr<CanonicalBrowsingContext> browsingContext =
CanonicalBrowsingContext::Get(aInit.context().mBrowsingContextId);
if (!browsingContext) {
return IPC_FAIL(this, "Cannot create for missing BrowsingContext");
}
if (!aInit.principal()) {
return IPC_FAIL(this, "Cannot create without valid principal");
}
if (!Manager()->ValidatePrincipal(aInit.principal(), validationOptions)) {
ContentParent::LogAndAssertFailedPrincipalValidationInfo(aInit.principal(),
__func__);
}
RefPtr<WindowGlobalParent> wgp =
WindowGlobalParent::CreateDisconnected(aInit);
BindPWindowGlobalEndpoint(std::move(aEndpoint), wgp);
wgp->Init();
return IPC_OK();
}
This function looks up a CanonicalBrowsingContext using the child-supplied aInit.context().mBrowsingContextId, then creates a WindowGlobalParent. The visible checks do not verify that the current BrowserParent / ContentParent is the legitimate owner of that browsing context.
Principal validation is not equivalent to process ownership validation. For about principals, the validation mainly checks whether the about page can be loaded in a child process.
5. WindowGlobalParent Stores Child-Provided Metadata and Updates Current Window State
File: dom/ipc/WindowGlobalParent.cpp
wgp =
new WindowGlobalParent(browsingContext, aInit.context().mInnerWindowId,
aInit.context().mOuterWindowId, std::move(fields));
wgp->mDocumentPrincipal = aInit.principal();
wgp->mDocumentURI = aInit.documentURI();
WindowGlobalParent::Init() then updates the target browsing context's current inner window id:
if (!BrowsingContext()->IsDiscarded()) {
MOZ_ALWAYS_SUCCEEDS(
BrowsingContext()->SetCurrentInnerWindowId(InnerWindowId()));
}
If the sender process is not verified as the owner of the target browsing context, a WindowGlobalParent from a different process can affect the target browsing context's current window global state.
6. Sender Remote Type and BrowsingContext currentRemoteType Come From Different Sources
File: dom/ipc/WindowGlobalParent.cpp
const nsACString& WindowGlobalParent::GetRemoteType() const {
if (RefPtr<BrowserParent> browserParent = GetBrowserParent()) {
return browserParent->Manager()->GetRemoteType();
}
return NOT_REMOTE_TYPE;
}
File: docshell/base/CanonicalBrowsingContext.cpp
void CanonicalBrowsingContext::GetCurrentRemoteType(nsACString& aRemoteType,
ErrorResult& aRv) const {
if (mProcessId == 0) {
aRemoteType = NOT_REMOTE_TYPE;
return;
}
ContentParent* cp = GetContentParent();
...
aRemoteType = cp->GetRemoteType();
}
WindowGlobalParent::GetRemoteType() returns the remote type of the BrowserParent associated with that WGP. BrowsingContext.currentRemoteType, however, is derived from the owner process id stored on the CanonicalBrowsingContext.
Therefore, a forged WGP can be attached to a web content process while the target browsing context still reports currentRemoteType as privilegedabout.
7. BackupUIParent Checks Browsing Context State, Not Sender Provenance
File: browser/components/backup/actors/BackupUIParent.sys.mjs
async receiveMessage(message) {
let currentWindowGlobal = this.browsingContext.currentWindowGlobal;
// The backup spotlights can be embedded in less privileged content pages, so let's
// make sure that any messages from content are coming from the privileged
// about content process type
if (
!currentWindowGlobal ||
(!currentWindowGlobal.isInProcess &&
this.browsingContext.currentRemoteType !=
lazy.E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE)
) {
lazy.logConsole.debug(
"BackupUIParent: received message from the wrong content process type."
);
return null;
}
This guard checks whether the target browsing context currently belongs to a privilegedabout process. It does not verify that the sender of this specific BackupUI message is that privilegedabout owner process.
As a result, the compromised child can reach the restore path protected by BackupUIParent. The security-relevant follow-on impact is described by the restored xulstore.json path below.
8. Restored xulstore.json to Privileged Chrome JS
An attacker-controlled backup archive can include xulstore.json, because PreferencesBackupResource copies that file during backup and recovery. After restore, XULStore loads xulstore.json from the profile, and XULPersist applies stored attributes to system-principal chrome documents.
The critical sink is SetAttr(...) in dom/xul/XULPersist.cpp:
if (value == kMissingAttributeToken) {
(void)element->UnsetAttr(kNameSpaceID_None, attr, true);
} else {
(void)element->SetAttr(kNameSpaceID_None, attr, value, true);
}
For chrome://browser/content/preferences/dialogs/translationExceptions.xhtml, the root element has a stable id:
<window
id="TranslationDialog"
...
onload="gTranslationExceptions.onLoad()"
persist="width height"
>
A restored xulstore.json entry of this shape can attach executable event-handler attributes to the chrome document:
{
"chrome://browser/content/preferences/dialogs/translationExceptions.xhtml": {
"TranslationDialog": {
"onfocus": "<chrome JavaScript>",
"onfocusin": "<chrome JavaScript>",
"onload": "<chrome JavaScript>"
}
}
}
The resulting chain is:
BackupUI restore authorization bypass
-> restore attacker-controlled xulstore.json
-> load translationExceptions.xhtml chrome dialog
-> XULPersist applies onload/onfocus/onfocusin to TranslationDialog
-> event handler executes as system-principal browser chrome JS
The repository also contains toolkit/components/xulstore/tests/chrome/test_event_attribute_injection.xhtml, which confirms the primitive: XULStore can apply a stored event-handler attribute not listed in the target element's persist attribute, and the injected handler runs in a system-principal chrome document.
Confirmed Vulnerable Chain
Based on the source code, the defensible vulnerable chain is:
about:welcomeis a privilegedabout-capable about page that loads in a child process.BackupUImatchesabout:welcome*, but does not specifyremoteTypes: ["privilegedabout"].- JSActor matching uses the
WindowGlobalParentdocument URI and remote type. - When
remoteTypesis empty,RemoteTypePrefixMatchesreturns true, soBackupUIis not rejected for a web remote type WGP. RecvNewWindowGlobalcreates aWindowGlobalParentfrom a child-supplied browsing context id without verifying that the sender process owns the target browsing context.WindowGlobalParent::Initsets the target browsing context's current inner window id.BackupUIParent.receiveMessagechecksthis.browsingContext.currentRemoteType, not the sender WGP/process provenance.currentRemoteTypeis based on the browsing context owner process, and is not guaranteed to match the sender WGP's process remote type.- A compromised web content child with arbitrary IPC can reach
BackupUIParentBackupService entry points through the BackupUI actor path. - If the restored archive controls
xulstore.json, it can set chrome document event-handler attributes and lead to system-principal browser chrome JS execution.
Security Impact
This is not a bug where ordinary web page JavaScript can directly invoke backup or restore operations. The required precondition is a compromised web content child or an arbitrary IPC primitive.
Under that precondition, the impact can extend beyond the content sandbox and reach parent-process profile backup and restore functionality. If the restore archive controls xulstore.json, the restored profile state can also become a privileged chrome JS execution primitive through persisted event-handler attributes.
The restore path is especially sensitive because it is connected to profile replacement and launch/quit behavior.
Root Cause
The root cause is that the BackupUI security policy is split across multiple layers, but those layers do not enforce the same security invariant.
BackupUIParentassumes that BackupUI messages from content should originate from a privilegedabout process.DesktopActorRegistrydoes not restrict theBackupUIactor toremoteTypes: ["privilegedabout"].RecvNewWindowGlobaldoes not bind target browsing context ownership to the sender process.BackupUIParent.receiveMessagechecks the browsing context's current remote type, not the sending process or WGP provenance.- Backup recovery restores
xulstore.jsonas profile UI state, while XULPersist can apply event-handler attributes to chrome documents.
The required invariant is that the WindowGlobalParent / process sending the message must be the legitimate privilegedabout owner of the target browsing context. After restore, Firefox must also guarantee that restored profile UI state cannot become executable chrome attributes.
PoC Baseline
The PoC shellcode referenced by this report was written for the Windows build of Firefox 150.0.2.
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
Likely the BackupUI actor registration omits a remoteTypes restriction and the parent process authorises messages based on the browsing context's current remote type rather than the provenance of the sending WindowGlobalParent or content process.
Impact
Under the precondition of a compromised web content child or an arbitrary IPC primitive, the impact could extend beyond the content sandbox to parent-process backup and restore, and a restored xulstore.json could become a privileged chrome JS execution primitive.
What the attacker needed
Compromised web content child; arbitrary IPC primitive; attacker-controlled backup archive
The fix
The BackupUI actor should be restricted to remoteTypes: ["privilegedabout"], and the parent process should verify that the sending WindowGlobalParent or process is the legitimate owner of the target browsing context.
How it was found
- A compromised web content child sends an IPC message to create a WindowGlobalParent using a child-supplied browsing context id.
- The parent process creates the WindowGlobalParent without verifying that the sender owns the target browsing context.
- The forged WindowGlobalParent is associated with an about:welcome browsing context that reports currentRemoteType as privilegedabout.
- The child sends a BackupUI message, and BackupUIParent's guard passes because it checks the browsing context's current remote type.
- The attacker-controlled backup archive containing a malicious xulstore.json is restored.
- When the translationExceptions.xhtml chrome dialog loads, XULPersist applies the stored event-handler attributes, executing chrome JavaScript.
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.
Firefox separates web pages into child processes for safety, and some privileged pages like about:welcome run in a special process. The BackupUI feature is supposed to only accept messages from that special process, but the check looks at the wrong thing, so a compromised child process could pretend to be privileged. If an attacker can already run code in a child process, they could then trigger a backup restore that plants malicious settings, which later run as browser code.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.