Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b651d295 authored by Kunal Malhotra's avatar Kunal Malhotra
Browse files

Adding in verification of calling UID in onShellCommand

Test: manual testing on device
Change-Id: I68903ebd6d3d85f4bc820b745e3233a448b62273
Bug: b/261709193
parent 6e73eaf2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -9488,6 +9488,10 @@ 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) {
            throw new SecurityException("Shell commands are only callable by root or shell");
        }
        (new ActivityManagerShellCommand(this, false)).exec(
                this, in, out, err, args, callback, resultReceiver);
    }