Presentation is loading. Please wait.

Presentation is loading. Please wait.

Differential Protocol Analysis & API Level Attacks Mike Bond Computer Security Group Security and Protection of Information30 th Apr ‘03.

Similar presentations


Presentation on theme: "Differential Protocol Analysis & API Level Attacks Mike Bond Computer Security Group Security and Protection of Information30 th Apr ‘03."— Presentation transcript:

1 Differential Protocol Analysis & API Level Attacks Mike Bond Computer Security Group Security and Protection of Information30 th Apr ‘03

2 Summary Security APIs Hardware Security Modules Introduction to Banking Security Conventional Protocol Attacks API-Level Attacks Differential Protocol Analysis Solution: Formal Methods & Evaluation ? Conclusions

3 What is a Security API ? A command set that uses cryptography to control processing of and access to sensitive data, according to a certain policy Host PC or Mainframe Security Processor PCI Card or Separate Module Security API VDU I/O Devs Network

4 Example Security API Commands U->C : { A } KM, { B } KM C->U : { A+B } KM U->C : GUESS, { ANS } KM C->U : YES (if GUESS=ANS else NO) U->C : { X } K1, { K1 } KM, { K2 } KM C->U : { X } K2

5 Research into API Attacks Some work in early 90’s using prolog style search to find attacks, but few documented atttacks Work started in 2000 at University of Cambridge with analysis of hardware security modules used in banks to protect PINs for ATMs New work found many more attacks, and produced first significant catalogue of API failures Scope has been broadened to include security modules used by certification authorities and also general purpose crypto libraries (eg MSCAPI, PKCS#11) Latest work revisiting financial APIs examining PIN generation and verification procedures…

6 Hardware Security Modules An instantiation of a security API Often physically tamper-resistant (epoxy potting, temperature & xray sensors) May have hardware crypto acceleration (not so important with speed of modern PC) May have special ‘trusted’ peripherals (key switches, smartcard readers, key pads) (referred to as HSMs subsequently)

7 Hardware Security Modules

8 Who Needs Security Modules ? Those who need to enforce access policies to sensitive information Examples: Granting signing permission at a Certification Authority Enforcing split control policies on nuclear weapons & arming codes Those who need to protect mission critical sensitive data Example: Protecting PIN generation keys at banks Those who need to protect data in hostile environments Examples: Protecting Token Vending Machines (Electricity, Lottery etc…) Protecting communications keys in battlefield radios Those with high crypto throughput requirements Example: SSL acceleration for webservers

9 Financial HSMs & API Attacks Attacks discovered at Cambridge –VSM Type System attack –XOR to Null key attack –Meet in the Middle attack Newly discovered attacks: –Decimalisation table attack –PAN modification attack Prerequisites: –Financial security 101 –Conventional Protocol Attacks review

10 Why Financial Security? Concrete and simple security policy for APIs “Only the customer should know her PIN.” “Keys protecting PINs may only be manipulated when authorised by two different employees.” API manuals are often publicly available –IBM put 4758 CCA manual on its website –Diversity: many manufacturers have APIs performing same broad functionality – good for comparison ATM security was the “killer-app” that brought cryptography into the commercial mainstream – so long history of financial API development

11 Introduction to ATM Security The crucial secret is the customer PIN. The customer should be the only person that knows the value of this PIN PINs need to be protected from malicious insiders and outsiders PINs must be protected when generated, in storage, when issued to customers, when travelling via the international ATM network, and when being verified To this end, banks use Hardware Security Modules (HSMs) to perform cryptography and implement a policy which prevents both insiders and outsiders from gaining unauthorised access to PINS.

12 Security Modules in Banks Issuing Bank Regional HQ HSM ATM Acquiring Bank Issuing Bank ATM Network HSM HSM with keypad HSM

13 Start with your bank account number (PAN) Encrypt with PIN Derivation Key (aka PMK – Pin Master Key) 22BD 4677 F1FF 34AC Chop off the (B->1) End 2213(D->3) How are PINs Generated ? decimalise

14 What’s a Decimalisation Table ? Remember encrypted result was in hexadecimal? Encryption produces output that looks uniformly distributed, so 0-F are all equally likely Decimalisation Table used to map 0-F back to 0-9 digit in ABCDEF digit out e.g. 22BD -> 2213 Because some numbers have several hexadecimal digits mapped to them, they are more likely to occur in issued PINs than others

15 Example Distribution : HSBC (Sample size: 45 people)

16 Conventional Protocol Attacks The starting point for the study of API attacks The protocol world has attacks similar to each of those found on APIs Each example demonstrates a different aspect of protocol attack: –Needham Schroder Public Key attacker knows how to encrypt/decrypt –TMN Protocol attacker knows algebra of RSA –Bleichenbacher PKCS#1 Attack attacker knows protocol data structures & understands RSA crypto

17 Protocol Attacks Manipulation Attacks Mathematical Attacks Needham Schroeder Public Key TMN Attack Bleichenbacher Attack

18 Needham-Schroeder Public Key Protocol A -> B : { N A, A} KB B -> A : { N A, N B } KA A -> B : { N B } KB A -> B : { N A, A} KB B -> D : { N A, A} KD D -> B : { N A, N D } KA B -> A : { N A, N D } KA A -> B : { N D } KB B -> D : { N D } KD attackers abilities: Construct messages, Encrypt & decrypt

19 TMN Protocol A->S: R A 3 mod N B->S: R B 3 mod N S->A: R A xor R B C->S: R A 3 * X 3 mod N D->S: R D 3 mod N S->A: R A *X xor R D Explanation: Cubing modulo N represents RSA encryption under public key of server S Explanation: Server will not accept same random number twice, so C cannot simply replay R A 3

20 Bleichenbacher PKCS#1 Attack A->S: K e mod N S->A: {data} K C->S: K e * X e mod N S->A: {data} K*X or S->A: decryption error S->A: format error Explanation: Alice sends key K encrypted using RSA with PKCS#1 v1.5 padding Explanation: Server tries to decrypt message from Charlie, and leaks information as to whether the decrypted message satisfied PKCS#1 format requirement

21 API Attacks & Protocol Attacks API Attacks already found in each category –Manipulation (VSM Type System) –Mathematical (XOR to null key) –Cryptographic (MIM attack) (both manipulative and mathematical) Differences between API and Protocol Attacks: –API is a ‘dumb adversary’ –APIs are more complex – contain many protocols –APIs (usually) have only two principals, HSM and User

22 XOR to Null Key Attack Top-level crypto keys exchanged between banks in several parts carried by separate couriers, which are recombined using the exclusive-OR function A single operator could feed in the same part twice, which cancels out to produce an ‘all zeroes’ test key. PINs could be extracted in the clear using this key U->C : {KP1} KM, {KP2} KM C->U : {KP1 xor KP2} KM U->C : {KP1} KM, {KP1} KM C->U : {KP1 xor KP1} KM ( = {0} KM ) (Anderson 2000)

23 VSM Type System Attack Encrypting communication keys for transfer to an ATMs used exactly the same process as calculating a customer PIN Customer PINs could be generated by re-labelling an account number as a communications key, and using the same encryption process (Bond 2000)

24 The Visa Security Module

25 VSM Type Diagram

26 VSM Type System Attack

27 Type System Attack (Protocol Notation) U->C : C->U : { } TC U->C : { } TC, { PMK } TMK C->U : { } PMK { } PMK = 22BD 4677 F1FF 34AC So customer PIN is 22BD i.e. 2213

28 Car Park Analogy A thief walks into a car park and tries to steal a car... How many keys must he try?

29 Car Park Analogy 1900

30 Car Park Analogy 2000

31 The Meet in the Middle Attack Common sense statistics Attack multiple keys in parallel Need the same plaintext under each key Encrypt this plaintext to get a ‘test vector’ Typical case: A 2 56 search for one key becomes a 2 40 search for 2 16 keys Poor implementations of 3DES key storage allow 3DES key halves to be attacked individually

32 MIM Attack on DES Security Modules 40 bits16 bits Generate 2 16 keys Encrypt test vectors U->C : { KEY1 } KM C->U : { } KEY1 Do 2 40 search Cryptoprocessor’s EffortSearch Machine’s Effort 56 bit key space

33

34 Protocol Attacks Manipulation Attacks Differential Attacks Mathematical Attacks Needham Schroeder Public Key TMN Attack Bleichenbacher Attack Decimalisation Table Attack PAN Modification Attack

35 Decimalisation Table Attack Remember PINs derived from account numbers Hexadecimal raw PIN is converted to decimal using decimalisation table Most APIs allow the decimalisation table to be specified with each PIN verification command A normal verification command eliminates one of 10,000 combinations of PIN for the attacker. If the table is altered, whether or not the alteration affects correct verification leaks much more information about the PIN examples… (Bond/Clulow 2002)

36 Decimalisation Table Attack (1) PIN_Verify Yes/No (eliminates 1 combination) ABCDEF Trial PIN 0000 PAN Encrypted PMK 48CCA975F4B2C8A5 1. Encrypt PAN Raw PIN = 22BD 2. Decimalise Natural PIN = Verify 0000 != 2213

37 Decimalisation Table Attack (2) PIN_Verify Yes/No (eliminates all PINs containing digit 7) ABCDEF Trial PIN 0000 PAN Encrypted PMK 48CCA975F4B2C8A5 1. Encrypt PAN Raw PIN = 22BD 2. Decimalise Natural PIN = Verify 0000 = 0000

38 Decimalisation Table Attack (3) PIN_Verify Yes/No (shows PIN contains digit 2) ABCDEF Trial PIN 0000 PAN Encrypted PMK 48CCA975F4B2C8A5 1. Encrypt PAN Raw PIN = 22BD 2. Decimalise Natural PIN = Verify 0000 != 1100

39 Decimalisation Table Attack (4) PIN_Verify Yes/No (no information) ABCDEF Encrypted Trial PIN {2213} KM PAN Encrypted PMK 48CCA975F4B2C8A5 1. Encrypt PAN Raw PIN = 22BD 2. Decimalise Natural PIN = Verify 2213 = 2213

40 Decimalisation Table Attack (5) PIN_Verify Yes/No (eliminates PINs containing digit 7) ABCDEF Encrypted Trial PIN {2213} KM PAN Encrypted PMK 48CCA975F4B2C8A5 1. Encrypt PAN Raw PIN = 22BD 2. Decimalise Natural PIN = Verify 2213 = 2213

41 PAN Modification Attack (1) Encrypted PINs transferred from ATM to issuing bank via ATM network using point to point encryption At each node PIN block must be decrypted with incoming key, and re-encrypted with outgoing key Common ISO standard “binds” PIN to particular customer by exclusive-ORing PAN with PIN before encryption Attack: specifying incorrect PAN may make deduced PIN contain hexadecimal digit ‘A’-’F’, which causes formatting error. Conditions under which formatting error arises leaks information about PIN. (Clulow 2002)

42 PIN Block Formats FFFFFFFFFF xor = 0412A6FC9CBADDC6 Primary Account Number (PAN) IS0-0 IS0-2 padding PIN PIN length FFFFFFFFFF Format ID

43 PAN Modification Attack (2) PIN_Translate {PIN Block} AWK (or FORMAT ERROR) Format Info PAN{IWK} KM {AWK} KM {PIN Block} IWK

44 PAN Modification Attack (3) FFFFFFFFFF xor = 0412B6FC9CBADDC AB BA CD DC EF FE 889ABCDEF01 998BADCFE10 AAB89EFCD23 BBA98FEDC32 CCDEF89AB45 DDCFE98BA54 EEFCDAB8967 FFEDCBA9876 PIN PAN 0412B6FC9CBADDC6 xor = FFFFFFFFFF 0412B6FC9CBADDC6 xor = 0412C4FFFFFFFFFF construction of PIN block correct PAN removed modified PAN Removed – PIN contains ‘C’ – error

45 Differential Protocol Analysis Phrase coined by Anderson & Bond in “Protocol Analysis, Composability and Computation” in Feb 2003 Differential Protocol Analysis refers to attacks which use multiple runs of a protocol to gradually discover a secret key protected by the protocol Input differentials (pairs of inputs) are carefully chosen such that a difference in output will be observed dependent upon some secret key material Before this work, such attacks were rare – dumb adversaries were thought unlikely

46 Dectab Attack during PIN Generation PIN_Generate FD29DA DC ABCDEF PAN Encrypted PMK 48CCA975F4B2C8A5 1. Encrypt PAN Raw PIN = 22BD 2. Decimalise Natural PIN = Store as ISO PIN Block FFFFFFFFFF

47 “DPA” - Decimalisation Table PANDectabPMKOutput E92F67BFEADF91D9 FD29DA DC E92F67BFEADF91D9 FD29DA DC 08F8E3983E3BDF E92F67BFEADF91D9 FD29DA DC 3BDF08F8E3E E92F67BFEADF91D9 FD29DA DC 726F0FD293E26F E92F67BFEADF91D9 FD29DA DC E92F67BFEADF91D9 FD29DA DC E92F67BFEADF91D9 FD29DA DC E92F67BFEADF91D9 FD29DA DC

48 “DPA” – PAN Modification PANIWKAWKOutput D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC 08F8E3983E3BDF D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC 3BDF08F8E3E D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC 726F0FD293E26F D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC A D7604EBA10AC7F3 E92F67BFEADF91D9 FD29DA DC

49 Protecting against API Attacks: Formal Methods and Evaluation? New protocol attacks show formal methods now cover just one of many aspects of protocol attacks Automated information-theoretic reasoning about protocols and APIs could be an interesting new direction for research and evaluation tools, but is years away API attacks are already having an effect on the real world – especially in financial security, yet evaluation standards e.g. FIPS 140 series are not keeping up API attacks have defeated many different modules certified FIPS Level 4 – why? Because the evaluation does not cover the whole system, just a few components. Be careful when buying entire systems to establish what has been evaluated, and what has not.

50 Conclusions Protocol Analysis is far from dead API security complements and extends the study of security protocols “Differential Protocol Analysis” attacks were previously novelties, but may become important against ‘dumb adversaries’ as Security APIs become more common API analysis used to only be relevant to a few specialist applications such as banking security and certification authorities; TCPA and Palladium APIs when deployed will bring targets into everybody’s homes Formal methods tools have a long way to go to provide assurance for using systems Independent evaluation can protect against these attacks, but it must cover the whole system.

51 More Info Academic Papers “Decimalisation Table Attacks for PIN Cracking” Bond, Zielinski, Mar 2003 “API-Level Attacks on Embedded Systems” Bond, Anderson, Oct 2001 “The Design and Analysis of Cryptographic APIs for Security Devices ” Clulow, Jan 2003 My Webpage


Download ppt "Differential Protocol Analysis & API Level Attacks Mike Bond Computer Security Group Security and Protection of Information30 th Apr ‘03."

Similar presentations


Ads by Google