Clients matchAll in the parent trusts a child-supplied principal, disclosing another origin's window URLs
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: vanirxxx, Unassigned)
Details
(Keywords: reporter-external, Whiteboard: [client-bounty-form])
Attachments
(1 file)
|
11.51 KB,
application/x-zip-compressed
|
Details |
Summary
The parent's ClientManagerService::MatchAll selects which window clients to return using a principal taken
from the IPC message, and ignores which content process actually sent the request. A compromised content
process can therefore send a matchAll op carrying a forged principal for a victim origin and receive
that origin's Window clients — including each window's full URL (which routinely carries secrets such as
session tokens, OAuth codes, and password-reset tokens), client UUID, CSP, and visibility. This is a
cross-origin information disclosure, confirmed dynamically at changeset 79223b6429f6.
Affects
- Core :: DOM: Service Workers / Clients (
dom/clients/manager), current Nightly79223b6429f6, all OS. - Default configuration (Service Workers on). Precondition: a compromised content process (renderer RCE).
Root cause
ClientManagerService::MatchAll receives the sending process handle but never uses it, and matches purely on
the child-supplied principal:
dom/clients/manager/ClientManagerService.cpp:523
RefPtr<ClientOpPromise> ClientManagerService::MatchAll(
ThreadsafeContentParentHandle* aOriginContent, // the real sender — never used
const ClientMatchAllArgs& aArgs) {
ServiceWorkerDescriptor swd(aArgs.serviceWorker());
const PrincipalInfo& principalInfo = swd.PrincipalInfo(); // child-controlled
for (const auto& entry : mSourceTable) {
ClientSourceParent* source = MaybeUnwrapAsExistingSource(entry.GetData());
...
if (!ClientMatchPrincipalInfo(source->Info().PrincipalInfo(), principalInfo)) {
continue; // matches by forged principal only
}
...
promiseList->AddPromise(source->StartOp(ClientGetInfoAndStateArgs(
source->Info().Id(), source->Info().PrincipalInfo()))); // returns url + UUID + state
}
}
The op path has no principal validation at all: ClientManagerParent::RecvPClientManagerOpConstructor
(ClientManagerParent.cpp:53) just calls actor->Init(aArgs), and the manager is opened over PBackground with
no principal binding (BackgroundParentImpl.cpp:1274 RecvPClientManagerConstructor → InitClientManagerParent).
ClientMatchPrincipalInfo (ClientPrincipalUtils.cpp:14) matches a content principal on exact
(originNoSuffix, attrs), so a forged victim principal returns exactly the victim's Window clients; a forged
SystemPrincipalInfo "always matches" and returns every system/chrome window. includeUncontrolled=true
removes any need for a ServiceWorker on the victim side.
The sibling PBackground actors — LocalStorage, Cache, IndexedDB, SharedWorker, and ClientSource creation — already
validate a child-supplied principal against the sending process with ValidatePrincipalCouldPotentiallyBeLoadedBy;
the ClientManager op path (MatchAll and its siblings GetInfoAndState/Navigate/Claim) does not.
Steps to Reproduce
- Attacker page (
https://attacker.example) registers a ServiceWorker. - From a compromised content process, send a
PClientManagerOpClientMatchAllArgswith
serviceWorker.principalInfoforged to the victim origin,type=Window,includeUncontrolled=true.
(poc/simulates this with a one-branch env-gated forge of the outgoing principal,CLIENTS_FORGE_ORIGIN;
the parent code under test is unmodified.) - The parent returns the victim origin's open windows; read
client.url.
poc/poc.py runs it end-to-end (victim.test window at a secret token URL + attacker.test SW). Proven result
(poc/RESULTS.txt, poc/leak-capture.txt): the attacker SW exfiltrated
https://victim.test:8443/account?session_token=SECRET_abc123_DO_NOT_LEAK.
Actual vs Expected
Actual: a compromised content process reads the full URLs + UUIDs of any other origin's open windows.
Expected: matchAll must be scoped to the requesting process's own principal — the result must be derived from
the trusted sender (aOriginContent), not from a child-supplied principal.
Fix
Validate aArgs.serviceWorker().principalInfo() against the sending process — call
ValidatePrincipalCouldPotentiallyBeLoadedBy(principal, aOriginContent->GetRemoteType()) (the same check the
sibling PBackground actors already perform) at the top of MatchAll and the other ClientManagerService ops,
and reject a system principal from a content process. Better still: derive the result from the ClientSource
principal the sending process already owns, rather than accepting a principal from the message.
Comment 1•4 months ago
|
||
Thank you for the report. This issue has been determined to be a duplicate of bug 2018164.
Bug 2018164 ("ClientOpenWindow uses principal from the child without verification") is the canonical bug for this exact class of principal-trust flaw in the PClientManager IPC path. Its comment 10 spells out the identical MatchAll variant, and the proposed fix validates child-supplied principals across all PClientManager entry points (MatchAll/Claim/Navigate/GetInfoAndState/OpenWindow). Three earlier duplicate reports of the same MatchAll issue (bug 2033284, bug 2033436, bug 2028006) were already resolved as duplicates of bug 2018164.
Updated•4 months ago
|
Updated•3 months ago
|
Updated•13 days ago
|
Description
•