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.
- 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:
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:
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:
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)
- Compromised content forges
SendStoreAndBroadcastBlobURLRegistration("blob:system/<uuid>", attackerBlob, contentPrincipal, "") ContentParent::RecvStoreAndBroadcastBlobURLRegistrationaccepts;gDataTablemaps URI → (attacker bytes, content principal)- Content forges
SendPSharedWorkerConstructor(RemoteWorkerData{principalInfo=TSystemPrincipalInfo, resolvedScriptURL="blob:system/<uuid>", baseScriptURL=same, originalScriptURL=same, serviceWorkerData=void_t(), ...}) BackgroundParentImpl::RecvPSharedWorkerConstructoraccepts (Defect A)RemoteWorkerManager::SelectTargetActorroutes to parent'smParentActorbecauseprincipalInfo.type() == TSystemPrincipalInfoRemoteWorkerChild::ExecWorkerOnMainThreadsetsinfo.mPrincipal = mLoadingPrincipal = SystemPrincipal, opens channel for the blob:system URIBlobURLChannel::OpenContentStreamresolves viagDataTable→ returns attacker bytesnsScriptSecurityManager::GetChannelURIPrincipal→BasePrincipal::CreateContentPrincipal(blob scheme branch) →BlobURLProtocolHandler::GetBlobURLPrincipal→OriginPart()=="system"→ returns SystemPrincipal singleton (Defect B)WorkerLoadInfo::GetPrincipalsAndLoadGroupFromChannel:193-232:mLoadingPrincipal->IsSystemPrincipal()TRUE,!channelPrincipal->IsSystemPrincipal()evaluates FALSE because channel result IS SystemPrincipal → innerURI_IS_UI_RESOURCEcheck skipped naturally → returnsNS_OKClientIsValidCreationURL(dom/clients/manager/ClientValidation.cpp:138-150): blob: in SystemPrincipal allow-list → passesWorkerScope.cpp:1246SharedWorkerGlobalScope::WrapGlobalObjectcreates SpiderMonkey realm withmWorkerPrivate->GetPrincipal()= SystemPrincipal (immutable)- 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
cd ~/work/mozilla-central
patch -p1 < poc/src/SharedWorker.cpp.patch
./mach build binaries
cd /path/to/poc
bash run.sh
The harness:
- Verifies
dom/workers/WorkerLoadInfo.cppanddom/workers/ScriptLoader.cppare unmodified - Stages the attacker payload at
/tmp/poc_payload.js - Writes a profile with
dom.workers.testing.chain011_blobsystem_forge=trueandsecurity.allow_parent_unrestricted_js_loads=true(the second pref only needed for debug builds — release builds reach the chain without it) - Launches headless Firefox with
MOZ_LOG=Workers:5,SharedWorker:5,BlobURL:5,CSMLog: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):
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:
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::RecvCreateNotificationParentBackgroundParentImpl::RecvCreateWebTransportParentBackgroundParentImpl::RecvCreateFileSystemManagerParentdom/indexedDB/ActorsParent::Factory::AllocPBackgroundIDBFactoryRequestParentdom/localstorage/ActorsParentLS Request/Database/Observer constructorsdom/simpledb/ActorsParentSDBConnectiondom/quota/PrincipalUtils.cpp:23-93IsPrincipalInfoValid(the shared validator that returnstruefor anyTSystemPrincipalInfo)
Proposed helper:
// 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.
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
- Patch the content-side SharedWorker constructor to send the two forged IPC messages.
- Build Firefox binaries and run the harness, which checks the worker loading files are unmodified.
- The harness stages the attacker payload and writes a profile with the test preference enabled.
- Launch headless Firefox with worker and blob URL logging.
- 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.