Phys Feng Shui¶
OS'in physical-memory allocator'ını (buddy allocator) deterministik biçimde yönlendirerek bir victim page table sayfasının Rowhammer'a açık bir physical konuma düşmesini sağlamak; böylece probabilistic flip'leri güvenilir bir exploit'e çevirmek.
Mechanism¶
Note
Probabilistic Rowhammer exploitation (page-table spraying) bir flip'in işe yarar bir sayfaya düşmesini umar. Phys Feng Shui bu şansı ortadan kaldırır: kernel'in bir sonraki adımda hangi physical page'i verdiğini kontrol etmek için buddy allocator'ın deterministik davranışını manipüle eder. Buddy allocator, power-of-two page block'larını öngörülebilir bir sırada böler ve birleştirir; önce belleği tüketip sonra block'ları seçici biçimde free ederek bir attacker, sonraki bir allocation'ın döndüreceği physical page'i tahmin edip seçebilir. Attacker bunu, flip yönü bilinen tam o physical hücrenin yanına templated, flip'e açık bir sayfa (ve o hücrenin üstüne bir victim page-table sayfası) yerleştirmek için kullanır.
Phys Feng Shui, mobil (ARM/Android) üzerinde deduplication gibi özel bir OS özelliği olmadan deterministik Rowhammer privilege escalation elde etmek için Drammer'da (van der Veen et al., CCS 2016) tanıtıldı. Üç yapı taşı şunlardır: DRAM templating (flip'leri bul), sonra bir page table'ı vulnerable bir hücreye oturtmak için physical massaging (Phys Feng Shui), sonra bir PFN bit'ini flip'leyip physical memory'nin kontrolünü ele geçirmek için hammering.
Walkthrough¶
Massaging, bellek bir kez groom edildikten sonra buddy allocator'ın physically contiguous / öngörülebilir block'lar döndürmesini suistimal eder:
1. Template DRAM -> record physical offsets with reproducible flips.
2. Exhaust memory -> allocate until the buddy allocator's free lists are
drained, forcing predictable allocation order.
3. Selective free -> free a chosen block so the next allocation reuses a
known physical page (the "feng shui" placement).
4. Land the victim -> trigger the kernel to allocate a page-table page into
that known, flip-vulnerable physical page.
5. Hammer -> flip a PFN bit in the victim PTE -> control physical
memory -> root.
Drammer'daki grooming primitive'i, kavramsal olarak büyük physically-contiguous allocation'lara dayanır:
// Drain and shape the buddy allocator, then capture a known physical page.
allocate_until_exhausted(); // empties higher-order free lists
free_one_chosen_block(); // next alloc will reuse this physical block
trigger_kernel_pagetable_alloc(); // kernel takes the predicted page
// page table now sits on the templated vulnerable cell -> hammer it
Detection¶
- Aşırı memory exhaustion ardından hedefli free'ler alışılmadık bir allocation pattern'idir; Rowhammer activation burst'leri ve ECC hatalarıyla birleştiğinde tespit edilebilir.
Mitigation¶
- Domain-aware / guard-row physical allocation (örn. ARM'da CATT, GuardION) bir attacker sayfasının kernel sayfalarına physically adjacent yapılmasını önler.
- ECC, TRR/PRAC ve artırılmış refresh, placement'ın dayandığı flip'leri azaltır.