Access Control Patterns in Android Open Source Project
ratazze
8 views
7 slides
Jul 09, 2024
Slide 1 of 7
1
2
3
4
5
6
7
About This Presentation
Access Control Patterns in AOSP
Size: 49.01 KB
Language: en
Added: Jul 09, 2024
Slides: 7 pages
Slide Content
Access Control Patterns in AOSP Paul Ratazzi July-September 2015
Access Control Pattern Code or data structures that assign powers to subjects or adjudicate subjects’ requests for access to objects.
Purposes Gain insight into security architecture Learn ‘proper’ way of adding new features, services, etc. Identify problems, missing controls Find better/best way to fix problems, improve Quickly evaluate vendor customizations or new features Predict where controls should be
Breakdown Access control involves Subject Object Decision Look for places where: Subjects are identified Decisions are made Grant/deny results are returned
Subject Identification Binder.getCallingUid () Many derivatives, e.g. getCallingUserId () Binder.getCallingPid () GID (method TBD) GID-controlled resources such as BT, Internet, etc. Package name (method TBD)
Decision Making and Result Return Use of checkPermission () and related methods to verify manifest permissions Compare current user to calling user DESCRIPTOR check across proxy-stub interface (Parcel class) Permission bypass for system (1000) and root (0) uid s System-only (calling uid == 1000) protected actions Calling app vs. package name check SELinux checks (kernel)
Code Example: Permission Bypass for system/root ( ActivityManagerService.getIntentSender () ) if ( callingUid != 0 && callingUid != Process.SYSTEM_UID ) { int uid = AppGlobals.getPackageManager () . getPackageUid ( packageName , UserHandle.getUserId ( callingUid )); if (! UserHandle.isSameApp ( callingUid , uid )) { String msg = "Permission Denial: getIntentSender () from pid =" + Binder.getCallingPid () + ", uid =" + Binder.getCallingUid () + ", (need uid =" + uid + ")" + " is not allowed to send as package " + packageName ; Slog.w (TAG, msg ); throw new SecurityException ( msg ); } }