PLockManager constructor accepts unchecked principal — content process can acquire/steal Web Locks for any origin
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: pakhunov.anton.n, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: ai-involved, reporter-external, sec-want)
Summary
PLockManager is created via PBackground with a caller-supplied nsIPrincipal. The constructor in BackgroundParentImpl::RecvPLockManagerConstructor only blocks the system principal — any content process can forge a content principal for any origin and get a LockManagerParent keyed to that origin's lock namespace.
The check that exists (and what it misses)
// BackgroundParentImpl.cpp
IPCResult BackgroundParentImpl::RecvPLockManagerConstructor(
PLockManagerParent* aActor, NotNull<nsIPrincipal*> aPrincipalInfo, ...) {
if (aPrincipalInfo->IsSystemPrincipal() &&
BackgroundParent::IsOtherProcessActor(this)) {
return IPC_FAIL_NO_REASON(this);
}
return IPC_OK();
}
Blocked: system principal from content. Not blocked: any content principal, including one forged for bank.com while calling from evil.com's content process.
What you can do with the forged LockManager
sManagedLocksMap in LockManagerParent.cpp is a global map from PrincipalHashKey to ManagedLocks. A LockManagerParent with a forged bank.com principal shares the same ManagedLocks entry as the real bank.com lock manager.
RecvQuery — returns the full snapshot of held and pending locks for the forged origin:
held: [{name: "transaction-mutex", mode: "exclusive", clientId: "..."}]
pending: [...]
Lock names often encode internal application state.
RecvPLockRequestConstructor with steal: true — immediately evicts all currently held locks for the given resource name and grants the lock to the attacker:
if (aRequest.steal()) {
mManagedLocks->mHeldLocks.RemoveElementsBy(
[&aRequest](const RefPtr<LockRequestParent>& aHeld) {
if (aHeld->Data().name() == aRequest.name()) {
PLockRequestParent::Send__delete__(aHeld, true); // releases real holder
return true;
}
});
}
This lets the attacker release critical locks held by the victim origin — aborting in-progress database transactions, corrupting coordinated state, or causing the victim's tabs to lose their "only one tab" invariant if they use locks for that.
RecvPLockRequestConstructor with mode: "exclusive" — acquires an exclusive lock on any resource name in the victim's namespace, blocking all legitimate lock requests for that resource indefinitely.
Attack scenario
- Attacker's content process at
evil.comsendsPBackground::PLockManager(principal=bank.com, ...) - Constructor passes — system principal check doesn't apply
- Attacker sends
RecvQuery→ gets list of all lock names bank.com is using - Attacker sends
PLockRequestConstructor(name="payment-lock", mode="exclusive", steal=true) - Any
bank.comtab holding "payment-lock" immediately loses it (lock isstolen) - Attacker holds the exclusive lock — all
bank.comtabs block trying to acquire it
Suggested fix
In RecvPLockManagerConstructor, validate that the supplied principal belongs to the calling process, similar to how CacheStorageParent and LocalStorageParent validate principal ownership. At minimum, reject any request from a content process where the origin doesn't match a document in that process.
Alternatively, look up the principal via the background actor's content parent rather than accepting it from the child.
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•3 months ago
|
Updated•15 days ago
|
Description
•