Slide 1

Slide 1 text

Practical cryptanalysis for hackers Chen-Mou Cheng [email protected] Dept. Electrical Engineering National Taiwan University December 5, 2015

Slide 2

Slide 2 text

What is cryptography? What is cryptanalysis?

Slide 3

Slide 3 text

What is cryptography? What is cryptanalysis? Not going to lecture about them today

Slide 4

Slide 4 text

About myself PhD, Harvard University, 2007

Slide 5

Slide 5 text

About myself PhD, Harvard University, 2007 目前:國立台灣大學負教授

Slide 6

Slide 6 text

About myself PhD, Harvard University, 2007 目前:國立台灣大學負教授 Has published >60 papers

Slide 7

Slide 7 text

About myself PhD, Harvard University, 2007 目前:國立台灣大學負教授 Has published >60 papers Most are garbage don’t have a high impact factor; hasn’t really changed anything in practice, it seems

Slide 8

Slide 8 text

砍掉重練?

Slide 9

Slide 9 text

砍掉重練? A bit late, as no one wants to hire a middle-aged professor who has never really left school

Slide 10

Slide 10 text

砍掉重練? A bit late, as no one wants to hire a middle-aged professor who has never really left school “肝已不再新鮮”TM

Slide 11

Slide 11 text

砍掉重練? A bit late, as no one wants to hire a middle-aged professor who has never really left school “肝已不再新鮮”TM Must do some work having something to do with practice

Slide 12

Slide 12 text

How we got started May, 2009: Read “Wirelessly Pickpocketing a Mifare Classic Card” (IEEE S&P 2009) by F. D. Garcia, P. van Rossum, R. Verdult, and R. W. Schreur from Nijmegen Summer, 2009: Repeated the experiments on 悠遊卡 Fall, 2009: Demonstrated several attacks to the authority Card-only attacks (Nijmegen) Long-range sniffing (ours)

Slide 13

Slide 13 text

How we got started May, 2009: Read “Wirelessly Pickpocketing a Mifare Classic Card” (IEEE S&P 2009) by F. D. Garcia, P. van Rossum, R. Verdult, and R. W. Schreur from Nijmegen Summer, 2009: Repeated the experiments on 悠遊卡 Fall, 2009: Demonstrated several attacks to the authority Card-only attacks (Nijmegen) Long-range sniffing (ours)

Slide 14

Slide 14 text

The story went on Fall, 2009: Demonstrated several attacks to the authority

Slide 15

Slide 15 text

The story went on Fall, 2009: Demonstrated several attacks to the authority Jan., 2010: Government regulators approved 悠遊卡 as a means of electronic payment in Taiwan (!)

Slide 16

Slide 16 text

The story went on Fall, 2009: Demonstrated several attacks to the authority Jan., 2010: Government regulators approved 悠遊卡 as a means of electronic payment in Taiwan (!) (怒) “Just don’t say you heard it from me: MIFARE Classic is completely broken,” at the 4th Hacks in Taiwan Conference (HIT 2010), Taipei, Taiwan, Jul. 2010

Slide 17

Slide 17 text

“Reverse-engineering a real-world RFID payment system” A talk by Harald Welte in 27C3, Dec., 2010 Disclosed “the process of reverse-engineering the actual content of the [悠遊卡] to discover the public transportation transaction log, the account balance and how the daily spending limit work” As well as “how easy it is to add or subtract monetary value to/from the card. Cards manipulated as described in the talk have been accepted by the payment system”

Slide 18

Slide 18 text

“Reverse-engineering a real-world RFID payment system” A talk by Harald Welte in 27C3, Dec., 2010 Disclosed “the process of reverse-engineering the actual content of the [悠遊卡] to discover the public transportation transaction log, the account balance and how the daily spending limit work” As well as “how easy it is to add or subtract monetary value to/from the card. Cards manipulated as described in the talk have been accepted by the payment system” “Corporations enabling citizens to print digital money”

Slide 19

Slide 19 text

