280 likes | 456 Views
ACM CCS’09. Countering Kernel Rootkits with Lightweight Hook Protection. Zhi Wang @ NCSU Xuxian Jiang @ NCSU Weidong Cui @ Microsoft Research Peng Ning @ NCSU. Outline. Introduction HookSafe Design Implementation Evaluation Related Work & Conclusion. Introduction.
E N D
ACM CCS’09 Countering Kernel Rootkits with Lightweight Hook Protection ZhiWang @ NCSU Xuxian Jiang @ NCSU Weidong Cui @ Microsoft Research PengNing@ NCSU
Outline • Introduction • HookSafe Design • Implementation • Evaluation • Related Work & Conclusion Advanced Defense Lab @ National Central Univ.
Introduction • Prior research: • Behaviors • Symptoms • Kernel code integrity • Return-oriented rootkits • Return-Oriented Rootkits: Bypassing Kernel Code Integrity Protection Mechanisms @ Usenix Security ‘09 Advanced Defense Lab @ National Central Univ.
Introduction • Better solution… • Preserve kernel code integrity by preserving the kernel control flow integrity • Kernel control data: • Return addresses • Function pointers • Function pointers == kernel hooks (in this paper) Advanced Defense Lab @ National Central Univ.
Introduction • Hardware-based page-level protection • Limited number of kernel hooks • Hooks are not co-located together with frequently modified memory data Advanced Defense Lab @ National Central Univ.
Introduction • HookSafe • Hypervisor-based • Lightweight • Protect all kernel hooks • Byte-level granularity Advanced Defense Lab @ National Central Univ.
Introduction Distribution of 5881 kernel hooks in a running Ubuntu system Advanced Defense Lab @ National Central Univ.
HookSafe Design • Offline Hook Profiler • Profile the guest kernel execution and output a hook access profile for each protected hook • Hook Access Points(HAPs) • Online Hook Protector • Create a shadow copy of all protected hooks • Implement HAPs • Redirection Advanced Defense Lab @ National Central Univ.
HookSafe Design The HookSafe architecture Advanced Defense Lab @ National Central Univ.
HookSafe Design • Offline Hook Profiling • Static analysis • More complete; less precise • Dynamic analysis • More precise • QEMU – monitoring every memory access instruction Advanced Defense Lab @ National Central Univ.
HookSafe Design • Online Hook Protection Advanced Defense Lab @ National Central Univ.
HookSafe Design • Online Hook Protection – Initialization • At Boot time • Create shadow copy • Patch the HAPs(requires the support of the hypervisor) Advanced Defense Lab @ National Central Univ.
HookSafe Design • Online Hook Protection – Runtime R/W Indirection • Read : read from the shadow copy and return • Write : • Make a hypercall • Validate the request • Update the shadow copy if valid Advanced Defense Lab @ National Central Univ.
HookSafe Design • Online Hook Protection – Runtime Tracking of Dynamic Allocated Hooks • A dynamic allocated hook is embedded in a dynamic kernel object • Hypercall while a kernel object containing a hook is allocated • Create the shadow copy of the hook Advanced Defense Lab @ National Central Univ.
HookSafe Design • Hardware Register Protection • GDTR, IDTR, DR0-DR7 • Hardware-based page-level protection Advanced Defense Lab @ National Central Univ.
Implementation • Offline Hook Profiler • QEMU – binary translation • If an instruction accesses any kernel hook in the given list, mark it as an HAP and log the value • Dynamic allocated kernel hook: • Track the creation of the kernel object and locate the location • Hook access profile Advanced Defense Lab @ National Central Univ.
Implementation An example access profile related to ext3_dir_operations->readdir kernel hook Advanced Defense Lab @ National Central Univ.
Implementation • Hook Indirection • HAP Patching • Overwrite the instruction of HAP with a 5-byte jmp instruction • Jump to trampoline code • > 5 bytes : Fill the space with NOP instructions • < 5 bytes : overwrite the subsequent instruction Advanced Defense Lab @ National Central Univ.
Implementation The implementation of hook indirection Advanced Defense Lab @ National Central Univ.
Implementation Advanced Defense Lab @ National Central Univ.
Implementation • Hook Indirection - HAP Patching • HAP after HAP • The second instruction is a target of jump instruction Advanced Defense Lab @ National Central Univ.
Implementation • Read/Write Indirection • Detection: Read – compare the original hook with shadow copy • Write – update both Advanced Defense Lab @ National Central Univ.
Implementation • Runtime LKM and Hook Tracking • SLAB interface • LKM • Virtual machine introspection • Memory Protection • Shadow page table (SPT) in Xen Advanced Defense Lab @ National Central Univ.
Evaluation • Test with 9 real-world rootkits • UnixBench and ApacheBench Advanced Defense Lab @ National Central Univ.
Evaluation Advanced Defense Lab @ National Central Univ.
Evaluation Advanced Defense Lab @ National Central Univ.
Evaluation • Performance Advanced Defense Lab @ National Central Univ.