Skip to content
Access control Disclosed report Advanced CVE-2026-12294

PSharedWorker SystemPrincipal escalation via blob:system

A compromised content process could forge two IPC messages so the parent process created a SharedWorker whose realm held the system principal, letting the worker spawn native processes at the user's privilege. The report demonstrates this with a content-side patch that stands in for the content-RCE precondition.

Quy Pham Follow

Originally disclosed on Mozilla

  • Fixed in 13 days
  • Paid in 26 days
  • Disclosed after 13 days

Created attachment 9586710 poc.zip

Affects: Firefox 152.0a1 Nightly (mozilla-central HEAD 574d441b). Tier claim: Highest Impact — Sandbox Escape — $18,000–$20,000 per footnote 0 ("Vulnerabilities that assume arbitrary code execution in the content process — such as invoking an IPC method with attacker-controlled parameters — do qualify for Highest Impact.")

Summary

A compromised content process sends two forged IPDL messages to the parent. The parent accepts both without principal-vs-sender validation, spawns a SharedWorker in the parent process whose realm bears SystemPrincipal, and the worker can call IOUtils.launchProcess(["/bin/sh", "-c", "..."], { environment: [] }) to spawn arbitrary native processes at the user's privilege.

Empirically verified: a /bin/sh child of the Firefox parent process was spawned, captured id/whoami confirming uid=1000(ego) with sudo+docker group membership, and read /etc/passwd and /proc/version from the spawned shell.

Two defects

Defect A — BackgroundParentImpl::RecvPSharedWorkerConstructor accepts forged TSystemPrincipalInfo

ipc/glue/BackgroundParentImpl.cpp:538-551:

C++
IPCResult BackgroundParentImpl::RecvPSharedWorkerConstructor(
    PSharedWorkerParent* aActor, const mozilla::dom::RemoteWorkerData& aData,
    const uint64_t& aWindowID, const mozilla::dom::MessagePortIdentifier& aPortIdentifier) {
  if (MOZ_UNLIKELY(aData.serviceWorkerData().type() !=
                   OptionalServiceWorkerData::Tvoid_t)) {
    return IPC_FAIL(this, "Invalid worker type for PSharedWorkerParent");
  }
  // No principal validation. No IsOtherProcessActor check. No PrincipalVerifier.
  mozilla::dom::SharedWorkerParent* actor =
      static_cast<mozilla::dom::SharedWorkerParent*>(aActor);
  actor->Initialize(aData, aWindowID, aPortIdentifier);
  return IPC_OK();
}

Content forges RemoteWorkerData.principalInfo = TSystemPrincipalInfo() → PrincipalInfoToPrincipal (ipc/glue/BackgroundUtils.cpp:52-59) returns the real SystemPrincipal::Get() singleton → RemoteWorkerManager::SelectTargetActor:435-438 routes the worker to mParentActor (parent process).

Defect B — BlobURLProtocolHandler::GetBlobURLPrincipal derives SystemPrincipal from URI string

dom/file/uri/BlobURLProtocolHandler.cpp:871-873:

C++
nsDependentCSubstring originPart = blobURL->OriginPart();
if (originPart == "system"_ns) {
  principal = nsContentUtils::GetSystemPrincipal();
}

For any URI of form blob:system/<uuid> the returned principal is SystemPrincipal — regardless of the principal actually stored in gDataTable for that URI.

ContentParent::RecvStoreAndBroadcastBlobURLRegistration (dom/ipc/ContentParent.cpp:5869-5889) accepts content-supplied URI strings without validating that the URI's origin part matches the calling principal:

C++
if (!ValidatePrincipal(aPrincipal, {ValidatePrincipalOptions::AllowSystem})) {
  return PrincipalValidationIpcFail(aPrincipal, this, __func__);
}
// aURI is content-supplied; no validation of its origin part vs aPrincipal.
BlobURLProtocolHandler::AddDataEntryParent(aURI, aPrincipal, aPartitionKey, blobImpl, ChildID());

A content process passes any valid principal (its own) → validation passes → URI blob:system/<uuid> stored. Later channel resolution reads OriginPart() == "system" and returns SystemPrincipal for the channel result principal.

Mozilla's source comments the design as fragile and tracks removal in bug 2006467 (BlobURLProtocolHandler.cpp:735: "See bug 2006467 for removing system principal Blob URLs in the future."). The two defects compose into a no-stand-in-needed chain.

