CVE-2026-28588 AI-generated analysis
platform/frameworks/base, packages/ExternalStorageProvider (Storage Access Framework external storage provider)
ExternalStorageProvider.shouldBlockDirectoryFromTree now NFD-normalizes the document path and strips default-ignorable Unicode code points before comparing it against the storage root, Download and Android directory names, so names padded with invisible characters can no longer slip past the block list.
Root cause
In packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java, shouldBlockDirectoryFromTree(documentId) derived a path via getPathFromDocId and then checked path.isEmpty() (storage root) and equalIgnoringCase(path, Environment.DIRECTORY_DOWNLOADS / DIRECTORY_ANDROID). equalIgnoringCase only lower-cases with Locale.ROOT and does an exact TextUtils.equals. A path containing default-ignorable Unicode code points (for example a zero-width space, as in the added test cases "Android\u200B" and "Download\u200B") therefore did not match the blocked names. The fix's own Javadoc says the lower file system ignores such characters. As a result, the block check for tree access to the root, Download and Android directories could be bypassed by a name that differed only in invisible characters.
How the fix works
- ExternalStorageProvider.java: adds a new static helper normalizeAndFilterDefaultIgnorableCodepoints(String path) (annotated @VisibleForTesting, documented as copied from MediaProvider's FileUtils). It returns null or empty input unchanged. Otherwise it applies java.text.Normalizer.normalize(path, Normalizer.Form.NFD) and scans the code points. If any code point has UProperty.DEFAULT_IGNORABLE_CODE_POINT (checked via android.icu.lang.UCharacter.hasBinaryProperty), it rebuilds the string without those code points. If none is found, it returns the NFD string as-is.
- ExternalStorageProvider.java:shouldBlockDirectoryFromTree: computes normalizedPath = normalizeAndFilterDefaultIgnorableCodepoints(path) immediately after getPathFromDocId. It then uses normalizedPath instead of path for the three existing checks: normalizedPath.isEmpty() (block root), equalIgnoringCase(normalizedPath, Environment.DIRECTORY_DOWNLOADS) and equalIgnoringCase(normalizedPath, Environment.DIRECTORY_ANDROID). equalIgnoringCase itself is unchanged.
- New imports: android.icu.lang.UCharacter, android.icu.lang.UProperty, java.text.Normalizer.
- The Android 15/16/17 commits also add test_shouldBlockDirectoryFromTree to packages/ExternalStorageProvider/tests/src/com/android/externalstorage/ExternalStorageProviderTest.java. It asserts that "Android", "Download", "Android\u200B", "Download\u200B", "Android/\u200B", "android" and "DOWNLOAD" are blocked, and that "Android/datadir", "Download/my_file" and "Documents" are not (FileNotFoundException is tolerated).
Completeness
- Covers: the three block checks in shouldBlockDirectoryFromTree (root, Download, Android) now operate on an NFD-normalized string with all DEFAULT_IGNORABLE_CODE_POINT characters removed. This addresses invisible-character padding of those names. A path made only of ignorable code points now collapses to empty and is treated as the root.
- The diff changes only the three checks in shouldBlockDirectoryFromTree that it shows. The rest of that method and any other path handling in ExternalStorageProvider or FileSystemProvider are not shown in the material, so it is not known whether they compare raw strings.
- The filter removes only characters with the DEFAULT_IGNORABLE_CODE_POINT property after NFD. Other kinds of lookalike or confusable characters are not addressed by this change. The comparison targets are ASCII, so NFD alone does not alter them.
- The Android 14 commit diffstat lists only ExternalStorageProvider.java (1 file changed), so the regression test added on 15/16/17 is not part of the 14 commit as shown.
Behavior changes
- Tree-access requests whose document path equals "", "Download" or "Android" (case-insensitive) after NFD normalization and removal of default-ignorable code points are now blocked. Before the fix, only exact case-insensitive matches were blocked.
- A small additional cost per call: Normalizer.normalize plus a code point scan on every shouldBlockDirectoryFromTree invocation.
- No new error codes or exceptions; the method still returns boolean.
Per major
- Android 14: same fix: commit 2cd960f154ec in android-security-14.0.0_r29 (RESTRICT AUTOMERGE, cherry-pick of 31d6e9390fbb). Source hunks are identical (blob defbc1142adb -> fa48b9a16021). The diffstat shows only ExternalStorageProvider.java, no test file. 8/8 patched lines present at android-security-14.0.0_r31.
- Android 15: same fix: commit b94ba8571216 in android-security-15.0.0_r17. Source hunks are identical (same blob hashes as 14), plus test_shouldBlockDirectoryFromTree in ExternalStorageProviderTest.java. 8/8 lines present at android-security-15.0.0_r19.
- Android 16: same fix: commit 8785e148ca82 in android-security-16.0.0_r8. Same hunk content on a slightly different file (blob 28b891ebc3c9 -> eb03f386f547; the helper hunk starts at old line 838 instead of 835), plus the same test. 8/8 lines present at android-security-16.0.0_r10.
- Android 17: adapted placement, same logic: commit 250af57de977 in android-security-17.0.0_r1. The shouldBlockDirectoryFromTree hunk is at line 453, and the helper is appended after the trash-directory helper (DIRECTORY_TRASH_STORAGE) in a hunk at line 1048. The test is added to a larger ExternalStorageProviderTest.java. 8/8 lines present at android-security-17.0.0_r3.
Unknowns
- The call chain into shouldBlockDirectoryFromTree (which FileSystemProvider / DocumentsContract operations invoke it), and whether other entry points perform their own unnormalized path checks.
- The remainder of shouldBlockDirectoryFromTree after the patched checks, and whether it uses the raw path.
- How getPathFromDocId handles trailing separators. The test expects "Android/\u200B" to be blocked, but the material does not show that path form being reduced to "Android".
- Whether the Android 14 commit intentionally dropped the regression test, or whether the material only shows the source hunk.
- The file-system behavior that ignores default-ignorable code points, which is stated only in the fix's Javadoc.