Overview
The GNU C Library (glibc) heap allocator has undergone significant security hardening over the years. This changelog documents the major protection mechanisms and consistency checks added to the heap implementation, explaining how each change impacts exploitation techniques.Version 2.25 and Earlier
Baseline Protection Level
All attacks in the how2heap repository work at least in glibc 2.25, making it a baseline for studying classic heap exploitation techniques. Available Techniques:- Fastbin attacks (fastbin_dup, fastbin_dup_into_stack)
- House of Force
- House of Lore
- House of Orange
- House of Roman
- Unsorted bin attacks
- Unsafe unlink
- Overlapping chunks
If you’re learning heap exploitation fundamentals, glibc 2.25 or earlier provides the most permissive environment.
Version 2.26
Major Changes
1. tcache (Per-Thread Cache) Introduction
What Changed:- Introduced thread-local caching for small allocations
- Separate free lists per thread (7 bins per size class)
- Initially had minimal security checks
- New attack surface: tcache poisoning
- Fastbin attacks became more complex
- New primitive: tcache_dup (double free in tcache)
tcache was enabled in Ubuntu builds starting from glibc 2.27, even though it was introduced in 2.26.
2. Unlink Size Consistency Check
What Changed: Added size validation in theunlink(AV, P, BK, FD) macro:
- Harder to exploit unsafe unlink
- Requires more careful chunk metadata manipulation
- Size consistency must be maintained across adjacent chunks
- unsafe_unlink (still possible but more constrained)
- overlapping_chunks (requires careful size manipulation)
Version 2.27
Major Changes
1. tcache Enabled by Default in Ubuntu
What Changed:- Ubuntu builds enabled tcache by default
- Significantly changed heap behavior
2. Fastbin Consolidation Size Check
What Changed: Added size validation inmalloc_consolidate(mstate av):
- Prevents fastbin consolidation with corrupted sizes
- Makes some fastbin attacks more difficult
- Requires attackers to maintain valid size fields
- fastbin_dup_consolidate (requires valid sizes)
- Some House of Force variants
3. tcache Double Free Check
What Changed: Added basic double-free detection in tcache:- tcache_dup technique obsoleted
- Need to bypass double-free check
- Led to development of house_of_botcake
Version 2.29
Major Changes
1. Enhanced Size Checks
What Changed: Multiple size consistency checks added to unsorted bin processing:- Breaks overlapping_chunks technique
- Breaks unsorted_bin_into_stack
- Breaks unsorted_bin_attack
- Breaks house_of_force
- Breaks house_of_roman
- Breaks house_of_storm
- overlapping_chunks (< 2.29)
- overlapping_chunks_2 (< 2.29)
- house_of_force (< 2.29)
- unsorted_bin_into_stack (< 2.29)
- unsorted_bin_attack (< 2.29)
- house_of_roman (< 2.29)
- house_of_storm (< 2.29)
Version 2.32
Major Changes
1. Safe-Linking Protection
What Changed: Introduced pointer mangling in tcache and fastbins:- Forward pointers in tcache/fastbins are now obfuscated
- Requires heap leak to decrypt pointers
- Makes blind tcache poisoning impossible
- Led to development of decrypt_safe_linking technique
- tcache_poisoning (now requires heap leak)
- fastbin_dup (requires pointer decryption)
- All tcache-based attacks
- decrypt_safe_linking (demonstrates decryption)
- safe_link_double_protect (bypass via double protection)
Version 2.33
Major Changes
Minor improvements to existing protections. No major new mitigations introduced.Version 2.34
Major Changes
Continued refinement of existing security checks.Version 2.35
Major Changes
Most modern techniques have been updated to work with this version. Many “latest” techniques in how2heap target 2.35.Version 2.36 and Later
Major Changes
Ongoing security improvements and bug fixes. New techniques continue to be developed:- house_of_water (2.36+) - Leakless tcache exploitation
- safe_link_double_protect (2.36+) - Bypass safe-linking
- house_of_tangerine (2.39+) - Top chunk exploitation with tcache
- tcache_relative_write (2.41) - Out-of-bounds tcache metadata writes
Summary of Protection Timeline
2.26 - tcache Introduction
2.26 - tcache Introduction
- tcache per-thread caching added
- Unlink size consistency check
- New attack surface created
2.27 - Initial Hardening
2.27 - Initial Hardening
- tcache enabled in Ubuntu
- Fastbin consolidation checks
- tcache double-free detection
2.29 - Major Security Milestone
2.29 - Major Security Milestone
- Comprehensive size consistency checks
- Patched 7+ classic techniques
- Unsorted bin attack mitigated
- House of Force patched
2.32 - Safe-Linking
2.32 - Safe-Linking
- Pointer obfuscation in tcache/fastbins
- Requires heap leaks for exploitation
- Major impact on all pointer-based attacks
Impact on CTF and Real-World Exploitation
For CTF Players
Always check the glibc version of the target binary. Many CTF challenges use older glibc versions to allow specific techniques.
- 2.23-2.27: Classic techniques work, good for learning
- 2.29-2.31: Transitional period, some techniques patched
- 2.32+: Modern protections, requires advanced techniques
For Security Researchers
Understanding the protection timeline helps in:- Vulnerability impact assessment
- Exploit development for specific versions
- Writing portable exploits
- Developing new bypass techniques
