Open Bug 2072082 Opened 2 months ago Updated 1 month ago

Compromised content process receives raw gamepad input

Categories

(Core :: DOM: Device Interfaces, defect)

defect

Tracking

()

People

(Reporter: kq5y, Unassigned, NeedInfo)

References

Details

(Keywords: reporter-external, sec-want, Whiteboard: [client-bounty-form][deduped][nosec])

Attachments

(1 file)

Overview:

A compromised sandboxed content process can construct the production PGamepadEventChannel actor without identifying a principal, BrowsingContext, eligible document, foreground window, or Resist Fingerprinting state. The parent registers every actor with the process-global GamepadPlatformService, which broadcasts each raw controller update to every registered content channel.

The attached browser-chrome test opens unrelated sites in distinct content PIDs. A background process with no Gamepad exposed through the DOM and a foreground control process both receive the same uniquely injected, fully decoded button and axis values at GamepadEventChannelChild::RecvGamepadUpdate. The background process's ordinary navigator.getGamepads() and Gamepad events remain empty.

This requires native code execution in a content process; it is not reachable from ordinary page JavaScript. The additional capability is receipt of exact controller input before document-level foreground and privacy filtering.

Tested version:

  • Firefox 158.0a1 source revision 0304f5a3e392699f440f0e15f9ea0bc2790309c6, Build ID 20260915002241, Linux x86-64 optimized ASan+FUZZING build: reproduced at will in the mochitest's fresh profile.
  • Current main 9e4ba5f8a056a91000b369dd508c1e438e3a2192, Firefox 157.0b1 tag 5e16c7ecd4399d887495785a1fd0de55d3b080fc, and Firefox 155.0.1 tag fb95137a04eb8fe1196cb12f26b100c1e060295c retain the same argument-free actor, unconditional parent registration, and process-global fanout. The three parent transport files are byte-identical across those revisions.

Steps to reproduce:

  1. Check out revision 0304f5a3e392699f440f0e15f9ea0bc2790309c6 and apply gamepad-raw-ipc-repro.patch.

  2. Build Firefox on Linux with ASan, optimization, and FUZZING enabled.

  3. Run:

    MOZ_IPC_MESSAGE_LOG=PBackground,PGamepadEventChannel,PGamepadTestChannel \
      ./mach mochitest \
      toolkit/components/resistfingerprinting/tests/browser/browser_gamepad_raw_ipc_two_process.js \
      --headless
    
  4. Confirm that pidA and pidB differ and that GAMEPAD_RAW_IPC prints the unique button and axis values in both PIDs before the first DOM reads.

FUZZING is used only to access Firefox's parent-pref-gated deterministic input injector. It invokes the same GamepadPlatformService and NotifyGamepadChange fanout as production platform backends. The actor, registration, payload, broadcast, and receive path are production code.

Actual results:

The background example.com receiver ran in PID 5215 and the foreground example.org control in PID 5221. Parent PID 4974 sent each update to both channels. Both receivers decoded button index 2 with value 0.73123456788999996, pressed=1, touched=1, and axis index 1 with value -0.42133700000000002.

After raw receipt, the background process reported hidden=true, pads=0, and zero Gamepad DOM events. The foreground control reported hidden=false, pads=1, one connection event, and one axis event. The run completed with zero unexpected results.

Expected results:

A content process with no eligible Gamepad document should not become a browser-global raw controller-input subscriber. Parent-side delivery should be bound to current eligible contexts and exclude a process whose relevant windows are backgrounded or privacy-suppressed.

Root cause:

PBackground.ipdl exposes an argument-free PGamepadEventChannel() constructor. BackgroundParentImpl::AllocPGamepadEventChannelParent creates it unconditionally. The GamepadEventChannelParent constructor registers it with the global service without any document authority.

GamepadPlatformService::AddChannelParent stores the actor in one global list. NotifyGamepadChange sends the complete change to every actor. GamepadManager::Update applies background and RFP checks only after the raw IPC object has entered the child.

Impact:

A compromised renderer with no eligible Gamepad document can receive exact controller button and axis updates observed by Firefox before the window privacy decisions that govern the ordinary API. The test uses deterministic injection rather than physical hardware and does not claim credentials, cross-origin DOM data, memory corruption, or parent-process execution.

Related public issues:

Bug 1765610 is the reverse direction: a compromised child used the separate testing actor to inject parent events. Bugs 1640085 and 1809776 cover ordinary Gamepad API visibility and RFP behavior. Bug 2062703 covers missing parent-side Permissions Policy enforcement; this report does not rely on Permissions Policy. No public report was found for authority-free raw update fanout to a process with no eligible document.

Suggested fix:

Keep raw platform events in the parent and send a per-context representation only after parent-derived eligibility checks, or bind each channel to a parent-verified context and filter delivery there. A regression test should prove that a process with no eligible Gamepad document receives no controller changes.

Flags: sec-bounty?
Whiteboard: [client-bounty-form] → [client-bounty-form][deduped]

This duplicate check has been performed by our automated bug triage tool (currently under development). No validation or verification has been performed.

Bugs considered:

  • bug 1765610 — similar symptoms but a different root cause
  • bug 2062703 — similar symptoms but a different root cause
  • bug 2025964 — similar symptoms but a different root cause

Confidence: 80%

Whiteboard: [client-bounty-form][deduped] → [client-bounty-form][deduped][nosec]

This rating has been determined by our automated bug rating tool (currently under development). No validation or verification has been performed.

Confidence: 75%

Like bug 2062703, Gamepad use (permissions, prefs, actors) are not enforced by the parent.

Group: firefox-core-security
Status: UNCONFIRMED → NEW
Component: Security → DOM: Device Interfaces
Ever confirmed: true
Keywords: sec-want
Product: Firefox → Core
See Also: → 2062703
Flags: sec-bounty? → sec-bounty-

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

For more information, please visit BugBot documentation.

Flags: needinfo?(cmartin)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: