Closed Bug 2039244 Opened 6 months ago Closed 4 months ago

PBrowser drag IPC trusts child-supplied principal for file URL drops

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1500946

People

(Reporter: kq5y, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: reporter-external, sec-moderate, Whiteboard: [client-bounty-form])

Attachments

(2 files)

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:

  1. 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.

Flags: sec-bounty?
Group: firefox-core-security → core-security
Component: Security → DOM: Copy & Paste and Drag & Drop
Product: Firefox → Core
Group: core-security → dom-core-security

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.

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.

Attachment #9585946 - Attachment is patch: true
Attachment #9585946 - Attachment mime type: text/x-patch → text/plain
See Also: → CVE-2026-16378
Blocks: 2040307

The severity field is not set for this bug.
:hsinyi, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(htsai)
Duplicate of this bug: 2041964
Severity: -- → S3
Flags: needinfo?(htsai)
Duplicate of this bug: 2040307
Status: UNCONFIRMED → RESOLVED
Closed: 4 months ago
Duplicate of bug: 1500946
Resolution: --- → DUPLICATE
No longer duplicate of this bug: 2040307
No longer duplicate of this bug: 2041964
Flags: sec-bounty? → sec-bounty-
Group: dom-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: