T56 Dec 24, 2025 2 min read

Use-after-free

A memory safety bug where code uses memory after it has been freed, leading to crashes, corruption, or exploitable behavior.

Definition

A use-after-free bug happens when code continues to read from or write to memory after that memory has been freed and potentially reused for something else.

Why it’s dangerous

Use-after-free can cause:

  • crashes (invalid access)
  • subtle data corruption
  • security issues if an attacker can influence what gets allocated into the freed region

Where it shows up

This is most common in native code and unsafe code paths. It can surface as SIGSEGV, SIGBUS, or seemingly random behavior.

It’s also a common underlying cause behind “executing data as code” style failures.