Use-After-Free
What is Use-After-Free?
Use-After-FreeA memory-safety bug where a program continues to use memory after it has been freed, often allowing attackers to control object state and hijack execution.
A use-after-free (UAF) happens when a pointer keeps referencing an object after free()/delete has released it. If the attacker can cause the same memory region to be reallocated as a different object — a technique called heap grooming or "heap feng shui" — the dangling pointer effectively gives them a type confusion, perfect for overwriting virtual-function pointers, callback addresses, or sensitive state. UAFs dominate browser and kernel exploitation and are catalogued as CWE-416.
Named cases illustrate the impact. CVE-2018-8174, a UAF in the VBScript engine reachable through Internet Explorer, was weaponised in the "Double Kill" zero-day and folded into exploit kits. CVE-2022-0609, a UAF in Chrome's Animation component, was exploited in the wild as a zero-day; Google's Threat Analysis Group attributed the campaigns to North Korean state actors targeting media and fintech firms. The prevalence of such bugs is why Microsoft and Google both report that around 70% of their historical CVEs stem from memory-safety errors, driving the industry push toward Rust.
flowchart TD A[Object allocated, pointer P references it] --> B["free() / delete called"] B --> C[P now dangles, memory returned to allocator] C --> D[Attacker sprays heap to reclaim the slot] D --> E[Same memory reallocated as attacker-controlled object] E --> F[Program dereferences P] F --> G[Type confusion -> hijack vtable / control flow]
Defences include disciplined ownership models (RAII, smart pointers), garbage-collected or memory-safe languages such as Rust, hardened allocators (quarantine, isolation pools, GWP-ASan), and KASAN/Valgrind testing. Browsers also deploy MiraclePtr and PartitionAlloc-style guards.
● Examples
- 01
CVE-2018-8174 (VBScript engine) — UAF exploited by APT actors.
- 02
CVE-2022-0609 (Chrome animation) — UAF, used as a zero-day.
● Frequently asked questions
What is Use-After-Free?
A memory-safety bug where a program continues to use memory after it has been freed, often allowing attackers to control object state and hijack execution. It belongs to the Vulnerabilities category of cybersecurity.
What does Use-After-Free mean?
A memory-safety bug where a program continues to use memory after it has been freed, often allowing attackers to control object state and hijack execution.
How do you defend against Use-After-Free?
Defences for Use-After-Free typically combine technical controls and operational practices, as detailed in the full definition above.
What are other names for Use-After-Free?
Common alternative names include: UAF.