End-to-end chain (12 steps)

  1. Compromised content forges SendStoreAndBroadcastBlobURLRegistration("blob:system/<uuid>", attackerBlob, contentPrincipal, "")
  2. ContentParent::RecvStoreAndBroadcastBlobURLRegistration accepts; gDataTable maps URI → (attacker bytes, content principal)
  3. Content forges SendPSharedWorkerConstructor(RemoteWorkerData{principalInfo=TSystemPrincipalInfo, resolvedScriptURL="blob:system/<uuid>", baseScriptURL=same, originalScriptURL=same, serviceWorkerData=void_t(), ...})
  4. BackgroundParentImpl::RecvPSharedWorkerConstructor accepts (Defect A)
  5. RemoteWorkerManager::SelectTargetActor routes to parent's mParentActor because principalInfo.type() == TSystemPrincipalInfo
  6. RemoteWorkerChild::ExecWorkerOnMainThread sets info.mPrincipal = mLoadingPrincipal = SystemPrincipal, opens channel for the blob:system URI
  7. BlobURLChannel::OpenContentStream resolves via gDataTable → returns attacker bytes
  8. nsScriptSecurityManager::GetChannelURIPrincipal → BasePrincipal::CreateContentPrincipal (blob scheme branch) → BlobURLProtocolHandler::GetBlobURLPrincipal → OriginPart()=="system" → returns SystemPrincipal singleton (Defect B)
  9. WorkerLoadInfo::GetPrincipalsAndLoadGroupFromChannel:193-232: mLoadingPrincipal->IsSystemPrincipal() TRUE, !channelPrincipal->IsSystemPrincipal() evaluates FALSE because channel result IS SystemPrincipal → inner URI_IS_UI_RESOURCE check skipped naturally → returns NS_OK
  10. ClientIsValidCreationURL (dom/clients/manager/ClientValidation.cpp:138-150): blob: in SystemPrincipal allow-list → passes
  11. WorkerScope.cpp:1246 SharedWorkerGlobalScope::WrapGlobalObject creates SpiderMonkey realm with mWorkerPrivate->GetPrincipal() = SystemPrincipal (immutable)
  12. Worker JS compiles + runs. IOUtils.launchProcess (dom/chrome-webidl/IOUtils.webidl:446-447, [ChromeOnly, Exposed=Worker]) spawns /bin/sh — native code execution.

PoC reproduction

poc.zip contains a single-file content-side patch (SharedWorker.cpp.patch, pref-gated, default off) that simulates the footnote-0 precondition by performing the two forged IPDL sends from the content-side SharedWorker::Constructor. The patch is the only modification to mozilla-central. WorkerLoadInfo.cpp and ScriptLoader.cpp are stock (verified by run.sh step 0).

Build and run

Bash
cd ~/work/mozilla-central
patch -p1 < poc/src/SharedWorker.cpp.patch
./mach build binaries
cd /path/to/poc
bash run.sh

The harness:

  1. Verifies dom/workers/WorkerLoadInfo.cpp and dom/workers/ScriptLoader.cpp are unmodified
  2. Stages the attacker payload at /tmp/poc_payload.js
  3. Writes a profile with dom.workers.testing.chain011_blobsystem_forge=true and security.allow_parent_unrestricted_js_loads=true (the second pref only needed for debug builds — release builds reach the chain without it)
  4. Launches headless Firefox with MOZ_LOG=Workers:5,SharedWorker:5,BlobURL:5,CSMLog:5
  5. Polls /tmp/poc-rce-* for 60 s

Empirical proof (from poc/proof/)

native_exec_id.txt — output written by /bin/sh spawned by the parent-process SystemPrincipal worker via IOUtils.launchProcess:

spawned by firefox-parent at 2026-05-15T13:11:04Z
pid=732812 ppid=732549
user=ego uid=1000 groups=ego adm cdrom sudo dip plugdev users docker
parent-cmd: /home/ego/work/mozilla-central/obj-debug/dist/bin/firefox

native_exec_etc_passwd.txt — sensitive file read by a second /bin/sh spawn:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
---
Linux version 6.6.87.2-microsoft-standard-WSL2 (root@439a258ad544) (gcc (GCC) 11.2.0, ...

marker_FINAL.log — worker-realm trace including IOUtils.launchProcess return PID and the [ChromeOnly] globals exposed on the worker globalThis (ChromeUtils, IOUtils, PathUtils, SyncReadFile, MLS, etc.).

poc_demo.gif — animated terminal recording of the full run: source-tree state, harness verdict, /bin/sh spawn output, sensitive-file read.

A real attacker who reaches a content-RCE primitive sends the same two IPDL byte sequences directly via the open PBackgroundChild / PContent channels — the patch only stands in for that precondition. All 12 parent-side chain steps run against unmodified Firefox 152 Nightly.

Proposed fix

Fix A — RecvPSharedWorkerConstructor reject content-forged SystemPrincipal

Mirror the existing defense in dom/cache/PrincipalVerifier.cpp:106-111 (whose comment "to prevent system principal is spoofed" names exactly this threat):

C++
IPCResult BackgroundParentImpl::RecvPSharedWorkerConstructor(
    PSharedWorkerParent* aActor, const RemoteWorkerData& aData, ...) {
  // existing serviceWorker-discriminator check
  ...

  // Reject SystemPrincipal forgery from content-bound actors.
  ThreadsafeContentParentHandle* handle =
      BackgroundParent::GetContentParentHandle(this);
  if (handle) {
    for (const PrincipalInfo* p : {&aData.principalInfo(),
                                    &aData.loadingPrincipalInfo(),
                                    &aData.partitionedPrincipalInfo()}) {
      if (p->type() == PrincipalInfo::TSystemPrincipalInfo) {
        return IPC_FAIL(this, "Spoofed SystemPrincipal from content actor");
      }
    }
  }
  ...
}

Fix B — RecvStoreAndBroadcastBlobURLRegistration validate URI origin vs principal

Reject URI strings whose origin part doesn't match the calling principal:

C++
mozilla::ipc::IPCResult ContentParent::RecvStoreAndBroadcastBlobURLRegistration(
    const nsACString& aURI, const IPCBlob& aBlob, nsIPrincipal* aPrincipal,
    const nsCString& aPartitionKey) {
  if (!aPrincipal) return IPC_FAIL(this, "No principal");
  if (!ValidatePrincipal(aPrincipal, {ValidatePrincipalOptions::AllowSystem})) {
    return PrincipalValidationIpcFail(aPrincipal, this, __func__);
  }

  // NEW: validate URI's origin part matches aPrincipal's origin.
  nsCOMPtr<nsIURI> uri;
  if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), aURI))) {
    return IPC_FAIL(this, "bad URI");
  }
  RefPtr<BlobURL> blobURL = do_QueryObject(uri);
  if (!blobURL) {
    return IPC_FAIL(this, "not a blob URL");
  }
  nsAutoCString expectedOrigin;
  if (aPrincipal->IsSystemPrincipal()) {
    expectedOrigin = "system"_ns;
  } else if (NS_FAILED(aPrincipal->GetWebExposedOriginSerialization(expectedOrigin))) {
    return IPC_FAIL(this, "principal origin lookup failed");
  }
  if (blobURL->OriginPart() != expectedOrigin) {
    return IPC_FAIL(this, "URI origin part doesn't match aPrincipal");
  }
  ...
}

