P1:L2 Software Security Flashcards
Buffer (or memory) Overflow
A common and persistent vulnerability
In information security and programming, a buffer overflow, or buffer overrun, is an anomaly where a program, while writing data to a buffer, overruns the buffer’s boundary and overwrites adjacent memory locations.
Stack buffer overflows
In software, a stack buffer overflow or stack buffer overrun occurs when a program writes to a memory address on the program’s call stack outside of the intended data structure, which is usually a fixed-length buffer.
stacks are used
- In function/procedure calls
- for allocation of memory for
- local variables
- parameters
- control information (return address)
Vulnerable password checking program
Not good to hardcode password in code
Push and pop
Push = Stack grows Pop = Stack shrinks
Password check code quiz
Too much data gets stored in the variable for int Remember memory (or buffer) overflow
So… variable could possible be different from 0
Bad input caused a manipulation
Which vulnerability applied to the code in example quiz?
The code did not check the input and reject password strings longer than 12 bytes.
Creates a shell which allows it to execute any code the attacker wants
Shell Code
ShellCode
Has to be stored in memory… instructions… assembler language.. translated into machine code.
Whose privileges are used when attacker code is executed?
- The host program’s
- System service or OS root privileges
“Keys to the kingdom”
How many CVE vulnerabilities does NVD have?
NVD = National Vulnerability Database
CVE = Common Vulnerability and Exposure)
Close to 70,000
How many buffer overflow vulnerabilities reported in the last 3 months
Close to one hundred
How many buffer overflow vulnerabilities in last 3 years?
Over a thousand
The return address is overwritten to point to a standard library function
Return-to-libc (write type)
This is a type of Buffer Overflow (a variation of)
Data stored in the heap is overwritten. Data can be tables of function pointers.
Heap Overflows (write type) (another variation of Buffer Overflow)