All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies
@ 2016-03-29 19:53 ` Scott Bauer
  0 siblings, 0 replies; 57+ messages in thread
From: Scott Bauer @ 2016-03-29 19:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-hardening, x86, ak, luto, mingo, tglx, wmealing, torvalds

Sigreturn-oriented programming is a new attack vector in userland
where an attacker crafts a fake signal frame on the stack and calls
sigreturn. The kernel will extract the fake signal frame, which
contains attacker controlled "saved" registers. The kernel will then
transfer control to the attacker controlled userland instruction pointer.

To prevent SROP attacks the kernel needs to know or be able to dervive
whether a sigreturn it is processing is in response to a legitimate
signal the kernel previously delivered. 

Further information and test code can be found in Documentation/security
and this excellent article:
http://lwn.net/Articles/676803/

These patches implement the necessary changes to generate a cookie
which will be placed above signal frame upon signal delivery to userland.
The cookie is generated using a per-process random value xor'd with
the address where the cookie will be stored on the stack.

Upon a sigreturn the kernel will extract the cookie from userland,
recalculate what the original cookie should be and verify that the two
do not differ. If the two differ the kernel will terminate the process
with a SIGSEGV.

This prevents SROP by adding a value that the attacker cannot guess,
but the kernel can verify. Therefore an attacker cannot use sigreturn as
a method to control the flow of a process.


Version	changes:

v3->v4
	Removed	ambiguous __user annotation, added Documentation
	and test code.

v2->v3
	Changed	cookie calculation from	using restored regs->sp	to
	using frame pointer from before	restoration.

v1->v2
	Miscellaneous nits and code cleanup.

Scott Bauer (4):
      SROP Mitigation: Architecture independent code for signal cookies
      x86: SROP Mitigation: Implement Signal Cookies
      Sysctl: SROP Mitigation: Add Sysctl argument to disable SROP.
      Documentation: SROP Mitigation: Add documentation for SROP cookies


 Documentation/security/srop-cookies.txt | 203 ++++++++++++++++++++++++++++++++
 arch/x86/ia32/ia32_signal.c             |  65 +++++++++-
 arch/x86/include/asm/fpu/signal.h       |   2 +
 arch/x86/kernel/fpu/signal.c            |  10 ++
 arch/x86/kernel/signal.c                |  83 +++++++++++--
 fs/exec.c                               |   3 +
 include/linux/sched.h                   |   7 ++
 include/linux/signal.h                  |   3 +
 kernel/signal.c                         |  49 ++++++++
 kernel/sysctl.c                         |   8 ++
 10 files changed, 418 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2016-04-24 16:27 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29 19:53 [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies Scott Bauer
2016-03-29 19:53 ` [kernel-hardening] " Scott Bauer
2016-03-29 19:53 ` [PATCH v4 1/4] SROP Mitigation: Architecture independent code for signal cookies Scott Bauer
2016-03-29 19:53   ` [kernel-hardening] " Scott Bauer
2016-03-29 23:04   ` Linus Torvalds
2016-03-29 23:04     ` [kernel-hardening] " Linus Torvalds
2016-03-31 20:25   ` Eric W. Biederman
2016-03-31 20:25     ` [kernel-hardening] " Eric W. Biederman
2016-03-31 22:00     ` Linus Torvalds
2016-03-31 22:00       ` [kernel-hardening] " Linus Torvalds
2016-03-31 22:17       ` Eric W. Biederman
2016-03-31 22:17         ` [kernel-hardening] " Eric W. Biederman
2016-03-29 19:53 ` [PATCH v4 2/4] x86: SROP Mitigation: Implement Signal Cookies Scott Bauer
2016-03-29 19:53   ` [kernel-hardening] " Scott Bauer
2016-03-29 19:53 ` [PATCH v4 3/4] Sysctl: SROP Mitigation: Add Sysctl argument to disable SROP Scott Bauer
2016-03-29 19:53   ` [kernel-hardening] " Scott Bauer
2016-03-29 19:59   ` Andi Kleen
2016-03-29 19:59     ` [kernel-hardening] " Andi Kleen
2016-03-29 20:46     ` Scotty Bauer
2016-03-29 20:46       ` [kernel-hardening] " Scotty Bauer
2016-03-29 20:53       ` Andi Kleen
2016-03-29 20:53         ` [kernel-hardening] " Andi Kleen
2016-03-29 19:53 ` [PATCH v4 4/4] Documentation: SROP Mitigation: Add documentation for SROP cookies Scott Bauer
2016-03-29 19:53   ` [kernel-hardening] " Scott Bauer
2016-03-29 20:12   ` Brian Gerst
2016-03-29 20:12     ` [kernel-hardening] " Brian Gerst
2016-04-24 16:27   ` Pavel Machek
2016-04-24 16:27     ` [kernel-hardening] " Pavel Machek
2016-03-29 21:29 ` [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies Andy Lutomirski
2016-03-29 21:29   ` [kernel-hardening] " Andy Lutomirski
2016-03-29 21:36   ` Scotty Bauer
2016-03-29 21:36     ` [kernel-hardening] " Scotty Bauer
2016-03-29 21:38     ` Andy Lutomirski
2016-03-29 21:38       ` [kernel-hardening] " Andy Lutomirski
2016-03-29 22:34       ` Linus Torvalds
2016-03-29 22:34         ` [kernel-hardening] " Linus Torvalds
2016-03-29 23:14         ` Scotty Bauer
2016-03-29 23:14           ` [kernel-hardening] " Scotty Bauer
2016-03-31 20:22           ` Eric W. Biederman
2016-03-31 20:22             ` [kernel-hardening] " Eric W. Biederman
2016-04-01 12:57             ` Cyrill Gorcunov
2016-04-01 12:57               ` [kernel-hardening] " Cyrill Gorcunov
2016-03-29 22:55       ` Daniel Micay
2016-04-24 16:14   ` Pavel Machek
2016-04-24 16:14     ` [kernel-hardening] " Pavel Machek
2016-03-29 22:54 ` Linus Torvalds
2016-03-29 22:54   ` [kernel-hardening] " Linus Torvalds
2016-03-29 22:55   ` Linus Torvalds
2016-03-29 22:55     ` [kernel-hardening] " Linus Torvalds
2016-03-29 23:05   ` Andy Lutomirski
2016-03-29 23:05     ` [kernel-hardening] " Andy Lutomirski
2016-03-29 23:11   ` Scotty Bauer
2016-03-29 23:11     ` [kernel-hardening] " Scotty Bauer
2016-03-29 23:25     ` Linus Torvalds
2016-03-29 23:25       ` [kernel-hardening] " Linus Torvalds
2016-03-29 23:34       ` Scotty Bauer
2016-03-29 23:34         ` [kernel-hardening] " Scotty Bauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.