BH US 12 Serna Leak Era Slides
BH US 12 Serna Leak Era Slides
BH US 12 Serna Leak Era Slides
Agenda
Background info on info leaks
Previous examples
Who is @fjserna?
Fermin J. Serna @fjserna - [email protected]
Information Security Engineer at Google since Dec/2011
Previously Security Software Engineer at Microsoft MSRC
You do not find info leaks you create them, Halvar Flake at Immunitys
Infiltrate conference 2011
We were lazy
Even when we became more skilled and less lazy there were
generic ways to bypass some mitigations without an info leak
10
11
12
Type confusion
Converting a use after free into an universal XSS
Application specific vulnerabilities: CVE-2012-0769
13
Other variables
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Saved EBP
0x10563480
0x41414141
Saved EIP
Function args
0x7FE39823
0x7FE34141
14
Later on with JS you can read the entire address space (relative to
your buffer) with:
var content=str.substr(rel_address,rel_address+2)
Heap based buffer
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Object
Size: 0x00000004
Size: 0xFFFFFFFF
Blah
Blah
0x7F347690
0x7F347690
15
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Blah\0\0
AAAAAA
Object
0x7F347690
0x7F347690
16
17
class
cyberpompeii
{
private:
void
*
ptr;
attacker
will
control
this
once
he
gets
the
free
chunk
public:
DWORD
f()
{
return
*(DWORD
*)ptr;
}
};
18
19
20
void * ptr;
AAAA // vtable_ptr
public:
[]
void f() {
0x0c0c4560 // ptr
free(ptr);
String spray
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
[]
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
0x7f3E4560 AAAAAAAAA
};
AAAAAAAAAAAAAAAAA
Step1:
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
Step3:
AAAAAAAAAAAAAAAAA
21
Memory chunk
Object
claimed by a string
AAAAAAAAAAAAAA
uint32_ptr
Vtable_ptr
[]
AAAAA
AAAAAAAAAAAAA
void
* ptr
0x7F345678
[]
AAAAAAAAAAAA
ptr=GetProcAddress(dll,WinExec);
}
};
Google Confidential and Proprietary
22
Type confusion
Replace the freed object memory chunk (size X) with a different
object type of same size X.
Virtual call friendly, since the vtable_ptr will point to a valid place, but different
than expected
The virtual function called must have the same number of arguments for CoE
Does this new virtual function perform any of the previously mentioned, and
useful, operations? And does not crash the application? J
class
original_object
{
class replaced_object {
private:
private:
void * blahhh;
void * ptr;
public:
public:
return -1;
HMODULE dll=LoadLibrary(kernel32.dll);
ptr=GetProcAddress(dll,WinExec);
};
}
};
Google Confidential and Proprietary
23
Sounds crazy?
It works, but not reliably.
24
Attacker page
var elem =
CElement
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
Iframe Target
25
Demo time!
Target: IE9/Win7
Using a patched vulnerabilityCVE-2012-1889
MSXML un-initialized stack variable
anyone!
26
27
The vulnerability
Universal info leak
28
29
if (histogram[i]==1) return i;
}
return
0;
}
[...]
memory=bd.histogram(new
Rectangle(-0x200,0,1,1));
data=(find_item(memory[3])<<24)
+
(find_item(memory[0])<<16)
+
(find_item(memory[1])<<8)
+
(find_item(memory[2]));
30
31
32
33
34
35
36
data=process_vectors(
bd.histogram (new Rectangle(X-bitmap_buffer_addr,0,1,1))
);
37
38
39
40
41
42
43
44
@fjserna [email protected]
Q&A
45