Heap spray
From Wikipedia, the free encyclopedia
In computer security, a heap spray is a technique used in exploits to facilitate arbitrary code execution. The term is also used to describe the part of the source code of an exploit that implements this technique. In general, code that sprays the heap attempts to put a certain sequence of bytes at a predetermined location in the memory of a target process by having it allocate (large) blocks on the process' heap and fill the bytes in these blocks with the right values. They commonly take advantage from the fact that these heap blocks will roughly be in the location everytime the heap spray is run.
Contents |
[edit] History
Heap sprays have been used occasionally in exploits since at least 2001[1], but the technique started to see widespread used in exploits for web browsers soon after the release a series of exploits that used it that exploited a wide range of bugs in Internet Explorer[2][3][4][5][6]. The heap sprays used in all these exploits was very similar, which showed its versatility and ease of use without need for mayor modifications between exploits. It proved simple enough to understand and use to allow novice hackers to quickly write reliable exploits for many types of vulnerabilities in web browsers and web browser plug-ins. Many web browser exploits that use heap spraying consist only of a heap spray that is copy-pasted from a previous exploit combined with a small piece of script or HTML that triggers the vulnerabily.
Even though the technique was proven to work on other webbrowsers[7], it has not seem the same widespread use as seen for Internet Explorer.
[edit] Implementation
[edit] JavaScript
Heap sprays for web browsers are commonly implemented in JavaScript and spray the heap by creating large Unicode strings with the same character repeated many times by starting with a string of one character and concatenating it with itself over and over. This causes the length of the string to grow exponentially up to the maximum length allowed by the scripting engine. When the maximum length (or an arbitrary lower length) is reached, the heap spraying code starts to make copies of the long string and stores these in an array, up to the point where enough memory has been sprayed. VBScript is sometimes (though very rarely) used to create strings as well because it is made easy by the String function.
[edit] Images
Though it has been proven that heap-spraying can be done through other means, for instance by loading image files into the process[citation needed], this has not seen widespread use (as of February 2008).
[edit] References
- ^ eEye Digital Security - Research
- ^ Www.edup.tudelft.nl/~bjwever/advisory iframe.html.php - Skypher
- ^ Www.edup.tudelft.nl/~bjwever/details msie ani.html.php - Skypher
- ^ Www.edup.tudelft.nl/~bjwever/advisory msie R6025.html.php - Skypher
- ^ FrSIRT - Microsoft Internet Explorer javaprxy.dll COM Object Vulnerability / Exploit (Security Advisories)
- ^ FrSIRT - Microsoft Internet Explorer "Msdds.dll" Remote Code Execution / Exploit (Security Advisories)
- ^ Mozilla Browsers 0xAD (HOST:) Remote Heap Buffer Overrun Exploit (v2)

