Skip to content

Commit

Permalink
init.te: delete kernel load policy support
Browse files Browse the repository at this point in the history
Remove the ability to dynamically update SELinux policy on the
device.

1) This functionality has never been used, so we have no idea if
it works or not.

2) If system_server is compromised, this functionality allows a
complete bypass of the SELinux policy on the device. In particular,
an attacker can force a regression of the following patch
  * https://android-review.googlesource.com/138510
see also https://code.google.com/p/android/issues/detail?id=181826

3) Dynamic policy update can be used to bypass neverallow protections
enforced in CTS, by pushing a policy to the device after certification.
Such an updated policy could bring the device out of compliance or
deliberately introduce security weaknesses.

Bug: 22885422
Bug: 8949824
Change-Id: Id98b5e09d79254816d920b92003efe8dcbe6cd2e
  • Loading branch information
nickkral committed Aug 2, 2015
1 parent 301555e commit 356df32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions domain.te
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,10 @@ neverallow domain self:capability2 mac_override;
# Only recovery needs mac_admin to set contexts not defined in current policy.
neverallow { domain -recovery } self:capability2 mac_admin;

# Only init should be able to load SELinux policies.
# Nobody should be able to load a new SELinux policy.
# The first load technically occurs while still in the kernel domain,
# but this does not trigger a denial since there is no policy yet.
# Policy reload requires allowing this to the init domain.
neverallow { domain -init } kernel:security load_policy;
neverallow domain kernel:security load_policy;

# Only init and the system_server can set selinux.reload_policy 1
# to trigger a policy reload.
Expand Down
1 change: 0 additions & 1 deletion init.te
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ allow init security_file:dir { create setattr };

# Reload policy upon setprop selinux.reload_policy 1.
r_dir_file(init, security_file)
allow init kernel:security load_policy;

# Any operation that can modify the kernel ring buffer, e.g. clear
# or a read that consumes the messages that were read.
Expand Down

0 comments on commit 356df32

Please sign in to comment.