1
0
Fork 0
remarkable-linux/arch/um
Jann Horn 2e840836fd fs/coredump: prevent fsuid=0 dumps into user-controlled directories
[ Upstream commit 378c6520e7 ]

This commit fixes the following security hole affecting systems where
all of the following conditions are fulfilled:

 - The fs.suid_dumpable sysctl is set to 2.
 - The kernel.core_pattern sysctl's value starts with "/". (Systems
   where kernel.core_pattern starts with "|/" are not affected.)
 - Unprivileged user namespace creation is permitted. (This is
   true on Linux >=3.8, but some distributions disallow it by
   default using a distro patch.)

Under these conditions, if a program executes under secure exec rules,
causing it to run with the SUID_DUMP_ROOT flag, then unshares its user
namespace, changes its root directory and crashes, the coredump will be
written using fsuid=0 and a path derived from kernel.core_pattern - but
this path is interpreted relative to the root directory of the process,
allowing the attacker to control where a coredump will be written with
root privileges.

To fix the security issue, always interpret core_pattern for dumps that
are written under SUID_DUMP_ROOT relative to the root directory of init.

Signed-off-by: Jann Horn <jann@thejh.net>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-04-18 08:51:07 -04:00
..
configs arch/um: make it work with defconfig and x86_64 2013-11-17 11:31:48 +01:00
drivers fs/coredump: prevent fsuid=0 dumps into user-controlled directories 2016-04-18 08:51:07 -04:00
include Merge branch 'exec_domain_rip_v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2015-04-15 13:53:55 -07:00
kernel um: Print minimum physical memory requirement 2015-04-13 21:17:46 +02:00
os-Linux uml: flush stdout before forking 2016-02-03 14:01:45 -05:00
scripts um: Preinclude include/linux/kern_levels.h 2012-09-27 20:20:09 +02:00
.gitignore um: tell git to ignore generated files 2010-03-06 11:26:28 -08:00
Kconfig.char um: remove used STDIO_CONSOLE Kconfig param 2013-11-17 11:32:27 +01:00
Kconfig.common um: Skip futex_atomic_cmpxchg_inatomic() test 2015-01-04 14:20:26 +01:00
Kconfig.debug lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
Kconfig.net arch/um: remove depends on CONFIG_EXPERIMENTAL 2013-01-11 11:38:04 -08:00
Kconfig.rest um: switch to use of drivers/Kconfig 2011-11-02 14:15:41 +01:00
Kconfig.um Merge tag 'for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml 2015-04-15 13:49:27 -07:00
Makefile kbuild: use relative path more to include Makefile 2015-04-02 16:42:08 +02:00
Makefile-os-Linux x86, um: get rid of arch/um/os symlink 2008-10-22 22:55:22 -07:00
Makefile-skas [PATCH] uml makefiles sanitized 2005-09-29 08:46:26 -07:00