Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 1 | ### |
| 2 | ### A domain for further sandboxing privileged apps. |
| 3 | ### |
| 4 | |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 5 | typeattribute priv_app coredomain; |
dcashman | 3e8dbf0 | 2016-12-08 11:23:34 -0800 | [diff] [blame] | 6 | app_domain(priv_app) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 7 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 8 | # Access the network. |
| 9 | net_domain(priv_app) |
| 10 | # Access bluetooth. |
| 11 | bluetooth_domain(priv_app) |
| 12 | |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 13 | # Allow the allocation and use of ptys |
| 14 | # Used by: https://play.privileged.com/store/apps/details?id=jackpal.androidterm |
| 15 | create_pty(priv_app) |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 16 | |
Nick Kralevich | e1ddd74 | 2018-10-27 15:20:38 -0700 | [diff] [blame] | 17 | # Allow loading executable code from writable priv-app home |
| 18 | # directories. This is a W^X violation, however, it needs |
| 19 | # to be supported for now for the following reasons. |
| 20 | # * /data/user_*/0/*/code_cache/* POSSIBLE uses (b/117841367) |
| 21 | # 1) com.android.opengl.shaders_cache |
| 22 | # 2) com.android.skia.shaders_cache |
| 23 | # 3) com.android.renderscript.cache |
| 24 | # * /data/user_de/0/com.google.android.gms/app_chimera |
| 25 | # TODO: Tighten (b/112357170) |
| 26 | allow priv_app privapp_data_file:file execute; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 27 | |
Elliott Hughes | 25cb904 | 2021-02-10 10:07:45 -0800 | [diff] [blame] | 28 | # Chrome Crashpad uses the the dynamic linker to load native executables |
| 29 | # from an APK (b/112050209, crbug.com/928422) |
| 30 | allow priv_app system_linker_exec:file execute_no_trans; |
| 31 | |
Nick Kralevich | 87e9123 | 2019-01-24 13:05:03 -0800 | [diff] [blame] | 32 | allow priv_app privapp_data_file:lnk_file create_file_perms; |
| 33 | |
Alan Stokes | 5c378a5 | 2019-03-21 23:52:30 +0000 | [diff] [blame] | 34 | # Priv apps can find services that expose both @SystemAPI and normal APIs. |
yro | 31b11d8 | 2018-01-09 11:27:36 -0800 | [diff] [blame] | 35 | allow priv_app app_api_service:service_manager find; |
Alan Stokes | 5c378a5 | 2019-03-21 23:52:30 +0000 | [diff] [blame] | 36 | allow priv_app system_api_service:service_manager find; |
| 37 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 38 | allow priv_app audioserver_service:service_manager find; |
| 39 | allow priv_app cameraserver_service:service_manager find; |
| 40 | allow priv_app drmserver_service:service_manager find; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 41 | allow priv_app mediadrmserver_service:service_manager find; |
| 42 | allow priv_app mediaextractor_service:service_manager find; |
yro | 31b11d8 | 2018-01-09 11:27:36 -0800 | [diff] [blame] | 43 | allow priv_app mediametrics_service:service_manager find; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 44 | allow priv_app mediaserver_service:service_manager find; |
Nick Moukhine | affe239 | 2020-09-18 09:47:05 +0200 | [diff] [blame] | 45 | allow priv_app music_recognition_service:service_manager find; |
Ricky Wai | c635297 | 2017-11-13 17:52:05 +0000 | [diff] [blame] | 46 | allow priv_app network_watchlist_service:service_manager find; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 47 | allow priv_app nfc_service:service_manager find; |
Andrew Scull | 3717424 | 2017-02-17 13:51:32 +0000 | [diff] [blame] | 48 | allow priv_app oem_lock_service:service_manager find; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 49 | allow priv_app persistent_data_block_service:service_manager find; |
yro | 31b11d8 | 2018-01-09 11:27:36 -0800 | [diff] [blame] | 50 | allow priv_app radio_service:service_manager find; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 51 | allow priv_app recovery_service:service_manager find; |
yro | 31b11d8 | 2018-01-09 11:27:36 -0800 | [diff] [blame] | 52 | allow priv_app stats_service:service_manager find; |
Yiwei Zhang | 544d6b3 | 2019-02-07 15:00:55 -0800 | [diff] [blame] | 53 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 54 | # Write to /cache. |
| 55 | allow priv_app { cache_file cache_recovery_file }:dir create_dir_perms; |
| 56 | allow priv_app { cache_file cache_recovery_file }:file create_file_perms; |
Nick Kralevich | 21cb045 | 2017-01-23 22:19:06 -0800 | [diff] [blame] | 57 | # /cache is a symlink to /data/cache on some devices. Allow reading the link. |
| 58 | allow priv_app cache_file:lnk_file r_file_perms; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 59 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 60 | # Access to /data/media. |
| 61 | allow priv_app media_rw_data_file:dir create_dir_perms; |
| 62 | allow priv_app media_rw_data_file:file create_file_perms; |
| 63 | |
| 64 | # Used by Finsky / Android "Verify Apps" functionality when |
| 65 | # running "adb install foo.apk". |
| 66 | allow priv_app shell_data_file:file r_file_perms; |
| 67 | allow priv_app shell_data_file:dir r_dir_perms; |
| 68 | |
Max Bires | 715e2ae | 2018-03-13 09:56:27 -0700 | [diff] [blame] | 69 | # Allow traceur to pass file descriptors through a content provider to betterbug |
| 70 | allow priv_app trace_data_file:file { getattr read }; |
| 71 | |
Yi Kong | ae9645e | 2021-03-18 01:45:52 +0800 | [diff] [blame] | 72 | # Allow betterbug to read profile reports generated by profcollect. |
| 73 | userdebug_or_eng(` |
| 74 | allow priv_app profcollectd_data_file:file r_file_perms; |
| 75 | ') |
| 76 | |
Primiano Tucci | 2f99809 | 2021-01-07 17:12:21 +0000 | [diff] [blame] | 77 | # Allow the bug reporting frontend to read the presence and timestamp of the |
| 78 | # trace attached to the bugreport (but not its contents, which will go in the |
| 79 | # usual bugreport .zip file). This is used by the bug reporting UI to tell if |
| 80 | # the bugreport will contain a system trace or not while the bugreport is still |
| 81 | # in progress. |
Nataniel Borges | 6b624a5 | 2021-11-25 14:57:24 +0100 | [diff] [blame] | 82 | allow priv_app wm_trace_data_file:dir r_dir_perms; |
| 83 | allow priv_app wm_trace_data_file:file getattr; |
Primiano Tucci | 2f99809 | 2021-01-07 17:12:21 +0000 | [diff] [blame] | 84 | allow priv_app perfetto_traces_bugreport_data_file:dir r_dir_perms; |
| 85 | allow priv_app perfetto_traces_bugreport_data_file:file { getattr }; |
Primiano Tucci | 2bb8587 | 2021-01-18 09:26:57 +0000 | [diff] [blame] | 86 | # Required to traverse the parent dir (/data/misc/perfetto-traces). |
| 87 | allow priv_app perfetto_traces_data_file:dir { search }; |
Primiano Tucci | 2f99809 | 2021-01-07 17:12:21 +0000 | [diff] [blame] | 88 | |
Lalit Maganti | b549e2d | 2021-12-10 21:50:44 +0000 | [diff] [blame] | 89 | # Allow priv apps (e.g. BetterBug) to receive Perfetto traces through |
| 90 | # the framework (i.e. TracingServiceProxy) and sendfile them into their private |
| 91 | # directories for reporting when network and battery conditions are |
| 92 | # appropriate. |
| 93 | allow priv_app perfetto:fd use; |
| 94 | allow priv_app perfetto_traces_data_file:file { read getattr }; |
| 95 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 96 | # Allow verifier to access staged apks. |
| 97 | allow priv_app { apk_tmp_file apk_private_tmp_file }:dir r_dir_perms; |
| 98 | allow priv_app { apk_tmp_file apk_private_tmp_file }:file r_file_perms; |
| 99 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 100 | # For AppFuse. |
| 101 | allow priv_app vold:fd use; |
| 102 | allow priv_app fuse_device:chr_file { read write }; |
| 103 | |
Tri Vo | f92cfb9 | 2017-12-08 15:37:01 -0800 | [diff] [blame] | 104 | # /proc access |
| 105 | allow priv_app { |
| 106 | proc_vmstat |
| 107 | }:file r_file_perms; |
| 108 | |
| 109 | allow priv_app sysfs_type:dir search; |
Tri Vo | f92cfb9 | 2017-12-08 15:37:01 -0800 | [diff] [blame] | 110 | # Read access to /sys/block/zram*/mm_stat |
| 111 | r_dir_file(priv_app, sysfs_zram) |
| 112 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 113 | r_dir_file(priv_app, rootfs) |
| 114 | |
Ashwini Oruganti | 60c6d4e | 2019-12-13 13:30:53 -0800 | [diff] [blame] | 115 | # Allow com.android.vending to communicate with statsd. |
yro | 31b11d8 | 2018-01-09 11:27:36 -0800 | [diff] [blame] | 116 | binder_call(priv_app, statsd) |
| 117 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 118 | # Allow Phone to read/write cached ringtones (opened by system). |
| 119 | allow priv_app ringtone_file:file { getattr read write }; |
| 120 | |
| 121 | # Access to /data/preloads |
| 122 | allow priv_app preloads_data_file:file r_file_perms; |
| 123 | allow priv_app preloads_data_file:dir r_dir_perms; |
Fyodor Kupolov | b238fe6 | 2017-03-14 11:42:03 -0700 | [diff] [blame] | 124 | allow priv_app preloads_media_file:file r_file_perms; |
| 125 | allow priv_app preloads_media_file:dir r_dir_perms; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 126 | |
Mark Salyzyn | d33a9a1 | 2016-11-07 15:11:39 -0800 | [diff] [blame] | 127 | read_runtime_log_tags(priv_app) |
| 128 | |
Joe Onorato | 9cc5c09 | 2019-03-16 15:45:45 -0700 | [diff] [blame] | 129 | # Allow priv_apps to request and collect incident reports. |
| 130 | # (Also requires DUMP and PACKAGE_USAGE_STATS permissions) |
| 131 | allow priv_app incident_service:service_manager find; |
| 132 | binder_call(priv_app, incidentd) |
| 133 | allow priv_app incidentd:fifo_file { read write }; |
| 134 | |
Hung-ying Tyan | 565384d | 2019-04-26 16:14:52 +0800 | [diff] [blame] | 135 | # Allow priv_apps to check whether Dynamic System Update is enabled |
| 136 | get_prop(priv_app, dynamic_system_prop) |
| 137 | |
Jeff Vander Stoep | 6d8a876 | 2018-01-18 08:55:02 -0800 | [diff] [blame] | 138 | # suppress denials for non-API accesses. |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 139 | dontaudit priv_app exec_type:file getattr; |
Jeff Vander Stoep | 6233848 | 2017-10-20 13:35:42 -0700 | [diff] [blame] | 140 | dontaudit priv_app device:dir read; |
Joel Galenson | 9ec59f6 | 2018-04-20 15:27:21 -0700 | [diff] [blame] | 141 | dontaudit priv_app fs_bpf:dir search; |
Jeff Vander Stoep | 9dc1d53 | 2018-04-04 14:36:13 -0700 | [diff] [blame] | 142 | dontaudit priv_app net_dns_prop:file read; |
Tri Vo | f92cfb9 | 2017-12-08 15:37:01 -0800 | [diff] [blame] | 143 | dontaudit priv_app proc:file read; |
Jeff Vander Stoep | 6233848 | 2017-10-20 13:35:42 -0700 | [diff] [blame] | 144 | dontaudit priv_app proc_interrupts:file read; |
| 145 | dontaudit priv_app proc_modules:file read; |
Tri Vo | e319c03 | 2019-05-09 16:14:04 -0700 | [diff] [blame] | 146 | dontaudit priv_app proc_net:file read; |
Jeff Vander Stoep | e88d649 | 2018-01-29 20:50:59 -0800 | [diff] [blame] | 147 | dontaudit priv_app proc_stat:file read; |
Jeff Vander Stoep | 6d8a876 | 2018-01-18 08:55:02 -0800 | [diff] [blame] | 148 | dontaudit priv_app proc_version:file read; |
Jeff Vander Stoep | 9dc1d53 | 2018-04-04 14:36:13 -0700 | [diff] [blame] | 149 | dontaudit priv_app sysfs:dir read; |
Jeff Vander Stoep | 4894d9f | 2018-06-29 11:04:24 -0700 | [diff] [blame] | 150 | dontaudit priv_app sysfs:file read; |
Jeff Vander Stoep | 9dc1d53 | 2018-04-04 14:36:13 -0700 | [diff] [blame] | 151 | dontaudit priv_app sysfs_android_usb:file read; |
Jeff Vander Stoep | 90bd1de | 2019-10-25 11:01:40 +0200 | [diff] [blame] | 152 | dontaudit priv_app sysfs_dm:file r_file_perms; |
Inseob Kim | 3dbf3d8 | 2020-06-25 21:20:42 +0900 | [diff] [blame] | 153 | dontaudit priv_app { wifi_prop wifi_hal_prop }:file read; |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 154 | |
Nathan Harold | ee26864 | 2017-12-14 18:20:30 -0800 | [diff] [blame] | 155 | # allow privileged apps to use UDP sockets provided by the system server but not |
| 156 | # modify them other than to connect |
Nathan Harold | 252b015 | 2018-03-27 06:34:54 -0700 | [diff] [blame] | 157 | allow priv_app system_server:udp_socket { |
| 158 | connect getattr read recvfrom sendto write getopt setopt }; |
Nathan Harold | ee26864 | 2017-12-14 18:20:30 -0800 | [diff] [blame] | 159 | |
Songchun Fan | 3922253 | 2020-02-13 08:38:36 -0800 | [diff] [blame] | 160 | # allow apps like Phonesky to check the file signature of an apk installed on |
Songchun Fan | b4c9491 | 2021-02-09 14:33:24 -0800 | [diff] [blame] | 161 | # the Incremental File System, fill missing blocks and get the app status and loading progress |
Yurii Zubrytskyi | 80dfa06 | 2021-01-14 21:01:25 -0800 | [diff] [blame] | 162 | allowxperm priv_app apk_data_file:file ioctl { |
| 163 | INCFS_IOCTL_READ_SIGNATURE |
| 164 | INCFS_IOCTL_FILL_BLOCKS |
| 165 | INCFS_IOCTL_GET_BLOCK_COUNT |
Songchun Fan | b4c9491 | 2021-02-09 14:33:24 -0800 | [diff] [blame] | 166 | INCFS_IOCTL_GET_FILLED_BLOCKS |
Yurii Zubrytskyi | 80dfa06 | 2021-01-14 21:01:25 -0800 | [diff] [blame] | 167 | }; |
Songchun Fan | 3922253 | 2020-02-13 08:38:36 -0800 | [diff] [blame] | 168 | |
Songchun Fan | 82ea55d | 2020-02-21 17:41:40 -0800 | [diff] [blame] | 169 | # allow privileged data loader apps (e.g. com.android.vending) to read logs from Incremental File System |
Songchun Fan | 2679d8e | 2020-03-17 18:30:34 -0700 | [diff] [blame] | 170 | allow priv_app incremental_control_file:file { read getattr ioctl }; |
| 171 | |
| 172 | # allow apps like Phonesky to request permission to fill blocks of an apk file |
| 173 | # on the Incremental File System. |
| 174 | allowxperm priv_app incremental_control_file:file ioctl INCFS_IOCTL_PERMIT_FILL; |
Songchun Fan | 82ea55d | 2020-02-21 17:41:40 -0800 | [diff] [blame] | 175 | |
Alex Buynytskyy | 0f01076 | 2021-02-04 14:41:41 -0800 | [diff] [blame] | 176 | # allow privileged apps to read the vendor property that indicates if Incremental File System is enabled |
| 177 | get_prop(priv_app, incremental_prop) |
| 178 | |
Seigo Nonaka | 5717c08 | 2023-09-11 09:53:44 +0900 | [diff] [blame^] | 179 | # allow privileged apps to read the device config flags. |
| 180 | get_prop(priv_app, device_config_aconfig_flags_prop) |
| 181 | |
Nikita Ioffe | 01d4c99 | 2020-04-22 00:04:04 +0100 | [diff] [blame] | 182 | # Required for Phonesky to be able to read APEX files under /data/apex/active/. |
| 183 | allow priv_app apex_data_file:dir search; |
| 184 | allow priv_app staging_data_file:file r_file_perms; |
Mohammad Samiul Islam | a45cdda | 2020-12-10 21:48:51 +0000 | [diff] [blame] | 185 | # Required for Phonesky to be able to read staged files under /data/app-staging. |
| 186 | allow priv_app staging_data_file:dir r_dir_perms; |
Nikita Ioffe | 01d4c99 | 2020-04-22 00:04:04 +0100 | [diff] [blame] | 187 | |
Deyao Ren | dfb3182 | 2022-10-03 22:32:09 +0000 | [diff] [blame] | 188 | # Allow com.android.vending to access files under vendor/apex as well as system apex files. |
| 189 | # This is required for com.android.vending to handle APEXes for e.g. delta patch optimization. |
| 190 | allow priv_app vendor_apex_file:dir r_dir_perms; |
| 191 | allow priv_app vendor_apex_file:file r_file_perms; |
| 192 | |
tianli | 0709fbc | 2020-06-17 17:57:25 +0800 | [diff] [blame] | 193 | # allow priv app to access the system app data files for ContentProvider case. |
| 194 | allow priv_app system_app_data_file:file { read getattr }; |
| 195 | |
Hongguang | 737b098 | 2021-06-09 09:36:39 -0700 | [diff] [blame] | 196 | # Allow the renderscript compiler to be run. |
| 197 | domain_auto_trans(priv_app, rs_exec, rs) |
| 198 | |
| 199 | # Allow loading and deleting executable shared libraries |
| 200 | # within an application home directory. Such shared libraries would be |
| 201 | # created by things like renderscript or via other mechanisms. |
| 202 | allow priv_app app_exec_data_file:file { r_file_perms execute unlink }; |
| 203 | |
Alan Stokes | 3060852 | 2022-10-24 12:32:34 +0100 | [diff] [blame] | 204 | # Allow privileged apps to create a VM. Note that access is still |
| 205 | # guarded with the `android.permission.MANAGE_VIRTUAL_MACHINE` |
| 206 | # permission. |
| 207 | virtualizationservice_use(priv_app) |
| 208 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 209 | ### |
| 210 | ### neverallow rules |
| 211 | ### |
| 212 | |
| 213 | # Receive or send uevent messages. |
| 214 | neverallow priv_app domain:netlink_kobject_uevent_socket *; |
| 215 | |
| 216 | # Receive or send generic netlink messages |
| 217 | neverallow priv_app domain:netlink_socket *; |
| 218 | |
Alan Stokes | a0518b7 | 2020-10-27 11:28:00 +0000 | [diff] [blame] | 219 | # Read or write kernel printk buffer |
| 220 | neverallow priv_app kmsg_device:chr_file no_rw_file_perms; |
| 221 | |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 222 | # Too much leaky information in debugfs. It's a security |
| 223 | # best practice to ensure these files aren't readable. |
Steven Moreland | b56bf68 | 2023-05-22 23:02:24 +0000 | [diff] [blame] | 224 | neverallow priv_app debugfs_type:file read; |
Alex Klyubin | 92295ef | 2017-01-05 15:44:32 -0800 | [diff] [blame] | 225 | |
| 226 | # Do not allow privileged apps to register services. |
| 227 | # Only trusted components of Android should be registering |
| 228 | # services. |
| 229 | neverallow priv_app service_manager_type:service_manager add; |
| 230 | |
| 231 | # Do not allow privileged apps to connect to the property service |
| 232 | # or set properties. b/10243159 |
| 233 | neverallow priv_app property_socket:sock_file write; |
| 234 | neverallow priv_app init:unix_stream_socket connectto; |
| 235 | neverallow priv_app property_type:property_service set; |
| 236 | |
| 237 | # Do not allow priv_app to be assigned mlstrustedsubject. |
| 238 | # This would undermine the per-user isolation model being |
| 239 | # enforced via levelFrom=user in seapp_contexts and the mls |
| 240 | # constraints. As there is no direct way to specify a neverallow |
| 241 | # on attribute assignment, this relies on the fact that fork |
| 242 | # permission only makes sense within a domain (hence should |
| 243 | # never be granted to any other domain within mlstrustedsubject) |
| 244 | # and priv_app is allowed fork permission to itself. |
| 245 | neverallow priv_app mlstrustedsubject:process fork; |
| 246 | |
| 247 | # Do not allow priv_app to hard link to any files. |
| 248 | # In particular, if priv_app links to other app data |
| 249 | # files, installd will not be able to guarantee the deletion |
| 250 | # of the linked to file. Hard links also contribute to security |
| 251 | # bugs, so we want to ensure priv_app never has this |
| 252 | # capability. |
| 253 | neverallow priv_app file_type:file link; |
Max Bires | 715e2ae | 2018-03-13 09:56:27 -0700 | [diff] [blame] | 254 | |
| 255 | # priv apps should not be able to open trace data files, they should depend |
| 256 | # upon traceur to pass a file descriptor which they can then read |
| 257 | neverallow priv_app trace_data_file:dir *; |
| 258 | neverallow priv_app trace_data_file:file { no_w_file_perms open }; |
Tri Vo | f55c989 | 2018-10-10 22:48:15 +0000 | [diff] [blame] | 259 | |
| 260 | # Do not allow priv_app access to cgroups. |
| 261 | neverallow priv_app cgroup:file *; |
Marco Ballesio | aa4ce95 | 2021-02-11 15:18:11 -0800 | [diff] [blame] | 262 | neverallow priv_app cgroup_v2:file *; |
Nick Kralevich | e1ddd74 | 2018-10-27 15:20:38 -0700 | [diff] [blame] | 263 | |
| 264 | # Do not allow loading executable code from non-privileged |
| 265 | # application home directories. Code loading across a security boundary |
| 266 | # is dangerous and allows a full compromise of a privileged process |
| 267 | # by an unprivileged process. b/112357170 |
Steven Moreland | f3722d5 | 2023-05-22 23:45:40 +0000 | [diff] [blame] | 268 | neverallow priv_app { app_data_file_type -privapp_data_file }:file no_x_file_perms; |
Nick Kralevich | 87e9123 | 2019-01-24 13:05:03 -0800 | [diff] [blame] | 269 | |
Steven Moreland | f3722d5 | 2023-05-22 23:45:40 +0000 | [diff] [blame] | 270 | # Do not follow any app provided symlinks |
| 271 | neverallow priv_app { app_data_file_type -privapp_data_file }:lnk_file { open read getattr }; |
Jeff Vander Stoep | 7f23ef4 | 2021-09-24 11:52:08 +0200 | [diff] [blame] | 272 | |
| 273 | # Do not allow getting permission-protected network information from sysfs. |
| 274 | neverallow priv_app sysfs_net:file *; |
| 275 | |
| 276 | # Restrict socket ioctls. Either 1. disallow privileged ioctls, 2. disallow the |
| 277 | # ioctl permission, or 3. disallow the socket class. |
| 278 | neverallowxperm priv_app domain:{ icmp_socket rawip_socket tcp_socket udp_socket } ioctl priv_sock_ioctls; |
| 279 | neverallow priv_app *:{ netlink_route_socket netlink_selinux_socket } ioctl; |
| 280 | neverallow priv_app *:{ |
| 281 | socket netlink_socket packet_socket key_socket appletalk_socket |
| 282 | netlink_tcpdiag_socket netlink_nflog_socket |
| 283 | netlink_xfrm_socket netlink_audit_socket |
| 284 | netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket |
| 285 | netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket |
| 286 | netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket |
| 287 | netlink_rdma_socket netlink_crypto_socket sctp_socket |
| 288 | ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket |
| 289 | atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket |
| 290 | bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket |
| 291 | alg_socket nfc_socket kcm_socket qipcrtr_socket smc_socket xdp_socket |
| 292 | } *; |
Josh Yang | 9aeba4f | 2022-02-04 10:49:30 -0800 | [diff] [blame] | 293 | |
| 294 | # Allow priv apps to report off body events to keystore2. |
| 295 | allow priv_app keystore:keystore2 report_off_body; |