Home Page Contact Us FAQ Search
Break Microcontroller
Everything they make, we can break!

 

Probability Theory for Pickpockets--ec-PIN Guessing

By Markus G. Kuhn

 

This abstract briefly describes an algorithm for determining the most likely 4-digit PINs associated with a debit card used at EuroCheque (ec) ATMs. We determine the probability of every PIN based on knowledge of the PIN-generation method and the data on the magnetic stripe. A card thief could use this strategy to optimally select the three PINs that he can try on a stolen card before it will be invalidated. The analysis shows a signi cant security problem of the PIN-generation algorithm, which allows the presented PIN-guess strategy to achieve a considerably higher success rate than a random guess would. The reader is assumed to be familiar with basic probability theory. The analyzed PIN-generation algorithm has been used by German banks from 1981 until 1997 according to documents available to the author.

Users of ec-cards cannot select their own PIN. The bank calculates the PIN for each customer as illustrated in the diagram. A 16-digit decimal number is formed by concatenating ve digits of the bank routing number, the ten digit account number, and a single digit card sequence number. This number is transformed into a 64-bit pattern by encoding each digit with its 4- bit binary value (BCD). The result is encrypted using the DES algorithm with a secret 56-bit institute key KI . The resulting 64-bit ciphertext can be written as a 16-digit hexadecimal number. We take the digits 3{6 and replace all occurrences of the letters A{F by digits 0{5 respectively. If the rst of those four digits is a 0, we replace it by a 1. ATM networks owned by the card-issuing bank know KI . They reconstruct the PIN the same way and compare it with what the customer has entered. ATM networks of other banks use a pool key KP1 instead, which results in a di erent PIN of course. The magnetic stripe of each card contains a 4-digit correction o set O1 that an ATM using KP1 has to add without carry-over to the digits 3{6 of the decimalized DES result, to get the PIN known by the customer. In the decimalized DES result obtained with a pool key, a leading zero is not replaced. Since KP1 is known by all banks in Europe, it could be compromised more easily. Therefore, there exist two backup pool keys KP2 and KP3 and the card stripe stores two corresponding o sets O2 and O3. The emergency plan should KP1 be compromised one day is to switch to KP2 and overwrite O1 on all cards at the next ATM visit. The problem that the designer of this PIN-handling system had not understood is that these pool key o sets provide valuable hints for someone who tries to guess a PIN.


From track 3 of the magnetic stripe of a card, we know the 12 o set digits

Our goal is to determine four PIN digits

that are most likely the actual PIN for this card.

Let ~ Pj denote the random variable representing the j-th digit of the actual PIN of a card, and let ~Oi;j denote the random variable representing the j-th digit in o set number i. We assume that all hexadecimal digits of the four DES results are mutually independent and that the 16 digits are uniformly distributed, a required characteristic of any good block-cipher algorithm such as DES. Then, the distributions of these random variables are due to the applied decimalization method (see diagram) as follows:
A most likely PIN ^ P is a P for which the conditional probability is maximal. Since all digits of the PIN are determined independently of each other, we can determine a most likely j-th PIN digit ^ Pj as a Pj that maximizes and get a most likely PIN simply as the combination of the most likely digits for each position.

We can turn around this conditional probability as follows (Bayes' theorem)

and since we assumed the DES results with the three pool keys to be mutually independent, we can replace the conditional probabilities for the combination of digits from all three o sets
by the product of the probabilities for the individual o set digits, and thus we get

This formula uses only the known distributions given in (1). Based on it, we can easily write
a small program to calculate for all given O1;j , O2;j, and O3;j , and determine a ^ Pj for which this probability is maximal. We do this for all four digit positions j and get this way a most likely PIN candidate ^ P. The probability that this PIN is correct is the product of the probabilities that the individual digits ^ Pj are each
correct, as calculated above. It can get as high as 0:948%1/105.

We have so far described how to nd a most likely PIN for a speci c card for which we know the o sets, and we can calculate its success probability. We now calculate, what success probability we expect if we do not have the o sets of a speci c card given, but if we pick a random card. This can be estimated per digit position j with another small program as follows. We try all 164 possible combinations for the four hexadecimal digits (W;X; Y; Z) in each of the four DES results that determine one digit in the PIN and one in each o set. We determine from this quadruple|like a bank does when a new card is issued|the j-th digit of the PIN and the three o sets as follows:

This way, we have generated a set of 164 simulated cards that has the same PIN and o set
digit distribution that we expect from the set of all cards in circulation. Now, we determine
a most likely PIN digit ^ Pj as described above for each of those 164 cards. Since we know for
each of these simulated cards the correct PIN digit Pj , we can count which fraction of the 16sq4 calculated most likely PIN digits ^ Pj is correct and equals the corresponding Pj .

The results of this program run are the following probabilities for a correct guess for each of
the four PIN digit positions j:

Note that if the banks had used a good PIN generation algorithm, we would have expected a random guess success rate of 11% for the rst digit (no leading zero) and 10% for the remaining three digits. By multiplying the actual four per-digit success probabilities above, we get a success probability of 0:00233460:233%1=428 for the most likely PIN. Since a thief has at least three attempts, and since most second or third best PINs have a similar success chance, the probability to get access to the account is roughly three times the success probability of the most likely PIN, this means in the order of 0:7%1/150. Had the banks used a good PIN-generation algorithm, we would have expected only a 1=30000:033% success rate in three attempts, because there are 9000 possible PINs (1000 - 9999). In other words, the security of the ec-PIN system is worse than that of a good system with only three digit PINs, where we would expect a 1/3000:33% success rate in three attempts.

This text did not discuss techniques that allow more than three attempts to enter a PIN. It also did not discuss the cost of determining the DES keys using a brute-force search with special hardware. Both are in the author's opinion valid additional serious concerns regarding the security of the EC card system.

The author wishes to thank Bodo and Ulf Moller from the University of Hamburg for their help and for their suggestions in this analysis.

PIN Calculation for EuroCheque ATM Debit Cards

 

Semiconductor/Microcontroller Manufacturers:
Actel Corp
Advanced Micro Devices
Allegro Micro
Alliance
Altera
Analog Devices
Asiliant Technologies
Atmel
Catalyst Semiconductor
Conexant Systems
Chips & Technologies
Cirrus Logic
Cypress
Dallas Semiconductor
Fairchild semiconductor
Flextronics
Fujitsu Microelectronics
Hitachi
Hitachi Semiconductor
Hyundai
ICT
Infineon Tech
Integrated Device Technology
Intel
Intel Semiconductor
Intersil
ISSI
Lattice Semiconductor
Linear Technology
Logic Devices
LSI Logic
Matsushita
Maxim

Micrel
Microchip
Motorola
Motorola Semiconductor
National Semiconductor
NEC
Orbit Semiconductor
Pericom Semiconductor
Philips
Philips Semiconductor
Rabbit Semiconductor
Rohm
Samsung
Scenix
Sharp
Siemens AG
Sony
SST
ST
ST PSM Division
Synergy Semiconductor
Texas Instrument
Toshiba
Toshiba Semiconductor
Winbond
Xicor
Xilinx
Zilog

Lattice ISP LSI 1016, 1024, 1032
Lattice M4A3-32, M4A3-64, M4A3-128, M4A3-256
Lattice M4A5-32, M4A5-64, M4A5-128, M4A5-256

FPGAS: Field Programmable Gate Array
Xilinx XC9536, XC9572, XC95108, XC95144, XC95216, XC95288
Xilinx XC9536XL, XC9572XL, XC95144XL, XC95288XL

Microprocessors Atmel AT89C51, AT89C52, AT89C55, AT89C1051, AT89C2051, AT89C4051, AT89S51, AT89S52, AT87F51, AT87F54, AT87F58, P89C51, P89C52, P89C54, P89C58
Atmel AT90S1200, AT90S1200A, AT90S2313, AT90S2323, AT90S2343, AT90S2333, AT90S4433, AT90S4414, AT90S4434, AT90S8515, AT90S8515A, AT90S8535
Atmel ATTINY11, ATTINY12, ATTINY15, ATTINY28
Atmel ATMEGA8, ATMEGA16, ATMEGA32, ATMEGA103, ATMEGA128, ATMEGA161, ATMEGA163

AMD, Intel, and Others 8742, 8749, 8752, 87C51, 87C52, ETC.

PALS: Programmable Array Logic GALS: Generic Array Logic Dallas Semiconductor DS5000 Hitachi H8/3002, H8/3008, H8/3032, H8/3042, H8/3048, H8/3052, H8/3334, H8/3337, H8/3437, H8/3637, H8/3664, H8/3724, H8/3834

deprotection bus encryption Tamper resistant microchip
PIC10F200 PIC10F202 PIC10F204 PIC10F206 ??PIC10F220* PIC10F222*
PIC12XXº
PIC12F508 PIC12F509 PIC12F510* PIC12F629 PIC12F635 PIC12F675
PIC12F683
PIC16XXº
PIC16F505 PIC16F506* PIC16F54 PIC16F57 PIC16F59 PIC16F627
PIC16F628 PIC16F628A PIC16F630 PIC16F636 PIC16F639 PIC16F648A
PIC16F684 PIC16F685* PIC16F687* PIC16F688 PIC16F689* PIC16F690
PIC16F72 PIC16F73 PIC16F74 PIC16F76 PIC16F77 PIC16F737
PIC16F767 PIC16F777 PIC16F785 PIC16F818 PIC16F819 PIC16F84A
PIC16F870 PIC16F871 PIC16F872 PIC16F873¨A© PIC16F874¨A) PIC16F876¨A)
PIC16F627A PIC16F676 PIC16F716 PIC16F747 PIC16F87 PIC16F877¨A©
PIC16F88 PIC16F913 PIC16F914 PIC16F916 PIC16F917
PIC18CXXº
PIC18C601 PIC18C801
PIC18FXXº

copy protection protection removal Code protection remove
NEC uPD78F9026, uPD78F9046, uPD78F9116, uPD78F9136


TI MSP430F110, MSP430F112, MSP430F1101, MSP430F1111, MSP430F1121,
MSP430F122, MSP430F123, MSP430F1222, MSP430F1232, MSP430F133,
MSP430F135, MSP430F147, MSP430F148, MSP430F149, MSP430F412,
MSP430F413, MSP430F435, MSP430F436, MSP430F437, MSP430F447,
MSP430F448, MSP430F449, bus encryption, cryptography, secure microprocessor, crypto processor

Philips:

P87C51, P87C52, P87C54, P87C58, P87C552 P87C554 P87C575 P87C576 P87C557
P87LPC759 P87LPC760 P87LPC761 P87LPC762 P87LPC764 P87LPC767 P87LPC768 P87LPC769 P87LPC779
P89C51, P89C52, P89C54, P89C58 P89C60 P89C61 P89C51RX+, P89C138, P89C238, P89C660 P89C661 P89C662 P89C663 P89C664 P89C638 P89C667 P89C668 P89C669
P89LPC901 P89LPC902 P89LPC903 P89LPC904 P89LPC906 P89LPC907 P89LPC908 P89LPC912 P89LPC913 P89LPC914 P89LPC915 P89LPC916 P89LPC917 P89LPC920 P89LPC921 P89LPC922 P89LPC924 P89LPC925 P89PCL930 P89LPC931 P89LPC932 P89LPC933 P89LPC934 P89LPC935

Intel: break crack mcu attack Microcontroller hack eeprom program memory extract deprotect Source code D87C51 P87C51 P87C51FA P87C51FB P87C51FC P87C52 P87C54 P87C58 P87C196KC P87C196MC P87C196MH P87C196KB

Synmos: SM2952 SM2958 SM2965
SM8951A SM8952A SM8954A SM8958A SM89516
SM5964 SM59264 SSU7301A SM7964 SM79164 SM79264 SM7301A

PIC18F1220 PIC18F1320 PIC18F2220 PIC18F2320 PIC18F2331 PIC18F2410
PIC18F2420 PIC18F2431 PIC18F2439 PIC18F2455 PIC18F248 PIC18F2480
PIC18F2515 PIC18F252 PIC18F2520 PIC18F2525 PIC18F2539 PIC18F2550
PIC18F2580 PIC18F2585 PIC18F2610 PIC18F2620 PIC18F2680 PIC18F4220
PIC18F4331 PIC18F4410 PIC18F442 PIC18F4420 PIC18F4431 PIC18F4439
PIC18F448 PIC18F4480 PIC18F4510 PIC18F4515 PIC18F452 PIC18F4520
PIC18F4539 PIC18F4550 PIC18F458 PIC18F4580 PIC18F4585 PIC18F4610
PIC18F4680 PIC18F6310 PIC18F6390 PIC18F6410 PIC18F6490 PIC18F6520
PIC18F6527* PIC18F6585 PIC18F6620 PIC18F6621 PIC18F6622* PIC18F6627
PIC18F6720 PIC18F6722 PIC18F67J10* PIC18F8310 PIC18F8390 PIC18F8410
PIC18F8520 PIC18F8525 PIC18F8527* PIC18F8585 PIC18F8620 PIC18F8621
PIC18F8622* PIC18F8490 PIC18F6680 PIC18F6525 PIC18F4620 PIC18F258
PIC18F4525 PIC18F4455 PIC18F4320 PIC18F2510 PIC18F242 PIC18F87J10*
PIC18F8627 PIC18F8680 PIC18F8720 PIC18F8722
dsPIC30FXX:
dsPIC30F2010 dsPIC30F2011 dsPIC30F2012 dsPIC30F3010 dsPIC30F3011 dsPIC30F3012
dsPIC30F3014 dsPIC30F4011 dsPIC30F4012 dsPIC30F4013 dsPIC30F5011 dsPIC30F5013
dsPIC30F6011 dsPIC30F6012 dsPIC30F6013 dsPIC30F6014 dsPIC30F3013 dsPIC30F6010

cryptography secure security microprocessor unlock crypto processor code recovery antifuse retrieve code fuse blown
Motorola MC68705P3, MC68705P5
Motorola MC68HC705C8, MC68HC705C8A, MC68HC705C9, MC68HC705C9A
Motorola MC68HC05B6, MC68HC05B8, MC68HC05B16, MC68HC05B32
Motorola MC68HC05X16, MC68HC05X32
Motorola MC68HC11A8, MC68HC11E9, MC68HC11E20, MC68HC11L6, MC68HC11KA2, MC68HC11KA4, MC68HC11KG2, MC68HC11KG4