Default
Use after free
Much like the name suggests, this technique involves us using data once it is freed. The weakness here is that programmers often wrongly assume that once the chunk is freed it cannot be used and don’t bother writing checks to ensure data is not freed. This means it is possible to write data to a free chunk, which is very dangerous.
UAF
happens when a program continues to use a pointer after the memory it points to has been freed. can lead to
- Crashes
- arbitrary code execution
- information disclosure
Typical
UAF
Flow- Allocate memory (
malloc
,new
) - Use it normally
- Free it (
free
,delete
) - Use it again!
- Allocate memory (
HOW UAF
is exploited
- reallocated the freed chunk with attacker-controlled data
- overwrite function pointers, vtables, hooks, etc
- hijack execution flow