Android security tags, read closely by Lightrion

CVE-2023-40127 AI-generated analysis

platform/packages/providers/MediaProvider: MediaProvider.call() SCAN_FILE_CALL handling, plus ModernMediaScanner / FileUtils path handling

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.

Canonicalizes the caller-supplied file path in MediaProvider's SCAN_FILE_CALL handler and in ModernMediaScanner's public scanFile(), scanDirectory() and onDirectoryDirty() entry points, so that non-canonical paths ("..", symlinks) are not scanned as-is under MediaProvider's cleared calling identity.

Root cause

In MediaProvider.call(), the SCAN_FILE_CALL branch ran `new File(arg)` on the raw string supplied by the caller. It passed the result straight to scanFile(file, REASON_DEMAND) after clearLocalCallingIdentity()/clearCallingIdentity(), so the scan ran with MediaProvider's own identity on whatever path the caller named. The resulting Uri was returned to the caller in Intent.EXTRA_STREAM. Neither the provider nor ModernMediaScanner.scanFile()/scanDirectory()/onDirectoryDirty() canonicalized the path, so paths containing ".." segments or symlinks reached the scanner in non-canonical form. The bulletin classifies the issue as information disclosure (ID), High.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to October 2023 · Findings