ClientManagerService::MatchAll iterates global client table using child-supplied principalInfo, leaking cross-origin tab URLs to compromised renderers
Categories
(Core :: DOM: Service Workers, defect)
Tracking
()
People
(Reporter: pakhunov.anton.n, Unassigned)
Details
(Keywords: ai-involved, reporter-external)
Attachments
(1 file)
ClientManagerService::MatchAll takes a ThreadsafeContentParentHandle* aOriginContent parameter identifying the calling content process, but never uses it to filter results. Instead it iterates mSourceTable — a process-global table containing every live client (tab, worker, etc.) from every content process — and matches entries by comparing against a PrincipalInfo supplied in the IPC message body:
// ClientManagerService.cpp
RefPtr<ClientOpPromise> ClientManagerService::MatchAll(
ThreadsafeContentParentHandle* aOriginContent, // never consulted
const ClientMatchAllArgs& aArgs) {
ServiceWorkerDescriptor swd(aArgs.serviceWorker());
const PrincipalInfo& principalInfo = swd.PrincipalInfo(); // attacker-controlled
for (const auto& entry : mSourceTable) {
if (!ClientMatchPrincipalInfo(source->Info().PrincipalInfo(), principalInfo))
continue;
promiseList->AddPromise(source->StartOp(ClientGetInfoAndStateArgs(...)));
}
}
ClientMatchPrincipalInfo compares leftContent.originNoSuffix() == rightContent.originNoSuffix(). Since the right-hand side comes from the IPC payload, a compromised renderer can set it to any origin. The resolved ClientOpResult contains a ClientList where each entry includes the full url of the matching tab.
Compare to HasWindow, the one method in the same class that does check process ownership:
if (aContentParentId && !source->IsOwnedByProcess(aContentParentId.value()))
return false;
The PClientManager actor lives on PBackground, which any content process can obtain. AllocPClientManagerParent in BackgroundParentImpl.cpp has no IsOtherProcessActor guard.
With includeUncontrolled=true in ClientMatchAllArgs, the match covers every client at the target origin regardless of service worker registration.
Confirmed with a patched debug build: a content process at https://example.net issues ClientManager::MatchAll with a forged ContentPrincipalInfo containing originNoSuffix=https://example.com. The promise resolves with the full URL of the concurrently open tab:
[ClientManagerPoC] EXPLOIT SUCCESS: 1 client(s) at origin='https://example.com' leaked to attacker process
[ClientManagerPoC] url='https://example.com/secret-page'
The Navigate variant has the same structural gap: ClientManagerService::Navigate also receives aOriginContent and also never uses it. A compromised renderer with the target client's UUID (obtainable from a prior MatchAll) can call ClientManager::Navigate with an attacker-chosen URL, causing the victim's tab to navigate. CheckSameOriginURI at line 81 of ClientNavigateOpChild.cpp limits what client info is returned in the response, but the docShell->LoadURI call fires regardless.
Fix direction: validate that the principalInfo from the IPC message is consistent with an origin the calling content process is authorized to claim, or derive origin from aOriginContent directly instead of trusting the descriptor.
PoC source attached (C++, integrated into dom/clients/manager/, activated by pref media.poc.victim_origin).
| Reporter | ||
Comment 1•7 months ago
|
||
| Reporter | ||
Comment 2•7 months ago
|
||
Same root cause extends to ClientManagerService::Claim (lines 618-670).
Claim takes ThreadsafeContentParentHandle* aOriginContent but never uses it. It iterates mSourceTable and matches by child-supplied principalInfo only (line 624-636). A compromised renderer can forge a SW descriptor for any origin and cause the parent process to dispatch MaybeClaimClient calls to the victim's tabs, corrupting their service worker controller state.
The comment at line 499 in ClientManagerService.cpp even acknowledges both methods should share code: // wait for MatchAll() and Claim() to share this code. The fix should cover MatchAll, Navigate, and Claim in a single pass.
Updated•7 months ago
|
Updated•7 months ago
|
Updated•13 days ago
|
Description
•