android_kernel_samsung_msm8226/security
David Howells e212bc1d16 KEYS: Disallow keyrings beginning with '.' to be joined as session keyrings
This fixes CVE-2016-9604.

Keyrings whose name begin with a '.' are special internal keyrings and so
userspace isn't allowed to create keyrings by this name to prevent
shadowing.  However, the patch that added the guard didn't fix
KEYCTL_JOIN_SESSION_KEYRING.  Not only can that create dot-named keyrings,
it can also subscribe to them as a session keyring if they grant SEARCH
permission to the user.

This, for example, allows a root process to set .builtin_trusted_keys as
its session keyring, at which point it has full access because now the
possessor permissions are added.  This permits root to add extra public
keys, thereby bypassing module verification.

This also affects kexec and IMA.

This can be tested by (as root):

	keyctl session .builtin_trusted_keys
	keyctl add user a a @s
	keyctl list @s

which on my test box gives me:

	2 keys in keyring:
	180010936: ---lswrv     0     0 asymmetric: Build time autogenerated kernel key: ae3d4a31b82daa8e1a75b49dc2bba949fd992a05
	801382539: --alswrv     0     0 user: a

Fix this by rejecting names beginning with a '.' in the keyctl.

Change-Id: I9ff468aa61e0f64acfe27cb2e10670c9defb0ae3
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
cc: linux-ima-devel@lists.sourceforge.net
cc: stable@vger.kernel.org
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 12:24:25 +02:00
..
apparmor nick kvfree() from apparmor 2019-08-05 14:22:44 +02:00
integrity Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
keys KEYS: Disallow keyrings beginning with '.' to be joined as session keyrings 2019-08-06 12:24:25 +02:00
selinux Merge remote-tracking branch 'google-common/deprecated/android-3.4' into lineage-16.0 2019-08-06 11:41:21 +02:00
smack consitify do_mount() arguments 2019-08-06 10:44:14 +02:00
tima_uevent misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
tomoyo consitify do_mount() arguments 2019-08-06 10:44:14 +02:00
tz_iccc misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
yama Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
Kconfig misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
Makefile misc: Remove Samsung Secure Data Protection sprinkles 2019-08-05 09:12:33 +02:00
capability.c consitify do_mount() arguments 2019-08-06 10:44:14 +02:00
commoncap.c Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs 2019-08-05 14:21:58 +02:00
device_cgroup.c
inode.c vfs: Add permission2 for filesystems with per mount permissions 2019-08-06 10:44:34 +02:00
lsm_audit.c security: lsm_audit: add ioctl specific auditing 2015-06-30 12:52:32 +05:30
min_addr.c
security.c consitify do_mount() arguments 2019-08-06 10:44:14 +02:00