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
"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
01
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>
02
Takeaway Overview of Rowhammer defenses
RAMPAGERowhammer attacks against the latest Android OS
GuardION Lightweight mitigation<br>
03
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>
04
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>
05
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>
06
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>
07
Overview of Defenses<br>
08
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>
09
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>
10
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>
11
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>
12
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>
13
USER-SPACE<br>
14
KERNEL MEMORY USER-SPACE Page tables Empty row ION allocations<br>
15
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>
16
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>
17
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>
18
RAMPAGE<br>
19
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>
Privilege escalation (Drammer++)
PoC on LG G4: 64-bit device running Android 7.1<br>
21
GUARDION<br>
22
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>
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>
30
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>
31
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>
32
GuardION Performance OverheadRelative performance (%) (higher is better) Benchmark apps found in Google Play Performance increase of 5.8% (geometric mean)<br>
33
CONCLUSION<br>
34
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>
35
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>