This prevents content (with content principal) from registering at blob:system/... URIs.

Systemic fix (recommended)

The defense pattern from dom/cache/PrincipalVerifier.cpp was deployed in exactly one subsystem (the comment phrase "system principal is spoofed" appears nowhere else in mozilla-central). At least the following PBackground / ContentParent IPC handlers accept content-forged TSystemPrincipalInfo without an equivalent check and should adopt a centralized helper:

  • BackgroundParentImpl::RecvPSharedWorkerConstructor (Defect A)
  • BackgroundParentImpl::RecvCreateNotificationParent
  • BackgroundParentImpl::RecvCreateWebTransportParent
  • BackgroundParentImpl::RecvCreateFileSystemManagerParent
  • dom/indexedDB/ActorsParent::Factory::AllocPBackgroundIDBFactoryRequestParent
  • dom/localstorage/ActorsParent LS Request/Database/Observer constructors
  • dom/simpledb/ActorsParent SDBConnection
  • dom/quota/PrincipalUtils.cpp:23-93 IsPrincipalInfoValid (the shared validator that returns true for any TSystemPrincipalInfo)

Proposed helper:

C++
// ipc/glue/BackgroundParentImpl.h
static bool BackgroundParent::RejectIfContentActorSpoofsSystem(
    PBackgroundParent* aActor, const PrincipalInfo& aPrincipalInfo) {
  ThreadsafeContentParentHandle* handle =
      BackgroundParent::GetContentParentHandle(aActor);
  if (!handle) return false;
  if (aPrincipalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) return true;
  if (aPrincipalInfo.type() == PrincipalInfo::TExpandedPrincipalInfo) {
    for (const auto& p : aPrincipalInfo.get_ExpandedPrincipalInfo().allowlist()) {
      if (p.type() == PrincipalInfo::TSystemPrincipalInfo) return true;
    }
  }
  return false;
}

Apply to every Recv* accepting PrincipalInfo.

The original report as published on Mozilla's Bugzilla, by Quy Pham. 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 two missing checks: the parent accepts a content-supplied system principal on a SharedWorker constructor message, and blob URL registration accepts a URI whose 'system' origin part does not match the caller's principal, so later lookups return the system principal.

Impact

A compromised content process could escalate to native code execution at the user's privilege in the parent process, though the demonstration relies on a test-only patch standing in for the content-RCE precondition.

What the attacker needed

Attacker already has code execution in content process; test-only patch used to simulate that precondition

The fix

The report proposes rejecting system principals from content-bound actors in the SharedWorker constructor and validating that a registered blob URL's origin part matches the calling principal, plus a centralised helper for other IPC handlers.

How it was found

  1. Patch the content-side SharedWorker constructor to send the two forged IPC messages.
  2. Build Firefox binaries and run the harness, which checks the worker loading files are unmodified.
  3. The harness stages the attacker payload and writes a profile with the test preference enabled.
  4. Launch headless Firefox with worker and blob URL logging.
  5. Poll for the marker files produced by the spawned shell.

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 splits its work into a sandboxed 'content' process that renders web pages and a more powerful 'parent' process. The report shows that a page process, if already taken over by an attacker, could trick the parent into running a background script with the highest internal privileges, and that script could start ordinary programs on the computer. The author proves this by patching the page side to send the trick messages, since a real attacker would already have that level of control.

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 Quy Pham

View all

1 more disclosed report, 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.