public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jirka Kosina <jikos@jikos.cz>
Cc: Arjan van de Ven <arjan@infradead.org>,
	linux-kernel@vger.kernel.org, akpm@osdl.org, torvalds@osdl.org
Subject: Re: Patch 4/6  randomize the stack pointer
Date: Fri, 28 Jan 2005 06:58:35 +0100	[thread overview]
Message-ID: <20050128055835.GA30570@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.58.0501272323150.9190@twin.jikos.cz>


* Jirka Kosina <jikos@jikos.cz> wrote:

> Also, besides security implications of stack randomization, there is
> one more aspect that should not be forgotten - stack randomization
> (even for quite small range) could be useful to distribute a pressure
> on cache (which may not be fully associative in all cases), so if
> everyone runs with stack on the same address, it could impose quite
> noticeable stress on some cachelines (those representing stack
> addresses), while other will be idling unused.
> 
> I thought that this was the original purpose of the "stack
> randomization" which is shipped for example by RedHat kernels, as the
> randomization is quite small and easy to bruteforce, so it can't serve
> too much as a buffer overflow protection.

Fedora kernels have 2MB of stack randomization. If 2MB is easy to
brute-force then 256MB is easy to brute-force nearly as much. But the
difference between _zero_ randomisation and 2MB randomisation is much
bigger than the difference between 2MB and 256MB of randomisation.

example: if there is no randomisation and e.g. there's an up to 100
bytes buffer-overflow in a UDP based service, then a single-packet
remote attack may become possible, and an automated worm has an easy
'vector to spread'. (worms these days are mainly limited by bandwidth,
so the number of packets it needs to spread is crutial. Also,
detection/prevention of a worm is easier if the attacker has to send
multiple packets in a row.)

some quick calculations about how the economics of attack look like if
there is randomisation in place:

If the hole has a possibility to inject a 'padding invariant' into the
attack (either NOPs into the shell code, so that a jump address can be
'fuzzy', or e.g. "././././" padding into a pathname/URL attack string),
so that the attack can use a 'fuzzy' address accurate only to the size
of padding, then the brute-forcing can be reduced to ~2MB/100bytes==20
thousand tries. If there is randomisation then a single-packet remote
attack needs to become a ~20-thousand packets brute-force attack. The
box is by no means in the clear against attacks, but worms become
uneconomic.

if the attack needs a specific address (or offset) to the stack and
there is no invariant then 2MB of of randomisation requires 2 million
tries to do the brute-force-attack.

with 256MB of randomisation and the possibility of an invariant, the
same attack would become a 2 million packets brute-force attack. A site
that didnt notice a 10-thousand packets attack probably wont notice a 2
million packets attack either. Plus the site is still vulnerable: 2
million packets (which with a 100 bytes attack size takes ~20 minutes
over broadband) and it's gone.

with no invariant and 256 million packets needed for an attack, it will
take over a day (over broadband) to brute-force a box - and security
purists would still consider the box vulnerable.

conclusion: stack randomisation (and other VM randomisations) are not a
tool against local attacks (which are much easier and faster to
brute-force) or against targeted remote attacks, but mainly a tool to
degrade the economy of automated remote attacks.

256 MB of stack randomisation negatively impacts the VM layout and
creates all sorts of problems, so it's really impractical. If your only
goal is to maximize security, then clearly, the more randomisation, the
better. If you have other goals as well (e.g. my goal is to make
security as painless as possible, so that _other_ people who dont
usually care about security end up using our stuff too) then you will
settle for somewhere inbetween. We started with 8MB in Fedora but that
already caused some problems so we decreased it to 2MB and that worked
pretty well on 32-bit systems. 64K is probably too low but is still a
good start and much better than nothing.

