In-depth lesson · Memory corruption
Root causes
Every point the Memory corruption reports back under this heading, best-backed first, each with the reports it is seen in.
-
An object is used without checking it still exists, leaving a dangling pointer.
Seen in 116 reports
-
A user-controlled value is dereferenced as a pointer without validating that it points to legitimate memory.
Seen in 96 reports
-
Objects are used after being freed because their existence is not checked before use.
Seen in 67 reports
-
The dominant root cause is missing or incorrect length and bounds checks before copying input into a heap or stack buffer.
Seen in 67 reports
-
Incoming data is written to a heap buffer without a correct size or bounds check.
Seen in 60 reports
-
Input sizes or lengths are not checked before data is copied into heap or stack buffers, causing overflows.
Seen in 57 reports
-
Missing bounds checks let parsers read or write past the end of an allocated buffer.
Seen in 56 reports
-
File parser bounds checks are missing: parsers trust length, size or offset fields in the file and copy or read without checking them against the destination buffer.
Seen in 56 reports
-
Memory is freed while still referenced, or freed twice, because object lifetime is not tracked across threads.
Seen in 50 reports
-
User-supplied lengths or sizes are trusted and copied into fixed-size buffers without a bounds check.
Seen in 49 reports
-
The code freed an object and later used it without checking that it still existed.
Seen in 47 reports
-
Scripting methods and properties operate on objects without checking that they still exist, so freed memory is reused.
Seen in 46 reports
-
File parsers trust size, length or offset values in the file without checking them against the destination or allocated buffer.
Seen in 45 reports
-
Incoming data copied into a heap buffer without a correct size or bounds check.
Seen in 43 reports
-
CAD and 3D file parsers repeatedly wrote or read past the end of allocated buffers because bounds checks were missing.
Seen in 43 reports
-
A user-controlled length is not checked before copying into a fixed-size heap or stack buffer.
Seen in 42 reports
-
Most Apple memory corruption reports trace to missing or insufficient bounds checks before writing or reading image, font, model or file system data.
Seen in 39 reports
-
A missing bounds check lets a read or write go past the end of an allocated buffer.
Seen in 38 reports
-
User-supplied data is copied into a fixed-length stack buffer without a length check first.
Seen in 36 reports
-
Generic mishandling of objects in memory in scripting engines, kernel components and libraries.
Seen in 34 reports
-
Size or index values from the input are trusted without checking them against the allocated buffer.
Seen in 34 reports
-
Code freed objects and then used them again without checking they still existed.
Seen in 33 reports
-
Use-after-free where memory is accessed after being released, often requiring a race condition.
Seen in 33 reports
-
User-supplied data was copied into fixed-length stack or heap buffers without checking its length first.
Seen in 33 reports
-
Image and document parsing lacks bounds checks before reading or writing user-supplied data.
Seen in 32 reports
-
Objects are freed while still referenced, so a race window lets an attacker reuse the freed memory.
Seen in 32 reports
-
Objects are used after being freed because existence is not checked before the operation.
Seen in 32 reports
-
Objects are freed but still referenced, giving use-after-free conditions often only reachable through a race.
Seen in 32 reports
-
A second root cause is memory lifetime management: objects freed while still referenced, producing use-after-free conditions.
Seen in 31 reports
-
The parser does not check that an object still exists before using it, leading to a use-after-free.
Seen in 31 reports
-
User-supplied data copied into a fixed stack buffer without a length check.
Seen in 31 reports
-
Lengths, sizes and offsets from the input are trusted without bounds checks, leading to reads and writes past allocated buffers.
Seen in 30 reports
-
Memory freed but still referenced, often only reachable by winning a race condition.
Seen in 30 reports
-
Objects are freed or closed but later used without checking they still exist.
Seen in 30 reports
-
Objects are used after being freed because existence is not checked before use.
Seen in 30 reports
-
File parsing trusts size, length or offset fields from the file without checking them against the allocated buffer.
Seen in 30 reports
-
The vulnerable window only opens when two threads race, so timing is central to exploitation.
Seen in 30 reports
-
Buffers are read past their end because the read length is not checked against the allocation.
Seen in 29 reports
-
Objects are freed while still referenced, often with a race window that lets an attacker influence the freed memory.
Seen in 29 reports
-
User-supplied data is used without validating its size or structure before memory operations.
Seen in 29 reports
-
Attribute values from parsed files were copied into fixed-size stack or heap buffers without a length check.
Seen in 28 reports
-
Code used or freed objects without checking they still existed, causing use-after-free and double free.
Seen in 28 reports
-
User-supplied lengths are copied into fixed-size buffers without checking them first.
Seen in 28 reports
-
Heap-based buffer overflow from missing or wrong length and size checks.
Seen in 27 reports
-
Objects are freed or invalidated but later dereferenced without checking they still exist, across services, parsers and drivers.
Seen in 27 reports
-
The parser uses an object after freeing it because it does not check the object still exists.
Seen in 27 reports
-
Objects are freed and then used again, often with a race window that makes the timing exploitable.
Seen in 26 reports
-
Size or offset values from user-supplied files are trusted without checking them against the real buffer length.
Seen in 25 reports
-
The parser trusts size or offset values in the file without checking them against the actual buffer, so it reads or writes beyond the allocated object.
Seen in 25 reports
-
A length field or data block from the file is copied into a fixed-size stack buffer without checking that it fits.
Seen in 24 reports