Proxmark3 developers community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

#1 2019-08-26 04:04:55

Ryston
Contributor
Registered: 2019-07-09
Posts: 16

Request for Help: iCLASS Legacy Cloning

Hello,

I know, what I am asking is taboo.  I hope to convince someone to provide some hint by describing my reasons and progress.

Reason:  I am the new physical security systems technician for a secure data center.  Being an avid consumer of defcon tubes, I suspected we were placing more faith in the security of our RFID cards than was wise, and convinced my superiors to buy me a proxmark and indulge me in demonstrating that alleged vulnerability.

The good-ish news; I was right - we're using iCLASS Legacy!  We should upgrade.
The bad news: I am just not quite bright enough to fully demonstrate the vulnerability.  At least not by the time they want the report finished, which would be by the end of the month.  (I've been at this for about two months now.)

I've dumped some of the cards (the 14443b compliant ones anyways) and written some arbitrary data blocks, but of course 00 and 04* are not so easy.  I've socialized the progress with the primary internal stakeholders...  I seem to be able to talk them through the 14443b issue but the fact I can't pull off a successful clone of the normal cards is clearly going to weigh heavily on their decision.  I've had some luck tackling issues in my SysAdmin hat, and they have tossed around that if it took ME this long to figure it out, it must require a very advanced attacker to exploit...  It's been... awkward trying to impress upon a new employer that they're overestimating me.

Progress:  Well I wish I could say I successfully extracted the master key myself, the truth is I studied just enough crypto to hopefully understand the code I was planning to pilfer when I started searching gits and stumbled across the leaked key.

After a couple of dumps, I figured out I was looking at a chicken and the egg problem with blocks 00 and 04*. The PM3 would calc the diversified key to authenticate with based on the CSN it reads (the writeblk command doesn't let you specify a CSN or a diversified key, just a master key)

I understand, or think I understand anyways, what to do with the calcnewkey command so I can correctly try and post the xor of o and n to blk 04*

Anyways I never got that far.  I decided to brick a card in the name of an experiment and discovered I can't even write blk 00, it appears to authenticate using a diversified key but then simply says, 'Write Block Failed'

That was two weeks ago, I haven't made any real progress since. 

I am running out of time.  If I can't do this by the end of the week I fear my organization is going to regard the vulnerability as a low risk and opt to borrow the advice given by a contractor to a sister facility; which was to slowly drift towards Seos. 

I hope to convince them to let me do a report contrasting Seos with DESFire EV 2...  but I fear the consequence of my "you over estimate me" talk was less of the intended: "We shouldn't read too much into the lack of a successful clone." and more, "I guess that consultant is the most knowledgeable SME around, we'll just go with what he recommended."  :-/

I know there's not a lot of love for cloners in this group, but I reckon this is about as good a reason for such a request as can be made.

Thank you in advance for whatever is offered.

* Oh and about 04...  when I dump the cards, it's blocks 04 and 05 that are read protected.  I figure that means they hold my diversified keys (instead of 03 and 04 as documented.) 

-Ryston

Last edited by Ryston (2019-08-26 04:17:00)

Offline

#2 2019-08-26 07:41:23

iceman
Administrator
Registered: 2013-04-25
Posts: 6,654
Website

Re: Request for Help: iCLASS Legacy Cloning

[admin]  moved to the correct category


If you feel the love,  https://www.patreon.com/iceman1001

modhex(hkhehghthbhudcfcdchkigiehgduiehg)

Offline

#3 2019-08-26 19:22:11

Ryston
Contributor
Registered: 2019-07-09
Posts: 16

Re: Request for Help: iCLASS Legacy Cloning

hmm  Found my answer in something I've read before, just forgot about.

Sorry to have bothered everyone.

From: http://www.proxmark.org/forum/viewtopic.php?id=5210

AmmonRa wrote:

@carl55 I have a question about the different types of cards.

In terms of reprogram-ability, is there any difference between 2) Initialized/Configured and 3) Programmed? I.e. I can auth to both types of cards, but is there any limitation on writing data to these cards?
I assume I can update AA1 on both cards, but not some other blocks. (I guess blk 3 could be updated, but it would be equivalent of making the Elite, meaning I'd need to use the card appropriate Authentication Key to auth with the card in future.)

also, can the CSN of 1) Uninitialized/Unconfigured be changed?

