diff options
author | Julien Tinnes <[email protected]> | 2009-06-26 20:27:40 +0200 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2009-07-12 12:21:33 -0700 |
commit | f9fabcb58a6d26d6efde842d1703ac7cfa9427b6 (patch) | |
tree | 3bab868d1db85521932b77897983e7c673f7a669 | |
parent | a137802ee839ace40079bebde24cfb416f73208a (diff) |
personality: fix PER_CLEAR_ON_SETID
We have found that the current PER_CLEAR_ON_SETID mask on Linux doesn't
include neither ADDR_COMPAT_LAYOUT, nor MMAP_PAGE_ZERO.
The current mask is READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE.
We believe it is important to add MMAP_PAGE_ZERO, because by using this
personality it is possible to have the first page mapped inside a
process running as setuid root. This could be used in those scenarios:
- Exploiting a NULL pointer dereference issue in a setuid root binary
- Bypassing the mmap_min_addr restrictions of the Linux kernel: by
running a setuid binary that would drop privileges before giving us
control back (for instance by loading a user-supplied library), we
could get the first page mapped in a process we control. By further
using mremap and mprotect on this mapping, we can then completely
bypass the mmap_min_addr restrictions.
Less importantly, we believe ADDR_COMPAT_LAYOUT should also be added
since on x86 32bits it will in practice disable most of the address
space layout randomization (only the stack will remain randomized).
Signed-off-by: Julien Tinnes <[email protected]>
Signed-off-by: Tavis Ormandy <[email protected]>
Cc: [email protected]
Acked-by: Christoph Hellwig <[email protected]>
Acked-by: Kees Cook <[email protected]>
Acked-by: Eugene Teo <[email protected]>
[ Shortened lines and fixed whitespace as per Christophs' suggestion ]
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | include/linux/personality.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/personality.h b/include/linux/personality.h index a84e9ff9b27e..126120819a0d 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -40,7 +40,10 @@ enum { * Security-relevant compatibility flags that must be * cleared upon setuid or setgid exec: */ -#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE) +#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \ + ADDR_NO_RANDOMIZE | \ + ADDR_COMPAT_LAYOUT | \ + MMAP_PAGE_ZERO) /* * Personality types. |