Side-Channel Attacks Vitaly Shmatikov CS 6431. Acoustic Information in Typing uDifferent keystrokes make different sounds Different locations on the supporting.

Slides:



Advertisements
Similar presentations
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesThe Mighty Mod.
Advertisements

Side-Channel Attacks on RSA with CRT Weakness of RSA Alexander Kozak Jared Vanderbeck.
Lecture 5: Cryptographic Hashes
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (3) Information Security.
1 Lecture 3: Secret Key Cryptography Outline concepts DES IDEA AES.
Speech Recognition Part 3 Back end processing. Speech recognition simplified block diagram Speech Capture Speech Capture Feature Extraction Feature Extraction.
White-Box Cryptography
Cryptography and Network Security Chapter 3
Public Key Encryption Algorithm
Computer Science CSC 405By Dr. Peng Ning1 CSC 405 Introduction to Computer Security Topic 2. Basic Cryptography (Part II)
Session 4 Asymmetric ciphers.
Dr. Lo’ai Tawalbeh Summer 2007 Chapter 9 – Public Key Cryptography and RSA Dr. Lo’ai Tawalbeh New York Institute of Technology (NYIT) Jordan’s Campus INCS.
Homework #4 Solutions Brian A. LaMacchia Portions © , Brian A. LaMacchia. This material is provided without.
First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown and edited by Archana Chidanandan Cryptographic Tools.
Remote Timing Attacks -Rashmi Kukanur. Agenda  Timing Attacks  Case Study : –David Brumley –Dan Boneh  Defenses.
RSA Attacks 1 RSA Implementation Attacks RSA Attacks 2 RSA  RSA o Public key: (e,N) o Private key: d  Encrypt M C = M e (mod N)  Decrypt C M = C d.
Cryptography Lecture 11: Oct 12. Cryptography AliceBob Cryptography is the study of methods for sending and receiving secret messages. adversary Goal:
Lest We Remember Cold-Boot Attacks Against Disk Encryption J. Alex Halderman, Seth D. Schoen, Nadia Heninger, William Clarkson, William Paul, Joseph A.
1 Security problems of your keyboard –Authentication based on key strokes –Compromising emanations consist of electrical, mechanical, or acoustical –Supply.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender and receiver if this key is disclosed communications.
Side-Channel Attack: timing attack Hiroki Morimoto.
0x1A Great Papers in Computer Security
L1.1. An Introduction to Classical Cryptosystems Rocky K. C. Chang, February 2013.
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
0x1A Great Papers in Computer Security
Topic 18: RSA Implementation and Security
The RSA Algorithm Rocky K. C. Chang, March
Chapter 2 Basic Encryption and Decryption. csci5233 computer security & integrity 2 Encryption / Decryption encrypted transmission AB plaintext ciphertext.
Cryptography Lecture 8 Stefan Dziembowski
Calculating Discrete Logarithms John Hawley Nicolette Nicolosi Ryan Rivard.
MATH 224 – Discrete Mathematics
Cryptography: RSA & DES Marcia Noel Ken Roe Jaime Buccheri.
Cryptography Dec 29. This Lecture In this last lecture for number theory, we will see probably the most important application of number theory in computer.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
9th IMA Conference on Cryptography & Coding Dec 2003 More Detail for a Combined Timing and Power Attack against Implementations of RSA Werner Schindler.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
Csc Lecture 7 Recognizing speech. Geoffrey Hinton.
0x1A Great Papers in Computer Security Vitaly Shmatikov CS 380S
Module 3 – Cryptography Cryptography basics Ciphers Symmetric Key Algorithms Public Key Algorithms Message Digests Digital Signatures.
Cryptography Lecture 7: RSA Primality Testing Piotr Faliszewski.
Section 4.4: The RSA Cryptosystem Practice HW Handwritten and Maple Exercises p at end of class notes.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Cryptography and Network Security Chapter 9 - Public-Key Cryptography
Some Number Theory Modulo Operation: Question: What is 12 mod 9?
Computer Security: Principles and Practice First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Chapter 2 – Cryptographic.
Chapter 7 – Confidentiality Using Symmetric Encryption.
Slide 1 Vitaly Shmatikov CS 380S Timing Attacks. slide 2 Reading uKocher. “Timing Attacks on Implementations of Diffie-Hellman, RSA, DSS, and Other Systems”
Sliding Windows Succumbs to Big Mac Attack Colin D. Walter
Scott CH Huang COM 5336 Cryptography Lecture 6 Public Key Cryptography & RSA Scott CH Huang COM 5336 Cryptography Lecture 6.
Exploiting Cache-Timing in AES: Attacks and Countermeasures Ivo Pooters March 17, 2008 Seminar Information Security Technology.
Chapter 9 Public Key Cryptography and RSA. Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
DATA & COMPUTER SECURITY (CSNB414) MODULE 3 MODERN SYMMETRIC ENCRYPTION.
Remote Timing Attacks are Practical David Brumley Dan Boneh [Modified by Somesh.
1/16 Seeing through M IST given a Small Fraction of an RSA Private Key Colin D. Walter Comodo Research Lab (Bradford, UK)
0x1A Great Papers in Computer Security Vitaly Shmatikov CS 380S
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Lecture 6. RSA Use in Encryption to encrypt a message M the sender: – obtains public key of recipient PU={e,n} – computes: C = M e mod n, where 0≤M
Copyright © Zeph Grunschlag, RSA Encryption Zeph Grunschlag.
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
Cryptography services Lecturer: Dr. Peter Soreanu Students: Raed Awad Ahmad Abdalhalim
Department of Computer Science Chapter 5 Introduction to Cryptography Semester 1.
หัวข้อบรรยาย Stream cipher RC4 WEP (in)security LFSR CSS (in)security.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
Public Key Cryptography
Presented by Kartik Patel
Remote Timing Attacks are Practical
Cryptographic Timing Attacks
Presentation transcript:

Side-Channel Attacks Vitaly Shmatikov CS 6431

Acoustic Information in Typing uDifferent keystrokes make different sounds Different locations on the supporting plate Each key is slightly different uFrequency information in the sound of the typed key can be used to learn which key it is Observed by Asonov and Agrawal (2004) slide 2

“Key” Observation uBuild acoustic model for keyboard and typist uExploit the fact that typed text is non-random (for example, English) Limited number of words Limited letter sequences (spelling) Limited word sequences (grammar) uThis requires a natural language model slide 3 [Zhuang et al. “Keyboard Acoustic Emanations Revisited”. CCS 2005]

Overview Initial training Unsupervised Learning Language Model Correction Sample Collector Classifier Builder keystroke classifier recovered keystrokes Feature Extraction wave signal (recorded sound) Subsequent recognition Feature Extraction wave signal Keystroke Classifier Language Model Correction (optional) recovered keystrokes [Zhuang, Zhou, Tygar] slide 4

Sound of a Keystroke uEach keystroke is represented as a vector of Cepstrum features Fourier transform of the decibel spectrum Standard technique from speech processing slide 5 [Zhuang, Zhou, Tygar]

Bi-Grams of Characters uGroup keystrokes into N clusters uFind the best mapping from cluster labels to characters uExploit the fact that some 2-character combinations are more common than others Example: “th” vs. “tj” Hidden Markov Models (HMM) for unsupervised learning slide “t”“h”“e” [Zhuang, Zhou, Tygar]

Spelling and Grammar uFirst, spelling correction uThen, simple statistical model of English grammar: common tri-grams of words Use HMMs again to model slide 7 [Zhuang, Zhou, Tygar]

Recovered Text _____ = errors in recovery = errors corrected by grammar slide 8 Before spelling and grammar correction After spelling and grammar correction [Zhuang, Zhou, Tygar]

Feedback-based Training uRecovered characters + language correction provide feedback for more rounds of training uOutput: keystroke classifier Language-independent Can be used to recognize random sequences of keys –For example, passwords Many possible representations of keystroke classifier –Neural networks, linear classification, Gaussian mixtures slide 9 [Zhuang, Zhou, Tygar]

Experiment: Single Keyboard uLogitech Elite Duo wireless keyboard u4 data sets recorded in two settings: quiet and noisy Consecutive keystrokes are clearly separable uAutomatically extract keystroke positions in the signal with some manual error correction [Zhuang, Zhou, Tygar] slide 10

Results for a Single Keyboard slide 11 Recording lengthNumber of wordsNumber of keys Set 1~12 min~400~2500 Set 2~27 min~1000~5500 Set 3~22 min~800~4200 Set 4~24 min~700~4300 Set 1 (%)Set 2 (%)Set 3 (%)Set 4 (%) WordCharWordCharWordCharWordChar Initial Final [Zhuang, Zhou, Tygar] uDatasets uInitial and final recognition rate

Experiment: Multiple Keyboards uKeyboard 1: Dell QuietKey PS/2 In use for about 6 months uKeyboard 2: Dell QuietKey PS/2 In use for more than 5 years uKeyboard 3: Dell Wireless Keyboard New slide 12 [Zhuang, Zhou, Tygar]

Results for Multiple Keyboards u12-minute recording with app characters Keyboard 1 (%)Keyboard 2 (%)Keyboard 3 (%) WordCharWordCharWordChar Initial Final [Zhuang, Zhou, Tygar] slide 13

slide 14 Encrypted Voice-over-IP uHuman speech = sequence of phonemes Example: “rock and roll” = [ ɹɒ k ænd ɹ o ʊ l] uVariable-rate encoding: encodings of different phonemes have different lengths uStream ciphers preserve length of plaintext, therefore can observe length of individual encrypted phonemes uUse a language model (phonotactics) to reconstruct speech without decrypting [White et al. “Phonotactic Reconstruction of Encrypted VoIP Conversations: Hookt on fon-iks”. Oakland 2011]

slide 15 Phonotactic Reconstruction

slide 16 Segment Stream into Phonemes Transition between phonemes: sound changes significantly, thus more information needs to be encoded in the frame

slide 17 Frequency Analysis Language correction

slide 18 Segment Stream into Words uInsert potential word breaks to break up phoneme triples that don’t occur in any English word uMatch phonemes around the break with all possible phonemes that can end/begin words uUse pronunciation dictionary to match phoneme subsequences to words, insert breaks at positions consistent with all matches [in ɔ li ɹ æg]“an oily rag” “an oil E. rag” “an awe ill E. rag”

slide 19 Reconstruct Words uPrevious step produces phoneme sequences corresponding to individual words uCompute phonetic edit distance between each phoneme sequence and each word in the pronunciation dictionary uUse word and part-of-speech model to disambiguate between homophones “ate” vs. “eight” uResult: human-understandable transcript of the conversation

slide 20 Attacking Cryptographic Schemes uCryptanalysis Find mathematical weaknesses in constructions Statistical analysis of plaintext / ciphertext pairs uSide-channel attacks Exploit characteristics of implementations Power analysis Electromagnetic radiation analysis Acoustic analysis Timing analysis

Protecting Data on a Laptop slide 21 File system Disk drivers On-the-fly crypto Password: ********

Common Attack Scenario slide 22 Security Assumptions The encryption is strong The OS protects the key in RAM …the attacker might reboot to circumvent the OS, but since RAM is volatile, the key will be lost…

0 Dynamic RAM Volatility 1 Write “1” 1 DRAM cell (capacitor) 0 Refresh (read and rewrite) Refresh interval ≈ 32 ms What if we don’t refresh? slide 23

Decay After Cutting Power 5 secs30 secs60 secs300 secs slide 24

Capturing Residual Data uNo special equipment needed, but … u… booting OS overwrites large areas of RAM uSolution: boot a small low-level program to dump out memory contents PXE dump (9 KB) EFI dump (10 KB) USB dump (22 KB) uWhat if BIOS clears RAM? Common on systems with error-corrected RAM slide 25

Slowing Decay By Cooling -50°C < 0.2% decay after 1 minute slide 26

-196°C Liquid nitrogen < 0.17% decay after 1 hour Not necessary in practice Even Cooler slide 28

Dealing with Bit Errors Some bit errors inevitable, especially without cooling (increasing with memory density) Given corrupted K’, find K: Brute-force search over low Hamming distance to K’ e.g. 256-bit key with 10% error: > 2 56 guesses (too slow!) Given corrupted K’, find K: Brute-force search over low Hamming distance to K’ e.g. 256-bit key with 10% error: > 2 56 guesses (too slow!) Naïve Approach Most programs store precomputed derivatives of K (e.g., key schedules) These derivatives contain redundancy; can treat them as error correcting codes Most programs store precomputed derivatives of K (e.g., key schedules) These derivatives contain redundancy; can treat them as error correcting codes Insight slide 29 [Halderman et al. “Cold Boot Attacks on Encryption Keys”. USENIX Security 2008]

Correcting Bit Errors in DES Key schedule contains ~14 redundant copies of each bit from the key ~20% error slide 30

AES Key Schedule   Round 0 key (K) Round 1 key Round 10 key … … Core 128-bit key K  10 more 128-bit keys for cipher rounds   Byte slide 31

Correcting Bit Errors in AES (1)  Round 0 key (K) Round 1 key Core  Key schedule recovered from memory (contains errors) 1. Slices: 4 bytes in Round 0 determine 3 bytes in Round 1 2.Enumerate 2 32 possibilities for each 7 byte slice 3.Eliminate values unlikely to have decayed to observed bytes (excludes vast majority) slide 32

Correcting Bit Errors in AES (2)  Round 0 key (K) Round 1 key Core  4.Repeat for each of the 4 slices 5.Combine possible slice values into candidate keys 6.Test candidates keys by expanding them into full key schedules – compare to recovered memory Key schedule recovered from memory (contains errors) slide 33

Finding AES Key Schedules uIterate through each byte of memory uTreat following region as an AES key schedule uFor each word in the candidate “schedule”: Calculate correct value, assuming other bytes correct Take Hamming distance to observed value uIf total distance is low, output the key slide 34

Demonstrated Attacks Linux dm-crypt Linux LoopAES Windows BitLocker Mac OS FileVault TrueCrypt slide 35

slide 36 Timing Attack uBasic idea: learn the system’s secret by observing how long it takes to perform various computations uTypical goal: extract private key uExtremely powerful because isolation doesn’t help Victim could be remote Victim could be inside its own virtual machine Keys could be in tamper-proof storage or smartcard uAttacker wins simply by measuring response times

slide 37 RSA Cryptosystem uKey generation: Generate large (say, 512-bit) primes p, q Compute n=pq and  (n)=(p-1)(q-1) Choose small e, relatively prime to  (n) –Typically, e=3 (may be vulnerable) or e= =65537 (why?) Compute unique d such that ed = 1 mod  (n) Public key = (e,n); private key = d –Security relies on the assumption that it is difficult to compute roots modulo n without knowing p and q uEncryption of m (simplified!): c = m e mod n uDecryption of c: c d mod n = (m e ) d mod n = m

slide 38 How RSA Decryption Works uRSA decryption: compute y x mod n This is a modular exponentiation operation uNaïve algorithm: square and multiply

slide 39 Kocher’s Observation This takes a while to compute This is instantaneous Whether iteration takes a long time depends on the k th bit of secret exponent

Exploiting Timing Dependency uAssumption / heuristic: timings of subsequent multiplications are independent Given that we know the first k-1 bits of x … Given a guess for the k th bit of x … … Time for remaining bits independent uGiven measurement of total time, determine whether there is correlation between “time for k th bit is long” and “total time is long” Exact timing Exact guess slide 40

slide 41 Outline of Kocher’s Attack uIdea: guess some bits of the exponent and predict how long decryption will take uIf guess is correct, will observe correlation; if incorrect, then prediction will look random This is a signal detection problem, where signal is timing variation due to guessed exponent bits The more bits you already know, the stronger the signal, thus easier to detect (error-correction property) uStart by guessing a few top bits, look at correlations for each guess, pick the most promising candidate and continue

slide 42 RSA in OpenSSL uOpenSSL is a popular open-source toolkit mod_SSL (in Apache = 28% of HTTPS market) stunnel (secure TCP/IP servers) sNFS (secure NFS) Many more applications uKocher’s attack doesn’t work against OpenSSL Instead of square-and-multiply, OpenSSL uses CRT, sliding windows and two different multiplication algorithms for modular exponentiation –CRT = Chinese Remainder Theorem –Secret exponent is processed in chunks, not bit-by-bit [Brumley and Boneh. “Remote Timing Attacks are Practical”. USENIX Security 2003]

slide 43 Chinese Remainder Theorem un = n 1 n 2 …n k where gcd(n i,n j )=1 when i  j uThe system of congruences x = x 1 mod n 1 = … = x k mod n k Has a simultaneous solution x to all congruences There exists exactly one solution x between 0 and n-1 uFor RSA modulus n=pq, to compute x mod n it’s enough to know x mod p and x mod q

slide 44 RSA Decryption With CRT uTo decrypt c, need to compute m=c d mod n uUse Chinese Remainder Theorem (why?) d 1 = d mod (p-1) d 2 = d mod (q-1) qinv = q -1 mod p Compute m 1 = c d 1 mod p; m 2 = c d 2 mod q Compute m = m 2 +(qinv*(m 1 -m 2 ) mod p)*q these are precomputed Attack this computation in order to learn q. This is enough to learn private key (why?)

slide 45 Montgomery Reduction uDecryption requires computing m 2 = c d 2 mod q uThis is done by repeated multiplication Simple: square and multiply (process d 2 1 bit at a time) More clever: sliding windows (process d 2 in 5-bit blocks) uIn either case, many multiplications modulo q uMultiplications use Montgomery reduction Pick some R = 2 k To compute x*y mod q, convert x and y into their Montgomery form xR mod q and yR mod q Compute (xR * yR) * R -1 = zR mod q –Multiplication by R -1 can be done very efficiently

slide 46 Schindler’s Observation uAt the end of Montgomery reduction, if zR > q, then need to subtract q Probability of this extra step is proportional to c mod q uIf c is close to q, a lot of subtractions will be done uIf c mod q = 0, very few subtractions Decryption will take longer as c gets closer to q, then become fast as c passes a multiple of q uBy playing with different values of c and observing how long decryption takes, attacker can guess q Doesn’t work directly against OpenSSL because of sliding windows and two multiplication algorithms

slide 47 Value of ciphertext c Decryption time q2qp Reduction Timing Dependency

slide 48 Integer Multiplication Routines u30-40% of OpenSSL running time is spent on integer multiplication uIf integers have the same number of words n, OpenSSL uses Karatsuba multiplication Takes O(n log 2 3 ) uIf integers have unequal number of words n and m, OpenSSL uses normal multiplication Takes O(nm)

slide 49 g<qg>q Montgomery effect LongerShorter Multiplication effect ShorterLonger g is the decryption value (same as c) Different effects… but one will always dominate! Summary of Time Dependencies

slide 50 Decryption time #Reductions Mult routine Value of ciphertext q 0-1 Gap Discontinuity in Decryption Time

slide 51 Normal SSL Handshake Regular client SSL server 1. ClientHello 2. ServerHello (send public key) 3. ClientKeyExchange (encrypted under public key) Exchange data encrypted with new shared key

slide 52 Attacking SSL Handshake SSL server 1. ClientHello 2. ServerHello (send public key) Attacker 3. Record time t 1 Send guess g or g hi 4. Alert 5. Record time t 2 Compute t 2 –t 1

slide 53 uInitial guess g for q between and (why?) uTry all possible guesses for the top few bits uSuppose we know i-1 top bits of q. Goal: i th bit. Set g = Set g hi = note: g<g hi –If g<q<g hi then the i th bit of q is 0 –If g<g hi <q then the i th bit of q is 1 uGoal: decide whether g<q<g hi or g<g hi <q Attack Overview

slide 54 Two Possibilities for g hi Decryption time #Reductions Mult routine Value of ciphertext q gg hi ? Difference in decryption times between g and g hi will be small Difference in decryption times between g and g hi will be large

slide 55 Timing Attack Details uWhat is “large” and “small”? Know from attacking previous bits uDecrypting just g does not work because of sliding windows Decrypt a neighborhood of values near g Will increase difference between large and small values, resulting in larger 0-1 gap uAttack requires only 2 hours, about 1.4 million queries to recover the private key Only need to recover most significant half bits of q

slide 56 Impact of Neighborhood Size zero-one gap

slide 57 Extracting RSA Private Key Montgomery reduction dominates Multiplication routine dominates zero-one gap

slide 58 Works On The Internet Similar timing on WAN vs. LAN

slide 59 Defenses uBad: require statically that all decryptions take the same time For example, always do the extra “dummy” reduction … but what if compiler optimizes it away? uBad: dynamically make all decryptions the same or multiples of the same time “quantum” Now all decryptions have to be as slow as the slowest decryption uGood: Use RSA blinding

slide 60 RSA Blinding uInstead of decrypting ciphertext c, decrypt a random ciphertext related to c Compute x’ = c*r e mod n, r is random Decrypt x’ to obtain m’ Calculate original plaintext m = m’/r mod n uSince r is random, decryption time is random u2-10% performance penalty

slide 61 Blinding Works