Shortly after in Taiwan Jan., 2010: Government regulators approved 悠遊卡 as a means of electronic payment in Taiwan

Slide 20

Slide 20 text

Shortly after in Taiwan Jan., 2010: Government regulators approved 悠遊卡 as a means of electronic payment in Taiwan Sep., 2011: First 悠遊卡 hacking incident reported in media Soon the authority disclosed upgrade plans to “二代悠遊卡,” claiming that it will be “secure” Aug., 2012: Official release of 二代悠遊卡

Slide 21

Slide 21 text

Recall: Most serious weaknesses of MIFARE Classic Bad randomness Parity weaknesses Weaknesses in nested authentications Together, they allow very efficient key recovery 1. mfcuk can recover one key in less than an hour 2. mfoc can recover all subsequent keys in a few hours

Slide 22

Slide 22 text

The “secure” 二代悠遊卡 二代悠遊卡, like many other similar cards used around the world, is essentially a CPU card with MIFARE Classic emulation Tag nonce now is unpredictable and seems to have 32-bit entropy, disabling attacks based on tag nonce manipulation and nested authentications Sure, sniffing still works if you have a legitimate reader So does brute-force if you don’t have such a reader, which may take years on an ordinary PC All other existing, efficient card-only attacks no longer work Seems “secure” enough from a practical point of view

Slide 23

Slide 23 text

Do you believe that?

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

The research question Is there a practically relevant card-only attack on 二代悠遊卡?

Slide 26

Slide 26 text

Attack techniques M. Albrecht and C. Cid: “Algebraic techniques in differential cryptanalysis” (FSE 2009) S. Knellwolf, W. Meier, and M. Naya-Plasencia: “Conditional differential cryptanalysis of NLFSR-based cryptosystems” (ASIACRYPT 2010) Y.-H. Chiu, W.-C. Hong, L.-P. Chou, J. Ding, B.-Y. Yang, and C.-M. Cheng, “A practical attack on patched MIFARE Classic” (Inscrypt 2013)

Slide 27

Slide 27 text

Experiment setup All experiments are performed on an old laptop and a standard ACR 122 reader Running Ubuntu with libraries such as libnfc and crapto1 We use the CryptoMiniSat SAT solver The CNF formulas are generated by our own software

Slide 28

Slide 28 text

Target under attack Card type Parities checked nT generation 一代悠遊卡 Yes Predictable 一代悠遊卡加強版 Yes Somewhat random 二代悠遊卡 No (always 0x0) Random

Slide 29

Slide 29 text

Experiment results Attack type Online time Compute time 1.0 1.5 2.0 Sniffing attack 2 sec. < 2 sec. √ √ √ GPU brute-force 5 sec. 14 hours √ √ √ CPU brute-force 5 sec. > 1 month √ √ √ Parities attack > 3 min. < 30 sec. √ ? Nested authentications 15–75 sec. 25–125 sec. √ √ Our attack (simulation) 10–20 hours 2–15 min. √

Slide 30

Slide 30 text

State of the art Without any prior knowledge, can break 二代悠遊卡 and obtain a key in 10–20 hours

Slide 31

Slide 31 text

State of the art Without any prior knowledge, can break 二代悠遊卡 and obtain a key in 10–20 hours C. Meijer and R. Verdult, “Ciphertext-only cryptanalysis on hardened MIFARE Classic cards” (ACM CCS 2015) First using our or other attacks to obtain a key, can break 二 代悠遊卡 and obtain one key every 10–20 minutes Together can break 二代悠遊卡 and obtain all the keys in 15–30 hours

Slide 32

Slide 32 text

How can we fix this problem?

Slide 33

Slide 33 text

How can we fix this problem? Give up MIFARE Classic! Many cities are doing so If not, controlling damage by restricting usage

Slide 34

Slide 34 text

How can we hackers help?

Slide 35

Slide 35 text

How can we hackers help? Making these attacks really really easy for ordinary people to understand Breaking information asymmetry and taking back the right to make the (right) decision

Slide 36

Slide 36 text

Thanks! Questions or comments?