how to make aslr win the clone wars runtime re
play

How to Make ASLR Win the Clone Wars: Runtime Re-Randomization - PowerPoint PPT Presentation

How to Make ASLR Win the Clone Wars: Runtime Re-Randomization Kangjie Lu , Stefan Nrnberger, Michael Backes, and Wenke Lee Georgia Tech, CISPA, Saarland University, MPI-SWS, DFKI RuntimeASLR 1 What did we do? We re-randomize the memory


  1. How to Make ASLR Win the Clone Wars: Runtime Re-Randomization Kangjie Lu , Stefan Nürnberger, Michael Backes, and Wenke Lee Georgia Tech, CISPA, Saarland University, MPI-SWS, DFKI RuntimeASLR 1

  2. What did we do? • We re-randomize the memory layout of the cloned ( i.e. , forked) processes at runtime fork() Parent Child code data code data RuntimeASLR 2

  3. In this talk, I will explain… • Why we need to re-randomize cloned processes? – To prevent clone-probing attacks • How to re-randomize them? – A semantic-preserving and runtime-based approach • What are the results? – Defeated clone-probing, e.g., Blind ROP attack – No performance overhead to cloned processes RuntimeASLR 3

  4. Background - ASLR • Address Space Layout Randomization (ASLR) – Mitigating code reuses attacks, privilege escalation, and information leaks Run 1 Run 2 Run 3 code data code code data data RuntimeASLR 4

  5. Background - ASLR • Address Space Layout Randomization (ASLR) – Mitigating code reuses attacks, privilege escalation, and information leaks Run 1 Run 2 Run 3 code data code code data data – One time, per-process, load-time RuntimeASLR 5

  6. Background – Daemon Servers • Web services are powered by daemon servers, e.g., Nginx web server RuntimeASLR 6

  7. Designs of Daemon Server Worker processes (with same layout) Worker code Daemon process data HTTP/HTTPS fork() Master code Worker fork() code data HTTP/HTTPS data fork() Worker code data HTTP/HTTPS 1) The daemon process pre-forks multiple worker processes that handle users requests RuntimeASLR 7

  8. Designs of Daemon Server Worker processes (with same layout) Worker code Daemon process data HTTP/HTTPS fork() Master code Worker fork() code data HTTP/HTTPS data fork() Worker code data HTTP/HTTPS 1) The daemon process pre-forks multiple worker processes that handle users requests 2) The daemon will re-fork a new worker process if it crashes, to be robust RuntimeASLR 8

  9. Designs of Daemon Server Worker processes (with same layout) Worker code Daemon process data HTTP/HTTPS fork() Master code Worker fork() code data HTTP/HTTPS All forked worker processes share the same data fork() memory layout as the daemon process Worker code data HTTP/HTTPS 1) The daemon process pre-forks multiple worker processes that handle users requests 2) The daemon will re-fork a new worker process if it crashes, to be robust RuntimeASLR 9

  10. When ASLR meets daemon servers… RuntimeASLR 10

  11. Clone-Probing Attack • Attack goal: guess the randomized address (e.g., return address), say a web server with a stack buffer overflow vulnerability Stack in remote server return address buffer 12 34 56 78 9a bc ed f0 RuntimeASLR 11

  12. Clone-Probing Attack • Attack goal: guess the randomized address (e.g., return address), say a web server with a stack buffer overflow vulnerability Stack in remote server return address buffer 12 34 56 78 9a bc ed f0 Crash, try another one AAAAAAA 00 34 56 78 9a bc ed f0 Attack payload RuntimeASLR 12

  13. Clone-Probing Attack • Attack goal: guess the randomized address (e.g., return address), say a web server with a stack buffer overflow vulnerability Stack in remote server return address buffer 12 34 56 78 9a bc ed f0 Crash, try another one AAAAAAA 00 34 56 78 9a bc ed f0 Attack AAAAAAA 01 34 56 78 9a bc ed f0 Crash, try another one payload RuntimeASLR 13

  14. Clone-Probing Attack • Attack goal: guess the randomized address (e.g., return address), say a web server with a stack buffer overflow vulnerability Stack in remote server return address buffer 12 34 56 78 9a bc ed f0 Crash, try another one AAAAAAA 00 34 56 78 9a bc ed f0 Attack AAAAAAA 01 34 56 78 9a bc ed f0 Crash, try another one payload … … Bingo, continue to AAAAAAA 12 34 56 78 9a bc ed f0 guess next byte RuntimeASLR 14

  15. Clone-Probing Attack • Attack goal: guess the randomized address (e.g., return address), say a web server with a stack buffer overflow vulnerability Stack in remote server return address buffer 12 34 56 78 9a bc ed f0 Crash, try another one AAAAAAA 00 34 56 78 9a bc ed f0 Attack AAAAAAA 01 34 56 78 9a bc ed f0 Crash, try another one payload … … Bingo, continue to AAAAAAA 12 34 56 78 9a bc ed f0 guess next byte … … … AAAAAAA 12 00 56 78 9a bc ed f0 RuntimeASLR 15

  16. Clone-Probing Attack • Attack goal: guess the randomized address (e.g., return address), say a web server with a stack buffer overflow vulnerability Stack in remote server return address buffer 12 34 56 78 9a bc ed f0 Crash, try another one AAAAAAA 00 34 56 78 9a bc ed f0 Attack AAAAAAA 01 34 56 78 9a bc ed f0 Crash, try another one payload … … Bingo, continue to AAAAAAA 12 34 56 78 9a bc ed f0 guess next byte … … … AAAAAAA 12 00 56 78 9a bc ed f0 … … Finally, get all bytes AAAAAAA 12 34 56 78 9a bc ed f0 RuntimeASLR 16

  17. Clone-Probing Attack • Attack goal: guess the randomized address (e.g., return address), say a web server with a stack buffer overflow vulnerability Stack in remote server return address Brute-forcing complexity is reduced from 2 64 to 8*2 8 buffer 12 34 56 78 9a bc ed f0 (From thousands of years to 2 minutes J ) Crash, try another one AAAAAAA 00 34 56 78 9a bc ed f0 Attack AAAAAAA 01 34 56 78 9a bc ed f0 Crash, try another one payload … … Bingo, continue to AAAAAAA 12 34 56 78 9a bc ed f0 guess next byte … … … AAAAAAA 12 00 56 78 9a bc ed f0 … … Finally, get all bytes AAAAAAA 12 34 56 78 9a bc ed f0 RuntimeASLR 17

  18. This Attack is Critical! A simple buffer overflow à bypass ASLR (two minutes) à control daemon server L RuntimeASLR 18

  19. Preventing clone-probing with RuntimeASLR Solution: re-randomizing the memory layout of cloned processes RuntimeASLR 19

  20. Challenge • Remapping memory à dangling pointers • How to track all pointers on the fly and update them? – Accuracy – Efficiency RuntimeASLR 20

  21. Pointer Tracking Problem • Treat it as a taint tracking problem Pointer All Source tracking tracked pointers policy pointers RuntimeASLR 21

  22. Source Pointers Pointer All Source tracking tracked pointers policy pointers • Kernel routinely loads program – Easy to find source pointers • Only in stack and registers RuntimeASLR 22

  23. Pointer Tracking Policy Pointer All Source tracking tracked pointers policy pointers RuntimeASLR 23

  24. Pointer Tracking Policy Pointer All Source tracking tracked pointers policy pointers • Read 1,513- pages Intel ISA manual and manually define them?? RuntimeASLR 24

  25. Automatic Tracking Policy Generation • Automatically identifying instructions behaviors Execution snapshot Process Memory and registers status Instruction instruction behaviors snapshot Process compare status • This way, we know if it generates or destroys some “values” RuntimeASLR 25

  26. How to Determine a Pointer? • Without type info, how do we know if a value is a pointer? • Example: mov rdi, rsp – Before: rsp =0xcafebabe, and know it is a pointer – After: rdi =0xcafebabe, memory is unchanged – How to know if rdi is a pointer? RuntimeASLR 26

  27. Multi-Run Pointer Verification • Observation: rdi is likely a pointer if it points to mapped memory on 64-bits platform, why? • Run program n times with ASLR, if rdi always points to mapped memory, rdi is more and more likely a pointer – Mapping n runs with instruction execution sequence rdi Multi-runs with … ASLR-enabled Run n Run 1 Run 2 RuntimeASLR

  28. Accuracy of Multi-Run Verification • Assume size of mapped memory is b bytes, run n times on 64-bits platform, false positive rate for one value is: n b . . b b 2 -64 n P fpr 2 64 2 64 RuntimeASLR 28

  29. Accuracy of Multi-Run Verification • Assume size of mapped memory is b bytes, run n times on 64-bits platform, false positive rate for one value is: n b . . b b 2 -64 n P fpr 2 64 2 64 • Say b is 22MB (Nginx) and run 2 times. This will result in FPR=2 −103 RuntimeASLR 29

  30. Export Policy • Given mov reg1, reg2 – if reg2 is a 64-bits register and tainted (i.e., a pointer) à taint reg1 after execution RuntimeASLR 30

  31. Track All Pointers Pointer All Source tracking tracked pointers policy pointers RuntimeASLR 31

  32. Implementation • Intel’s PIN—a dynamic instrumentation tool • Three modules Policy Pointer Randomizer generator tracker (shared lib) (pintool) (pintool) • Source code – Coming soon RuntimeASLR 32

  33. Evaluation • Correctness – Applied to Nginx web server – Memory snapshot analysis to find all pointers – RuntimeASLR correctly finds all pointers RuntimeASLR 33

  34. Evaluation • Security – Blind ROP is a clone-probing attack – Addresses of all modules are re-randomized – RuntimeASLR successfully defeats it Without RuntimeASLR With RuntimeASLR RuntimeASLR 34

  35. Evaluation • Performance – Pointer tracking is extremely expensive: >10,000 times on SPEC CPU2006 • One time overhead at startup; 35 seconds for Nginx – However, no overhead on cloned worker processes RuntimeASLR 35

  36. Discussions and Limitations • Ambiguous policy • Completeness of tracking policy • Applicability for general programs • Supporting pointer obfuscation RuntimeASLR 36

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