
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

































Buffer Overflow I: Attack Introduction
8
0x
code 0x
static data
bss
heap
shared library
stack
kernel space
0x
0xC
0xFFFFFFFF
From Dawn Song’s RISE: http://research.microsoft.com/projects/SWSecInstitute/slides/Song.ppt
10
00000000
Addresses
SP
SP+ offset
SP: stack pointer BP: base/frame pointer
BP
18 addressof(y=3) return address saved stack pointer buf y x
11
x=2;
foo(18);
y=3;
void foo(int j) { int x,y; char buf[100]; x=j; … }
13
*void foo(char s) { char buf[100]; strcpy(buf,s); …
return-address saved sp
buf
pointer to pgm
Small Program
char buf[20];
char prefix[] = ”http://”;
...
strcpy(buf, prefix);
// copies the string prefix to buf
strncat(buf, path, sizeof(buf));
// concatenates path to the string buf
char src[9]; char dest[9];
char base_url = ”www.ru.nl”;
strncpy(src, base_url, 9);
// copies base_url to src strcpy(dest, src);
// copies src to dest
19
base_url is 10 chars long, incl. its null terminator, so src won’t be not null-terminated
so strcpy will overrun the buffer dest
\0;