DynaGuard: Armoring Canary-Based Protections against Brute-force Attacks
2015 Annual Computer Security Applications Conference (ACSAC) Los Angeles, California, USA
Columbia University Brown University Stony Brook University
DynaGuard: Armoring Canary-Based Protections against Brute-force - - PowerPoint PPT Presentation
DynaGuard: Armoring Canary-Based Protections against Brute-force Attacks Theofilos Petsios, Vasileios P. Kemerlis Michalis Polychronakis Angelos D. Keromytis Columbia University Stony Brook University Brown University 2015 Annual Computer
2015 Annual Computer Security Applications Conference (ACSAC) Los Angeles, California, USA
Columbia University Brown University Stony Brook University
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
2
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
3 Overflow Direction buffer start byte 0x0 byte 0x1 ... byte 0x7 ... canary start byte 0x0 byte 0x7 canary end copy of str Return Address Frame Pointer Canary char buffer[] int *x int i copy of n Higher Addresses Lower Addresses
int vuln(int n, char *str) { int i; int *x = NULL; char bufger [8]; ... /* unbounded copy */ memcpy(bufger , str , n); ... }
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
4
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
5
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
6
Overflow Direction buffer start byte 0x0 byte 0x1 ... byte 0x7 ... canary start byte 0x0 byte 0x7 canary end copy of str Return Address Frame Pointer Canary char buffer[] int *x int i copy of n Higher Addresses Lower Addresses
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
7
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
8
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
9
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
10
Overflow Direction buffer start byte 0x0 byte 0x1 ... byte 0x7 canary start canary end copy of str Return Address Frame Pointer Canary char buffer[] int *x int i copy of n Higher Addresses Lower Addresses
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 11
2006
2010
2013
2014
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
13
......
......
......
......
......
......
......
......
......
= ? = ?
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 19
......
......
......
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 20
......
......
......
......
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 21
......
......
......
......
......
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 22
......
......
......
......
......
= ? = ?
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
24
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 25
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 26
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 27
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 28
;function prologue push %rbp mov %rsp,%rbp sub $0x40,%rsp ;canary stack placement mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax ... ;canary check mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je <exit> callq <__stack_chk_fail@plt> Original push %rbp mov %rsp,%rbp sub $0x40,%rsp push %r14 (1) push %r15 lea -0x8(%rbp),%rax (2) mov %fs:0x2a0,%r14 (3) mov %fs:0x2a8,%r15 (4) mov %rax,(%r14,%r15,8) (5) incq %fs:0x2a8 (6) pop %r15 (7) pop %r14 mov %fs:0x2b8,%rax (8) mov %rax,-0x8(%rbp) xor %eax,%eax ... decq %fs:0x2a8 (9) mov -0x8(%rbp),%rcx xor %fs:0x2b8,%rcx (10) je <exit> callq <__stack_chk_fail@plt> DynaGuard
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 29
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 30
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
31
DynaGuard Pin Instrumentation API Pin Virtual Machine Code Cache Kernel Space User Space Analysis Code
Native Code Single Address Space
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
32
Instrumentation Pseudocode if((instruction has segment prefix) && (prefix is one of fs/gs) && (offset from fs/gs is 0x28/0x14) && (instr. is a ‘mov’ from mem to reg) && (next instr. is a `mov’ from reg to mem)&& (dest. operand(register) of current instr. is the source operand of next instr.)) { insert_analysis_call( before_next_instr, push_canary(thread_context, canary_address))} push rbp mov rsp,%rbp sub $0x40,rsp mov fs:0x28,%rax (1) mov rax,-0x8(%rbp)(2) Sample Function Prologue
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
33
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 34
0.995 1 1.005 1.01 1.015 1.02 1.025 1.03 1.035 1.04 1.045 1.05 1.055 1.06 400.perlbench 401.bzip2 403.gcc 429.mcf 445.gobmk 456.hmmer 458.sjeng 462.libquantum 464.h264ref 471.omnetpp 473.astar 483.xalancbmk Apache Nginx PostgreSQL SQLite MySQL
Slowdown (normalized over native)
SPEC CPU2006 Benchmarks I/O-bound Benchmarks
Compiler-based version of DynaGuard
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard 35
0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3 3.1 3.2 3.3 400.perlbench 401.bzip2 403.gcc 429.mcf 445.gobmk 456.hmmer 458.sjeng 462.libquantum 464.h264ref 471.omnetpp 473.astar 483.xalancbmk Apache Nginx PostgreSQL SQLite MySQL
Slowdown (normalized over native)
SPEC CPU2006 Benchmarks I/O-bound Benchmarks
Pin DynaGuard
DBI-based version of DynaGuard
Theofilos Petsios (theofilos@cs.columbia.edu) ACSAC 2015 /36 DynaGuard
36