Documentation Index
Fetch the complete documentation index at: https://mintlify.com/shellphish/how2heap/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The House of Orange is a legendary heap exploitation technique that achieves arbitrary code execution by corrupting the_IO_list_all pointer and exploiting the FILE structure mechanism. This technique is notable for achieving code execution without ever calling free(), making it powerful in constrained environments.
Glibc Version Compatibility
| Version | Status | Notes |
|---|---|---|
| glibc < 2.24 | ✅ Working | Original technique works |
| glibc 2.24-2.25 | ⚠️ Mitigated | vtable whitelist check added |
| glibc >= 2.26 | ❌ Patched | malloc_printerr no longer flushes FILE |
| Latest | ❌ Patched | Use House of Tangerine or House of Apple |
- vtable validation (2.24): db3476aff19b75c4fdefbe65fcd5f0a90588ba51
- abort behavior (2.26): 91e7cf982d0104f0e71770f5ae8e3faf352dea9f
Ret2 Wargames Practice: Try this technique hands-on at House of Orange Interactive Challenge
What This Technique Achieves
The House of Orange enables:- Code execution without free(): Exploit purely through malloc() calls
- FILE structure exploitation: Hijack the FILE vtable mechanism
- Abort() exploitation: Turn a crash into code execution
- Unsorted bin manipulation: Force the old top chunk into unsorted bin
Prerequisites and Constraints
How It Works
Corrupt top chunk size
Overflow into the top chunk and set its size to a value that satisfies page alignment but is smaller than a large allocation.
Trigger sysmalloc and _int_free
Allocate a chunk larger than the corrupted top chunk size. This forces sysmalloc to mmap new memory and free the old top chunk.
Corrupt the freed top chunk
Use overflow to corrupt the old top chunk’s fd and bk pointers, and set its size.
Complete Source Code
Technical Deep Dive
Phase 1: Freeing the Top Chunk
The top chunk is normally never freed, but we can force it:- Corrupt top chunk size to be smaller than available space
- Allocate large chunk (> corrupted size)
- sysmalloc() is called to get more memory
- Old top chunk doesn’t merge with new memory
- _int_free() is called on old top chunk
Phase 2: Corrupting _IO_list_all
When malloc sorts the unsorted bin:victim->bk = _IO_list_all - 0x10, we write a main_arena pointer to _IO_list_all.
Phase 3: Fake FILE Structure
The_IO_FILE structure must pass several checks:
fp->_mode <= 0fp->_IO_write_ptr > fp->_IO_write_base- Valid vtable pointer
_IO_OVERFLOWpoints to our function
Phase 4: The Exploit Chain
Why Size 0x61?
The size 0x61 (97 bytes) is chosen because:- It’s in the smallbin range
- It goes to smallbin[4]
- smallbin[4] is at offset +0x68 from main_arena
- This offset becomes the fake FILE’s fd pointer in _IO_list_all traversal
CTF Challenge
Hitcon CTF 2016 - House of Orange
Hitcon CTF 2016 - House of Orange
Challenge: Orange management system with heap overflow but no free()Vulnerability:
- Heap overflow via orange description field
- No free() function available
- Had to exploit purely through malloc()
- Leaked heap address via overlapping chunks
- Leaked libc address via unsorted bin pointers
- Corrupted top chunk size to 0xc01
- Allocated large chunk to free old top
- Corrupted old top chunk’s bk to _IO_list_all - 0x10
- Set up fake FILE structure with system() address
- Triggered abort() via small allocation
- Got shell when system(“/bin/sh”) was called
Common Pitfalls
The Patches
Patch 1: vtable Validation (glibc 2.24)
Patch 2: malloc_printerr (glibc 2.26)
Modern Alternatives
House of Tangerine
Modern technique for glibc 2.26+ using sysmalloc _int_free
House of Apple
Advanced FILE structure exploitation for modern glibc
House of Kiwi
Alternative FILE-based technique for code execution
Learning Resources
- Original Blog Post: Angelboy’s House of Orange
- FILE Structure Exploitation: Abusing FILE Structures
- Phrack Article: The House of Orange
See Also
- [FILE Structure Exploitation/resources/ctf-challenges)
- House of Tangerine
- Top Chunk Management
- Unsorted Bin Attack
- Heap Security Checks
