PBrowser drag IPC trusts child-supplied principal for file URL drops
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect)
Tracking
()
People
(Reporter: kq5y, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: reporter-external, sec-moderate, Whiteboard: [client-bounty-form])
Attachments
(2 files)
|
5.28 KB,
patch
|
Details | Diff | Splinter Review | |
|
799 bytes,
application/octet-stream
|
Details |
Overview:
Under the compromised-content-process IPC attacker model, PBrowser::InvokeDragSession accepts drag transferables and a caller-supplied principal from the child process. BrowserParent::RecvInvokeDragSession stores that principal in RemoteDragStartData without validating that the sending content process is allowed to claim it.
The parent later reconstructs a parent-side DataTransfer from those child-supplied values. During a cross-process drop, BrowserParent::QueryDropLinksForVerification records the dropped links from that forged parent DataTransfer. If the target child returns matching links, BrowserParent::RecvDropLinks calls DropLinks with SystemPrincipal. A compromised content process can therefore make the parent accept and load a local file URL as a verified drop.
This is not reachable from ordinary web JavaScript alone. The attached PoC simulates a compromised content process by modifying the child-side drag sender for one test URL: it changes a page-provided text/plain drag item into text/x-moz-url containing file:///etc/hosts, and replaces the principal sent in PBrowser::InvokeDragSession with SystemPrincipal.
I am not claiming parent-process code execution, UXSS, arbitrary native execution, or direct remote exfiltration from this PoC. The demonstrated impact is parent-mediated loading and rendering of a file: URL in a browser context through a forged drag principal. I have not demonstrated attacker-controlled remote exfiltration of the rendered file contents.
Tested build:
- Firefox current main / Nightly 152.0a1
- Source revision: 5f15185120f488edb4b4f2f38599fff543b9aa5a
- Build ID: 20260513185717
- Platform used for validation: macOS arm64
Steps to reproduce:
-
In a Firefox source checkout with normal Firefox build dependencies installed, apply the attached patch and run:
git apply /path/to/pbrowser-drag-forged-principal-file-load.patch
./mach build binaries
./mach build faster
./mach mochitest --force dom/events/test/browser_bbp_drag_principal_spoof_file_load.js --headless
Actual results:
The test completes the forged remote drag/drop flow and the target browser loads and renders file:///etc/hosts.
The attached test asserts both the final loaded URI prefix and rendered file contents.
Relevant output from the separate poc-test-current-main.log attachment:
PASS test_forged_remote_drag_loads_local_file - file:///etc/hosts was loaded and rendered - true == true
TEST_END: Test PASS. Subtests passed 170/170. Unexpected 0
Overall Summary
Expected results: 171
Unexpected results: 0
OK
Expected results:
The parent process should not trust a content process to supply an arbitrary drag principal or privileged internal drag flavor. BrowserParent::RecvInvokeDragSession should reject a principal that the sending content process is not allowed to claim, or should recompute the drag principal from parent-owned state.
Root cause:
- dom/ipc/PBrowser.ipdl: InvokeDragSession accepts child-supplied transferables and nullable nsIPrincipal.
- dom/ipc/BrowserParent.cpp: RecvInvokeDragSession passes aPrincipal into RemoteDragStartData without a principal/process validation check.
- dom/events/RemoteDragStartData.cpp: AddInitialDnDDataTo installs the supplied principal onto parent DataTransfer items through SetDataWithPrincipalFromOtherProcess.
- dom/events/DataTransfer.cpp: SetDataWithPrincipalFromOtherProcess does not re-run the web-facing PrincipalMaySetData restrictions.
- dom/ipc/BrowserParent.cpp: QueryDropLinksForVerification records links from the forged parent DataTransfer; RecvDropLinks then loads matching links with SystemPrincipal.
Public duplicate note:
Bug 1424107 / CVE-2018-5181 fixed normal web content dragging a file: URL by propagating drag principal data across processes. This report is different because it targets the current child-to-parent PBrowser::InvokeDragSession trust boundary under the compromised-content-process IPC model.
I also checked related public drag/drop and principal-validation bugs including Bug 1370843, Bug 1367038, Bug 1509384, and Bug 1873517, and did not find an exact public duplicate for this InvokeDragSession principal-spoofing path.
| Reporter | ||
Updated•6 months ago
|
| Reporter | ||
Comment 1•6 months ago
|
||
Updated•6 months ago
|
Comment 2•6 months ago
|
||
bug 2025609 uses a different mechanism, but was similarly a way to cause an arbitrary file load. Maybe this should start with the same rating?
We think that even in a compromised child process, you would require the user to do an actual non-synthetic drag as a precursor.
| Reporter | ||
Comment 3•6 months ago
|
||
Thanks, that matches my understanding.
I am not claiming that web content can synthesize or start the drag by itself. The intended precondition is that a real user drag has already started from content in a compromised child process.
The issue I intended to report is that, after that point, the child can alter the drag data/principal sent through PBrowser::InvokeDragSession, and the parent then trusts that data during drop verification.
I cannot access bug 2025609, but if it involved a comparable arbitrary file load primitive under similar preconditions, starting from the same rating makes sense to me.
| Reporter | ||
Updated•6 months ago
|
Updated•6 months ago
|
Comment 4•5 months ago
|
||
The severity field is not set for this bug.
:hsinyi, could you have a look please?
For more information, please visit BugBot documentation.
Updated•5 months ago
|
Updated•4 months ago
|
Updated•4 months ago
|
Updated•11 days ago
|
Description
•