+ All Categories
Home > Documents > Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT...

Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT...

Date post: 06-Sep-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
16
1 Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005 Side-channel Attacks Lecture 10 Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005 Bezpečný HW prvek – HW, FW (či kombinace), který je schopen provádět kryptografické operace v rámci entity s pevnou nepropustnou hranicí (logicky i fyzicky) Narušení – neautorizovaná modifikace funkce zařízení, může ovlivnit bezpečnost či omezit funkčnost Odolnost vůči narušení část systému chráněná proti modifikaci podstatně spolehlivějším způsobem než zbytek; prakticky těžko realizovatelné, slabším požadavkem je detekovatenost narušení Chápán ve 2 rovinách: 1/ zařízení k uchovávání informace 2/ zařízení schopné provádět kód Bezpečný hardware
Transcript
Page 1: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

1

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Side-channel Attacks

Lecture 10

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Bezpečný HW prvek – HW, FW (či kombinace), který je schopen provádět kryptografické operace v rámci entity s pevnou nepropustnou hranicí (logicky i fyzicky)

• Narušení – neautorizovaná modifikace funkce zařízení, může ovlivnit bezpečnost či omezit funkčnost

• Odolnost vůči narušení – část systému chráněná proti modifikaci podstatně spolehlivějším způsobem než zbytek; prakticky těžko realizovatelné, slabším požadavkem je detekovatenost narušení

• Chápán ve 2 rovinách: 1/ zařízení k uchovávání informace2/ zařízení schopné provádět kód

Bezpečný hardware

Page 2: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

2

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Útoky na čipové karty• Dvě základní dělení

– Pasivní • sledování korektní činnosti karty

– Aktivní• ovlivňování činnosti karty, vytváření chyb při běhu

• nebo– Invazivní

• narušování fyzické struktury čipu• mikrosondy, elektronový mikroskop, optická indukce chyb

– Neinvazivní• útok nemění fyzický vzhled, ani další funkčnost čipové karty• výkonová analýza, časové útoky, chybová analýza (napájení,

hodiny)

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Časové útoky

• Opět hledáme soukromý klíč, máme možnost nechat podepisovat různá data mnohokrát

• Čas potřebný k podepsání náhodně generované zprávy má přirozené rozdělení

• Je možné použít korelaci pro určení pravděpodobných časů pro předem daná data

Page 3: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

3

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Výkonová analýzaNeinvazivní útok, základem je sledování příkonu čipové karty při provádění kryptografických operací

16 rund DESu

2. a 3. runda detailně

Page 4: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

4

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Elektromagnetické vyzařování

• Obdoba útoků na obrazovky, kabely, klávesnice, apod.

• Každé zařízení vyzařuje elektromagnetické záření

• Je možné určit které části čipu v určitou chvíli pracují

• Je možné určit mapu čipu pro případné další invazivní útoky

• Je možné aplikovat statistické útoky – podobně jako u výkonové analýzy

Page 5: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

5

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Výkonová analýza

Výkonová charakteristika RSA

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Chybová analýza

• Cílem je ovlivnit zařízení tak, aby při své činnosti vytvořilo chyby

• teplota• napájecí napětí• taktovací hodiny• mikrovlnné záření

– Dlouhodobá změna mimo provozní limity

– Krátkodobé velmi výrazné výkyvy

Page 6: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

6

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Chybová analýza - příklad

• Čipová karta s RSA– Určíme okamžik, ve kterém dochází k výpočtu

podpisu

– Při novém spuštění vytvoříme krátkodobou napájecí špičku (4x – 5x normální napětí)

– Vytvořený podpis je s chybou – je možné vypočítat soukromý klíč

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Semiinvazivní útok• Je poškozen obal čipu, ale nesnažíme se o elektrický kontakt

s kovovým povrchem, nebo křemíkem• UV světlo, X-rays, laser, elektromagnetické pole a lokální ohřívání

lampa ze „sekáče“stála 20£

PIC16F84, 64B SRAM

Optical Fault Induction Attacks