Carl55 wrote:

Those two types of iClass credentials are identical with regards to which data blocks can be written.

The initialized/configured cards are programmed at the HID factory with data in blocks 0-5. The programmed cards are sold with data programmed in blocks 0-9.
Both types of credentials allow the end user to program/modify all data blocks (except 0,1,5) provided you have knowledge of the appropriate authentication key.

According to the various Picopass and HID documentation, the CSN (Block 0) cannot be re-programmed once it has been initially programmed at the factory.
That being said, it is certainly possible that an undocumented "backdoor" feature to do this might have been included in the initial picopass chip design. If so, it would probably require a proprietary method that requires the credential to be uninitialized and still operating in its default "personalization" mode. Unfortunately HID stopped selling the unitialized credentials immediately after the iclass technology was hacked and the iclass SE technology was introduced.

Offline

#4 2019-08-27 01:59:50

grauerfuchs
Contributor
Registered: 2018-08-28
Posts: 49

Re: Request for Help: iCLASS Legacy Cloning

It looks to me like you've been trying too hard. For the record, cloning cards for non-customized iClass legacy mode is frequently little more than trivial. If the readers support legacy mode, they haven't had the keys customized, and they haven't been programmed to accept only encrypted cards, you can effectively clone a credential by re-using an older HID-issued legacy iClass card. The CSN doesn't matter as long as the card was originally issued by HID.

Using the leaked master key, you need to write a config block that defines the card is unencrypted and then write the unencrypted card data in the data blocks. The details on the config block and many common card data layouts are present in these forums. The information for HID prox cards applies here; The only difference is that the iClass card doesn't use the prox header. It only needs a start bit prior to the formatted card data. This means you only need to manipulate blocks 06-09.

Don't be dissuaded by a few authentication failures when trying to write with the Proxmark. Stick with it. Some of the cards are very picky about position (and especially so with the cheaper Proxmark clones), and the timing in the official repo isn't perfect when trying to work with iClass cards.

Even if you can't demonstrate it with the Proxmark device, there is another way to do it with a device readily provided by HID themselves!
A certain popular series of USB smart card readers/writers had a fault in a certain publicly released version of the driver that allowed people to very easily re-write iClass credentials without needing any of the crypto keys. The script that resulted from finding this vulnerability is now also quite public.

Offline

#5 2019-08-27 09:14:12

piwi
Contributor
Registered: 2013-06-04
Posts: 704

Re: Request for Help: iCLASS Legacy Cloning

the timing in the official repo isn't perfect when trying to work with iClass cards.

Interesting. The iClass code is pretty much the same on both repos. How did you come to this conclusion?

Offline

#6 2019-08-27 17:33:37

Ryston
Contributor
Registered: 2019-07-09
Posts: 16

Re: Request for Help: iCLASS Legacy Cloning

grauerfuchs wrote:

Using the leaked master key, you need to write a config block that defines the card is unencrypted and then write the unencrypted card data in the data blocks. The details on the config block and many common card data layouts are present in these forums. The information for HID prox cards applies here; The only difference is that the iClass card doesn't use the prox header. It only needs a start bit prior to the formatted card data. This means you only need to manipulate blocks 06-09.

Thank you! 

This whole time I was assuming the reader authenticates the MAC and then, if it checks out, it sends the CSN to the panel and gets an approved or denied signal of some form back.  I don't know where I got that in my head from, but I'm glad it's cleared up now.  smile

Cloned a badge, showed my boss, who bragged about the project in a meeting with other facilities... my scope got crept, now I get to demonstrate cracking iCLASS Legacy Elite keys.  Life. is. awesome.

Thank you again!

Last edited by Ryston (2019-08-27 20:14:54)

Offline

#7 2019-08-27 22:44:56

grauerfuchs
Contributor
Registered: 2018-08-28
Posts: 49

Re: Request for Help: iCLASS Legacy Cloning

piwi wrote:

Interesting. The iClass code is pretty much the same on both repos. How did you come to this conclusion?

In testing, I get an average success rate of less than 10% regardless of where the card is located in relation to the antenna. This same behavior presents on an RDV2 and on a PM3E. I don't have an RDV4 to compare yet, unfortunately. The performance has been the same for the last few months, at least. I can't say when the issues started; it was before I first used the devices I currently have on hand.

