lkml.org 
[lkml]   [2014]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] ASLRv3: randomize_va_space=3 preventing offset2lib attack
From
On Mon, Dec 8, 2014 at 12:09 PM, Christian Borntraeger
<borntraeger@de.ibm.com> wrote:
> Am 05.12.2014 um 01:07 schrieb Hector Marco:
>> [PATCH] ASLRv3: randomize_va_space=3 preventing offset2lib attack
>>
>> The issue appears on PIE linked executables when all memory areas of
>> a process are randomized (randomize_va_space=2). In this case, the
>> attack "offset2lib" de-randomizes all library areas on 64 bit Linux
>> systems in less than one second.
>>
>> Further details of the PoC attack at:
>> http://cybersecurity.upv.es/attacks/offset2lib/offset2lib.html
>>
>> PIE linked applications are loaded side by side with the dynamic
>> libraries, which is exploited by the offset2lib attack. Moving away
>> the executable from the mmap_base area (libraries area) prevents the
>> attack.
>>
>> This patch loads the PIE linked executable in a different area than
>> the libraries when randomize_va_space=3.
>>
>> Patch implementation details:
>>
>> - The ELF_ET_DYN_BASE address is used as the base to load randomly
>> the PIE executable.
>>
>> - The executable image has the same entropy than
>> randomize_va_space=2.
> [...]
>> --- a/arch/arm/mm/mmap.c
>> +++ b/arch/arm/mm/mmap.c
> [...]
>> --- a/arch/arm64/mm/mmap.c
>> +++ b/arch/arm64/mm/mmap.c
> [...]
>
>> --- a/arch/x86/mm/mmap.c
>> +++ b/arch/x86/mm/mmap.c
> [...]
>
> FWIW, please note that s390 and power (maybe others?) also have PIE support done differently, e.g.
> commit d2c9dfccbc3 ("[S390] Randomize PIEs") and commit 501cb16d3cfdc ("powerpc: Randomise PIEs")
>
> What I can tell from a quick look both architectures should be fine regarding offsetlib, as they place the executable already in a different section and randomize those differently even with randomize_va_space=2.
>
> Would it make sense to unify the implementations again?

Seems like that would be best. If this is already being done on
non-x86 and non-arm, we should just fix x86 and arm to DTRT. :)

-Kees

--
Kees Cook
Chrome OS Security


\
 
 \ /
  Last update: 2014-12-09 19:21    [W:0.076 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site