Skip to content

Commit a0b943e

Browse files
Eric Miaojoeyhuab
authored andcommitted
Enforce permission and debuggability for am dumpbitmaps
CVE-Info: CVE-2026-0047 | Severity: Critical The previous implementation did not check for permission and debuggability for `am dumpbitmaps`, which allows a malicious app to access bitmaps in memory of other processes. Detailed vulnerability and how a malicious app could make use of it are documented in b/465136263. This CL enforces both permission check (with the same permission as `am dumpheap`) and debuggability. Bug: 465136263 Bug: 475543853 Flag: EXEMPT BUGFIX Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:93b72e5a84815c09d5eac89fe8f974a44002c629 Merged-In: I10836ce46969f50d837f7f8bf6336f977e830f05 Change-Id: I10836ce46969f50d837f7f8bf6336f977e830f05 See: b/465136263#comment27
1 parent f1bedc1 commit a0b943e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

services/core/java/com/android/server/am/ActivityManagerService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16216,6 +16216,10 @@ public void dumpAllResources(ParcelFileDescriptor fd, PrintWriter pw) throws Rem
1621616216
@NeverCompile // Avoid size overhead of debugging code.
1621716217
public void dumpBitmapsProto(ParcelFileDescriptor fd, String[] processes, int userId,
1621816218
boolean allPkgs, String dumpFormat) {
16219+
// note: re-use the same permission as dumpHeap until its own permission is available
16220+
enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER,
16221+
"dumpBitmapsProto()");
16222+
1621916223
ProtoOutputStream proto = new ProtoOutputStream(fd.getFileDescriptor());
1622016224
final ArrayList<ProcessRecord> procs = collectProcesses(null, 0, allPkgs, processes);
1622116225
if (procs == null) {
@@ -16232,6 +16236,13 @@ public void dumpBitmapsProto(ParcelFileDescriptor fd, String[] processes, int us
1623216236
if (thread == null) {
1623316237
continue;
1623416238
}
16239+
16240+
// check process debuggability
16241+
if (!Build.IS_DEBUGGABLE && !r.isDebuggable()) {
16242+
Slog.w(TAG, "Process not debuggable: " + r.info.packageName);
16243+
continue;
16244+
}
16245+
1623516246
try {
1623616247
if (pid == Process.myPid()) {
1623716248
// Directly dump to target proto for local dump to avoid hang.

0 commit comments

Comments
 (0)