Android security tags, read closely by Lightrion

CVE-2024-31318 AI-generated analysis

platform/frameworks/base, services/companion (CompanionDeviceManagerService, CDM shell commands)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (7 corrections). Verify against the commit before relying on it.

The CompanionDeviceManagerService binder implementation no longer overrides onShellCommand and instead overrides handleShellCommand. The base Binder.onShellCommand, which per the commit message checks the caller's permissions, therefore runs before CompanionDeviceShellCommand is executed.

Root cause

In services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java, the inner binder class overrode onShellCommand(FileDescriptor, FileDescriptor, FileDescriptor, String[], ShellCallback, ResultReceiver). The override unconditionally constructed a CompanionDeviceShellCommand (with the service's AssociationStore, DevicePresenceMonitor, TransportManager, SystemDataTransferRequestStore and AssociationRequestsProcessor) and called exec on it. Because this replaced Binder.onShellCommand, the caller permission check in Binder.onShellCommand was skipped. The commit message says: "Binder.onShellCommand checks the necessary permissions of the caller."

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to June 2024 · Findings