diff options
| author | 2023-10-04 03:49:40 +0000 | |
|---|---|---|
| committer | 2023-10-04 03:49:40 +0000 | |
| commit | 0670e9b77ea9c34298b7e6d510d137edf992f412 (patch) | |
| tree | 29aa9117f487073ea865bbd224cc17d0ebac1ae1 | |
| parent | f5f429385c88789c77cff7a886605ffaa5f29d47 (diff) | |
| parent | aaaf2b6cecb61877d0b1d31db14d18173a60951f (diff) | |
Merge "Adding in verification of calling UID in onShellCommand" into rvc-dev am: 7c905e103a am: ca34073d93 am: 8f6b8d313d am: 868bc803ff am: 264a36f6d0 am: 632a8b8a43 am: fe967cb3b4 am: aaaf2b6cec
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24058898
Change-Id: Ie70f51b651b17522ae297cfb3a2334bec58dcb1c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 8089dcfe7ebc..638e3946c8f9 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -9694,6 +9694,13 @@ public class ActivityManagerService extends IActivityManager.Stub public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, String[] args, ShellCallback callback, ResultReceiver resultReceiver) { + final int callingUid = Binder.getCallingUid(); + if (callingUid != ROOT_UID && callingUid != Process.SHELL_UID) { + if (resultReceiver != null) { + resultReceiver.send(-1, null); + } + throw new SecurityException("Shell commands are only callable by root or shell"); + } (new ActivityManagerShellCommand(this, false)).exec( this, in, out, err, args, callback, resultReceiver); } |