Closed Bug 2023105 Opened 8 months ago Closed 8 months ago

NeckoParent PUDPSocket/PTCPServerSocket constructors lack filter and permission enforcement present in BackgroundParentImpl equivalents

Categories

(Core :: Networking, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 2017857

People

(Reporter: lukefrancis09, Unassigned)

Details

(Keywords: ai-involved, reporter-external, Whiteboard: [client-bounty-form])

NeckoParent::RecvPUDPSocketConstructor performs no filter or principal enforcement, while the equivalent BackgroundParentImpl::RecvPUDPSocketConstructor requires null principal and STUN-only filter. A compromised content process can create unrestricted bidirectional UDP sockets and TCP server sockets via PNecko, bypassing content sandbox network restrictions. All socket I/O runs in the unsandboxed parent process.

The Asymmetry

BackgroundParentImpl (ipc/glue/BackgroundParentImpl.cpp:676):

if (aOptionalPrincipal.isSome()) {
  return IPC_FAIL_NO_REASON(this);    // principal must be null
}
if (!aFilter.EqualsASCII(NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX)) {
  return IPC_FAIL_NO_REASON(this);    // filter must be "stun"
}

NeckoParent (netwerk/ipc/NeckoParent.cpp:525):

if (!static_cast<UDPSocketParent*>(aActor)->Init(aPrincipal, aFilter)) {
  return IPC_FAIL_NO_REASON(this);
}
return IPC_OK();

No principal check. No filter check. UDPSocketParent::Init (dom/network/UDPSocketParent.cpp:39) accepts an empty filter and stores a null mFilter, which disables all downstream traffic filtering — RecvOutgoingData (line 302), OnPacketReceived (line 471), and RecvBind (line 76) all gate on if (mFilter) and skip filtering when null.

PNecko is managed by PContent (dom/ipc/PContent.ipdl:514) with no ProcessRestriction or remote-type check. Every content process has access. The UDPSocket.webidl gates (dom.udpsocket.enabled, ChromeOnly) only restrict the DOM API in the content process — a compromised renderer calls SendPUDPSocketConstructor directly via IPC, bypassing WebIDL entirely.

TCP Server Socket — Same Pattern

NeckoParent::RecvPTCPServerSocketConstructor (NeckoParent.cpp:505):

static_cast<TCPServerSocketParent*>(aActor)->Init();
return IPC_OK();

No port restriction, no permission check. TCPServerSocket::Init binds to the requested port on all interfaces (PR_IpAddrAny). The WebIDL gate requires SystemPrincipal (TCPSocket.cpp:1166) — content-side only, irrelevant post-compromise.

Impact

A compromised content process gains full bidirectional UDP and inbound TCP capability from the parent process's network context, bypassing OS-level content sandbox network restrictions. This includes access to internal networks, VPNs, and localhost services unreachable from the sandboxed content process.

Suggested Fix

Apply BackgroundParentImpl's restrictions to NeckoParent, or remove PUDPSocket and PTCPServerSocket from PNecko.ipdl entirely if no legitimate content-process code path uses them through PNecko anymore (WebRTC uses PBackground exclusively).

// RecvPUDPSocketConstructor — match BackgroundParentImpl:
if (aPrincipal) {
  return IPC_FAIL(this, "UDP socket principal not allowed from content");
}
if (!aFilter.EqualsASCII(NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX)) {
  return IPC_FAIL(this, "UDP socket requires STUN filter from content");
}

// RecvPTCPServerSocketConstructor — block entirely:
return IPC_FAIL(this, "TCP server socket not allowed from content process");

Found on 148.0.2.

let me know if you need any additional information, happy to provide it!

Flags: sec-bounty?
Group: firefox-core-security → network-core-security
Status: UNCONFIRMED → RESOLVED
Closed: 8 months ago
Component: Security → Networking
Duplicate of bug: CVE-2026-6761
Product: Firefox → Core
Resolution: --- → DUPLICATE
Flags: sec-bounty? → sec-bounty-
Group: network-core-security
You need to log in before you can comment on or make changes to this bug.