"매 freed pointer 의 detectable invalid value 채움". Pointer poisoning 매 use-after-free / double-free / uninitialized-read 의 detection 기법 — free 후 pointer 를 매 0x0, 0xDEADBEEF, kernel-specific magic 으로 set 하여 매 dereference 즉시 crash. Linux kernel LIST_POISON1/2, glibc MALLOC_PERTURB_, AddressSanitizer 매 광범위 활용. 2026 기준 Rust/Swift 매 ownership 으로 매 회피, C/C++ 매 여전히 핵심 defensive technique.
매 핵심
매 왜 poison
Use-after-free 즉시 detect: 매 0xDEAD... dereference → page fault.
Debugger trail: stack trace 의 pointer value 만 보고 매 lifecycle stage 추정.
Heap exploit 완화: attacker 매 freed object reuse 의 일부 차단.
매 일반적인 poison value
0x0 — 매 NULL (가장 단순, page 0 unmapped).
0xDEADBEEF / 0xDEADC0DE — 매 32-bit human-readable.
0xDEADBEEFDEADBEEF — 매 64-bit.
Linux kernel: LIST_POISON1 = 0xdead000000000100, LIST_POISON2 = 0xdead000000000122 (매 user-space dereference 시 distinct fault address).
glibc tcache: poison 매 next-pointer 의 obfuscation (safe-linking, 2.32+).
매 응용
Linux kernel list_del — LIST_POISON1/2 매 next/prev.
// Conceptual: actual implementation in malloc.c
#define PROTECT_PTR(pos, ptr) \
((__typeof(ptr))((((size_t)(pos)) >> 12) ^ ((size_t)(ptr))))
#define REVEAL_PTR(ptr) PROTECT_PTR(&(ptr), ptr)
// Storing freed chunk's next pointer obfuscated → attacker-controlled
// linked-list overwrite no longer trivially redirects allocator.
C++ smart pointer reset (매 modern equivalent)
#include<memory>voidmodern(){autop=std::make_unique<Widget>();p->use();p.reset();// p == nullptr now; UAF 매 not possible via p
// p->use(); // SIGSEGV (NULL deref)
}
기본값: 매 new code 매 Rust / smart pointer. C 의 legacy 만 manual poison.
🔗 Graph
🤖 LLM 활용
언제: legacy C/C++ codebase 의 UAF debug, kernel module dev, embedded firmware hardening.
언제 X: managed language (JS/TS/Python/Java) — GC 가 매 처리. 매 over-engineering.
❌ 안티패턴
Free without poison + raw pointer 재사용: 매 silent UAF — heap reuse 시 detection X.
Poison value 가 valid mappable address: 매 0x1 매 page 0 의 일부 — distinct unmapped 사용.
Poison only after free, not in struct invalidation: 매 list, tree node 의 stale pointer 미처리.
Trust poison without ASLR: 매 attacker 매 정확한 poison value 알아도 OK — poison 매 detection only, not mitigation alone.
Production with ASAN: 매 2-3x slowdown, memory 2x — 매 staging only.