Note that 64-bit systems are different, there we can do a pretty good
grade of randomisation as VM space is plenty.

	Ingo

  reply	other threads:[~2005-01-28  5:59 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-27 10:11 Patch 0/6 virtual address space randomisation Arjan van de Ven
2005-01-27 10:12 ` Patch 1/6 introduce sysctl Arjan van de Ven
2005-01-27 10:36   ` Andi Kleen
2005-01-27 11:13     ` Arjan van de Ven
2005-01-27 18:16   ` Pavel Machek
2005-01-27 19:11     ` Ingo Molnar
2005-01-27 19:46       ` Dave Jones
2005-01-27 19:53         ` Ingo Molnar
2005-01-27 19:53         ` Arjan van de Ven
2005-02-04 21:27   ` Benoit Boissinot
2005-01-27 10:12 ` Patch 2/6 introduce helper infrastructure Arjan van de Ven
2005-01-27 10:41   ` Andi Kleen
2005-01-27 11:58     ` Arjan van de Ven
2005-01-27 12:27       ` Andi Kleen
2005-01-27 12:43         ` Arjan van de Ven
2005-02-01 21:14   ` Matt Mackall
2005-01-27 10:12 ` Patch 3/6 per process flag Arjan van de Ven
2005-01-27 10:13 ` Patch 4/6 randomize the stack pointer Arjan van de Ven
2005-01-27 10:21   ` Christoph Hellwig
2005-01-27 17:38   ` John Richard Moser
2005-01-27 17:47     ` Arjan van de Ven
2005-01-27 18:04       ` John Richard Moser
2005-01-27 18:09         ` Arjan van de Ven
2005-01-27 18:12         ` Christoph Hellwig
2005-01-27 18:16         ` Linus Torvalds
2005-01-27 18:28           ` Linus Torvalds
2005-01-27 18:55             ` John Richard Moser
2005-01-27 18:49           ` John Richard Moser
2005-01-27 19:30             ` Linus Torvalds
2005-01-27 19:48               ` Arjan van de Ven
2005-01-27 19:59                 ` Linus Torvalds
2005-01-27 20:04                   ` Arjan van de Ven
2005-01-27 20:08               ` John Richard Moser
2005-01-27 19:19           ` linux-os
2005-01-27 19:52             ` Julien TINNES
2005-01-27 20:02             ` Arjan van de Ven
2005-01-27 20:13               ` John Richard Moser
2005-01-27 21:33                 ` jnf
2005-01-28 17:22                 ` Paulo Marques
2005-01-28 17:51                   ` John Richard Moser
2005-01-28 18:42                   ` Ingo Molnar
2005-01-29  6:04                     ` John Richard Moser
2005-01-27 20:37               ` linux-os
2005-01-27 20:45                 ` John Richard Moser
2005-01-27 21:39           ` John Richard Moser
2005-01-27 21:53             ` Arjan van de Ven
2005-01-27 22:34               ` John Richard Moser
2005-01-29  2:50                 ` Rik van Riel
2005-01-29  6:31                   ` John Richard Moser
2005-01-29  8:10                     ` Arjan van de Ven
     [not found]                       ` <41FBB821.3000403@comcast.net>
2005-01-29 16:42                         ` Arjan van de Ven
2005-01-29 16:59                           ` John Richard Moser
2005-01-29 16:46                         ` Arjan van de Ven
2005-01-29 17:04                           ` John Richard Moser
2005-01-29 17:37                     ` Jakub Jelinek
2005-01-29 17:49                       ` John Richard Moser
2005-01-29 17:55                         ` Christoph Hellwig
2005-01-29 18:10                           ` John Richard Moser
2005-01-29 18:12                             ` Rik van Riel
2005-01-29 18:16                             ` Christoph Hellwig
2005-01-29  7:46           ` John Richard Moser
2005-01-27 18:40         ` Felipe Alfaro Solana
2005-01-27 22:31     ` Jirka Kosina
2005-01-28  5:58       ` Ingo Molnar [this message]
2005-01-28 19:02         ` David Lang
2005-01-28  7:33       ` Arjan van de Ven
2005-01-27 19:43   ` Julien TINNES
2005-01-28  0:10     ` H. Peter Anvin
2005-01-28  0:23       ` Roland Dreier
2005-01-28  1:06         ` H. Peter Anvin
2005-01-28  2:03     ` Horst von Brand
2005-01-28  8:45       ` Julien TINNES
2005-01-27 20:23   ` Christoph Hellwig
2005-01-27 20:27     ` Arjan van de Ven
2005-01-27 20:32       ` Christoph Hellwig
2005-01-27 20:35         ` Arjan van de Ven
2005-01-27 20:40         ` Rik van Riel
2005-01-27 20:42           ` Christoph Hellwig
2005-01-27 20:56             ` Arjan van de Ven
2005-01-27 21:13               ` Linus Torvalds
2005-01-27 10:13 ` Patch 5/6 randomize mmap addresses Arjan van de Ven
2005-01-27 10:14 ` Patch 6/6 default enable randomisation for -mm Arjan van de Ven
2005-01-27 11:45 ` Patch 0/6 virtual address space randomisation Julien TINNES
2005-01-27 11:57   ` Arjan van de Ven
2005-01-27 17:42     ` John Richard Moser
2005-01-27 19:34       ` Julien TINNES
2005-01-27 19:57         ` John Richard Moser
2005-01-27 20:13         ` Arjan van de Ven
2005-01-28  8:45           ` David Weinehall
  -- strict thread matches above, loose matches on Subject: below --
2005-01-31 10:55 Patch 4/6 randomize the stack pointer linux
2005-01-31 17:28 ` John Richard Moser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050128055835.GA30570@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=jikos@jikos.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox