aslr guard
play

ASLR-Guard: Stopping Address Space Leakage for Code Reuse - PowerPoint PPT Presentation

ASLR-Guard: Stopping Address Space Leakage for Code Reuse A9acks Kangjie Lu, Chengyu Song, Byoungyoung Lee, Simon P. Chung, Taesoo Kim, Wenke Lee


  1. ASLR-­‑Guard: ¡ Stopping ¡Address ¡Space ¡Leakage ¡for ¡Code ¡Reuse ¡A9acks ¡ Kangjie ¡Lu, ¡Chengyu ¡Song, ¡Byoungyoung ¡Lee, ¡Simon ¡P. ¡Chung, ¡ Taesoo ¡Kim, ¡Wenke ¡Lee ¡ School ¡of ¡Computer ¡Science ¡ Georgia ¡Tech ¡ ASLR-­‑Guard ¡

  2. Code ¡Reuse ¡A9ack ¡ • Circumvent ¡DEP ¡or ¡W^X ¡ – Code ¡reuse ¡is ¡usually ¡the ¡only ¡way ¡to ¡launch ¡ “remote ¡code ¡execuNon” ¡a9acks ¡ – It ¡is ¡prevalent ¡in ¡real ¡world ¡ ASLR-­‑Guard ¡

  3. Code ¡Reuse ¡A9ack ¡ • Circumvent ¡DEP ¡or ¡W^X ¡ – Code ¡reuse ¡is ¡usually ¡the ¡only ¡way ¡to ¡launch ¡ “remote ¡execuNon” ¡a9acks ¡ – It ¡is ¡prevalent ¡in ¡real ¡world ¡ Servers ¡ Browsers ¡ Kernels ¡ A9ackers ¡ ASLR-­‑Guard ¡

  4. A ¡Code ¡Reuse ¡Example ¡ Stack ¡ Low ¡address ¡ Vuln ¡ buffer ¡ Ret ¡addr ¡ params ¡ ASLR-­‑Guard ¡

  5. A ¡Code ¡Reuse ¡Example ¡ Stack ¡ Low ¡address ¡ Filled ¡ buffer ¡ Original ¡ system() ¡ ret ¡address ¡ exit() ¡ “/bin/sh” ¡ ASLR-­‑Guard ¡

  6. A ¡Code ¡Reuse ¡Example ¡ Stack ¡ Loaded ¡libraries ¡ Low ¡address ¡ ... ¡ Filled ¡ buffer ¡ Libc.so ¡ ¡ ¡ Original ¡ system() ¡ ¡ ¡ ret ¡address ¡ system(){ ¡} ¡ ¡ exit() ¡ “/bin/sh” ¡ ... ¡ ASLR-­‑Guard ¡

  7. Code ¡Reuse ¡A9acks ¡Becoming ¡ ¡ More ¡SophisNcated ¡ • More ¡flexible, ¡more ¡automated, ¡and ¡more ¡ difficult ¡to ¡detect ¡and ¡defend ¡against ¡ ¡ <2001 ¡ 2007 ¡ 2010 ¡ Return-­‑into-­‑libc ¡ Return-­‑oriented ¡ ¡ JOP/ROP ¡without ¡ ¡ Programming ¡ returns ¡ Control ¡Jujutsu ¡ … ¡? ¡ 2013 ¡ 2014 ¡ 2015 ¡ JIT-­‑ROP ¡ Signal ¡ROP ¡ COOP ¡ PHP ¡ROP ¡ ASLR-­‑Guard ¡

  8. It’s ¡Easy ¡to ¡Launch ¡Code ¡Reuse ¡A9acks ¡ • Two ¡typical ¡requirements ¡ 1. ¡Knowing ¡address ¡of ¡ 2. ¡OverwriNng ¡control ¡ ¡ ¡ ¡ exisNng ¡code ¡gadgets ¡ data ¡with ¡your ¡address ¡ ¡ ¡ ¡ ASLR-­‑Guard ¡

  9. It’s ¡Easy ¡to ¡Launch ¡Code ¡Reuse ¡A9acks ¡ • Two ¡typical ¡requirements ¡ 1. ¡Knowing ¡address ¡of ¡ 2. ¡OverwriNng ¡control ¡ ¡ ¡ ¡ exisNng ¡code ¡gadgets ¡ data ¡with ¡your ¡address ¡ ¡ ¡ ¡ Stackguard, ¡ Control ¡flow ¡integrity, ¡ Code ¡pointer ¡integrity ¡ … ¡ ASLR-­‑Guard ¡

  10. It’s ¡Easy ¡to ¡Launch ¡Code ¡Reuse ¡A9acks ¡ • Two ¡typical ¡requirements ¡ 1. ¡Knowing ¡address ¡of ¡ 2. ¡OverwriNng ¡control ¡ ¡ ¡ ¡ exisNng ¡code ¡gadgets ¡ data ¡with ¡your ¡address ¡ ¡ ¡ ¡ Address ¡space ¡ RandomizaNons, ¡ Re-­‑randomizaNons ¡ … ¡ ASLR-­‑Guard ¡

  11. Address ¡Space ¡Layout ¡RandomizaNon ¡ ¡ (ASLR) ¡ • Efficient, ¡deployed ¡ ¡in ¡all ¡modern ¡OS ¡ ¡ Run1 ¡ Run2 ¡ program ¡ data ¡ program ¡ data ¡ heap ¡ libs ¡ libs ¡ stack ¡ heap ¡ stack ¡ ASLR-­‑Guard ¡

  12. A ¡Fundamental ¡LimitaNon: ¡ ¡ InformaNon ¡Leak ¡ ● Code ¡pointer ¡leak ¡ à ¡infer ¡code ¡address ¡ – e.g., ¡JIT-­‑ROP, ¡Blind ¡ROP, ¡“Missing ¡the ¡point”, ¡etc. ¡ ● Such ¡bugs ¡are ¡common, ¡increasing! ¡ h9p://www.cvedetails.com/vulnerabiliNes-­‑by-­‑types.php ¡ ASLR-­‑Guard ¡

  13. A ¡Fundamental ¡LimitaNon: ¡ ¡ InformaNon ¡Leak ¡ ● Code ¡pointer ¡leak ¡ à ¡infer ¡code ¡address ¡ – e.g., ¡JIT-­‑ROP, ¡Blind ¡ROP, ¡“Missing ¡the ¡point”, ¡etc. ¡ ● Such ¡bugs ¡are ¡common, ¡increasing! ¡ Security ¡guarantee ¡of ¡ASLR ¡is ¡gone! ¡ ¡ h9p://www.cvedetails.com/vulnerabiliNes-­‑by-­‑types.php ¡ ASLR-­‑Guard ¡

  14. Research ¡Goal: ¡ to ¡prevent ¡code ¡pointer ¡leaks ¡ à ¡Reclaim ¡the ¡benefits ¡of ¡ASLR ¡ ASLR-­‑Guard ¡

  15. Challenges ¡ • Many ¡ways ¡to ¡locate ¡code ¡gadgets ¡ – Direct: ¡Return ¡addr, ¡func ¡pointer, ¡vtable, ¡etc. ¡ – Indriect: ¡jmp ¡table, ¡etc ¡ ¡ • Code ¡pointers ¡are ¡everywhere ¡ – Propagated ¡as ¡data ¡ • Performance! ¡ ASLR-­‑Guard ¡

  16. ASLR-­‑Guard ¡ An ¡extremely ¡efficient ¡scheme ¡ to ¡hide ¡or ¡obfuscate ¡code ¡pointers! ¡ ASLR-­‑Guard ¡

  17. Two ¡Main ¡ContribuNons ¡ • SystemaNc ¡way ¡to ¡discover ¡code ¡pointers ¡ – Validated ¡with ¡memory ¡snapshot ¡comparisons ¡ ¡ • Two ¡techniques ¡to ¡prevent ¡code ¡pointer ¡leaks ¡ – IsolaNon ¡ – EncrypNon ¡ ASLR-­‑Guard ¡

  18. SystemaNc ¡Code ¡Pointer ¡Discovery ¡(1) ¡ ● How ¡are ¡code ¡pointers ¡created? ¡ – By ¡relocaNon: ¡ loader ¡must ¡relocate ¡ALL ¡staNc ¡ pointers ¡ ● E.g., ¡fn ¡= ¡base ¡+ ¡offset ¡ – From ¡program ¡counter ¡(PC) ¡ ● E.g., ¡lea ¡offset(%rip), ¡%rax ¡ – From ¡OS ¡ ● E.g., ¡entry ¡point, ¡excepNon ¡handler ¡ ASLR-­‑Guard ¡

  19. SystemaNc ¡Code ¡Pointer ¡Discovery ¡(1) ¡ ● How ¡are ¡code ¡pointers ¡created? ¡ – By ¡relocaNon: ¡ loader ¡must ¡relocate ¡ALL ¡staNc ¡ pointers ¡ ● E.g., ¡fn ¡= ¡base ¡+ ¡offset ¡ – From ¡program ¡counter ¡(PC) ¡ ● E.g., ¡lea ¡offset(%rip), ¡%rax ¡ – From ¡OS ¡ How ¡to ¡completely ¡catch ¡them? ¡ ● E.g., ¡entry ¡point, ¡excepNon ¡handler ¡ ASLR-­‑Guard ¡

  20. SystemaNc ¡Code ¡Pointer ¡Discovery ¡(2) ¡ ● RelocaNon-­‑based ¡code ¡pointers ¡ → ¡Hook ¡relocaNon ¡with ¡our ¡custom ¡ loader ¡ ● PC-­‑based ¡code ¡pointers ¡ → ¡Complete ¡control ¡of ¡toolchains ¡ ¡(e.g., ¡gcc, ¡gas ¡...) ¡ ● OS-­‑injected ¡code ¡pointers ¡ → ¡ ¡Tool ¡to ¡scan ¡process ¡memory ¡ ● Data ¡pointers? ¡ → ¡They ¡are ¡safe ¡as ¡we ¡decouple ¡code ¡and ¡data ¡ ASLR-­‑Guard ¡

  21. Discovered ¡Code ¡Pointers ¡ Propagated ¡as ¡data ¡ No ¡propagaNon ¡ ¡ • Return ¡address ¡ • Base ¡address ¡ • GOTPLT ¡entry ¡ • StaNc ¡func ¡pointer ¡ • Jump ¡table ¡entry ¡ • Virtual ¡func ¡pointer ¡ • … ¡ • GetPC/GetRet ¡ • Entry ¡point ¡ • ExcepNon ¡handler ¡ • … ¡ More ¡details ¡can ¡be ¡found ¡in ¡the ¡paper ¡ ASLR-­‑Guard ¡

  22. How ¡to ¡protect ¡all ¡the ¡discovered ¡ code ¡pointers? ¡ IsolaNon ¡+ ¡EncrypNon ¡ ASLR-­‑Guard ¡

  23. Code ¡Pointer ¡IsolaNon ¡ • Code ¡pointers ¡are ¡saved ¡in ¡isolated ¡memory ¡ – a9ackers ¡cannot ¡touch ¡ • IsolaNon ¡is ¡achieved ¡by ¡randomizaNon ¡(x64) ¡ – Fact: ¡brute-­‑forcingly ¡guessing ¡the ¡randomized ¡ address ¡on ¡x64 ¡ à ¡crash ¡ – Say ¡16 ¡MB ¡memory, ¡2^28 ¡entropy ¡ • P hit ¡= ¡16M/(2^28 ¡* ¡PageSize) ¡= ¡1/32,768 ¡ • Entropy ¡can ¡be ¡extended ¡to ¡up ¡to ¡2^47 ¡ ASLR-­‑Guard ¡

  24. Code ¡Pointer ¡IsolaNon ¡ • Safe ¡vault ¡and ¡AG-­‑Stack ¡at ¡random ¡address ¡ • Reserve ¡register ¡%GS ¡and ¡%RSP ¡ AG-­‑stack ¡ ¡ Safe ¡vault ¡ Regular ¡memory ¡ (similar ¡to ¡safe-­‑stack) ¡ • GOTPLT ¡entry ¡ ¡ ¡ ¡ • Jump ¡table ¡entry ¡ • Return ¡address ¡ • Other ¡data ¡ ¡ ¡ ¡ • … ¡ %GS ¡ %RSP ¡ ASLR-­‑Guard ¡

  25. Code ¡Pointer ¡IsolaNon ¡ Propagated ¡as ¡data ¡ No ¡propagaNon ¡ ¡ • Return ¡address ¡ • Base ¡address ¡ • GOTPLT ¡entry ¡ • StaNc ¡func ¡pointer ¡ ¡ • Jump ¡table ¡entry ¡ • Virtual ¡func ¡pointer ¡ ¡ • … ¡ • GetPC/GetRet ¡ • Entry ¡point ¡ • ExcepNon ¡handler ¡ • … ¡ Isolated ¡ ASLR-­‑Guard ¡

  26. Code ¡Pointer ¡EncrypNon ¡ • When ¡isolaNon ¡is ¡not ¡sufficient ¡ – E.g., ¡propagated ¡to ¡outside ¡safe ¡vault ¡or ¡AG-­‑stack ¡ • Three ¡requirements ¡ – ConfidenNality: ¡cannot ¡crack ¡ – Integrity: ¡cannot ¡modify ¡ – Efficiency ¡ ASLR-­‑Guard ¡

  27. EncrypNon ¡Scheme ¡ void ¡hello(); ¡ Assembly: ¡ lea ¡ ¡0x1234(%rip), ¡%rax ¡ void ¡(*fn)() ¡= ¡hello; ¡ ASLR-­‑Guard ¡

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