Page 7: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

7

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

– Funkční vlastnosti• Uložení kritických informací

• Provádění kritických operací

• Provádění složitějších funkcí

• Provádění celých aplikací– Kontrola přístupu

• Bez kontroly přístupu

• Kontrola přístupu k zařízení

• Kontrola přístupu k jednotlivým funkcím

• Kontrola přístupu ke vstupním datům funkcí

– Závislost na okolí• Bez závislosti

• Inicializace zařízení• Vstup a výstup operačních dat

• Závislost při samotné činnosti (zdroj napájení, hod. kmitočet)

Cryptographic coprocessors

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

– Příkazová sada• Výkonné příkazy• Příkazy pro správu klíčů• Administrační příkazy

– Kontrola přístupu• Duální kontrola• Použití „rolí“

– Hierarchie klíčů• Hlavní klíče• Klíče pro šifrování klíčů• Operační klíče

– Kontrolní vektory• Každý klíč má dán typ• Typ určuje použití klíče• Vyjádření typu• Musí být svázán s klíčem

Základní charakteristika

Page 8: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

8

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

– Předpoklad• Jsme schopni najít DES klíč v rozumném čase• Máme oprávnění importovat části klíčů (dual control)

– Mechanismus• Vytvoření klíče pro šifrování dat – single DES klíč K1• Vytvoření klíče pro šifrování klíčů – 3DES klíč, ale s oběma částmi stejnými K2,

kterým šifrujeme K1 (který jsme schopni najít)• Zkombinování 3DES klíče s částí 3DES klíče s „plnou délkou“ K3• Vyexportujeme všechny klíče pomocí K3 (tento klíč také najdeme)

– Výskyt• Zatím asi nejsložitější útok na kryptomodul IMB 4758. Jsme schopni získat

všechny exportovatelné klíče v modulu uložené.

Získání všech klíčů – IBM 4758

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Chyby integrace BP produktů do systému => nové útoky; pro HW lze snadněji sestavit formální model a testovat jej

• HW negarantuje absolutní bezpečnost – primárním cílem je výrazné znesnadnění a prodražení útoku

• Některé aplikace vyžadují stále složitější konstrukci bezpečnýchHW zařízení

• Složitost programového vybavení bezpečného HW – není možný formální důkaz správnosti ani na úrovni API

Shrnutí …

Page 9: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

9

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Basic terminology

– Hardware Security Module (HSM)• Example: IBM 4758 (depicted below)

– Host device

– Application Programming Interface (API)

– Attack• PIN Recovery Attacks

– Clear PIN-block (CPB)

– Encrypted PIN-block (EPB)

– Personal Account Number (PAN)

• Insufficient checking of function parameters

HSM - terminology

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

PIN Generation and Verification

• Techniques of PIN generation and verification

– IBM 3624 and IBM 3624 Offset• Based on validation data (e.g. account no. – PAN)

• Validation data encrypted with PIN derivation key• The result truncated, decimalised => PIN

• IBM 3624 Offset – decimalised result called IPIN (Intermediate PIN)

• Customer selects PIN, Offset = PIN – IPIN (digits mod 10)

– Verification process is the same• result is compared with decrypted EPB (encrypted PIN from

cash-machine)

Page 10: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

10

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

PIN Verification Function

• Simplified example of verification function and its parameters:

1. PIN (CPB) encryption/decryption key2. PIN derivation key – for PIN generation process3. PIN-block format4. validation data – for PIN extraction from EPB (e.g. PAN)5. encrypted PIN-block6. verification method7. data array – contains decimalisation table, validation data and

offset

• Clear PIN is not allowed to be a parameter of verification function!

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Inputs – (4-digit PIN)– PIN in EPB is 7216 (delivered by ATM)– Public offset (typically on card) – 4344– Decimalisation table – 0123 4567 8901 2789

– Personal Account Number (PAN) is 4556 2385 7753 2239

• Verification process• PAN is encrypted => 3F7C 2201 00CA 8AB3• Truncated to four digits => 3F7C• Decimalised according to the table => 3972• Added offset 4344, generated PIN => 7216• Decrypt EPB and compare with the correct PIN

PIN Verification – IBM 3624 Offset

Page 11: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

11

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Attacks utilising known PINs– Assume four-digit PINs and offset 0000– If decim. table (DT) is 0000 0000 0000 0000

generated PIN is always 0000– PIN generation function with zero DT outputs EPB with PIN 0000

– Let Dorig = 0123 4567 8901 2345 is original DT– Di is a zero DT with “1” where Dorig has i

e.g. D5 = 0000 0100 0000 0001– The attacker calls 10x verification function with EPB of 0000 PIN and with D0 to D9

– If i is not in PIN, the “1” will not be used and verification against 0000 will be successful

Decimalisation Table Attacks I

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Results– All PIN digits are discovered– PIN space reduced from 104 to 36 (worst case)

• Extended attack without known PINs– Assume, that we obtain customers EPB with correct

PIN– Di are DTs containing i–1 on positions, where Dorig

has i e.g. D5 = 0123 4467 8901 2344– Verification function is called with intercepted EPB

and Di– Position of PIN digits is discovered by using offset

with digits incremented individually by “1” • Bold “4” changes to “5”

Decimalisation Table Attacks II

Page 12: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

12

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Let PIN in EPB be 1492, offset is 1234• We want to find position of “2”

• Verification function with D2 results in 1491!=1492 => fails

• Offsets 2234, 1334, 1244, 1235 increment resulting generated PIN (2491,1591,…)

• Eventually the verification is successful with the last offset => 2 is the last digit

• To determine four-digit PIN with different digits is needed at most 6 calls of verification function

DT Attacks – Example

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Clear PIN Blocks

• Code Book Attacks and PIN-block formats– => clear PIN blocks (CPB)

• ECI-2 format for 4 digits PINs– ECI-2 CPB = pppprrrrrrrrrrrr

• Visa-3 format for 4–12 digits PINs– Visa-3 CPB = ppppFxxxxxxxxxxx

• ANSI X9.8 format for 4–12 digits PINs– P1 = ZlppppffffffffFF– P2 = ZZZZaaaaaaaaaaaa– ANSI X9.8 CPB = P1 xor P2

Z – 0x0 digitl – PIN lengthf – either “p” of “F”a – PAN digit

p – PIN digitr – random digitx – arbitrary,

all the sameF – 0xF digit

Page 13: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

13

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

ANSI X9.8 Attacks I

• Attacking PAN with translation & verification functions – input parameters (key K, EPB, PAN)– Functions decrypt EPB & extract PINCPB xor P2 = 04ppppFFFFFFFFFF => PIN =pppp

– Extraction tests PIN digits to be 0–9!– If a digit of PAN is modified by x

• P2’ = P2 xor 0000x00000000000• CPB xor P2’= 04ppppFFFFFFFFFF xor

xor 0000x00000000000it means that PIN = pppp xor 00x0

• If p xor x < 10 function ends successfully,

otherwise function fails

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

ANSI X9.8 Attacks II

– The sequence of (un)successful function calls can be used by attacker to identify p as a digit from set {p, p xor 1}

– For example if PIN digit is 8 or 9, then this sequence will be PPFFFFFFPPPPPPPP, where P is PASS, F is FAIL and x is incremented from 0 to 15

• Only last two PIN digits can be attacked• PIN space is reduced from 104 to 400

• This attack can be extended to all PIN digits

Page 14: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

14

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

ANSI X9.8 Attacks III

• Attack against PIN translation functions

– Input/output PIN-block format can be modified

– Consider ANSI X9.8 EPB with null PAN (wlog)• Attacker specifies input format as VISA-3 and output as ANSI

X9.8• PIN is then extracted from 04ppppFFFFFFFFFF as 04pppp

• 04pppp is formatted into ANSI CPB as 0604ppppFFFFFFFFand encrypted

– Attacker has EPB with six-digit PIN and can use previous attack to determine all 4 digits of original PIN

