Skip to content
Snippets Groups Projects
  1. Oct 31, 2018
  2. Oct 29, 2018
    • Nick Kralevich's avatar
      Enforce execve() restrictions for API > 28 · 0dd738d8
      Nick Kralevich authored
      untrusted_app: Remove the ability to run execve() on files within an
      application's home directory. Executing code from a writable /home
      directory is a W^X violation (https://en.wikipedia.org/wiki/W%5EX).
      Additionally, loading code from application home directories violates a
      security requirement that all executable code mapped into memory must
      come from signed sources, or be derived from signed sources.
      
      Note: this change does *not* remove the ability to load executable code
      through other mechanisms, such as mmap(PROT_EXEC) of a file descriptor
      from the app's home directory. In particular, functionality like
      dlopen() on files in an app's home directory continues to work even
      after this change.
      
      untrusted_app_25 and untrusted_app_27: For backwards compatibility,
      continue to allow these domains to execve() files from the
      application's home directory.
      
      seapp_contexts: Bump the minimum API level required to enter the
      untrusted_app domain. This will run API level 27-28 processes in
      the API level 27 sandbox. API level 28 will continue to run with
      levelFrom=all, and API level 27 will continue to run with
      levelFrom=user.
      
      Bug: 112357170
      Test: Device boots and no obvious problems.
      Test: See CTS test at https://android-review.googlesource.com/c/platform/cts/+/804228
      Change-Id: Ief9ae3a227d16ab5792f43bacbb577c1e70185a0
      0dd738d8
  3. Sep 28, 2018
    • Chenbo Feng's avatar
      Block access to xt_qtaguid proc files · 16dbe82e
      Chenbo Feng authored
      In the next Android release, there will be devices that have no
      xt_qtaguid module at all and framework and netd will decide which code
      path it takes for trafficStats depending on the device setup. So all
      apps and services should not depend on this device specific
      implementation anymore and use public API for the data they need.
      
      Bug: 114475331
      Bug: 79938294
      Test: QtaguidPermissionTest
      
      Change-Id: I0d37b2df23782eefa2e8977c6cdbf9210db3e0d2
      16dbe82e
  4. Aug 08, 2018
    • Nick Kralevich's avatar
      Remove legacy execmod access from API >= 26. · f3eb9854
      Nick Kralevich authored
      Text relocation support was removed from the linker for apps targeting
      API >= 23. See
      https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#text-relocations-enforced-for-api-level-23
      
      However, the security policy was not updated to remove the execmod
      permission at that time, since we didn't have support for targeting
      SELinux policies to API versions.
      
      Remove execmod permissions for apps targeting API 26 or greater. The
      linker support was removed, so it's pointless to keep around the SELinux
      permissions.
      
      Retain execmod support for apps targeting API 25 or lower. While in
      theory we could remove support for API 23-25, that would involve the
      introduction of a new SELinux domain (and the associated rule
      explosion), which I would prefer to avoid.
      
      This change helps protect application executable code from modification,
      enforcing W^X properties on executable code pages loaded from files.
      https://en.wikipedia.org/wiki/W%5EX
      
      Test: auditallow rules were added and nothing triggered for apps
            targeting API >= 26. Code compiles and device boots.
      Bug: 111544476
      
      Change-Id: Iab9a0bd297411e99699e3651c110e57eb02a3a41
      f3eb9854
  5. May 04, 2018
    • Jeff Vander Stoep's avatar
      Start the process of locking down proc/net · 7a4af30b
      Jeff Vander Stoep authored
      Files in /proc/net leak information. This change is the first step in
      determining which files apps may use, whitelisting benign access, and
      otherwise removing access while providing safe alternative APIs.
      
      To that end, this change:
      * Introduces the proc_net_type attribute which will assigned to any
      new SELinux types in /proc/net to avoid removing access to privileged
      processes. These processes may be evaluated later, but are lower
      priority than apps.
      * Labels /proc/net/{tcp,tcp6,udp,udp6} as proc_net_vpn due to existing
      use by VPN apps. This may be replaced by an alternative API.
      * Audits all other proc/net access for apps.
      * Audits proc/net access for other processes which are currently
      granted broad read access to /proc/net but should not be including
      storaged, zygote, clatd, logd, preopt2cachename and vold.
      
      Bug: 9496886
      Bug: 68016944
      Test: Boot Taimen-userdebug. On both wifi and cellular: stream youtube
          navigate maps, send text message, make voice call, make video call.
          Verify no avc "granted" messages in the logs.
      Test: A few VPN apps including "VPN Monster", "Turbo VPN", and
      "Freighter". Verify no logspam with the current setup.
      Test: atest CtsNativeNetTestCases
      Test: atest netd_integration_test
      Test: atest QtaguidPermissionTest
      Test: atest FileSystemPermissionTest
      
      Change-Id: I7e49f796a25cf68bc698c6c9206e24af3ae11457
      Merged-In: I7e49f796a25cf68bc698c6c9206e24af3ae11457
      (cherry picked from commit 08731895)
      7a4af30b
  6. Apr 03, 2018
    • Jeff Vander Stoep's avatar
      Add untrusted_app_27 · 3aa7ca56
      Jeff Vander Stoep authored
      This is a partial cherry pick of commit 6231b4d9
      'Enforce per-app data protections for targetSdk 28+'.
      
      Untrusted_app_27 remains unreachable, but it's existence
      prevents future merge conflicts.
      
      Bug: 63897054
      Test: build/boot aosp_walleye-userdebug
      Change-Id: I64b013874fe87b55f47e817a1279e76ecf86b7c0
      Merged-In: I64b013874fe87b55f47e817a1279e76ecf86b7c0
      (cherry picked from commit 6231b4d9)
      3aa7ca56
  7. Jan 18, 2018
    • Jeff Vander Stoep's avatar
      Enforce per-app data protections for targetSdk 28+ · 6231b4d9
      Jeff Vander Stoep authored
      Adds per-app categories to untrusted app domains and their
      app data types. Per-app categories are in addition to the
      existing per-user categories.
      
      Apps targeting sdk version 28+ will now have the following
      characteristics:
      Domain: u:r:untrusted_app:s0:c[0-9]+,c[0-9]+,c[0-9],c[0-9]
      Data context: u:object_r:app_data_file:s0:c[0-9]+,c[0-9]+,c[0-9],c[0-9]
      
      Whereas apps targeting 27- will look like:
      Domain: u:r:untrusted_app_27:s0:c[0-9]+,c[0-9]+
      Data context: u:object_r:app_data_file:s0:c[0-9]+,c[0-9]+
      
      To ensure backwards compatibility with previous SDK versions,
      the levelFrom=all now enforces categories by dominance instead of
      equality. Apps with per-app and per-user categories will continue
      to have selinux permissions (but not necessarily unix permissions)
      to access app data with only per-user categories, but apps with only
      per-user categories will not be able to access the data of apps with
      both per-app and per-user categories.
      
      Bug: 63897054
      Test: Boot sailfish, run apps, verify no new selinux denials.
      Test: cts-tradefed run cts -m CtsSelinuxTargetSdkCurrentTestCases
      Test: cts-tradefed run cts -m CtsSelinuxTargetSdk27TestCases
      Test: cts-tradefed run cts -m CtsSelinuxTargetSdk25TestCases
      Test: adb sideload an OTA and verify that files are correctly labeled.
      Change-Id: I64b013874fe87b55f47e817a1279e76ecf86b7c0
      6231b4d9
  8. Mar 24, 2017
    • Alex Klyubin's avatar
      Vendor domains must not use Binder · f5446eb1
      Alex Klyubin authored
      On PRODUCT_FULL_TREBLE devices, non-vendor domains (except vendor
      apps) are not permitted to use Binder. This commit thus:
      * groups non-vendor domains using the new "coredomain" attribute,
      * adds neverallow rules restricting Binder use to coredomain and
        appdomain only, and
      * temporarily exempts the domains which are currently violating this
        rule from this restriction. These domains are grouped using the new
        "binder_in_vendor_violators" attribute. The attribute is needed
        because the types corresponding to violators are not exposed to the
        public policy where the neverallow rules are.
      
      Test: mmm system/sepolicy
      Test: Device boots, no new denials
      Test: In Chrome, navigate to ip6.me, play a YouTube video
      Test: YouTube: play a video
      Test: Netflix: play a movie
      Test: Google Camera: take a photo, take an HDR+ photo, record video with
            sound, record slow motion video with sound. Confirm videos play
            back fine and with sound.
      Bug: 35870313
      Change-Id: I0cd1a80b60bcbde358ce0f7a47b90f4435a45c95
      f5446eb1
  9. Mar 06, 2017
    • Nick Kralevich's avatar
      Revert "Remove execmod support for newer API versions" · 9be90fb6
      Nick Kralevich authored
      We need more time to investigate the effect that this change will
      have on DRM solutions. Until the investigation is done, revert.
      
      This reverts commit 38d3eca0.
      
      Bug: 30146890
      Bug: 20013628
      Bug: 35323421
      Change-Id: I5ad69ef5ee12081ce7fc0a8440712f7f8f77cf16
      Test: policy compiles.
      9be90fb6
  10. Mar 05, 2017
  11. Mar 03, 2017
    • Nick Kralevich's avatar
      Label /proc/misc · 50bb7b5a
      Nick Kralevich authored
      Label /proc/misc and allow access to untrusted_apps targeting older API
      versions, as well as update_engine_common.
      
      /proc/misc is used by some banking apps to try to detect if they are
      running in an emulated environment.
      
      TODO: Remove access to proc:file from update_engine_common after more
      testing.
      
      Bug: 35917228
      Test: Device boots and no new denials.
      Change-Id: If1b97a9c55a74cb74d1bb15137201ffb95b5bd75
      50bb7b5a
  12. Feb 22, 2017
  13. Feb 14, 2017
    • Jeff Vander Stoep's avatar
      untrusted_app: policy versioning based on targetSdkVersion · bacb6d79
      Jeff Vander Stoep authored
      Motivation:
      Provide the ability to phase in new security policies by
      applying them to apps with a minimum targetSdkVersion.
      
      Place untrusted apps with targetSdkVersion<=25 into the
      untrustd_app_25 domain. Apps with targetSdkVersion>=26 are placed
      into the untrusted_app domain. Common rules are included in the
      untrusted_app_all attribute. Apps with a more recent targetSdkVersion
      are granted fewer permissions.
      
      Test: Marlin builds and boots. Apps targeting targetSdkVersion<=25
      run in untrusted_app_25 domain. Apps targeting the current development
      build >=26 run in the untrusted_app domain with fewer permissions. No
      new denials observed during testing.
      Bug: 34115651
      Bug: 35323421
      Change-Id: Ie6a015566fac07c44ea06c963c40793fcdc9a083
      bacb6d79
  14. Jan 05, 2017
    • Alex Klyubin's avatar
      Move untrusted_app policy to private · fce60d3d
      Alex Klyubin authored
      This leaves only the existence of untrusted_app domain as public API.
      All other rules are implementation details of this domain's policy and
      are thus now private.
      
      Test: No change to policy according to sesearch, except for
            disappearance of all allow rules from untrusted_domain_current
            attribute (as expected).
      Bug: 31364497
      
      Change-Id: Ief71fa16cfc38437cbe5c58100bba48b9a497c92
      fce60d3d
  15. Jan 04, 2017
    • Nick Kralevich's avatar
      untrusted_app: allow access to /proc/tty/drivers · e427a2b2
      Nick Kralevich authored
      /proc/tty/drivers is read by applications to figure out if they are
      running in an emulated environment. Specifically, they look for the
      string "goldfish" within that file.
      
      Arguably this is not an Android API, and really shouldn't be exposed to
      applications, but:
      
      1) A largish number of applications break if they can't read this file;
      2) The information here isn't particularly sensitive
      
      While we could spend a bunch of time trying to get applications fixed,
      there are bigger fish to fry. It's not worth the battle.
      
      Test: "ls -laZ /proc/tty/drivers" is labeled properly.
      Bug: 33214085
      Bug: 33814662
      Bug: 33791054
      Bug: 33211769
      Bug: 26813932
      Change-Id: Icc05bdc1c917547a6dca7d76636a1009369bde49
      e427a2b2
  16. Dec 08, 2016
    • dcashman's avatar
      Restore app_domain macro and move to private use. · 3e8dbf01
      dcashman authored
      app_domain was split up in commit: 2e00e637 to
      enable compilation by hiding type_transition rules from public policy.  These
      rules need to be hidden from public policy because they describe how objects are
      labeled, of which non-platform should be unaware.  Instead of cutting apart the
      app_domain macro, which non-platform policy may rely on for implementing new app
      types, move all app_domain calls to private policy.
      
      (cherry-pick of commit: 76035ea0)
      
      Bug: 33428593
      Test: bullhead and sailfish both boot. sediff shows no policy change.
      Change-Id: I4beead8ccc9b6e13c6348da98bb575756f539665
      3e8dbf01
    • dcashman's avatar
      Restore app_domain macro and move to private use. · 76035ea0
      dcashman authored
      app_domain was split up in commit: 2e00e637 to
      enable compilation by hiding type_transition rules from public policy.  These
      rules need to be hidden from public policy because they describe how objects are
      labeled, of which non-platform should be unaware.  Instead of cutting apart the
      app_domain macro, which non-platform policy may rely on for implementing new app
      types, move all app_domain calls to private policy.
      
      Bug: 33428593
      Test: bullhead and sailfish both boot. sediff shows no policy change.
      Change-Id: I4beead8ccc9b6e13c6348da98bb575756f539665
      76035ea0
  17. Dec 06, 2016
    • dcashman's avatar
      sepolicy: add version_policy tool and version non-platform policy. · 2e00e637
      dcashman authored
      In order to support platform changes without simultaneous updates from
      non-platform components, the platform and non-platform policies must be
      split.  In order to provide a guarantee that policy written for
      non-platform objects continues to provide the same access, all types
      exposed to non-platform policy are versioned by converting them and the
      policy using them into attributes.
      
      This change performs that split, the subsequent versioning and also
      generates a mapping file to glue the different policy components
      together.
      
      Test: Device boots and runs.
      Bug: 31369363
      Change-Id: Ibfd3eb077bd9b8e2ff3b2e6a0ca87e44d78b1317
      2e00e637
  18. Nov 22, 2016
    • Nick Kralevich's avatar
      neverallow some /proc file reads · 0b7506ff
      Nick Kralevich authored
      Lock in the gains we've made so far in restricting access to generically
      labeled /proc files. There's more we can do here, but let's avoid
      inadvertent regressions.
      
      Test: policy compiles. Only compile time assertions added.
      Bug: 26813932
      Change-Id: If354c2ddc1c59beed7f0eb4bcbd3f0d9971c3b8a
      0b7506ff
  19. Nov 20, 2016
    • Daniel Micay's avatar
      only permit text relocations in untrusted_app · dc083f59
      Daniel Micay authored
      The other domains either don't have the same backwards compatibility
      issues (isolated_app) or are privileged components that are pretty much
      part of the platform and can be expected to meet a higher standard.
      
      It would be possible to expose a build option for disabling the ART JIT,
      allowing conditional removal of execmem from some of these domains too
      (ones not ever using the WebView, until that's always in isolated_app).
      
      Bug: 20013628
      Change-Id: Ic22513157fc8b958b2a3d60381be0c07b5252fa5
      dc083f59
  20. Oct 06, 2016
    • dcashman's avatar
      Split general policy into public and private components. · cc39f637
      dcashman authored
      Divide policy into public and private components.  This is the first
      step in splitting the policy creation for platform and non-platform
      policies.  The policy in the public directory will be exported for use
      in non-platform policy creation.  Backwards compatibility with it will
      be achieved by converting the exported policy into attribute-based
      policy when included as part of the non-platform policy and a mapping
      file will be maintained to be included with the platform policy that
      maps exported attributes of previous versions to the current platform
      version.
      
      Eventually we would like to create a clear interface between the
      platform and non-platform device components so that the exported policy,
      and the need for attributes is minimal.  For now, almost all types and
      avrules are left in public.
      
      Test: Tested by building policy and running on device.
      
      Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
      cc39f637
    • Eric Bae's avatar
      allow policy to create a file by vfat (fs_type) for a case using sdcardfs · adf210d6
      Eric Bae authored
      Change-Id: Ia938d73b1a49b9ba4acf906df37095d21edee22e
      adf210d6
  21. Sep 12, 2016
    • Amith Yamasani's avatar
      Allow apps to read preloaded photos · aa2a33a2
      Amith Yamasani authored
      (cherry picked from commit e01654f9)
      
      For Retail Demo mode, we need to preload photos in
      /data/preloads and allow regular apps to access the
      photos returned by the media provider from the preloads
      directory.
      
      Bug: 29940807
      Change-Id: Ic1061dac55ace1b125ae04b5b0c70aae9aa0c732
      aa2a33a2
  22. Sep 10, 2016
  23. Sep 09, 2016
  24. Aug 29, 2016
  25. Jul 22, 2016
  26. Jul 15, 2016
    • dcashman's avatar
      Grant untrusted_app dir access to asec_apk_file. · 83348b0b
      dcashman authored
      untrusted_app lost all of the domain_deprecated permissions in N,
      including the ability to read asec_apk_file dirs.  This is used for
      forward locked apps.
      
      Addresses the following denials:
      avc: denied { search } for name="asec" dev="tmpfs" ino=9298 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:asec_apk_file:s0 tclass=dir permissive=0
      avc: denied { getattr } for path="/mnt/asec" dev="tmpfs" ino=9298 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:asec_apk_file:s0 tclass=dir permissive=0
      
      (cherry-pick of internal commit: addd3c9f)
      
      Bug: 30082229
      Change-Id: I87758f1daee19197d9299bca261f0324e01af5e0
      83348b0b
  27. Jul 14, 2016
    • Amith Yamasani's avatar
      Allow apps to read preloaded photos · e01654f9
      Amith Yamasani authored
      For Retail Demo mode, we need to preload photos in
      /data/preloads and allow regular apps to access the
      photos returned by the media provider from the preloads
      directory.
      
      Bug: 29940807
      Change-Id: Ic1061dac55ace1b125ae04b5b0c70aae9aa0c732
      e01654f9
  28. Jul 13, 2016
    • dcashman's avatar
      Grant untrusted_app dir access to asec_apk_file. · addd3c9f
      dcashman authored
      untrusted_app lost all of the domain_deprecated permissions in N,
      including the ability to read asec_apk_file dirs.  This is used for
      forward locked apps.
      
      Addresses the following denials:
      avc: denied { search } for name="asec" dev="tmpfs" ino=9298 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:asec_apk_file:s0 tclass=dir permissive=0
      avc: denied { getattr } for path="/mnt/asec" dev="tmpfs" ino=9298 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:asec_apk_file:s0 tclass=dir permissive=0
      
      Bug: 30082229
      Change-Id: I44119f218433b9009cf8d09d0ee5f8a13cc15dd9
      addd3c9f
  29. Jun 06, 2016
  30. May 12, 2016
    • Jeff Vander Stoep's avatar
      Remove domain_deprecated from isolated_app · 0b430aba
      Jeff Vander Stoep authored
      Address denials:
      avc: denied { read } for name="meminfo" dev="proc" ino=4026544360 scontext=u:r:isolated_app:s0:c512,c768 tcontext=u:object_r:proc_meminfo:s0 tclass=file permissive=0
      
      Bug: 28722489
      Change-Id: I3c55bd95bb82ec54e88e9e9bc42d6392a216a936
      0b430aba
  31. Apr 23, 2016
  32. Apr 16, 2016
  33. Apr 15, 2016
    • Jeff Vander Stoep's avatar
      Further restrict socket ioctls available to apps · 32333536
      Jeff Vander Stoep authored
      (cherry picked from commit 6ba383c5)
      
      Restrict unix_dgram_socket and unix_stream_socket to a whitelist.
      Disallow all ioctls for netlink_selinux_socket and netlink_route_socket.
      
      Neverallow third party app use of all ioctls other than
      unix_dgram_socket, unix_stream_socket, netlink_selinux_socket,
      netlink_route_socket, tcp_socket, udp_socket and rawip_socket.
      
      Bug: 28171804
      Change-Id: Icfe3486a62fc2fc2d2abd8d4030a5fbdd0ab30ab
      32333536
    • Jeff Vander Stoep's avatar
      Further restrict socket ioctls available to apps · 6ba383c5
      Jeff Vander Stoep authored
      Restrict unix_dgram_socket and unix_stream_socket to a whitelist.
      Disallow all ioctls for netlink_selinux_socket and netlink_route_socket.
      
      Neverallow third party app use of all ioctls other than
      unix_dgram_socket, unix_stream_socket, netlink_selinux_socket,
      netlink_route_socket, tcp_socket, udp_socket and rawip_socket.
      
      Bug: 28171804
      Change-Id: Icfe3486a62fc2fc2d2abd8d4030a5fbdd0ab30ab
      6ba383c5
    • Nick Kralevich's avatar
      neverallow /data/anr access for isolated/untrusted apps · 0e61a7a9
      Nick Kralevich authored
      Add a neverallow rule (compile time assertion + CTS test) that
      isolated_apps and untrusted_apps can't do anything else but append
      to /data/anr/traces.txt. In particular, assert that they can't
      read from the file, or overwrite other data which may already be
      in the file.
      
      Bug: 18340553
      Bug: 27853304
      
      (cherry picked from commit 369cf8cd)
      
      Change-Id: Ib33e7ea0342ad28e5a89dfffdd9bc16fe54d8b3d
      0e61a7a9
Loading