Low-level security or C and the infamous buffer overflow
A buffer overflow is a bug that affects low-level code, typically in C and C++, with significant security implications. Normally, a program with this bug will simply crash. But an attacker can alter the situations that cause the program to do much worse. Steal private information (e.g., ...
A buffer overflow is a bug that affects low-level code, typically in C and C++, with significant security implications. Normally, a program with this bug will simply crash. But an attacker can alter the situations that cause the program to do much worse.
- Steal private information (e.g., Heartbleed)
- Corrupt valuable information
- Run code of the attacker’s choice
Buffer overflows are still relevant today. C and C++ are still popular. Buffer overflows still occur with regularity. They have a long history. Many different approaches developed to defend against them, and bugs like them. C and C++ still very popular
Critical systems in C/C++ Most OS kernels and utilities
- Windows
- Linux
- shell Many high-performance servers
- Microsoft IIS, Apache httpd, nginx
- Microsoft SQL server, MySQL, redis, memcached Many embedded systems
- Mars rover, industrial control systems, automobiles
I use the term buffer overflow to mean any access of a buffer outside of its allotted bounds
- Could be an over-read, or an over-write
- Could be during iteration (“running off the end”) or by direct access (e.g., by pointer arithmetic)
- Out-of-bounds access could be to addresses that precede or follow the buffer
Benign outcome
void func(char *arg1) { char buffer[4]; strcpy(buffer, arg1); ... } int main() { char *mystr = “AuthMe!”; func(mystr); ... }
Upon return, sets %ebp to 0x0021654d strcpy() copy arg1 over %ebp
strcpy() will let you write as much as you want (til a ‘