In this post I will share how to clone a MiFare Classic card using the proxmark3.
- Obtain keys
- Dump card content
- Write dump to empty card
- Todo: Autopwn
There are several ways to cracking MiFare cards but the easiest way is just test and see if the default MiFare keys work. Luckily for me the default key “FFFFFFFFFFFF” did and I was able to dump the card.
Dumping card content
[usb] pm3 --> hf mf dump [=] Reading sector access bits… ……………. [+] Finished reading sector access bits [=] Dumping all blocks from card… [+] successfully read block 0 of sector 0. [+] successfully read block 1 of sector 0. [+] successfully read block 2 of sector 0. [+] successfully read block 3 of sector 0. [+] successfully read block 0 of sector 1. [snip] [/snip> [+] time: 17 seconds [+] Succeded in dumping all blocks [+] saved 1024 bytes to binary file hf-mf-B4EE8234-data.bin [+] saved 64 blocks to text file hf-mf-B4EE8234-data.eml [+] saved to json file hf-mf-B4EE8234-data.json
Writing the dump to a new card*
At this point I thought I hit the jackpot and could just write the dump to any blank MiFare card without issues but no. As I learned then the first block of any MiFare card is called the “Manufacturers block” and it is not writable by default. Therefore there is no way to change the UID on normal MiFare card. However there are some Chinese sellers that sell so called “Magic” or “UID block 0” modifiable cards where block 0 is (re)writable. The proxmark client will tell you if the card will answer to magic commands as highlighted in the command output:
[usb] pm3 --> hf search [=] Checking for known tags… UID : AA B5 11 02 ATQA : 00 04 SAK : 08  TYPE : NXP MIFARE CLASSIC 1k | Plus 2k SL1 | 1k Ev1 [=] proprietary non iso14443-4 card found, RATS not supported [+] Answers to magic commands (GEN 1a): YES [+] Prng detection: WEAK [+] Valid ISO14443-A tag found
At this point we can write the dump to the Chinese card:
[usb] pm3 --> hf mf cload hf-mf-B4EE8234-data.eml [+] loaded 1024 bytes from text file hf-mf-B4EE8234-data.eml [=] Copying to magic card ………………………………………………………. [+] Card loaded 64 blocks from file
Running hf search again to check to see if the process was successful. As can be seen the UID has been changed to that of the target card:
[usb] pm3 --> hf search [=] Checking for known tags… UID : B4 EE 82 34 ATQA : 00 04 SAK : 88  TYPE : Infineon MIFARE CLASSIC 1K [=] proprietary non iso14443-4 card found, RATS not supported [+] Answers to magic commands (GEN 1a): YES [+] Prng detection: WEAK [+] Valid ISO14443-A tag found