When the request fails, the PM3 returns an authentication error or a "no tag found..." response. The issue has presented with more than 10 cards tested. All cards tested were old-batch HID cards with standard keys, and each card was verified as functional with an HID reader to rule out dead cards. Two computers from different manufacturers and running different OSes were used for this test to rule out OS or hardware compatibility issues.

Last tune results on the RDV2 (prior to the test):

bootrom: master/v3.0.1-389-g6a0915e-suspect 2018-08-07 15:20:40
os: master/v3.0.1-550-g2de2605-suspect 2019-06-26 18:48:39
fpga_lf.bit built for 2s30vq100 on 2015/03/06 at 07:38:04
fpga_hf.bit built for 2s30vq100 on 2019/03/20 at 08:08:07
SmartCard Slot: not available

uC: AT91SAM7S512 Rev B
Embedded Processor: ARM7TDMI
Nonvolatile Program Memory Size: 512K bytes. Used: 210122 bytes (40). Free: 3141
Second Nonvolatile Program Memory Size: None
Internal SRAM Size: 64K bytes
Architecture Identifier: AT91SAM7Sxx Series
Nonvolatile Program Memory Type: Embedded Flash Memory

# LF antenna: 38.09 V @   125.00 kHz
# LF antenna: 23.51 V @   134.00 kHz
# LF optimal: 38.91 V @   126.32 kHz
# HF antenna: 30.17 V @    13.56 MHz

Offline

#8 2019-08-28 06:34:29

piwi
Contributor
Registered: 2013-06-04
Posts: 704

Re: Request for Help: iCLASS Legacy Cloning

@grauerfuchs: thanks for the info. Your local repository might be corrupt or incomplete (os version shows 3.0.1 instead of 3.1.0). This might cause funny issues, see https://github.com/Proxmark/proxmark3/i … -490607338.

If your repo is OK and the issue still persists, with which commands is this? reading, writing, both?

Offline

#9 2019-08-28 08:12:30

aaronml
Contributor
Registered: 2018-01-02
Posts: 30

Re: Request for Help: iCLASS Legacy Cloning

Just my personal opinion, but I wouldn’t even consider Seos at this point.... I’d suggest either iCLASS SE or DESFire EV1 / EV2.

Since you are currently using Legacy iCLASS, if you have a lot of readers/cards, I’d suggest transitioning to iCLASS SR cards immediately (since they will work with legacy readers and SE readers) and then once you have replaced all of your cards and/or readers, disabling Legacy iCLASS Support via config cards. Note that if you buy a CP1000 Encoder, you can actually re-encode legacy iCLASS cards as iCLASS SR, which might save some money depending on the volume you guys are looking at. Honestly though, for a secure data center you should not rely too heavily on card security.... I would say to have Card + PIN at a minimum.... ideally biometrics if possible (e.g. a palm vein scanner, etc.) Just my $0.02 smile

Offline

#10 2019-08-28 12:41:36

grauerfuchs
Contributor
Registered: 2018-08-28
Posts: 49

Re: Request for Help: iCLASS Legacy Cloning

@piwi:

Corrupt or incomplete repos on both computers? I suppose it's possible, but unlikely. I'll try a complete clear of the repos and re-build just in case. Issues were occurring both on read and write.

Offline

#11 2019-08-28 18:52:50

Ryston
Contributor
Registered: 2019-07-09
Posts: 16

Re: Request for Help: iCLASS Legacy Cloning

aaronml wrote:

Just my personal opinion, but I wouldn’t even consider Seos at this point.... I’d suggest either iCLASS SE or DESFire EV1 / EV2.

Since you are currently using Legacy iCLASS, if you have a lot of readers/cards, I’d suggest transitioning to iCLASS SR cards immediately (since they will work with legacy readers and SE readers) and then once you have replaced all of your cards and/or readers, disabling Legacy iCLASS Support via config cards. Note that if you buy a CP1000 Encoder, you can actually re-encode legacy iCLASS cards as iCLASS SR, which might save some money depending on the volume you guys are looking at. Honestly though, for a secure data center you should not rely too heavily on card security.... I would say to have Card + PIN at a minimum.... ideally biometrics if possible (e.g. a palm vein scanner, etc.) Just my $0.02 smile

