Fine-Grained Control-Flow Integrity through Binary Hardening
Mathias Payer, Antonio Barresi, Thomas R. Gross
ETH Zrich FFmpeg and a thousand fixes >1,000 bugs found and - - PowerPoint PPT Presentation
Fine-Grained Control-Flow Integrity through Binary Hardening Mathias Payer, Antonio Barresi, Thomas R. Gross ETH Zrich FFmpeg and a thousand fixes >1,000 bugs found and fixed 2 person-years & fuzzing on large cluster
Mathias Payer, Antonio Barresi, Thomas R. Gross
http://j00ru.vexillium.org/?p=2211 Jan-10, 2014
2 person-years & fuzzing on large cluster >1,000 bugs found and fixed
and memory safety for performance
– Programmer responsible for all checks
written in C / C++ prone to memory bugs
– Protect integrity through safe runtime system
Code Heap Stack
1 3 2 4 4'
– Function return – Indirect jump – Indirect call
– Return-oriented programming – Jump-oriented programming
flow transfer must target a statically determined set of locations
– Indirect jump – Indirect call – Function returns
– Find set of allowed targets for each location
… jmpl *%eax … call *(0xb) … call *(0xc) 0xa 0xb 0xc 0xd 0xd 0xe 0x2 0xf 1 3 2 4
– Find set of allowed targets for each location
… jmpl *%eax … call *(0xb) … call *(0xc) 0xa 0xb 0xc 0xd 0xd 0xe 0x2 0xf 1 3 2 4
– Support legacy, binary code – Support modularity (libraries) – Leverage precise, dynamic analysis – Low performance overhead
System Call Interface System Call Interface Kernel User
Lockdown Domain App. Domain ELF Files Loads ELF files /bin/<exe> Loader libc.so.6 lib* Code Cache read only readable + executable main() printf() func*() main' func1() func2() ... func2' printf' Binary Translator translate() CFT Verifier Run-time ICT validation Shadow stack Shadow stack Shadow stack
imported exported
.text
puts scanf funcA ...
/bin/<exec>
exported
.text
_dl* ...
/lib/libc.so.6
puts scanf mprotect ...
imported exported
.text
ifunc* ...
/lib/lib*
funcA funcB ... call puts ... lea fptr, %eax ... call *%eax ... puts: ... mprotect: ... funcA: ... funcB: ... symbol table of ELF DSO .text section of DSO allowed Control Flow transfer illegal Control Flow transfer
imported exported
.text
puts scanf funcA ...
/bin/<exec>
exported
.text
_dl* ...
/lib/libc.so.6
puts scanf mprotect ...
imported exported
.text
ifunc* ...
/lib/lib*
funcA funcB ... call puts ... lea fptr, %eax ... call *%eax ... puts: ... mprotect: ... funcA: ... funcB: ... symbol table of ELF DSO .text section of DSO allowed Control Flow transfer illegal Control Flow transfer
– Precise due to shadow stack
– Imported in the current module (context)
inside the current symbol (or functions)
Configuration Small file Image Combined
Single threaded 30.41% 1.94% 7.87% Concurrent 6.27% 1.09% 1.83% Concurrent with keep-alive 15.80% 3.00% 4.36%
– Both ROP (ret) or COP (icall) exploitation possible
Length RET CALL/JMP/ SYS ROP attack 30 7 COP attack 30 0 (487*) 99
* reachable, but protected by shadow stack
– Loop through two calls to the same function – Choose any caller as return location
– Attacker restricted to arbitrary targets on the stack – Each target can only be called once, in sequence
– Shadow stack, dynamic CFI, and locality – System call policy as secondary protection
Mathias Payer, Antonio Barresi, Thomas R. Gross
20 40 60 80 100 120 140 160
BT Lockdown Performance overhead