2017-01-28 00:53:38 +01:00
|
|
|
###
|
|
|
|
### neverallow rules for untrusted app domains
|
|
|
|
###
|
|
|
|
|
2017-04-27 01:14:40 +02:00
|
|
|
define(`all_untrusted_apps',`{
|
|
|
|
ephemeral_app
|
|
|
|
isolated_app
|
2023-01-20 04:34:19 +01:00
|
|
|
isolated_app_all
|
2023-01-17 09:16:44 +01:00
|
|
|
isolated_compute_app
|
2017-04-27 01:14:40 +02:00
|
|
|
mediaprovider
|
2020-01-30 16:52:45 +01:00
|
|
|
mediaprovider_app
|
2017-04-27 01:14:40 +02:00
|
|
|
untrusted_app
|
|
|
|
untrusted_app_25
|
2018-04-03 20:22:38 +02:00
|
|
|
untrusted_app_27
|
2020-01-20 10:14:48 +01:00
|
|
|
untrusted_app_29
|
2021-05-12 14:19:24 +02:00
|
|
|
untrusted_app_30
|
2017-04-27 01:14:40 +02:00
|
|
|
untrusted_app_all
|
|
|
|
}')
|
2017-01-28 00:53:38 +01:00
|
|
|
# Receive or send uevent messages.
|
2017-02-06 19:31:45 +01:00
|
|
|
neverallow all_untrusted_apps domain:netlink_kobject_uevent_socket *;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
|
|
|
# Receive or send generic netlink messages
|
2017-02-06 19:31:45 +01:00
|
|
|
neverallow all_untrusted_apps domain:netlink_socket *;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
2020-10-27 12:28:00 +01:00
|
|
|
# Read or write kernel printk buffer
|
|
|
|
neverallow all_untrusted_apps kmsg_device:chr_file no_rw_file_perms;
|
|
|
|
|
2017-01-28 00:53:38 +01:00
|
|
|
# Too much leaky information in debugfs. It's a security
|
|
|
|
# best practice to ensure these files aren't readable.
|
2018-11-29 19:37:18 +01:00
|
|
|
neverallow all_untrusted_apps { debugfs_type -debugfs_kcov }:file read;
|
2019-02-04 19:07:15 +01:00
|
|
|
neverallow {all_untrusted_apps userdebug_or_eng(`-domain')} debugfs_type:{ file lnk_file } read;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
|
|
|
# Do not allow untrusted apps to register services.
|
|
|
|
# Only trusted components of Android should be registering
|
|
|
|
# services.
|
2017-02-06 19:31:45 +01:00
|
|
|
neverallow all_untrusted_apps service_manager_type:service_manager add;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
2017-04-25 18:27:54 +02:00
|
|
|
# Do not allow untrusted apps to use VendorBinder
|
|
|
|
neverallow all_untrusted_apps vndbinder_device:chr_file *;
|
|
|
|
neverallow all_untrusted_apps vndservice_manager_type:service_manager *;
|
|
|
|
|
2017-01-28 00:53:38 +01:00
|
|
|
# Do not allow untrusted apps to connect to the property service
|
|
|
|
# or set properties. b/10243159
|
2017-04-11 01:57:48 +02:00
|
|
|
neverallow { all_untrusted_apps -mediaprovider } property_socket:sock_file write;
|
|
|
|
neverallow { all_untrusted_apps -mediaprovider } init:unix_stream_socket connectto;
|
|
|
|
neverallow { all_untrusted_apps -mediaprovider } property_type:property_service set;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
2019-10-15 21:00:22 +02:00
|
|
|
# net.dns properties are not a public API. Disallow untrusted apps from reading this property.
|
|
|
|
neverallow { all_untrusted_apps } net_dns_prop:file read;
|
2018-03-29 00:34:37 +02:00
|
|
|
|
2021-04-30 06:52:42 +02:00
|
|
|
# radio_cdma_ecm_prop properties are not a public API. Disallow untrusted apps from reading this property.
|
|
|
|
neverallow { all_untrusted_apps } radio_cdma_ecm_prop:file read;
|
|
|
|
|
2019-01-11 18:37:46 +01:00
|
|
|
# Shared libraries created by trusted components within an app home
|
|
|
|
# directory can be dlopen()ed. To maintain the W^X property, these files
|
2018-12-12 18:06:05 +01:00
|
|
|
# must never be writable to the app.
|
2019-01-11 18:37:46 +01:00
|
|
|
neverallow all_untrusted_apps app_exec_data_file:file
|
2018-12-12 18:06:05 +01:00
|
|
|
{ append create link relabelfrom relabelto rename setattr write };
|
|
|
|
|
2018-12-21 19:03:50 +01:00
|
|
|
# Block calling execve() on files in an apps home directory.
|
2018-11-02 19:12:43 +01:00
|
|
|
# This is a W^X violation (loading executable code from a writable
|
|
|
|
# home directory). For compatibility, allow for targetApi <= 28.
|
|
|
|
# b/112357170
|
|
|
|
neverallow {
|
|
|
|
all_untrusted_apps
|
|
|
|
-untrusted_app_25
|
|
|
|
-untrusted_app_27
|
2018-11-02 22:34:06 +01:00
|
|
|
-runas_app
|
2018-11-02 19:12:43 +01:00
|
|
|
} { app_data_file privapp_data_file }:file execute_no_trans;
|
|
|
|
|
Add SELinux policy for storage areas
We are adding the ability for apps to create "storage areas", which are
transparently encrypted directories that can only be opened when the
device is unlocked.
This CL makes the required SELinux policy changes.
First, assign the type "system_userdir_file" to the new top-level
directory /data/storage_area (non-recursively). This is the same type
used by the other top-level directories containing app data, such as
/data/user, and it restricts access to the directory in the desired way.
Second, add new types to represent an app's directory of storage areas,
the storage areas themselves, and their contents:
`storage_area_app_dir`, `storage_area_dir`, and
`storage_area_content_file` respectively.
All are `app_data_file_type`s.
The directory structure and their associated labels is as follows (note
that they also all get the categories of the user+package):
/data/storage_area/userId/pkgName
storage_area_app_dir
/data/storage_area/userId/pkgName/storageAreaName
storage_area_dir
/data/storage_area/userId/pkgName/storageAreaName/myFile.txt
storage_area_content_file
/data/storage_area/userId/pkgName/storageAreaName/mySubDir
storage_area_content_file
These new types allow us to restrict how and which processes interact
with storage areas.
The new type for the contents of storage areas allows us to add new,
desirable restrictions that we cannot add to the more general
`app_data_file` type in order to maintain backwards-compatibility,
e.g., we block apps from executing any files in their storage areas.
Third, allow:
-- vold_prepare_subdirs to create and delete
storage areas on behalf of apps, and assign them the SElinux type
`storage_area_dir`
i.e. create directories
/data/storage_area/$userId/$pkgName/$storageAreaName
-- vold to assign encryption policies to storage area directories
-- installd to create an app's directory of storage areas on app
install, and delete them on app uninstall, and assign them the SElinux
type `storage_area_app_dir`,
i.e. directories /data/storage_area/$userId/$pkgName
We also add a new SELinux type to represent the storage area encryption
keys: `storage_area_key_file`.
The keys are created by vold on storage area creation, and deleted
either by vold if an app calls
the `deleteStorageArea` API function explicitly, or by installd on
app uninstall.
These keys are stored in `/data/misc_ce/$userId/storage_area_keys`,
and only installd and vold have access to them.
Bug: 325121608
Test: atest StorageAreaTest
Change-Id: I74805d249f59226fc6963693f682c70949bfad93
2024-04-30 22:26:55 +02:00
|
|
|
is_flag_enabled(RELEASE_UNLOCKED_STORAGE_API, `
|
|
|
|
# block apps from executing files in their storage areas
|
|
|
|
# this is a stronger and more desirable guarantee than blocking execute_no_trans, but
|
|
|
|
# execute cannot be blocked on all of app_data_file without causing
|
|
|
|
# backwards compatibility issues (see b/237289679)
|
|
|
|
neverallow appdomain storage_area_content_file:file execute;
|
|
|
|
')
|
|
|
|
|
|
|
|
is_flag_enabled(RELEASE_UNLOCKED_STORAGE_API, `
|
|
|
|
# dont allow apps to modify their own directories of storage areas
|
|
|
|
neverallow appdomain storage_area_app_dir:dir_file_class_set {
|
|
|
|
create write setattr relabelfrom relabelto append unlink link rename
|
|
|
|
};
|
|
|
|
')
|
|
|
|
|
2018-11-20 00:02:49 +01:00
|
|
|
# Do not allow untrusted apps to invoke dex2oat. This was historically required
|
|
|
|
# by ART for compiling secondary dex files but has been removed in Q.
|
|
|
|
# Exempt legacy apps (targetApi<=28) for compatibility.
|
|
|
|
neverallow {
|
|
|
|
all_untrusted_apps
|
|
|
|
-untrusted_app_25
|
|
|
|
-untrusted_app_27
|
|
|
|
} dex2oat_exec:file no_x_file_perms;
|
|
|
|
|
2017-01-28 00:53:38 +01:00
|
|
|
# Do not allow untrusted apps to be assigned mlstrustedsubject.
|
|
|
|
# This would undermine the per-user isolation model being
|
|
|
|
# enforced via levelFrom=user in seapp_contexts and the mls
|
|
|
|
# constraints. As there is no direct way to specify a neverallow
|
|
|
|
# on attribute assignment, this relies on the fact that fork
|
|
|
|
# permission only makes sense within a domain (hence should
|
|
|
|
# never be granted to any other domain within mlstrustedsubject)
|
|
|
|
# and an untrusted app is allowed fork permission to itself.
|
2017-02-06 19:31:45 +01:00
|
|
|
neverallow all_untrusted_apps mlstrustedsubject:process fork;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
|
|
|
# Do not allow untrusted apps to hard link to any files.
|
|
|
|
# In particular, if an untrusted app links to other app data
|
|
|
|
# files, installd will not be able to guarantee the deletion
|
|
|
|
# of the linked to file. Hard links also contribute to security
|
|
|
|
# bugs, so we want to ensure untrusted apps never have this
|
|
|
|
# capability.
|
2017-02-06 19:31:45 +01:00
|
|
|
neverallow all_untrusted_apps file_type:file link;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
|
|
|
# Do not allow untrusted apps to access network MAC address file
|
2019-07-18 09:04:54 +02:00
|
|
|
neverallow all_untrusted_apps sysfs_net:file no_rw_file_perms;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
2017-10-04 22:12:25 +02:00
|
|
|
# Do not allow any write access to files in /sys
|
2018-03-29 00:34:37 +02:00
|
|
|
neverallow all_untrusted_apps sysfs_type:file { no_w_file_perms no_x_file_perms };
|
|
|
|
|
|
|
|
# Apps may never access the default sysfs label.
|
|
|
|
neverallow all_untrusted_apps sysfs:file no_rw_file_perms;
|
2017-10-04 22:12:25 +02:00
|
|
|
|
2017-01-28 00:53:38 +01:00
|
|
|
# Restrict socket ioctls. Either 1. disallow privileged ioctls, 2. disallow the
|
|
|
|
# ioctl permission, or 3. disallow the socket class.
|
2018-06-22 01:57:58 +02:00
|
|
|
neverallowxperm all_untrusted_apps domain:{ icmp_socket rawip_socket tcp_socket udp_socket } ioctl priv_sock_ioctls;
|
2017-02-06 19:31:45 +01:00
|
|
|
neverallow all_untrusted_apps *:{ netlink_route_socket netlink_selinux_socket } ioctl;
|
|
|
|
neverallow all_untrusted_apps *:{
|
2017-01-28 00:53:38 +01:00
|
|
|
socket netlink_socket packet_socket key_socket appletalk_socket
|
2017-02-06 20:14:58 +01:00
|
|
|
netlink_tcpdiag_socket netlink_nflog_socket
|
|
|
|
netlink_xfrm_socket netlink_audit_socket
|
2017-01-28 00:53:38 +01:00
|
|
|
netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket
|
|
|
|
netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket
|
|
|
|
netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket
|
2018-06-22 01:57:58 +02:00
|
|
|
netlink_rdma_socket netlink_crypto_socket sctp_socket
|
|
|
|
ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket
|
|
|
|
atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket
|
|
|
|
bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket
|
2021-07-12 14:11:33 +02:00
|
|
|
alg_socket nfc_socket kcm_socket qipcrtr_socket smc_socket xdp_socket
|
2017-01-28 00:53:38 +01:00
|
|
|
} *;
|
|
|
|
|
2021-09-07 13:25:38 +02:00
|
|
|
# Apps can read/write an already open vsock (e.g. created by
|
|
|
|
# virtualizationservice) but nothing more than that (e.g. creating a
|
|
|
|
# new vsock, etc.)
|
2022-08-30 16:10:48 +02:00
|
|
|
neverallow all_untrusted_apps *:vsock_socket ~{ getattr getopt read write };
|
2021-07-12 14:11:33 +02:00
|
|
|
|
2020-01-20 10:14:48 +01:00
|
|
|
# Disallow sending RTM_GETLINK messages on netlink sockets.
|
2021-04-30 15:48:09 +02:00
|
|
|
neverallow all_untrusted_apps domain:netlink_route_socket { bind nlmsg_readpriv };
|
2022-05-17 14:22:02 +02:00
|
|
|
neverallow priv_app domain:netlink_route_socket { bind nlmsg_readpriv };
|
2020-01-20 10:14:48 +01:00
|
|
|
|
2021-05-12 14:19:24 +02:00
|
|
|
# Disallow sending RTM_GETNEIGH{TBL} messages on netlink sockets.
|
|
|
|
neverallow {
|
|
|
|
all_untrusted_apps
|
|
|
|
-untrusted_app_25
|
|
|
|
-untrusted_app_27
|
|
|
|
-untrusted_app_29
|
|
|
|
-untrusted_app_30
|
|
|
|
} domain:netlink_route_socket nlmsg_getneigh;
|
|
|
|
|
2017-01-28 00:53:38 +01:00
|
|
|
# Do not allow untrusted apps access to /cache
|
2017-04-11 01:57:48 +02:00
|
|
|
neverallow { all_untrusted_apps -mediaprovider } { cache_file cache_recovery_file }:dir ~{ r_dir_perms };
|
|
|
|
neverallow { all_untrusted_apps -mediaprovider } { cache_file cache_recovery_file }:file ~{ read getattr };
|
2017-01-28 00:53:38 +01:00
|
|
|
|
|
|
|
# Do not allow untrusted apps to create/unlink files outside of its sandbox,
|
|
|
|
# internal storage or sdcard.
|
|
|
|
# World accessible data locations allow application to fill the device
|
|
|
|
# with unaccounted for data. This data will not get removed during
|
|
|
|
# application un-installation.
|
2017-04-11 01:57:48 +02:00
|
|
|
neverallow { all_untrusted_apps -mediaprovider } {
|
2017-01-28 00:53:38 +01:00
|
|
|
fs_type
|
2018-03-30 20:22:54 +02:00
|
|
|
-sdcard_type
|
2021-06-23 10:21:49 +02:00
|
|
|
-fuse
|
2017-01-28 00:53:38 +01:00
|
|
|
file_type
|
|
|
|
-app_data_file # The apps sandbox itself
|
2018-08-03 00:54:23 +02:00
|
|
|
-privapp_data_file
|
Add SELinux policy for storage areas
We are adding the ability for apps to create "storage areas", which are
transparently encrypted directories that can only be opened when the
device is unlocked.
This CL makes the required SELinux policy changes.
First, assign the type "system_userdir_file" to the new top-level
directory /data/storage_area (non-recursively). This is the same type
used by the other top-level directories containing app data, such as
/data/user, and it restricts access to the directory in the desired way.
Second, add new types to represent an app's directory of storage areas,
the storage areas themselves, and their contents:
`storage_area_app_dir`, `storage_area_dir`, and
`storage_area_content_file` respectively.
All are `app_data_file_type`s.
The directory structure and their associated labels is as follows (note
that they also all get the categories of the user+package):
/data/storage_area/userId/pkgName
storage_area_app_dir
/data/storage_area/userId/pkgName/storageAreaName
storage_area_dir
/data/storage_area/userId/pkgName/storageAreaName/myFile.txt
storage_area_content_file
/data/storage_area/userId/pkgName/storageAreaName/mySubDir
storage_area_content_file
These new types allow us to restrict how and which processes interact
with storage areas.
The new type for the contents of storage areas allows us to add new,
desirable restrictions that we cannot add to the more general
`app_data_file` type in order to maintain backwards-compatibility,
e.g., we block apps from executing any files in their storage areas.
Third, allow:
-- vold_prepare_subdirs to create and delete
storage areas on behalf of apps, and assign them the SElinux type
`storage_area_dir`
i.e. create directories
/data/storage_area/$userId/$pkgName/$storageAreaName
-- vold to assign encryption policies to storage area directories
-- installd to create an app's directory of storage areas on app
install, and delete them on app uninstall, and assign them the SElinux
type `storage_area_app_dir`,
i.e. directories /data/storage_area/$userId/$pkgName
We also add a new SELinux type to represent the storage area encryption
keys: `storage_area_key_file`.
The keys are created by vold on storage area creation, and deleted
either by vold if an app calls
the `deleteStorageArea` API function explicitly, or by installd on
app uninstall.
These keys are stored in `/data/misc_ce/$userId/storage_area_keys`,
and only installd and vold have access to them.
Bug: 325121608
Test: atest StorageAreaTest
Change-Id: I74805d249f59226fc6963693f682c70949bfad93
2024-04-30 22:26:55 +02:00
|
|
|
is_flag_enabled(RELEASE_UNLOCKED_STORAGE_API, `-storage_area_content_file')
|
2019-01-11 18:37:46 +01:00
|
|
|
-app_exec_data_file # stored within the app sandbox directory
|
2017-01-28 00:53:38 +01:00
|
|
|
-media_rw_data_file # Internal storage. Known that apps can
|
|
|
|
# leave artfacts here after uninstall.
|
|
|
|
-user_profile_data_file # Access to profile files
|
|
|
|
userdebug_or_eng(`
|
|
|
|
-method_trace_data_file # only on ro.debuggable=1
|
|
|
|
-coredump_file # userdebug/eng only
|
|
|
|
')
|
|
|
|
}:dir_file_class_set { create unlink };
|
|
|
|
|
2020-01-30 16:52:45 +01:00
|
|
|
# No untrusted component except mediaprovider_app should be touching /dev/fuse
|
|
|
|
neverallow { all_untrusted_apps -mediaprovider_app } fuse_device:chr_file *;
|
2017-04-26 20:40:48 +02:00
|
|
|
|
2018-11-15 15:14:07 +01:00
|
|
|
# Do not allow untrusted apps to directly open the tun_device
|
|
|
|
neverallow all_untrusted_apps tun_device:chr_file open;
|
|
|
|
# The tun_device ioctls below are not allowed, to prove equivalence
|
|
|
|
# to the kernel patch at
|
2018-10-31 04:12:41 +01:00
|
|
|
# https://android.googlesource.com/kernel/common/+/11cee2be0c2062ba88f04eb51196506f870a3b5d%5E%21
|
2020-07-08 02:39:22 +02:00
|
|
|
neverallowxperm all_untrusted_apps tun_device:chr_file ioctl ~{ FIOCLEX FIONCLEX TUNGETIFF };
|
2017-01-28 00:53:38 +01:00
|
|
|
|
|
|
|
# Only allow appending to /data/anr/traces.txt (b/27853304, b/18340553)
|
2017-02-06 19:31:45 +01:00
|
|
|
neverallow all_untrusted_apps anr_data_file:file ~{ open append };
|
|
|
|
neverallow all_untrusted_apps anr_data_file:dir ~search;
|
2017-01-28 00:53:38 +01:00
|
|
|
|
|
|
|
# Avoid reads from generically labeled /proc files
|
|
|
|
# Create a more specific label if needed
|
2017-09-26 21:58:29 +02:00
|
|
|
neverallow all_untrusted_apps {
|
|
|
|
proc
|
2017-10-06 19:20:53 +02:00
|
|
|
proc_asound
|
2017-09-26 21:58:29 +02:00
|
|
|
proc_kmsg
|
|
|
|
proc_loadavg
|
|
|
|
proc_mounts
|
|
|
|
proc_pagetypeinfo
|
2018-06-14 16:34:19 +02:00
|
|
|
proc_slabinfo
|
2018-03-29 00:34:37 +02:00
|
|
|
proc_stat
|
2017-09-26 21:58:29 +02:00
|
|
|
proc_swaps
|
2018-03-29 00:34:37 +02:00
|
|
|
proc_uptime
|
2017-09-26 21:58:29 +02:00
|
|
|
proc_version
|
|
|
|
proc_vmallocinfo
|
2018-03-29 00:34:37 +02:00
|
|
|
proc_vmstat
|
2017-09-26 21:58:29 +02:00
|
|
|
}:file { no_rw_file_perms no_x_file_perms };
|
2017-03-14 19:42:03 +01:00
|
|
|
|
2020-02-19 17:10:43 +01:00
|
|
|
# /proc/filesystems is accessible to mediaprovider_app only since it handles
|
|
|
|
# external storage
|
|
|
|
neverallow { all_untrusted_apps - mediaprovider_app } proc_filesystems:file { no_rw_file_perms no_x_file_perms };
|
|
|
|
|
2017-04-21 20:25:29 +02:00
|
|
|
# Avoid all access to kernel configuration
|
|
|
|
neverallow all_untrusted_apps config_gz:file { no_rw_file_perms no_x_file_perms };
|
|
|
|
|
2017-03-14 19:42:03 +01:00
|
|
|
# Do not allow untrusted apps access to preloads data files
|
|
|
|
neverallow all_untrusted_apps preloads_data_file:file no_rw_file_perms;
|
2017-03-22 18:35:24 +01:00
|
|
|
|
|
|
|
# Locking of files on /system could lead to denial of service attacks
|
|
|
|
# against privileged system components
|
|
|
|
neverallow all_untrusted_apps system_file:file lock;
|
2017-04-22 02:06:43 +02:00
|
|
|
|
2017-04-25 00:09:19 +02:00
|
|
|
# Do not permit untrusted apps to perform actions on HwBinder service_manager
|
|
|
|
# other than find actions for services listed below
|
|
|
|
neverallow all_untrusted_apps *:hwservice_manager ~find;
|
|
|
|
|
2020-10-21 23:47:00 +02:00
|
|
|
# Do not permit access from apps which host arbitrary code to the protected services
|
2017-04-22 02:06:43 +02:00
|
|
|
# The two main reasons for this are:
|
2020-10-21 23:47:00 +02:00
|
|
|
# 1. Protected HwBinder servers do not perform client authentication because
|
|
|
|
# vendor code does not have a way to understand apps or their relation to
|
|
|
|
# caller UID information and, even if it did, those services either operate
|
|
|
|
# at a level below that of apps (e.g., HALs) or must not rely on app identity
|
|
|
|
# for authorization. Thus, to be safe, the default assumption for all added
|
|
|
|
# vendor services is that they treat all their clients as equally authorized
|
|
|
|
# to perform operations offered by the service.
|
|
|
|
# 2. HAL servers contain code with higher incidence rate of security issues
|
|
|
|
# than system/core components and have access to lower layes of the stack
|
|
|
|
# (all the way down to hardware) thus increasing opportunities for bypassing
|
|
|
|
# the Android security model.
|
2019-08-21 17:04:50 +02:00
|
|
|
neverallow all_untrusted_apps protected_hwservice:hwservice_manager find;
|
2020-10-21 23:47:00 +02:00
|
|
|
neverallow all_untrusted_apps protected_service:service_manager find;
|
2019-08-21 00:42:58 +02:00
|
|
|
|
2017-09-26 21:58:29 +02:00
|
|
|
# SELinux is not an API for untrusted apps to use
|
|
|
|
neverallow all_untrusted_apps selinuxfs:file no_rw_file_perms;
|
|
|
|
|
2018-09-07 16:39:28 +02:00
|
|
|
# Access to /proc/tty/drivers, to allow apps to determine if they
|
|
|
|
# are running in an emulated environment.
|
|
|
|
# b/33214085 b/33814662 b/33791054 b/33211769
|
|
|
|
# https://github.com/strazzere/anti-emulator/blob/master/AntiEmulator/src/diff/strazzere/anti/emulator/FindEmulator.java
|
|
|
|
# This will go away in a future Android release
|
|
|
|
neverallow { all_untrusted_apps -untrusted_app_25 } proc_tty_drivers:file r_file_perms;
|
|
|
|
neverallow all_untrusted_apps proc_tty_drivers:file ~r_file_perms;
|
2018-10-11 00:48:15 +02:00
|
|
|
|
|
|
|
# Untrusted apps are not allowed to use cgroups.
|
|
|
|
neverallow all_untrusted_apps cgroup:file *;
|
2021-02-12 00:18:11 +01:00
|
|
|
neverallow all_untrusted_apps cgroup_v2:file *;
|
2019-01-27 22:39:19 +01:00
|
|
|
|
2019-04-12 00:23:24 +02:00
|
|
|
# /mnt/sdcard symlink was supposed to have been removed in Gingerbread. Apps
|
|
|
|
# must not use it.
|
|
|
|
neverallow {
|
|
|
|
all_untrusted_apps
|
|
|
|
-untrusted_app_25
|
|
|
|
-untrusted_app_27
|
|
|
|
} mnt_sdcard_file:lnk_file *;
|
2020-05-13 14:40:49 +02:00
|
|
|
|
|
|
|
# Only privileged apps may find the incident service
|
|
|
|
neverallow all_untrusted_apps incident_service:service_manager find;
|
2022-07-14 13:52:21 +02:00
|
|
|
|
2024-02-14 08:27:00 +01:00
|
|
|
# Only privileged apps may find stats service
|
|
|
|
neverallow all_untrusted_apps stats_service:service_manager find;
|
|
|
|
|
2022-08-18 15:09:36 +02:00
|
|
|
# Do not allow untrusted app to read hidden system proprerties.
|
|
|
|
# We do not include in the exclusions other normally untrusted applications such as mediaprovider
|
|
|
|
# due to the specific logging use cases.
|
2022-07-14 13:52:21 +02:00
|
|
|
# Context: b/193912100
|
|
|
|
neverallow {
|
2022-11-18 15:09:41 +01:00
|
|
|
all_untrusted_apps
|
|
|
|
-mediaprovider
|
|
|
|
-mediaprovider_app
|
2022-07-14 13:52:21 +02:00
|
|
|
} { userdebug_or_eng_prop }:file read;
|
2023-01-18 08:52:43 +01:00
|
|
|
|
|
|
|
# Do not allow untrusted app to access /dev/socket/mdnsd since U. The socket is
|
|
|
|
# used to communicate to the mdnsd responder. The mdnsd responder will be
|
|
|
|
# replaced by a java implementation which is integrated into the system server.
|
|
|
|
# For untrusted apps running with API level 33-, they still have access to
|
|
|
|
# /dev/socket/mdnsd for backward compatibility.
|
|
|
|
neverallow {
|
|
|
|
all_untrusted_apps
|
|
|
|
-untrusted_app_25
|
|
|
|
-untrusted_app_27
|
|
|
|
-untrusted_app_29
|
|
|
|
-untrusted_app_30
|
|
|
|
-untrusted_app_32
|
|
|
|
} mdnsd_socket:sock_file write;
|
|
|
|
neverallow {
|
|
|
|
all_untrusted_apps
|
|
|
|
-untrusted_app_25
|
|
|
|
-untrusted_app_27
|
|
|
|
-untrusted_app_29
|
|
|
|
-untrusted_app_30
|
|
|
|
-untrusted_app_32
|
|
|
|
} mdnsd:unix_stream_socket connectto;
|
2022-11-14 23:06:36 +01:00
|
|
|
|
|
|
|
# Do not allow untrusted apps to use anonymous inodes. At the moment,
|
|
|
|
# type transitions are the only way to distinguish between different
|
|
|
|
# anon_inode usages like userfaultfd and io_uring. This prevents us from
|
|
|
|
# creating a more fine-grained neverallow policy for each anon_inode usage.
|
|
|
|
neverallow all_untrusted_apps domain:anon_inode *;
|
2023-12-01 00:28:04 +01:00
|
|
|
|
|
|
|
# Do not allow untrusted app access to hidraw devices.
|
|
|
|
neverallow all_untrusted_apps hidraw_device:chr_file *;
|