GuardION: Practical Mitigation of DMA-based
Description: GuardION: Practical Mitigation of DMA-based Rowhammer Attacks on ARM Victor van der Veen, Martina Lindorfer, Yanick Fratantonio, Harikrishnan Padmanabha Pillai, Giovanni Vigna, Christopher Kruegel, Herbert Bos, and Kaveh Razavi
Related Topics
Download Presentation
"GuardION: Practical Mitigation of DMA-based" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Presentation Transcript
slide1. GuardION: Practical Mitigation of DMA-based Rowhammer Attacks on ARM Victor van der Veen, Martina Lindorfer†, Yanick Fratantonio‡, Harikrishnan Padmanabha Pillai*, Giovanni Vigna†, Christopher Kruegel†, Herbert Bos, and Kaveh Razavi<br>
slide2. Takeaway Overview of Rowhammer defenses
​RAMPAGERowhammer attacks against the latest Android OS
​GuardION Lightweight mitigation<br>
slide3. DRAM Disturbance Errors (refresh every 64ms) Memory cells (capacitors) have a natural discharge rate
Activating neighboring cells increases the discharge rate
Victim cell is charged to represent 1
Neighboring cells are accessed frequently
Victim cell leaks charge below a certain threshold
When read, victim cell is interpreted 0 Rowhammer<br>
slide15. Rowhammer Flip a bit in a victim row by reading from two aggressor rows
Not every bit may flip
Bit flips are reproducible
Challenges
Bypass the CPU cache
Get large contiguous chunks of memory<br>
slide16. Privilege Escalation with Rowhammer Page tables
Map virtual addresses to physical addresses (virt x is at phys y)
Stored in DRAM
Flipping a bit in a page table
Modifies the mapping: virt x is at phys z
Store a page table at phys z…
… read/write access to a page table: arbitrary read/write<br>
slide17. Privilege Escalation with Drammer The Android ION memory allocator
Generalized memory manager to support DMA buffers
Multiple ION heaps, some with internal pooling
User-space can request buffers with modified cache management
Drammer (2016) exploits the contiguous heap to
Bypass the CPU cache
Get large contiguous allocations Camera | Audio | Contiguous (kmalloc) | ADSP | IOMMU | qsecom | CMA | System | MM | …<br>
slide18. Overview of Defenses<br>
slide19. Rowhammer Defenses on ARM Software-based Rowhammer defenses
ANVIL | B-CATT | CATT | Android ION patches
Secure
Do they stop Rowhammer attacks?
Practical
Can we deploy them in practice, on Android/ARM?<br>
slide20. Rowhammer Defenses on ARM ANVIL
Performance counters measure cache misses / DRAM accessesThreshold exceeded?
Heavy-weight monitoring check for aggressor accessesThreshold exceeded?
Access the victim row to trigger a refresh
ANVIL is secure, but not practical on ARM
No performance counters to support 2.<br>
slide21. Rowhammer Defenses on ARM B-CATT
Scan memory during boot for vulnerable pages
Instruct the OS to mark those pages as unavailable
B-CATT is not secure
A single scan does not yield all possible bit flips<br>
slide23. Rowhammer Defenses on ARM B-CATT
Scan memory during boot for vulnerable pages
Instruct the OS to mark those pages as unavailable
B-CATT is not secure
A single scan does not yield all possible bit flips
B-CATT is not practical
You may have to blacklist all pages
A full memory scan can take over a day to complete<br>
slide24. Rowhammer Defenses on ARM CATT
Partition memory in n chunks, one for each security domain
1 for user-space allocations, 1 for kernel memory<br>
slide26. USER-SPACE<br>
slide27. KERNEL MEMORY USER-SPACE Page tables Empty row ION allocations<br>
slide28. Rowhammer Defenses on ARM CATT
Partition memory in n chunks, one for each security domain
1 for user-space allocations, 1 for kernel memory
CATT is not secure
Double-ownership buffers between kernel and user space
CATT is not practical
Android requires as many domains as installed apps
Severe performance penalty for low-memory devices<br>
slide29. Rowhammer Defenses on ARM Android ION patches (1/2)
Disable the contiguous (kmalloc) heap
Reduce ION internal pool sizes to at most 64 KB (equal the rowsize)
No longer guaranteed to get large contiguous chunks
Complicates scanning for bit flips
Complicates memory massaging
Practical, but not secure<br>
slide30. Rowhammer Defenses on ARM Android ION patches (2/2)
Better separation of highmem / lowmem
Get ION allocations (highmem) away from page tables (lowmem)
Practical, but not secure<br>
slide31. RAMPAGE<br>
slide32. Rampage: Rowhammer on Android Oreo 1. Contiguous memory with the ION system heap (vmalloc)
Allocate and free ION chunks (defragmentation)
(many) Multiple consecutive 64 KB requests
Timing side-channel (bank conflicts) to verify
2. Getting allocations in lowmem
Deplete highmem by using mmap
Monitor procfs/pagetypeinfo or procfs/zoneinfo to verify<br>
slide33. Rampage Variants App-to-App attacks
ION-to-ION
CMA-to-CMA
CMA-to-system
Privilege escalation (Drammer++)
PoC on LG G4: 64-bit device running Android 7.1<br>
slide34. GUARDION<br>
slide35. GuardION Fine grained memory isolation for DMA buffers
Focus on Android/ARM
Cache-eviction based Rowhammer is impossible
Allocate physical guard rows for each DMA allocation<br>
slide36. Request 1<br>
slide37. Request 1<br>
slide38. Guard row Guard row Request 1 Request 2<br>
slide39. Guard row Guard row Request 2 Request 1<br>
slide40. Guard row Guard row Request 2 Guard row Page Table Request 1<br>
slide41. Guard row Guard row Guard row Page Table Request 1 Request 2<br>
slide42. GuardION Fine grained memory isolation for DMA buffers
Focus on Android/ARM
Cache-eviction based Rowhammer is impossible
Allocate two physical guard rows for each DMA allocation
Memory overhead
At most 128 KB for each allocation
Only for uncached pages
Not many DMA allocations in practice<br>
slide43. GuardION Performance overhead
With GuardION, we can re-enable large ION pools
No need for many small allocations, just a single large one
Performance increase!
Implementation:
Protection for three heaps: system | CMA | contiguous
422 lines in 5 files for 3 heaps<br>
slide44. Benchmark apps found in Google Play Basemark OS II Comparison BenchmarkAndroid Billion Counter Bonsai Graphics H264 HardBench Kassja KFS LukaLukaBench NextMark OESK OMEGA Phone Benchmark Pi Benchmark Real Benchmark Relative Benchmark RinRinBench SQLite Unity Bench GuardION Memory FootprintMemory overhead in MB<br>
slide45. GuardION Performance OverheadRelative performance (%) (higher is better) Benchmark apps found in Google Play Performance increase of 5.8% (geometric mean)<br>
slide46. CONCLUSION<br>
slide47. Disclosure to Google CVE 2018-9442
The benchmark code provided has much larger allocation sizes than those observed in real-world tests that we have conducted … performance impact is much greater than what is cited from your benchmark
This is not good enough (yet)
Looking forward to improve GuardION memory footprint<br>
slide48. Conclusion Rowhammer in 2018
Overview of defenses – still no working solution
​RAMPAGE – Rowhammer attacks on recent Android devices
​GuardION – Lightweight mitigation by isolating DMA buffers
Future research
Real-world benchmarks for Android
Large-scale analysis on vulnerability of devices http://rampageattack.com https://github.com/vusec/guardion<br>
slide2. Takeaway Overview of Rowhammer defenses
​RAMPAGERowhammer attacks against the latest Android OS
​GuardION Lightweight mitigation<br>
slide3. DRAM Disturbance Errors (refresh every 64ms) Memory cells (capacitors) have a natural discharge rate
Activating neighboring cells increases the discharge rate
Victim cell is charged to represent 1
Neighboring cells are accessed frequently
Victim cell leaks charge below a certain threshold
When read, victim cell is interpreted 0 Rowhammer<br>
slide15. Rowhammer Flip a bit in a victim row by reading from two aggressor rows
Not every bit may flip
Bit flips are reproducible
Challenges
Bypass the CPU cache
Get large contiguous chunks of memory<br>
slide16. Privilege Escalation with Rowhammer Page tables
Map virtual addresses to physical addresses (virt x is at phys y)
Stored in DRAM
Flipping a bit in a page table
Modifies the mapping: virt x is at phys z
Store a page table at phys z…
… read/write access to a page table: arbitrary read/write<br>
slide17. Privilege Escalation with Drammer The Android ION memory allocator
Generalized memory manager to support DMA buffers
Multiple ION heaps, some with internal pooling
User-space can request buffers with modified cache management
Drammer (2016) exploits the contiguous heap to
Bypass the CPU cache
Get large contiguous allocations Camera | Audio | Contiguous (kmalloc) | ADSP | IOMMU | qsecom | CMA | System | MM | …<br>
slide18. Overview of Defenses<br>
slide19. Rowhammer Defenses on ARM Software-based Rowhammer defenses
ANVIL | B-CATT | CATT | Android ION patches
Secure
Do they stop Rowhammer attacks?
Practical
Can we deploy them in practice, on Android/ARM?<br>
slide20. Rowhammer Defenses on ARM ANVIL
Performance counters measure cache misses / DRAM accessesThreshold exceeded?
Heavy-weight monitoring check for aggressor accessesThreshold exceeded?
Access the victim row to trigger a refresh
ANVIL is secure, but not practical on ARM
No performance counters to support 2.<br>
slide21. Rowhammer Defenses on ARM B-CATT
Scan memory during boot for vulnerable pages
Instruct the OS to mark those pages as unavailable
B-CATT is not secure
A single scan does not yield all possible bit flips<br>
slide23. Rowhammer Defenses on ARM B-CATT
Scan memory during boot for vulnerable pages
Instruct the OS to mark those pages as unavailable
B-CATT is not secure
A single scan does not yield all possible bit flips
B-CATT is not practical
You may have to blacklist all pages
A full memory scan can take over a day to complete<br>
slide24. Rowhammer Defenses on ARM CATT
Partition memory in n chunks, one for each security domain
1 for user-space allocations, 1 for kernel memory<br>
slide26. USER-SPACE<br>
slide27. KERNEL MEMORY USER-SPACE Page tables Empty row ION allocations<br>
slide28. Rowhammer Defenses on ARM CATT
Partition memory in n chunks, one for each security domain
1 for user-space allocations, 1 for kernel memory
CATT is not secure
Double-ownership buffers between kernel and user space
CATT is not practical
Android requires as many domains as installed apps
Severe performance penalty for low-memory devices<br>
slide29. Rowhammer Defenses on ARM Android ION patches (1/2)
Disable the contiguous (kmalloc) heap
Reduce ION internal pool sizes to at most 64 KB (equal the rowsize)
No longer guaranteed to get large contiguous chunks
Complicates scanning for bit flips
Complicates memory massaging
Practical, but not secure<br>
slide30. Rowhammer Defenses on ARM Android ION patches (2/2)
Better separation of highmem / lowmem
Get ION allocations (highmem) away from page tables (lowmem)
Practical, but not secure<br>
slide31. RAMPAGE<br>
slide32. Rampage: Rowhammer on Android Oreo 1. Contiguous memory with the ION system heap (vmalloc)
Allocate and free ION chunks (defragmentation)
(many) Multiple consecutive 64 KB requests
Timing side-channel (bank conflicts) to verify
2. Getting allocations in lowmem
Deplete highmem by using mmap
Monitor procfs/pagetypeinfo or procfs/zoneinfo to verify<br>
slide33. Rampage Variants App-to-App attacks
ION-to-ION
CMA-to-CMA
CMA-to-system
Privilege escalation (Drammer++)
PoC on LG G4: 64-bit device running Android 7.1<br>
slide34. GUARDION<br>
slide35. GuardION Fine grained memory isolation for DMA buffers
Focus on Android/ARM
Cache-eviction based Rowhammer is impossible
Allocate physical guard rows for each DMA allocation<br>
slide36. Request 1<br>
slide37. Request 1<br>
slide38. Guard row Guard row Request 1 Request 2<br>
slide39. Guard row Guard row Request 2 Request 1<br>
slide40. Guard row Guard row Request 2 Guard row Page Table Request 1<br>
slide41. Guard row Guard row Guard row Page Table Request 1 Request 2<br>
slide42. GuardION Fine grained memory isolation for DMA buffers
Focus on Android/ARM
Cache-eviction based Rowhammer is impossible
Allocate two physical guard rows for each DMA allocation
Memory overhead
At most 128 KB for each allocation
Only for uncached pages
Not many DMA allocations in practice<br>
slide43. GuardION Performance overhead
With GuardION, we can re-enable large ION pools
No need for many small allocations, just a single large one
Performance increase!
Implementation:
Protection for three heaps: system | CMA | contiguous
422 lines in 5 files for 3 heaps<br>
slide44. Benchmark apps found in Google Play Basemark OS II Comparison BenchmarkAndroid Billion Counter Bonsai Graphics H264 HardBench Kassja KFS LukaLukaBench NextMark OESK OMEGA Phone Benchmark Pi Benchmark Real Benchmark Relative Benchmark RinRinBench SQLite Unity Bench GuardION Memory FootprintMemory overhead in MB<br>
slide45. GuardION Performance OverheadRelative performance (%) (higher is better) Benchmark apps found in Google Play Performance increase of 5.8% (geometric mean)<br>
slide46. CONCLUSION<br>
slide47. Disclosure to Google CVE 2018-9442
The benchmark code provided has much larger allocation sizes than those observed in real-world tests that we have conducted … performance impact is much greater than what is cited from your benchmark
This is not good enough (yet)
Looking forward to improve GuardION memory footprint<br>
slide48. Conclusion Rowhammer in 2018
Overview of defenses – still no working solution
​RAMPAGE – Rowhammer attacks on recent Android devices
​GuardION – Lightweight mitigation by isolating DMA buffers
Future research
Real-world benchmarks for Android
Large-scale analysis on vulnerability of devices http://rampageattack.com https://github.com/vusec/guardion<br>