to gain kernel privileges
play

to gain kernel privileges Writer : MARK SEABORN @GOOGLE Presenter - PowerPoint PPT Presentation

Exploiting the DRAM row hammer bug to gain kernel privileges Writer : MARK SEABORN @GOOGLE Presenter : Jiwon Choi Introduction Exploit ! without exploiting software bug Row hammer repeated accesses DRAMs row DRAM chipset DRAM


  1. Exploiting the DRAM row hammer bug to gain kernel privileges Writer : MARK SEABORN @GOOGLE Presenter : Jiwon Choi

  2. Introduction Exploit ! … without exploiting software bug

  3. Row hammer repeated accesses DRAM’s row DRAM chipset

  4. DRAM Structure DRAM chipset

  5. DRAM Structure DRAM chipset Rank Rank Rank Rank (Diagram from ARMOR project, University of Manchester)

  6. DRAM Structure Bank Rank ex) 4GB memory = 2ranks * 8 banks *8K per row * 32768 rows

  7. 01 DRAM ? Dynamic RAM !

  8. DRAM is really dynamic!

  9. X O

  10. DRAM row buffer Row buffer

  11. DRAM row buffer Row buffer

  12. Open - raise wordlin line to high voltage Row buffer

  13. Open - raise wordline to high voltage - Connecting capacitor to bitl bitlin ine Row buffer

  14. Open - raise wordline to high voltage - Connecting capacitor to bitline Row buffer - Access to row buffer are fast

  15. Open - raise wordline to high voltage - Connecting capacitor to bitline Row buffer - Access to row buffer are fast

  16. Open - raise wordline to high voltage - Connecting capacitor to bitline - DRO (Destructive Read Out) Row buffer - Access to row buffer are fast

  17. Recharge - Copy the row back Row buffer

  18. Cells are capacitor! - They leak charge - Cells should be periodically refreshed - Refresh circuitry perform refresh cycle within the refresh time interval : 64m 64ms

  19. 02 Introduction to rowhammer problems

  20. Introduction to rowhammer problems

  21. This “ aggressor ” row is repeatedly activated (hammered)

  22. This “ aggressor ” row is repeatedly activated (hammered) OPEN (voltage raise)

  23. This “ aggressor ” row is repeatedly activated (hammered)

  24. This “ aggressor ” row is repeatedly activated (hammered) OPEN (voltage raise) Result : These “ victim ” rows get bit flips

  25. Bad Cells Randomly distributed • Constantly flip when hammered • varies by DRAM module • - % of rows with bad cells : Varies from 30% to 99.9%

  26. 03 Understand bit flipping by looking hammering code !

  27. Challenge 1. Right way to flip bit. ① ? ② ? Challenge 2. How to find pair of rows? CPU Bank 0 Bank 7

  28. Challenge 1. Right way to flip bit. ① ? ② ? Challenge 2. How to find pair of rows? CPU Bank 0 Bank 7

  29. Challenge 1. Right way to flip bit. ① ? ② ? Challenge 2. How to find pair of rows? CPU Bank 0 Bank 7

  30. Challenge 1. Right way to flip bit. ① ? ② ? Challenge 2. How to find pair of rows? CPU Bank 0 Bank 7

  31. Challenge 1. Right way to flip bit. ① ? ② ? Challenge 2. How to find pair of rows? CPU Bank 0 Bank 7

  32. Challenge 1. Right way to flip bit. ① ? ② ? Challenge 2. How to find pair of rows? CPU Bank 0 Bank 7

  33. Challenge 1. Right way to flip bit. ① ? ② ? Challenge 2. How to find pair of rows? CPU Random pick = 1/8 Bank 0 Bank 7

  34. Bit flip code: 1. OPEN – CLOSE rows repeatedly pick 2 addresses : Same Bank Different Rows (SBDR) 2. CPU cache by clflush Bank 0 Bank 7

  35. Bit flip code: 1. OPEN – CLOSE rows repeatedly pick 2 addresses : Same Bank Different Rows (SBDR) 2. CPU cache by clflush expect flip hammer Victim Row expect flip expect flip hammer expect flip Bank 0 Bank 7

  36. 04 How to Exploit a bit flip 1. Native Client Sandbox 2. Linux Kernel

  37. 04 How to Exploit a bit flip 1. Native Client Sandbox 2. Linux Kernel

  38. Native Client Sandbox ✓ Sandbox for running C/C++ “native code” on the web ✓ Used in chrome ✓ Goal : make C/C++ code as safe as javascript ✓ In-process sandbox - Can’t call host OS’s syscalls

  39. Native Client Sandbox ✓ Sandbox for running C/C++ “native code” on the web ✓ Used in chrome ✓ Goal : make C/C++ code as safe as javascript Sandbox ✓ In-process sandbox escape ! - Can’t call host OS’s syscalls

  40. Challenges 1. Mark shellcode as executable 2. Jump to shellcode

  41. Challenges 1. Mark shellcode as executable 2. Jump to shellcode } Allowed by NaCl’s validater This conceals:

  42. Challenges 1. Mark shellcode as executable 2. Jump to shellcode Only allows “ jmp *%rax ” as part of this safe indirect jump sequence: 4c 01 f8 ff e0 Spray Sandbox’s dynamic code area

  43. 04 How to Exploit a bit flip 1. Native Client Sandbox 2. Linux Kernel

  44. normal Linux process 1. Spray most of physical memory with page tables 2. Bit flip! Kernel privilege escalation

  45. Linux kernel exploit

  46. RW = 1 Create shared memory

  47. RW = 1

  48. 1. mmap() data file repeatedly 2. Spray memory page table Map it multiple times

  49. 1. mmap() data file repeatedly 2. Spray memory page table

  50. Row hammering

  51. Got write access to page table! Bit flipped in PTE RW = 1

  52. Got write access to page table! Overwrite entry point of SUID-root executable (e.g. /bin/ping) to shell code Privilege escalation !

  53. 05 Experimental results

  54. 15/29 Machines were vulnerable …

  55. 06 Rowhammer defenses

  56. Rowhammer detection Software binary analysis •

  57. Rowhammer detection Software binary analysis • Rowhammer neutralization *G-CATT • ✓ Isolate user space / kernel space in physical memory ✓ attacker cannot exploit bit flips in kernel memory * “CAn’t Touch This: Software-only Mitigation against Rowhammer Attacks targeting Kernel Memory”, F.Brasser et al. (2017.08)

  58. Rowhammer detection Software binary analysis • Rowhammer neutralization *G-CATT • ✓ Isolate user space / kernel space in physical memory ✓ attacker cannot exploit bit flips in kernel memory Rowhammer elimination TRR (Target Row Refresh) : Identify frequently accessed DRAM addresses • tREFI (time of REfresh Interval) • e.g. Intel Skylake, Kaby lake ECC memory (Error Correcting Code) • * “CAn’t Touch This: Software-only Mitigation against Rowhammer Attacks targeting Kernel Memory”, F.Brasser et al. (2017.08)

  59. Rowhammer detection Software binary analysis • Rowhammer neutralization *G-CATT • ✓ Isolate user space / kernel space in physical memory ✓ attacker cannot exploit bit flips in kernel memory Rowhammer elimination TRR (Target Row Refresh) : Identify frequently accessed DRAM addresses • tREFI (time of REfresh Interval) • e.g. Intel Skylake, Kaby lake ECC memory (Error Correcting Code) • * https://www.extremetech.com/extreme/224860-new-paper-alleges-servers-some-ddr4-dram-still-vulnerable-to-critical-rowhammer-attack ** https://arstechnica.com/information-technology/2016/03/once-thought-safe-ddr4-memory-shown-to-be-vulnerable-to-rowhammer/

  60. 07 Conclusion & Recent study

  61. (2015.03) (2014.07) (2017.08) (2017.10) Another Flip in the Wall of Rowhammer Defenses - Daniel Gruss et el. Rowhammer attack on flash memory - IBM Exploiting the DRAM rowhammer bug to gain kernel privileges - Google project zero Flipping Bits in Memory Without Accessing Them - Yoongu Kim (CMU) el al.

  62. (2015.03) (2014.07) (2017.08) (2017.10) Another Flip in the Wall of Rowhammer Defenses - Daniel Gruss et el. Rowhammer attack on flash memory - IBM Exploiting the DRAM rowhammer bug to gain kernel privileges - Google project zero Flipping Bits in Memory Without Accessing Them - Yoongu Kim (CMU) el al.

  63. (2015.03) (2014.07) (2017.08) (2017.10) Another Flip in the Wall of Rowhammer Defenses - Daniel Gruss et el. Rowhammer attack on flash memory - IBM Exploiting the DRAM rowhammer bug to gain kernel privileges - Google project zero Flipping Bits in Memory Without Accessing Them - Yoongu Kim (CMU) el al.

  64. (2015.03) (2014.07) (2017.08) (2017.10) Another Flip in the Wall of Rowhammer Defenses - Daniel Gruss et el. Rowhammer attack on flash memory - IBM Exploiting the DRAM rowhammer bug to gain kernel privileges - Google project zero Flipping Bits in Memory Without Accessing Them - Yoongu Kim (CMU) el al.

  65. (2015.03) (2014.07) (2017.08) (2017.10) Another Flip in the Wall of Rowhammer Defenses - Daniel Gruss et el. ▲ Ordinary rowhammer ▲ One-location hammering

  66. 08 Future work

  67. It might be a good mitigation … - Arrange Refresh-only row buffer

  68. It might be a good mitigation … - Arrange Refresh-only row buffer Refresh-only row buffer Row buffer

  69. It might be a good mitigation … - Arrange Refresh-only row buffer Refresh-only row buffer Refresh Row buffer

  70. It might be a good mitigation … - Arrange Refresh-only row buffer Refresh-only row buffer ▲ Ordinary rowhammer ▲ One-location hammering

  71. Q/A

  72. THANK YOU

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend