linux-next/Documentation
Kees Cook 9520628e8c fs: make dumpable=2 require fully qualified path
When the suid_dumpable sysctl is set to "2", and there is no core dump
pipe defined in the core_pattern sysctl, a local user can cause core files
to be written to root-writable directories, potentially with
user-controlled content.

This means an admin can unknowningly reintroduce a variation of
CVE-2006-2451, allowing local users to gain root privileges.

  $ cat /proc/sys/fs/suid_dumpable
  2
  $ cat /proc/sys/kernel/core_pattern
  core
  $ ulimit -c unlimited
  $ cd /
  $ ls -l core
  ls: cannot access core: No such file or directory
  $ touch core
  touch: cannot touch `core': Permission denied
  $ OHAI="evil-string-here" ping localhost >/dev/null 2>&1 &
  $ pid=$!
  $ sleep 1
  $ kill -SEGV $pid
  $ ls -l core
  -rw------- 1 root kees 458752 Jun 21 11:35 core
  $ sudo strings core | grep evil
  OHAI=evil-string-here

While cron has been fixed to abort reading a file when there is any
parse error, there are still other sensitive directories that will read
any file present and skip unparsable lines.

Instead of introducing a suid_dumpable=3 mode and breaking all users of
mode 2, this only disables the unsafe portion of mode 2 (writing to disk
via relative path).  Most users of mode 2 (e.g.  Chrome OS) already use
a core dump pipe handler, so this change will not break them.  For the
situations where a pipe handler is not defined but mode 2 is still
active, crash dumps will only be written to fully qualified paths.  If a
relative path is defined (e.g.  the default "core" pattern), dump
attempts will trigger a printk yelling about the lack of a fully
qualified path.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Alan Cox <alan@linux.intel.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: James Morris <james.l.morris@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-07-30 17:25:11 -07:00
..
2012-07-26 11:25:33 -07:00
2011-09-27 18:08:04 +02:00
2012-04-03 13:09:18 +02:00
2011-09-27 18:08:04 +02:00
2012-06-18 13:42:03 +02:00
2011-03-31 11:26:23 -03:00
2012-07-05 07:13:51 +02:00
2012-07-18 18:35:57 -07:00
2011-03-31 11:26:23 -03:00
2012-07-09 16:42:11 -04:00
2011-09-27 18:08:04 +02:00
2012-07-19 00:03:46 +02:00
2011-11-02 16:07:02 -07:00
2012-07-24 13:37:37 -07:00
2011-03-31 11:26:23 -03:00
2012-07-24 23:20:40 -04:00
2011-09-27 18:08:04 +02:00
2010-04-08 11:34:34 +02:00
2012-03-16 20:35:01 +00:00
2011-03-31 11:26:23 -03:00
2012-06-03 12:05:50 +02:00
2011-03-31 11:26:23 -03:00
2011-09-27 18:08:04 +02:00
2012-07-24 18:11:22 -07:00
2011-03-07 13:20:05 -08:00
2011-09-27 18:08:04 +02:00
2012-02-28 16:05:06 +01:00
2011-09-27 18:08:04 +02:00
2011-03-31 11:26:23 -03:00
2010-07-19 10:56:54 +02:00
2010-03-16 11:47:56 +01:00
2012-01-02 13:04:55 +01:00