From 166d683ea416414794f50073b9711e452b6cbb44 Mon Sep 17 00:00:00 2001 From: Zim Date: Wed, 16 Dec 2020 10:36:40 +0000 Subject: [PATCH] Make low storage notification PendingIntent immutable Malicious apps, especially NotificationListeners can hijack such intents and grant themselves access to sensitive URIs by relying on the OS URI granting mechanism. This change mitigates the security issue and also adheres to the new enforcement requiring Android S+ targeting apps to explicitly specifiy a mutability flag. Test: Manual Bug: 153466381 Change-Id: If478386d68cf25c8f93c2685824700679e6b9ea9 (cherry picked from commit df9a44e1fb3968c6e3121aa76515a58f5e69fbee) --- .../android/server/storage/DeviceStorageMonitorService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java index 734b718244906..7ae296353a5b7 100644 --- a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java +++ b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java @@ -491,8 +491,8 @@ public class DeviceStorageMonitorService extends SystemService { com.android.internal.R.string.low_internal_storage_view_text); } - PendingIntent intent = PendingIntent.getActivityAsUser(context, 0, lowMemIntent, 0, - null, UserHandle.CURRENT); + PendingIntent intent = PendingIntent.getActivityAsUser(context, 0, lowMemIntent, + PendingIntent.FLAG_IMMUTABLE, null, UserHandle.CURRENT); Notification notification = new Notification.Builder(context, SystemNotificationChannels.ALERTS) .setSmallIcon(com.android.internal.R.drawable.stat_notify_disk_full)