address space layout randomization
≈ 6 min read
Names in other languages
- hyՀասցեի տարածքի դասավորության պատահականացում
- DeutschAddress Space Layout Randomization
- Englishaddress space layout randomization
- FrançaisAddress space layout randomization
- Italianoaddress space layout randomization
- РусскийAddress Space Layout Randomization
- 日本語アドレス空間配置のランダム化
- 中文位址空間配置隨機載入
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
Address space layout randomization (ASLR) is a computer security technique involved in preventing exploitation of memory corruption vulnerabilities. In order to prevent an attacker from reliably redirecting code execution to a particular exploited function in memory, ASLR randomly arranges the address space positions of key data areas of a process, including the base of the executable and the positions of the stack, heap and libraries. When applied to the kernel, this technique is called kernel address space layout randomization (KASLR).
Address space layout randomization (ASLR) is a computer security technique involved in preventing exploitation of memory corruption vulnerabilities. In order to prevent an attacker from reliably redirecting code execution to a particular exploited function in memory, ASLR randomly arranges the address space positions of key data areas of a process, including the base of the executable and the positions of the stack, heap and libraries. When applied to the kernel, this technique is called kernel address space layout randomization (KASLR). N (total amount of entropy: N = (E_s-A_s) + (E_m-A_m) + (E_x-A_x) + (E_h-A_h)\, ) To calculate the probability of an attacker succeeding, a number of attempts carried out without being interrupted by a signature-based IPS, law enforcement, or other factor must be assumed; in the case of brute forcing, the daemon cannot be restarted. The number of relevant bits and how many are being attacked in each attempt must also be calculated, leaving however many bits the attacker has to defeat. The following formulas represent the probability of success for a given set of attempts on bits of entropy. g \left ( \alpha\, \right ) = 1 - { \left ( 1 - {2^{-N}} \right ) ^ \alpha\,} \,\text{ if } 0 \le \, \alpha\, (isolated guessing; address space is re-randomized after each attempt) b \left ( \alpha\, \right ) = \frac{\alpha\,} \,\text{ if } 0 \le \, \alpha\, \le \, {2^N} (systematic brute forcing on copies of the program with the same address space) In many systems, 2^N can be in the thousands or millions. On 32-bit systems, a typical amount of entropy N is 8 bits. For 2004 computer speeds, Shacham and co-workers state "... 16 bits of address randomization can be defeated by a brute force attack within minutes." (The authors' statement depends on the ability to attack the same application multiple times without any delay. Proper implementations of ASLR, like that included in grsecurity, provide several methods to make such brute force attacks infeasible. One method involves preventing an executable from executing for a configurable amount of time if it has crashed a certain number of times.) On 64-bit systems, these numbers typically reach the millions at least. Android, and possibly other systems, implement Library Load Order Randomization, a form of ASLR which randomizes the order in which libraries are loaded. This supplies very little entropy. An approximation of the number of bits of entropy supplied per needed library appears below; this does not yet account for varied library sizes, so the actual entropy gained is really somewhat higher. Attackers usually need only one library; the math is more complex with multiple libraries, and shown below as well. The case of an attacker using only one library is a simplification of the more complex formula for l = 1 . (number of libraries loaded) (number of libraries used by the attacker) E_m = \begin{cases} \log_2 \left (l \right ) &\text{ if } \beta\, = 1, l \ge \, 1 \\ \sum_{i=l}^{l - \left ( \beta\, - 1 \right )} \log_2 \left (i \right ) &\text{ if } \beta\, \ge \, 1, l \ge \, 1 \end{cases} These values tend to be low even for large values of , most importantly since attackers typically can use only the C standard library and thus one can often assume that \beta\, = 1 . However, even for a small number of libraries there are a few bits of entropy gained here; it is thus potentially interesting to combine library load order randomization with VMA address randomization to gain a few extra bits of entropy. These extra bits of entropy will not apply to other mmap() segments, only libraries.
Kernel address space layout randomization
Kernel address space layout randomization (KASLR) enables address space randomization for the Linux kernel image by randomizing where the kernel code is placed at boot time. KASLR was merged into the Linux kernel mainline in kernel version 3.14, released on 30 March 2014. When compiled in, it can be disabled at boot time by specifying as one of the kernel's boot parameters. There are several side-channel attacks in x86 processors that could leak kernel addresses. In late 2017, kernel page-table isolation (KPTI aka KAISER) was developed to defeat these attacks. However, this method cannot protect against side-channel attacks utilizing collisions in branch predictor structures. , finer grained kernel address space layout randomization (or function granular KASLR, FGKASLR) is a planned extension of KASLR to randomize down to the function level by placing functions in separate sections and reordering them at boot time.
OpenBSD
In 2003, OpenBSD became the first mainstream operating system to support a strong form of ASLR and to activate it by default. OpenBSD completed its ASLR support in 2008 when it added support for PIE binaries. OpenBSD 4.4's malloc(3) was designed to improve security by taking advantage of ASLR and gap page features implemented as part of OpenBSD's mmap system call, and to detect use-after-free bugs. Released in 20131, OpenBSD 5.3 was the first mainstream operating system to enable position-independent executables by default on multiple hardware platforms, and OpenBSD 5.7 activated position-independent static binaries (Static-PIE) by default.
Exploitation
A side-channel attack utilizing branch target buffer was demonstrated to bypass ASLR protection. In 2017, an attack named "ASLR⊕Cache" was demonstrated which could defeat ASLR in a web browser using JavaScript. Bypassing PaX ASLR protection On the effectiveness of address space layout randomization Test Applications (or libraries) for their ASLR and DEP support ASLR Smack & Laugh Reference
Text derived from https://en.wikipedia.org/w/index.php?oldid=1365510028 under CC BY-SA 4.0; modifications have been made.
References
1 claim could not be tied to a specific sentence and is listed in the table below instead.
- ↩Wikipedia “address space layout randomization” release date (×1) · confidence 0.95 revision URL