prac l control flow integrity randomiza on for binary
play

Prac%cal Control Flow Integrity & Randomiza%on for Binary - PowerPoint PPT Presentation

Title Prac%cal Control Flow Integrity & Randomiza%on for Binary Executables Lei Duan Chao Zhang Tao Wei Zhaofeng Chen Peking University Peking University Peking University Peking University UC


  1. Title ¡ Prac%cal ¡Control ¡Flow ¡Integrity ¡& ¡ Randomiza%on ¡for ¡Binary ¡Executables Lei Duan Chao Zhang Tao Wei Zhaofeng Chen Peking University Peking University Peking University Peking University ¡ UC Berkeley Wei Zou László Szekeres Stephen McCamant Dawn Song Peking University Stony Brook University University of Minnesota UC Berkeley

  2. Title ¡ Eternal ¡War ¡in ¡Memory ¡( Oakland’13 ) buffer ¡overflow ¡... code ¡injec%on A ¡ D ¡ W ¡ ⊗ X t ¡ e ¡ ret2libc, ¡ ¡ROP t ¡ f ¡ code ¡re-­‑use a ¡ e ¡ ASLR c ¡ n ¡ k ¡ d ¡ e ¡ Info ¡Leakage e ¡ r r ... ? chao.100871.net 2

  3. Title ¡ Reac%ve ¡Defense ¡is ¡not ¡adequate § > ¡5,000 ¡CVE ¡vulnerabili%es ¡each ¡year. ¡ • Many ¡more ¡are ¡under ¡the ¡iceberg. ¡ § Vulnerabili%es ¡are ¡exploited ¡millions ¡of ¡%mes. #cve ¡ 7,000 ¡ 6,000 ¡ 5,000 ¡ 4,000 ¡ 3,000 ¡ 2,000 ¡ 1,000 ¡ 0 ¡ 2006 ¡ 2007 ¡ 2008 ¡ 2009 ¡ 2010 ¡ 2011 ¡ 2012 ¡ Symantec ¡Internet ¡Security ¡Threat ¡Report chao.100871.net 3

  4. Title ¡ Proac%ve ¡Defense: ¡Control ¡Flow ¡Integrity § Control ¡Flow ¡Integrity, ¡CFI ¡[CCS’05] ¡ § Security ¡policy ¡ • Each ¡run-­‑%me ¡control ¡transfer ¡must ¡comply ¡with ¡programmer’s ¡ compile-­‑%me ¡intent, ¡i.e., ¡the ¡control-­‑flow ¡graph ¡ ¡ § A ¡strong ¡guarantee ¡that ¡can ¡be ¡reasoned ¡about ¡formally ¡ • ROP, ¡JOP, ¡UAF ¡ § A ¡founda%on ¡for ¡other ¡low-­‑level ¡code ¡defenses ¡ • SFI, ¡sandboxing ¡untrusted ¡code ¡ § Determinis%c, ¡not ¡probabilis%c ¡defense ¡ chao.100871.net 4

  5. Title ¡ Control-­‑Flow ¡Graph ¡ § condi%onal ¡jump ¡(jz ¡…): ¡target ¡rela%ve ¡address ¡ § direct ¡jump/call: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡target ¡rela%ve ¡or ¡absolute ¡address ¡ § indirect ¡jump/call: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡target? ¡(read ¡or ¡computed ¡from ¡memory) ¡ § return: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡target ¡return ¡address ¡on ¡the ¡stack ¡ chao.100871.net 5

  6. Title ¡ Scope ¡of ¡Control-­‑Flow ¡Integrity ¡Protec%on Control ¡Transfer ¡Method Transfer ¡Targets Integrity ¡ Protec8on Excep%ons Excep%on ¡handlers SafeSEH, ¡ ¡SEHOP W ⊗ X Direct ¡CALL/JMP, ¡ Hard-­‑coded ¡func%on ¡pointers ¡ Condi%onal ¡jump ¡(JZ...) (embedded ¡in ¡the ¡code) Indirect ¡CALL/JMP In-­‑memory ¡func%on ¡pointers CFI RET ¡instruc%ons On-­‑stack ¡return ¡addresses /GS, ¡shadow ¡stack, ¡ CFI chao.100871.net 6

  7. Title ¡ Control ¡Flow ¡Integrity ¡(CCS’05) § build ¡Control ¡Flow ¡Graph ¡ foo: • source ¡code/debug ¡info ¡ ¡... ¡... • all ¡modules ¡ret ¡call ¡eax next_1: bar: ¡... ¡... ¡ret ¡call ¡ecx next_2: fun: ¡... ¡ret chao.100871.net 7

  8. Title ¡ Control ¡Flow ¡Integrity ¡(CCS’05) § build ¡Control ¡Flow ¡Graph ¡ foo: ID_1 § binary ¡rewri%ng ¡ ¡... ¡... • instrument ¡IDs ¡before ¡ ¡ret check ¡ID_1 transfer ¡targets ¡ ¡call ¡eax next_1: • validate ¡IDs ¡before ¡control ¡ bar: transferring ¡ ¡... ¡... ¡ret ¡call ¡ecx next_2: fun: ¡... ¡ret chao.100871.net 8

  9. Title ¡ Control ¡Flow ¡Integrity ¡(CCS’05) § build ¡Control ¡Flow ¡Graph ¡ foo: ID_1 § binary ¡rewri%ng ¡ ¡... ¡... ¡ret check ¡ID_1 ¡call ¡eax § diversity ¡of ¡IDs ¡ next_1: bar: ID_1 ¡... ¡... check ¡ID_1 ¡ret ¡call ¡ecx next_2: fun: ID_1 ¡... ¡ret chao.100871.net 9

  10. Title ¡ Control ¡Flow ¡Integrity ¡(CCS’05) § build ¡Control ¡Flow ¡Graph ¡ foo: ID_1 § binary ¡rewri%ng ¡ ¡... ¡... check ¡ID_2 ¡ret check ¡ID_1 ¡call ¡eax § diversity ¡of ¡IDs ¡ ID_2 next_1: bar: ID_1 ¡... ¡... § all ¡indirect ¡transfers ¡ check ¡ID_2 check ¡ID_1 ¡ret ¡call ¡ecx • indirect ¡call ¡ ID_2 next_2: • indirect ¡jmp ¡ fun: • ret ¡ ID_1 ¡... check ¡ID_2 ¡ret chao.100871.net 10

  11. Title ¡ Challenges ¡faced ¡by ¡CFI § performance ¡overhead: ¡average ¡15%, ¡max ¡46% ¡ ¡ Ø ID ¡is ¡embedded ¡in ¡a ¡slow ¡ ¡... prefetchnta ¡instruc%on ¡ check ¡ID_1 Ø executed ¡each ¡%me ¡the ¡transfer ¡ ¡call ¡eax foo: target ¡is ¡reached ¡ next_1: ID_1 ¡... ¡ret ¡... Ø introduce ¡overhead ¡even ¡if ¡ foo ¡ ¡call ¡foo is ¡called/jumped ¡to ¡directly ¡ ü most ¡calls/jumps ¡are ¡direct ¡ chao.100871.net 11

  12. Title ¡ Challenges ¡faced ¡by ¡CFI § performance ¡overhead ¡ § modularity ¡support ¡ • A ¡single ¡module ¡cannot ¡be ¡hardened ¡independently module_A libc ¡... ¡call ¡printf ID_A printf: ¡... check ¡which ¡ID? module_B ¡ret ¡... ¡call ¡printf ID_B chao.100871.net 12

  13. Title ¡ Challenges ¡faced ¡by ¡CFI § performance ¡overhead ¡ § modularity ¡support ¡ § backward ¡compa%bility ¡ unhardened module hardened module foo: ID_1 ¡... ¡... check ¡ID_1 ¡ret ¡call ¡eax test: next_1: ¡... bar: ¡ret ID_1 ¡... ¡ret chao.100871.net 13

  14. Title ¡ Challenges ¡faced ¡by ¡CFI § performance ¡overhead ¡ § modularity ¡support ¡ § backward ¡compa%bility ¡ § source ¡code/debug ¡info ¡dependency ¡ • to ¡build ¡Control ¡Flow ¡Graph ¡ chao.100871.net 14

  15. Title ¡ Mo%va%on § A ¡light-­‑weight ¡CFI ¡solu%on ¡with ¡a ¡strong ¡protec%on ¡ ·√ ¡ performance ¡overhead ·√ ¡ modularity ¡support ·√ ¡ backward ¡compatibility ·√ ¡ source ¡code ¡independent chao.100871.net 15

  16. Title ¡ Assump%on § ASLR ¡and ¡W ⊗X (e.g. DEP) are deployed § NO self-modifying code or dynamically generated code. § Limited ¡informa%on ¡disclosure ¡vulnerabili%es ¡ • e.g., ¡cannot ¡read ¡en%re ¡memory ¡regions ¡ chao.100871.net 16

  17. Title ¡ Outline § Mo%va%on ¡ § Intui%on ¡& ¡Design ¡ § Implementa%on ¡ § Security ¡Enhancement ¡ § Evalua%on ¡ § Conclusion chao.100871.net 17

  18. Title ¡ Intui%on § Checking ¡transfer ¡targets’ ¡kind, ¡rather ¡than ¡IDs ¡ • indirect ¡call/jmp ¡can ¡only ¡transfer ¡to ¡func%on-­‑pointer ¡stubs ¡ • returns ¡can ¡only ¡transfer ¡to ¡return-­‑address ¡stubs chao.100871.net 18

  19. Title ¡ Intui%on: ¡efficient ¡check § memory ¡alignment ¡ • func%on ¡pointer ¡stubs ¡are ¡8-­‑bytes ¡aligned ¡ • return ¡address ¡stubs ¡are ¡16-­‑bytes ¡aligned ¡ foo: ¡... ¡... test ¡[esp],0x0f ¡ret test ¡eax,7 § fast ¡bit ¡tes%ng ¡ ¡call ¡eax next_1: ·√ ¡ performance ¡overhead bar: § No ¡IDs ¡ ¡... test ¡[esp],0x0f ¡ret ·√ ¡ performance ¡overhead ¡... § only ¡check ¡type ¡ fun: test ¡ecx,7 ¡call ¡ecx ¡... ·√ ¡ modularity ¡support test ¡[esp],0x0f next_2: ¡ret chao.100871.net 19

  20. Title ¡ Intui%on: ¡security § Transfer ¡targets ¡must ¡be ¡within ¡memory ¡region ¡Springboard ¡ • 27 th ¡bit ¡is ¡0 ¡ foo: ¡... ¡... test ¡[esp],M_R ¡ ¡ret test ¡eax,M_F ¡call ¡eax next_1: bar: ¡... test ¡[esp],M_R ¡ret ¡... fun: test ¡ecx,M_F ¡... ¡call ¡ecx test ¡[esp],M_R next_2: ¡ret ¡ M_F ¡= ¡0x 8000007 M_R ¡= ¡0x 800000f ¡ § Policy: ¡all ¡indirect ¡transfer ¡targets ¡must ¡be ¡aligned ¡stubs ¡in ¡Springboard. chao.100871.net 20

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