< Previous | Contents | Next >
11.4.2. Memory Corruption
A memory corruption happens when a location within the memory space of a process is acciden- tally modified due to programming mistakes. Memory corruption bugs usually lead to unpre- dictable program behavior, however in many cases, these bugs allow process memory manipula- tion in such a way that the program execution flow can be controlled, allowing attacker-defined activity.
These attacks are typically referred to as buffer overflows, although this term is an over- simplification. The most common types of memory corruption are vastly different from one an- other and have their own tactics and techniques required for successful exploitation.
• Stack Buffer Overflow: When a program writes more data to a buffer on the stack than there is space available for it, adjacent memory can be corrupted, often causing the program to crash.
• Heap Corruption: Heap memory is allocated at run- time and usually contains data from the running program. Heap corruptions occur by manipulating the data to overwrite through the linked list of heap memory pointers.
• Integer Overflow: These overflows occur when an application tries to create a numeric value that can’t be contained within its allocated storage space.
• Format String: When a program accepts user input and formats it without checking it, mem- ory locations can be revealed or overwritten, depending on the format tokens that are used.