Skip to content
Access control Disclosed report Advanced

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.

ggwhyp Follow

Originally disclosed on Mozilla

  • 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:

  1. The BackupUI actor registration does not specify remoteTypes: ["privilegedabout"].
  2. RecvNewWindowGlobal creates a WindowGlobalParent from a child-supplied WindowGlobalInit browsing context id, without verifying that the sender process is the legitimate owner of the target browsing context.
  3. BackupUIParent.receiveMessage authorizes messages based on this.browsingContext.currentRemoteType, rather than the provenance of the sending WindowGlobalParent or 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.mjs
  • browser/components/about/AboutRedirector.cpp
  • browser/components/backup/actors/BackupUIParent.sys.mjs
  • dom/ipc/BrowserParent.cpp
  • dom/ipc/WindowGlobalParent.cpp
  • dom/ipc/WindowGlobalActor.cpp
  • dom/ipc/jsactor/JSWindowActorProtocol.cpp
  • dom/ipc/jsactor/JSActorService.cpp
  • docshell/base/CanonicalBrowsingContext.cpp
  • browser/components/backup/resources/PreferencesBackupResource.sys.mjs
  • dom/xul/XULPersist.cpp
  • toolkit/components/xulstore/XULStore.sys.mjs
  • browser/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.

JavaScript
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:

JavaScript
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.

C++
{"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

C++
if (!proto->Matches(BrowsingContext(), GetDocumentURI(), GetRemoteType(),
                    aRv)) {
  MOZ_ASSERT(aRv.Failed());
  return nullptr;
}

File: dom/ipc/jsactor/JSWindowActorProtocol.cpp

C++
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

C++
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

C++
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

C++
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:

C++
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

C++
const nsACString& WindowGlobalParent::GetRemoteType() const {
  if (RefPtr<BrowserParent> browserParent = GetBrowserParent()) {
    return browserParent->Manager()->GetRemoteType();
  }
  return NOT_REMOTE_TYPE;
}

File: docshell/base/CanonicalBrowsingContext.cpp

C++
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

JavaScript
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:

C++
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:

XML
<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:

JSON
{
  "chrome://browser/content/preferences/dialogs/translationExceptions.xhtml": {
    "TranslationDialog": {
      "onfocus": "<chrome JavaScript>",
      "onfocusin": "<chrome JavaScript>",
      "onload": "<chrome JavaScript>"
    }
  }
}

The resulting chain is:

Text
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:

  1. about:welcome is a privilegedabout-capable about page that loads in a child process.
  2. BackupUI matches about:welcome*, but does not specify remoteTypes: ["privilegedabout"].
  3. JSActor matching uses the WindowGlobalParent document URI and remote type.
  4. When remoteTypes is empty, RemoteTypePrefixMatches returns true, so BackupUI is not rejected for a web remote type WGP.
  5. RecvNewWindowGlobal creates a WindowGlobalParent from a child-supplied browsing context id without verifying that the sender process owns the target browsing context.
  6. WindowGlobalParent::Init sets the target browsing context's current inner window id.
  7. BackupUIParent.receiveMessage checks this.browsingContext.currentRemoteType, not the sender WGP/process provenance.
  8. currentRemoteType is based on the browsing context owner process, and is not guaranteed to match the sender WGP's process remote type.
  9. A compromised web content child with arbitrary IPC can reach BackupUIParent BackupService entry points through the BackupUI actor path.
  10. 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.

  • BackupUIParent assumes that BackupUI messages from content should originate from a privilegedabout process.
  • DesktopActorRegistry does not restrict the BackupUI actor to remoteTypes: ["privilegedabout"].
  • RecvNewWindowGlobal does not bind target browsing context ownership to the sender process.
  • BackupUIParent.receiveMessage checks the browsing context's current remote type, not the sending process or WGP provenance.
  • Backup recovery restores xulstore.json as 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.

The original report as published on Mozilla's Bugzilla, by ggwhyp. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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

  1. A compromised web content child sends an IPC message to create a WindowGlobalParent using a child-supplied browsing context id.
  2. The parent process creates the WindowGlobalParent without verifying that the sender owns the target browsing context.
  3. The forged WindowGlobalParent is associated with an about:welcome browsing context that reports currentRemoteType as privilegedabout.
  4. The child sends a BackupUI message, and BackupUIParent's guard passes because it checks the browsing context's current remote type.
  5. The attacker-controlled backup archive containing a malicious xulstore.json is restored.
  6. 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.

More by ggwhyp

View all

4 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.