Thanks Aaronml, your two cents is very much valued here.  I will be proposing the iCLASS SR cards as a transition.

I'm curious if you can point to a specific reason to favor SE over Seos?

We do have other layers of defense with different authentication measures that I won't delve into, public forum and all. 

I still want to recommend a more secure RFID solution, as it is a major component of the facilities access controls.

Last edited by Ryston (2019-08-28 19:06:59)

Offline

#12 2019-08-29 00:47:54

aaronml
Contributor
Registered: 2018-01-02
Posts: 30

Re: Request for Help: iCLASS Legacy Cloning

Ryston wrote:
aaronml wrote:

Just my personal opinion, but I wouldn’t even consider Seos at this point.... I’d suggest either iCLASS SE or DESFire EV1 / EV2.

Since you are currently using Legacy iCLASS, if you have a lot of readers/cards, I’d suggest transitioning to iCLASS SR cards immediately (since they will work with legacy readers and SE readers) and then once you have replaced all of your cards and/or readers, disabling Legacy iCLASS Support via config cards. Note that if you buy a CP1000 Encoder, you can actually re-encode legacy iCLASS cards as iCLASS SR, which might save some money depending on the volume you guys are looking at. Honestly though, for a secure data center you should not rely too heavily on card security.... I would say to have Card + PIN at a minimum.... ideally biometrics if possible (e.g. a palm vein scanner, etc.) Just my $0.02 smile

Thanks Aaronml, your two cents is very much valued here.  I will be proposing the iCLASS SR cards as a transition.

I'm curious if you can point to a specific reason to favor SE over Seos?

We do have other layers of defense with different authentication measures that I won't delve into, public forum and all. 

I still want to recommend a more secure RFID solution, as it is a major component of the facilities access controls.

So between iCLASS SE and Seos specifically:

iCLASS SE has been around for longer, for starters. At this point it is relatively (well, certainly in contrast to Seos) well understood, and considered to be fairly solid from a crypto standpoint.

Seos is still relatively immature..... HID is leveraging "security by obscurity" to a certain extent, and most public documentation out there on Seos is pretty "hand-wavey" in terms of how it works. I'd hardly call myself an expert on it, but from what I've seen of it so far, it seems overly complex (I'm a firm believer in the "KISS" ("Keep It Stupid Simple") design principle).... other folks' comments on this forum about it also don't inspire a ton of confidence.

From a functionality standpoint, HID's physical media (i.e. cards) offerings for Seos are fairly limited compared to iCLASS SE (e.g. no "Key Fob" form factor, no "clamshell" form factor, inability to hole-punch it (at least officially according to HID... they say it will damage/break the card)). The read range for Seos cards is also worse than iCLASS SE, see https://www.hidglobal.com/sites/default/files/resource_files/pacs-iclass-se-reader-family-ds-en.pdf.

Offline

#13 2019-08-29 05:04:06

0xFFFF
Administrator
From: Vic - Australia
Registered: 2011-05-31
Posts: 630

Re: Request for Help: iCLASS Legacy Cloning

I would advise avoiding Seos!


Want to contact me? Here's my email address...
modhex(ecijhhhhhhhhfchdhbidhniihghdduhehvhtduhbig)

Offline

#14 2019-08-29 12:47:24

piwi
Contributor
Registered: 2013-06-04
Posts: 704

Re: Request for Help: iCLASS Legacy Cloning

@0xffff: Because of known issues or because it is again security by obscurity?

@grauerfuchs: I stand corrected, no need for further tests. The iClass reader code is different. It is just the sim code which is nearly equal. Both aren't good. I have a look at it.

Offline

#15 2019-10-02 00:31:53

0xFFFF
Administrator
From: Vic - Australia
Registered: 2011-05-31
Posts: 630

Re: Request for Help: iCLASS Legacy Cloning

A bit of both. Mistakes were made on release which seem to have been rectified. Security by obscurity is their slogan.


Want to contact me? Here's my email address...
modhex(ecijhhhhhhhhfchdhbidhniihghdduhehvhtduhbig)

Offline

Board footer

Powered by FluxBB