Pointless Tain,ng?
Evalua,ng the Prac,cality of Pointer Tain,ng
Asia Slowinska, Herbert Bos Vrije Universiteit Amsterdam
PointlessTain,ng? Evalua,ngthePrac,calityofPointer Tain,ng - - PowerPoint PPT Presentation
PointlessTain,ng? Evalua,ngthePrac,calityofPointer Tain,ng AsiaSlowinska,HerbertBos VrijeUniversiteitAmsterdam Whypointertain,ng? AFacks Exploitlowlevelmemoryerrors
Asia Slowinska, Herbert Bos Vrije Universiteit Amsterdam
Exploit low‐level memory errors Buffer overflows Dangling pointers Format strings
Exploit low‐level memory errors Buffer overflows Dangling pointers Format strings
Control‐diver,ng
Exploit low‐level memory errors Buffer overflows Dangling pointers Format strings
Control‐diver,ng Non‐control‐diver,ng
Exploit low‐level memory errors Buffer overflows Dangling pointers Format strings
Installed by users or by the way of exploits e.g., trojan
Control‐diver,ng Non‐control‐diver,ng
Exploit low‐level memory errors Buffer overflows Dangling pointers Format strings
Installed by users or by the way of exploits e.g., trojan
Control‐diver,ng Non‐control‐diver,ng
diver,ng
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted.
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted.
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted. 2. Propagate taint through the OS.
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted. 2. Propagate taint through the OS.
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted. 2. Propagate taint through the OS.
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted. 2. Propagate taint through the OS. 3. Alert for dereferences due to tainted jumps, func,on calls/ returns.
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted. 2. Propagate taint through the OS. 3. Alert for dereferences due to tainted jumps, func,on calls/ returns.
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
ret
1. Mark network data as tainted. 2. Propagate taint through the OS. 3. Alert for dereferences due to tainted jumps, func,on calls/ returns.
void serve(int fd) { char *reply = ...; char request[64]; read(fd, request, 128); srv_send(fd, reply, 1024); }
reply msg reply request
void serve(int fd) { char *reply = ...; char request[64]; read(fd, request, 128); srv_send(fd, reply, 1024); }
reply msg server private data
reply request
1. Mark network data as tainted. 2. Propagate taint through the OS. 3. Alert for dereferences due to tainted jumps, func,on calls/returns.
1. Mark network data as tainted. 2. Propagate taint through the OS. 3. Alert for dereferences due to tainted jumps, func,on calls/returns.
void serve(int fd) { char *reply = ...; char request[64]; read(fd, request, 128); srv_send(fd, reply, 1024); }
reply msg server private data reply request
void serve(int fd) { char *reply; char request; read(fd, request, 1); srv_send(fd, reply, 1); }
void serve(int fd) { char *reply; char request; read(fd, request, 1); reply = to_lower[request]; srv_send(fd, reply, 1); }
void serve(int fd) { char *reply; char request; read(fd, request, 1); reply = to_lower[request]; srv_send(fd, reply, 1); }
0x100 0x141 0x142 0x143 0x61 (‘a’) 0x62 (‘b’) 0x63 (‘c’)
void serve(int fd) { char *reply; char request; read(fd, request, 1); reply = to_lower[request]; srv_send(fd, reply, 1); } request = 0x41 ‘A’
0x100 0x141 0x142 0x143 0x61 (‘a’) 0x62 (‘b’) 0x63 (‘c’)
void serve(int fd) { char *reply; char request; read(fd, request, 1); reply = to_lower[request]; srv_send(fd, reply, 1); } request = 0x41 ‘A’ addr = 0x100 + request reply = *addr
0x100 0x141 0x142 0x143 0x61 (‘a’) 0x62 (‘b’) 0x63 (‘c’)
void serve(int fd) { char *reply; char request; read(fd, request, 1); reply = to_lower[request]; srv_send(fd, reply, 1); } request = 0x41 ‘A’ addr = 0x100 + request reply = *addr
0x100 0x141 0x142 0x143 0x61 (‘a’) 0x62 (‘b’) 0x63 (‘c’)
Internet browser Poten,al malware
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
Internet browser Poten,al malware
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
Internet browser Poten,al malware
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
Internet browser Poten,al malware
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
Internet browser Poten,al malware
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
Internet browser Poten,al malware
memory taint tag Guest OS Emulator Host OS App 1 App 2 App 3
struct hlist_head *head = get_list_head(filename);
base
struct hlist_head *head = get_list_head(filename);
base
struct hlist_head *head = get_list_head(filename);
index = hash(filename)
base
struct hlist_head *head = get_list_head(filename);
index = hash(filename)
base
struct hlist_head *head = get_list_head(filename);
index = hash(filename)
struct hlist_head *head = get_list_head(filename); struct dentry *dentry = head->first;
struct hlist_head *head = get_list_head(filename); struct dentry *dentry = head->first;
next = NULL dentry of foo.txt info
struct hlist_head *head = get_list_head(“test.txt”); struct dentry *dentry = head->first;
next = NULL dentry of foo.txt info
struct hlist_head *head = get_list_head(“test.txt”); struct dentry *dentry = head->first;
next = NULL dentry of foo.txt next dentry of test.txt info info
next dentry of test.txt next = NULL dentry of foo.txt info info
struct hlist_head *head = get_list_head(“test.txt”); struct dentry *dentry = head->first;
head
next dentry of test.txt next = NULL dentry of foo.txt info info
struct hlist_head *head = get_list_head(“foo.txt”); struct dentry *dentry = head->first;
next dentry of test.txt next = NULL dentry of foo.txt info info
struct hlist_head *head = get_list_head(“foo.txt”); struct dentry *dentry = head->first; dentry = dentry->next; return info = dentry->info;
1. Mark network data as tainted. 2. Propagate taint through the OS. 3. Alert for dereferences due to tainted jumps, func,on calls/returns.
C program
ls cp tar gzip
kernel kernel threads hald-addon-storage dhcdbd hald syslogd pam-unix.so libnss-files-2.7.so console-kit-daemon bash (no. 1) bash (no. 2) run-parts bash (no. 3) bash (no. 4) sed tar gzip dash apt-get ls cp ping 50 100 150 200 Intervals clean dirty
val = transl_table[index] struct dentry dentry = prev_dentry->next;
val = transl_table[index] struct dentry dentry = prev_dentry->next;
val = transl_table[index] struct dentry dentry = prev_dentry->next; B = prev_dentry + offset dentry = *B
val = transl_table[index] struct dentry dentry = prev_dentry->next; B = prev_dentry + offset dentry = *B
val = transl_table[index] A = address of an array B = A + index*4 val = *B struct dentry dentry = prev_dentry->next; B = prev_dentry + offset dentry = *B
kernel apt-get bash (no. 1) gnome-terminal Xorg gnome-screensaver python2.5 dhcdbd hald-addon-storage kernel threads hald-addon-input metacity nm-applet gnome-panel hald nautilus bash (no. 2) tar (no. 1) gzip (no. 1) gpgv tar (no. 2) gzip (no. 2) 200 400 600 800 1000 1200 1400 Intervals clean dirty
struct hlist_head *head = d_hash(parent, hash); struct dentry *dentry = head->first;
attributes = transl_table[kbd_data]; lower_case = attributes->lower;
2 new_addr: modify the resul,ng pointer with a constant
– mov eax, dword ptr [ebp + 08h] – pop eax
A = address of an array i = index to be accessed B = A + i*4 Translated value: val = *B struct fd { HANDLER handler; STRING filename; struct fd *next; }; A = address of filename B = A – 0x0004 h1 = *(B + 0x0000) fd2 = *(B + 0x0020)
struct fd { HANDLER handler; STRING filename; struct fd *next; }; A = address of filename B = A – 0x0004 h1 = *(B + 0x0000) fd2 = *(B + 0x0020)
A = address of an array i = index to be accessed B = A + i*4 Translated value: val = *B
typedef struct test_t { int i; struct test_t *next; } test_t, *ptest_t; ptest_t table[256] = …; ptest_t i1 = table[index]; A = (table+index*sizeof(test_t)) ptest_t i2 = i1->next; addr: *(A + offset(next)) int i3 = i1->i; addr: *(A)
// tainted // clean // clean
– A[index].b: int b = *((char*)A+8*index+4)
attributes = transl_table[kbd_data]; lower_case = attributes->lower;