Predictable global surface handles allow unauthorized cross-process SurfaceTexture operations (Android GPU process)
The GPU process's surface allocator resolved caller-supplied 64-bit handles against a process-global registry without checking that the caller owned the handle, and handles were sequential and guessable. A compromised content process could therefore tear down another process's surface or point its snapshot target at an attacker surface and trigger a sync.
Originally disclosed on Mozilla
- Fixed in 8 days
- Paid in 28 days
- Disclosed after 8 days
Created attachment 9598467 poc.zip
Summary
The GPU process exposes the AIDL interface ISurfaceAllocator (implemented by
RemoteSurfaceAllocator, an ISurfaceAllocator.Stub) to every content process. Three of its methods
— releaseSurface(long handle), configureSync(SyncConfig), and sync(long handle) — resolve their
target object purely from a caller-supplied 64-bit handle via the process-global registry
GeckoSurfaceTexture.lookup(handle), with no check that the caller created/owns that handle. The
handles are (allocatorId << 32) | sequentialCounter from a single counter in the GPU process, so
one content process can guess the handles of others and invoke these operations against their
surfaces.
unauthorized cross-process surface teardown
(releaseSurface) and unauthorized snapshot configuration / sync trigger
(configureSync + sync) against a handle the caller never received. What is not proven:
actual readback of another process's frame pixels (the snapshot/blit path is accepted for a
victim handle, but a captured victim frame was not obtained
Root cause
1. Global registry resolved with no per-caller ownership
RemoteSurfaceAllocator.java:
@Override public void releaseSurface(final long handle) {
final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(handle); // global lookup
if (gst != null) { gst.decrementUse(); } // no owner check
}
@Override public void configureSync(final SyncConfig config) {
final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(config.sourceTextureHandle);
if (gst != null) { gst.configureSnapshot(config.targetSurface, config.width, config.height); }
}
@Override public void sync(final long handle) {
final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(handle);
if (gst != null) { gst.takeSnapshot(); }
}
GeckoSurfaceTexture.java:
private static final LongSparseArray<GeckoSurfaceTexture> sSurfaceTextures = ...; // process-global
public static GeckoSurfaceTexture lookup(final long handle) {
synchronized (sSurfaceTextures) { return sSurfaceTextures.get(handle); } // any handle, any caller
}
There is no association from the Binder caller identity to the set of handles that caller created, so
any client holding the ISurfaceAllocator binder can name any handle in the registry.
2. Handles are guessable ambient identifiers in a single shared namespace
The GPU process hosts one allocator instance for its lifetime, and handles come from one static counter:
private static AtomicInteger sNextHandle = new AtomicInteger(1);
public GeckoSurface acquireSurface(int w, int h, boolean singleBufferMode) {
final long handle = ((long) mAllocatorId << 32) | sNextHandle.getAndIncrement();
...
}
mAllocatorId identifies the GPU-process instance/generation (it is supplied by the parent as
mUniqueGpuProcessId), not the individual content process — so all content processes that use
this GPU process share one handle namespace. The accurate framing is therefore not "the singleton
is wrong" but: all clients share one global handle namespace, and handles act as guessable
sequential identifiers rather than scoped or unguessable capabilities. A client that allocates one
surface learns the namespace and can enumerate neighbours by ±1 on the low word.
Trust boundary
- Caller: any content process holding the
ISurfaceAllocatorbinder viaSurfaceAllocator.sAllocator. This includesisolatedProcess="true"content services (isolatedTab{N}inAndroidManifest_overlay.jinja), which have a distinct UID and no app permissions and may act only through the binders handed to them. - Deputy: the GPU process (
:gpu,isolatedProcess="false"), holding the global registry and GL state. (When the GPU process is disabled, the same allocator logic runs in the parent process viaRemoteSurfaceAllocator.getInstance(0).) - Victim: another content process whose
GeckoSurfaceTextureis registered in that GPU-process registry.
This is a content-process > GPU-process authorization gap and a Tab A > Tab B reachability gap.
Impact
Proven (see LIVE-EVIDENCE.md, clean-capture.txt)
-
Unauthorized cross-process surface teardown. An attacker content process called
releaseSurface(victimHandle)for a handle owned by a different content process. The victim'sGeckoSurfaceTexturewas removed from the GPU registry while the attacker's own surface remained (targeted, not a global reset).releaseSurfaceperforms onedecrementUse(); in the captured run the victim's use-count was 1, so a single call drove it to 0 and triggeredrelease()+ registry removal. -
Unauthorized snapshot configuration + sync trigger. The attacker built an ImageReader-backed target, wrapped it as a
GeckoSurface, calledconfigureSync(source = victimHandle, target = attackerSurface)thensync(victimHandle); both were accepted by the GPU stub for a handle the attacker does not own. Per source this installs the attacker's target as the blit destination on the victim texture and runstakeSnapshot()/blit().
Potential
- Cross-process frame disclosure. If
syncdelivers a victim frame into the attacker's target, the attacker could read back pixels produced through the victimGeckoSurfaceTexture— e.g. decoded video output or WebGL/canvas/remote-texture surfaces that are composited out-of-process.
Reachability
The attacker capability is a compromised content process (the standard precondition for
cross-process/sandbox-class issues). Such a process holds the ISurfaceAllocator binder and can call
these AIDL methods directly. The unauthorized operations are reachable from a content process, not
from unprivileged JavaScript alone. For research, the compromised content process was simulated by
attaching to the tab's content process and invoking only the already-exposed interface (no patching
of the allocator, registry, permissions, or process).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the allocator looked up handles in a single process-wide registry keyed by guessable sequential identifiers, with no binding between the Binder caller's identity and the handles it created.
Impact
A compromised content process could tear down another process's surface and install its own snapshot target, and could potentially read back another process's frame pixels, though that readback was not proven.
What the attacker needed
Compromised content process; ability to call the exposed AIDL binder
How it was found
- Obtain the ISurfaceAllocator binder from within a content process.
- Allocate one surface to learn the shared handle namespace.
- Guess a neighbouring handle belonging to another content process.
- Call releaseSurface on the guessed handle to tear down the victim's surface.
- Call configureSync with the victim handle as source and an attacker surface as target, then call sync on the victim handle.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Android apps are split into separate processes that are meant to be isolated from each other. Here one process could name another process's screen buffer by guessing a number, because the code that looks up buffers never checked who was asking. That let it destroy or redirect another process's buffer, though reading back the actual pixels was not demonstrated.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.