casym cache aware symbolic execution for side channel
play

CaSym: Cache Aware Symbolic Execution for Side Channel Detection - PowerPoint PPT Presentation

CaSym: Cache Aware Symbolic Execution for Side Channel Detection and Mitigation Robert Brotzman, Shen Liu, Danfeng Zhang, Gang Tan, Mahmut Kandemir Pennsylvania State University Cache Side Channels Process Data CPU Cache Program Side


  1. CaSym: Cache Aware Symbolic Execution for Side Channel Detection and Mitigation Robert Brotzman, Shen Liu, Danfeng Zhang, Gang Tan, Mahmut Kandemir Pennsylvania State University

  2. Cache Side Channels Process Data CPU Cache Program • Side Channel • Unintentional information transfer Robert Brotzman – Pennsylvania State University 2

  3. Cache Side Channels Process Data CPU Cache Program • Side Channel • Unintentional information transfer Robert Brotzman – Pennsylvania State University 3

  4. How Severe is the Problem? • High band width attack • Work on secure enclaves • Can be launched across VM’s in the cloud Finding vulnerabilities in code is challenging! Robert Brotzman – Pennsylvania State University 4

  5. Prior Work • CacheAudit (Doychev et al. Security ‘13) • Uses abstract interpretation • Computes upper bound on leakage • Does not provide location of leakage • CacheD (Wang et al. Security ‘17) • Uses symbolic execution • Can detect where leakage happens • May miss side channels (not sound) • Requires concrete inputs • Does not provide fixes Robert Brotzman – Pennsylvania State University 5

  6. Introducing CaSym • Uses cache-aware symbolic execution • Soundly models cache side channels • Memory accesses • Branches • Detects cause of side channel • Provides simple fix mechanisms • Flexible cache models • Infinite • Age • LRU Robert Brotzman – Pennsylvania State University 6

  7. CaSym: Overview Source LLVM Clang Code IR Code Fixed Apply Mitigations Code Cache Model: Attack Model: Infinite Access Age Trace LRU Localization Report Cache Cache Model Z3 Analysis Formula Robert Brotzman – Pennsylvania State University 7

  8. Example: Square & Multiply • Does modular exponentiation • Used in asymmetric encryption • RSA, ElGamal, etc Iterates over each bit of key Localization Report 1: result = 0 ; Problem: Key Dependent Branch 2: for( int i = expLen - 1 ; i > 0 ; i --) Detected at: Line 6 3: { Key 4: result = result * result ; Witnesses: … 5: result = result % mod ; 6: if(( 1 << i ) & exp ) 7: { 8: result = base * result ; 9: result = result % mod ; 10: } Causes different 11: } observable cache states Robert Brotzman – Pennsylvania State University 8

  9. Symbolic Execution • Program variables • Treats all program variables symbolically Toy Program • Cache variables int a , b; • Creates cache variable for each program variable int PRIV key ; • Cache variables values are determined by cache model if( key == 1 ) Cache Variables { a cache a = 0 ; b cache } key cache else { b = 0 ; } Robert Brotzman – Pennsylvania State University 9

  10. Verification • Run program twice • Cache and public variables are same between runs • Sensitive variables must be different • Vulnerability reported when two different cache states are achieved = Cache Variables Cache Variables Toy Program Toy Program ≠ a cache a’ cache int a , b; int a’ , b’; b cache b’ cache int PRIV key ; int PRIV key’ ; key cache key’ cache if( key == 1 ) if( key’ == 1 ) { { a = 0 ; a’ = 0 ; } } = ≠ else Cache Variables Cache Variables else a cache a’ cache { { b cache b’ cache b = 0 ; b’ = 0 ; } } key cache key’ cache Robert Brotzman – Pennsylvania State University 10

  11. Cache Models Motivation • Cache implementations are complex • Replacement policies, hierarchies, inclusivity, etc. • Vary amongst processors Infinite Age LRU • Treats cache as an • Assigns an age to • Also assigns ages infinite set all variables to all variables • Never evicts data • Overapproximates • Youngest n from cache real replacement variables are policies cached Robert Brotzman – Pennsylvania State University 11

  12. Infinite Model Demo Abstract Abstract Cache Cache Toy Program key " 1 key " 0 Initial key " 1 int a , b; int PRIV key ; Used(key) " true Used(key) " false Used(key) " true if( key == 1 ) Used(b) " false ≠ { a = 0 ; Used(a) " false Used(a) " true Used(a) " true } else { Used(b) " false Used(b) " true b = 0 ; } Robert Brotzman – Pennsylvania State University 12

  13. Age Model Demo Used(key) " 1 Abstract Abstract Cache Cache Toy Program key " 0 key " 1 Initial key " 1 int a , b; int PRIV key ; Used(key) " 0 Used(key) " ∞ Used(key) " 1 if( key == 1 ) Used(b) " ∞ ≠ { a = 0 ; Used(a) " 0 Used(a) " ∞ Used(a) " 0 } else { Used(b) " ∞ Used(b) " 0 b = 0 ; } Robert Brotzman – Pennsylvania State University 13

  14. Improving Performance • Array reads are unconstrained • Uses taint analysis to check if read is sensitive • Reset constraints • Breaks program into smaller chunks • Recomputes sensitive variables • Useful for loops • Loop transformation • Soundly rewrite program to be loop free • Makes loop unrolling unnecessary Robert Brotzman – Pennsylvania State University 14

  15. Attack Models Access Model Set of Addresses: {&a, &b, &c, &d, &e, &f} Program access(a); access(b); access(c); access(d); access(e); access(f); Robert Brotzman – Pennsylvania State University 15

  16. Attack Models Sequence of Trace Model Addresses: [&a, &b, &c, &d, Program &e, &f] access(a); access(b); access(c); access(d); access(e); access(f); Robert Brotzman – Pennsylvania State University 16

  17. Crypto Results: Trace Infinite Age LRU (2k) Benchmarks Found Time Found Time Found Time AES libgcrypt 64 8.9 64 16.7 64 635 AES mbed TLS 17 5.9 17 17.0 17 757 Can take 3DES libgcrypt 128 62.5 128 189 128 54.3 Order of accesses is significantly more still different 3DES mbed TLS 48 27.0 48 73.2 48 803 time DES glibc 2 0.92 2 2.65 2 9.2 UFC glibc 0 0.24 0 1.27 0 5.35 Order of magnitude Finds one additional Square & Multiply 4 8.2 4 125 4 180 Most realistic model more time vulnerable location libgcrypt Square & Always Multiply 3 18.9 4 184 3 163 libgcrypt Left-to-Right Modular Exp 3 84.8 3 2618 3 6275 libgcrypt Totals 269 217.36 270 3226.82 269 8881.85 Robert Brotzman – Pennsylvania State University 17

  18. Protected Results Data cached at beginning of function Data cached throughout function Preloading Pinning Infinite Age Infinite Age Functions TP Time (s) TP Time (s) TP Time (s) TP Time (s) AES libgcrypt 0 2.95 64 17.4 0 4.02 0 13.6 AES mbed TLS 0 1.68 17 17.4 0 2.00 0 9.60 3DES libgcrypt 0 84.0 128 170 0 0.61 0 1.53 3DES mbed TLS 0 1.53 48 65.5 0 0.03 0 1.70 DES glibc 0 0.56 2 3.15 0 0.51 0 1.79 Totals 0 90.72 259 273.45 0 7.17 0 28.22 Robert Brotzman – Pennsylvania State University 18

  19. Conclusions • Built CaSym to automatically identify vulnerabilities in programs • CaSym supports a variety of cache models • Easy to get different precision and efficiency • Tested on an assortment of benchmarks • Confirm many existing vulnerabilities in crypto benchmarks • Verified mitigations strategies on crypto benchmarks • Found over 20 new potential vulnerabilities in the PostgreSQL database Robert Brotzman – Pennsylvania State University 19

  20. Thank You! Robert Brotzman – Pennsylvania State University 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