• PIN space is reduced from 104 to 16

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

ANSI X9.8 Attacks IV

– PIN can be also determined exactly– The attacker needs to be able to modify PAN

• This is impossible if input format is Visa-3• PAN modification must be done earlier (in EPB)

– Let’s modify second digit of PAN by x• Input format is VISA-3 and output ANSI X9.8• PIN is decrypted from ANSI X9.8 EPB and extracted

as 04pppp xor 00000x• If x = p xor F (i.e. x xor p = F) then PIN is

extracted as 04ppp and formatted into ANSI X9.8• This can be detected by/during translation back to

VISA-3 format EPB

Page 15: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

15

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

• Assuming well designed API (e.g. DT is fixed)• Attack allows to partially identify last two PIN digits

– Basic idea (simple example with one-digit PIN&PAN)PAN PIN xor EPB PAN PIN xor EPB0 0 0 21A0 7 0 7 2F2C0 1 1 73D2 7 1 6 345A0 2 2 536A 7 2 5 03210 3 3 FA2A 7 3 4 FF3A0 4 4 FF3A 7 4 3 FA2A0 5 5 0321 7 5 2 536A0 6 6 345A 7 6 1 73D20 7 7 2F2C 7 7 0 21A00 8 8 4D0D 7 8 F AC420 9 9 21CC 7 9 E 9A91

– Attacker knows for each PAN only the set of EPBs

ANSI X9.8 Attacks – Collision Attack

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

ANSI X9.8 Attacks – Collision Attack

• Looking collisions in output of PIN generation function

• Remember PIN generation & ANSI X9.8 CPB• Formalising PIN generation function

– So EPB = Encrypt(Pad(Ua,Ub,Uc,Ud)), where

Ua= (Fa(e,f)+a) mod 10Ub= (Fb(e,f)+b) mod 10Uc=((Fc(e,f)+c) mod 10) xor eUd=((Fd(e,f)+d) mod 10) xor f

– e, f are first two digits of PAN– Fx(e,f) is respective digit of IPIN– a,b,c,d are digits of offset

Page 16: Side-channel Attackscvrcek/KIB/lecture10.pdf · –LetDorig = 0123 4567 8901 2345 is original DT – Di is a zero DT with “1” whereDorig has i e.g. D5 = 0000 0100 0000 0001 –

16

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

ANSI X9.8 Attacks – Collision Attack

– The whole function is Gen(a,b,c,d,e,f)

– Desired IPIN digits are Fc(e,f) and Fd(e,f)• To get Fc(e,f), the attacker must choose a fixed value DELTA

• She modifies offset and to get collisions: Gen(a,b,c,d,e,f) = Gen(a’,b’,c’,d’,e xor DELTA,f)

• When a collision is found: Uc=Uc’ and DELTA =((Fc(e,f)+c) mod 10)xor((Fc(e xor DELTA,f)+c) mod 10)

• Certain DELTA can be obtained only by a few combinations (e.g F=6xor 9 or 7 xor 8)

=>(Fc(e,f)+c) mod 10 is 6, 7, 8 or 9

• Next collision for DELTA=7 leaves only 6 and 7

• Because c is known, we simply get Fc(e,f)

Kryptografie a informační zabezpečenost, © Daniel Cvrček, 2005

Conclusion

• The security of current generation banking APIs is really bad with respect to insider attacks

• Function parameters can be arbitrarily changed –controls not sufficient

• PIN-block formats do not ensure sufficient entropy• Number of standards implemented ensures interoperatibility but also

causes errors

• Can asymmetric cryptography help? See an attack on Chrysalis Luna CA3 module!

• Other attacks– Master’s thesis (in czech):

http://www.fi.muni.cz/~xkrhovj/apinf/sdipr/DP_upravena_v1.pdf– Mike Bond’s research:

http://www.cl.cam.ac.uk/~mkb23/research.html– Jolyon Clulow’s research:

http://www.cl.cam.ac.uk/~jc407/


Recommended