Software Security Flashcards
Buffer Overflow
takes advantage of the stack
What is unique about C strings?
null terminating character at the end
What directions do strings grow in?
Upwards
What direction does the stack grow in?
Downward (from high memory addresses to low memory addresses)
What direction does the heap grow in?
Upward
Where are the stack and heap in relation to each other?
They share space, but grow in different directions
Shell Code
Creates a code that will execute any code
Has same privilege level as the host program that launched it
Shell Injection
return address of function is overwritten to point to shell code in the buffer
Return-to-libc
return address of function is overwritten to point to a standard library function
Heap Overflows
data stored in the heap is overwritten
manipulation using malloc()/free()
OpenSSL Heartbleed Vulnerability
Query database for information, setting the length of the return regardless of what the information contains
How does a programming language prevent buffer overflow attacks?
Strongly typed, autobound checks, auto memory management
What is a drawback of using a programming language to prevent buffer overflow attacks?
Performance suffers
If you have to use an unsafe language, what should you do to prevent buffer overflow attacks?
Check inputs, check bounds, perform code analysis
How do stack canaries work?
Random integer put before a return address that is checked to see if the buffer has been manipulated