# Android Security: Welcome To Shell (Permissions)

DevFeed: [Android Security: Welcome To Shell (Permissions)](<https://devfeed.tech/articles/android-security-welcome-to-shell-permissions-26036.md>)

Original publisher: [Read original article](<http://doridori.github.io//Android-Security-welcome-to-shell/>)

Author: SystemDotRun

Published: 2016-08-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [SystemDotRun](<https://devfeed.tech/sources/systemdotrun.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Android Security](<https://devfeed.tech/topics/android-security.md>), [Security](<https://devfeed.tech/topics/security.md>), [Process](<https://devfeed.tech/topics/process.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [POSIX](<https://devfeed.tech/topics/posix.md>)

Tags: [adb](<https://devfeed.tech/tags/adb.md>), [android](<https://devfeed.tech/tags/android.md>), [android-security](<https://devfeed.tech/tags/android-security.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [posix](<https://devfeed.tech/tags/posix.md>), [process](<https://devfeed.tech/tags/process.md>), [security](<https://devfeed.tech/tags/security.md>)

## AI overview

This article examines whether a shell started by an Android application has the same permissions as a shell accessed through ADB. It explains that Android process privileges depend on UID, GID, supplementary GIDs, and kernel-enforced resource access, then compares shell processes from ADB and an installed application.

## Source excerpt

Does a shell started from an application have the same permissions as a shell started via adb? What a good question! ADB is a shell that you get on a PC with the same permissions as if you were to run a shell/terminal app on the phone itself. I came across this statement on Reddit which went against my intuition and I had a quick look into it. It was important for me so I can understand the difference in potential attack vectors surrounding open shells. I started by flicking through the excellent Android Security Internals: An In-Depth Guide to Android's Security Architecture to get an overview about how process permissions worked on android. Most of the overview is just a condensed version of a few pages of this great book. This post will mostly talk about how this stuff works with low-level kernel permissions work in the OS, as opposed to high-level operations that involve the package manager (pm). A brief summary of the low-level stuff is: Privileges are based upon the processes UID, GID and supplementary GIDs Like all POSIX systems [clarification needed] access to system resources regulated by the kernel (files, sockets etc) is based on the owner and access mode of the resource and the UID & GID of accessing process Some permissions on Android are mapped to GIDs data/etc/platform.xml Other permissions are checked via pm and I'm guessing are not checkable by the process outlined in this post. These GIDs are mapped to AIDs android_filesystem_config.h For applications (quick diversion) the package manager will add the GIDs for the application at install time, for permissions that appear in the platform.xml file, to data/system/packages.list for the applications entry. When a process is forked from the zygote process, as it does for new application processes, the UID and GIDs are set. Kernel and system daemons use these to grant access to resources and functions. Relative shell permissions So, does a shell started from an application have the same permissions as a s