FreakCard collection
founder: niekt0
depends on:
interested: sargon
software license: various
hardware license: various

Aim of this project is to collect all physical access methods used these days, and analyze possibilities of reading, copying and emulating their tokens.

As a result, this document should provide practical guide for working with access tokens.


The most versatile tool for card reading and emulation is Proxmark3. There are two repositories containing code of x86 client, FPGA and ARM firmware:

The best revision for OS code is rev 838 from old SVN repo. All the stuff that I checked that should work works.

The latest versions of new repo cause always bootloader to be somehow bricked and requires JTAG to reflash old bootloader (even if fullimage is flashed - bootloader + OS + FPGA image). Instructions for unbricking can be found at the end of ARM debugging page.

There is also a library available for PC/SC readers that supports many kinds of cards, but you need specific reader for each separate card - https://github.com/islog/liblogicalaccess/wiki

Proxmark new versions - RDV4, EVO and pack with PN532 reader with Chameleon mini

PN532-based readers

PN532 based readers:

Software for PN532 readers

Decision tree.

Suppose, that you have unknown token in your hand, and you don't know anything about access tokens. Idiot's guide goes here:

1. Is it contact or contactless? Contact: goto 2, Contactless: goto 100.

2. Does it have only 2 contacts or more? If two, goto 4, if more, goto 10.

4. It is probably dalas ibutton, using 1-wire protocol

10. It is probably some type of contact smartcard. Can you recognize the access interface? If it is usb, (XX picture) goto 15. If it looks like smart card (XXX picture) goto 20.

15. Deskey? XXX

20. Smartcard, XXX

100. Contactless token. If you see “HID” written somewhere on the token, you may try to go directly to 150. Otherwise go to 101.

101. You need to start reading token. Try HF (high frequency) RFID reader and run isotype or lsnfc on the token. Is it recognized? If yes, goto 120. If no, It is probably LF (low frequency) card. Go to 140.

120. High frequency RFID card. (XXX link) So, now determine type of card. In output of isotype or lsnfc you should see some identification string. This is hard to describe in algorithmic way, so use your intelligence and go to 125 or XXX

125. Mifare. In output of isotype or lsnfc you should see some identification string. If you see exact type, go to 127, 128 o 129. If not you can try readmifare1k. If readmifare1k fails (no login failed or unknown key messages, but completely failed to read other sectors), it is probable Mifare Ultralight. UltraLight “cards” tend to be quite small, often flexible. Goto 127. If you can read other sectors, or get login failed messages, it is Mifare Classic or Desfire. Try cracking it with mfoc. XXX link If you succeed, it is Classic, goto 128. Otherwise, it is probably Desfire, goto 129.

127. Mifare UltraLight. See XXX

128. Mifare Classic. Can have 1K or 4K capacity. See XXX

129. Mifare Desfire. Can have 1K or 4K capacity. See XXX

140. Low frequency RFID card. (XXX picture or link) You need to start reading token. Try LF (high frequency) RFID reader and run (on proxmark)

 lf search 

Is it recognized? If no, goto 200.

145. HID

150. EM Microelectronic

200. You are in trouble, the token was not recognized. Try walking whole tree one more time, maybe you made some mistake. Alternatively, you can try to look for all pictures in this document, and identify tag visually. Otherwise, it may be token not known to authors of this guide, or not available at the time of writing. You are dead, sorry.

Tokens used in wild


High Frequency (HF) card



Mifare cards can have various forms. Here are some examples: Token that can be caried on keys, plain card, and isic card.


Very basic device, only UID transmitter. Get id:

~> lsnfc 
device = ACS ACR38U-CCID 00 00 / ACR122U102 - PN532 v1.4 (0x07)
* NXP MIFARE UltraLight
1 tag(s) on device.

Get id: Id is stored in first sector, not encrypted (Answer to Reset contains UID, reading Block 00 should not be necessary to get UID only). For example touchatag can be used for quick read of ID.

Several possible matches:
* NXP MIFARE Classic 4k
* NXP MIFARE Plus 4k

Full read: Use MFOC form nfc-tool to decrypt all encrypted sectors, then whole card can be read, for example by

mfoc -P 500 -O dump.file
./readmifare -r 0

from RFIdiot or

./readmifare -r 0

dumps the card after cracking all keys as well.

MFOC employs the “nested attack” and requires that at least one of the keys is a default key (i.e. requires one known key). Cracking the first key can be done via Proxmark (may not work if the card is new and has PRNG fixed):

hf mf mifare

After the first key is cracked, Proxmark also has an implementation of nested attack (A0A1A2A3A4A5 is the known key, the “1” stands for 1K card, “0” means the key is for sector 0):

hf mf nested 1 0 A A0A1A2A3A4A5

Scripting the attack is possible via Lua script, see HOWTO part 1 and part 2.

Clone: There is problem with cloning first sector. All other sectors can be cloned, once decrypted. No completly rewritable cards available on the market now afaik. You can get 1K and 4K mifare classic rewritable cards on many eshops.

Chinese "Magic" Mifare Classic 1K

These Mifare Classic cards have a special HW modification that allows writing block 0 and read/write without knowing A|B key. Writing the first block with UID (01020304 here in sample):

hf mf csetblk 0 01020304040804000910111213141516

First four bytes of sector 0 are the UID.

Important: offset 0x04 is BCC, which is XOR of four previous UID bytes. If you set wrong BCC, you may render the card unselectable (=brick it). Especially if you use first byte of UID 0x88, which is magic number for “Cascading Tag”. It is not possible to emulate more than 4-byte UID - the card does not support SELECT cascading level 2 (command 0x95).

Offset 0x5 contains SAK, two bytes at 0x06 denote ATQA (you might fool readers that card is of different type by changing SAK). In the above example, SAK 0x8 stands for Mifare Classic, ATQA 0x0004 means that anticollision is supported by the card (mind the reversed byte order).

Reading and writing chinse magic mifare can be done in “unlocked” mode with libfnc's utility nfc-mfclassic:

nfc-mfclassic R A magic.mfd  #read whole card without specifying key
nfc-mfclassic W A magic.mfd  #write whole card without specifying key, including rewrite of sector 0

Unbricking Chinese Magic Mifare Classic:

If you set the wrong BCC for UID and can't read the card anymore, you can use some backdoor commands to change sector 0 using Proxmark:

hf 14a raw -a -p -b 7 40
hf 14a raw -p 43
hf 14a raw -p -c a0 00
hf 14a raw -p -c de ad be ef 22 08 04 00 46 59 25 58 49 10 23 02

Alternatively, libfnc has nfc-mfsetuid utility that can set UID of the magic card or can revert bad BCC (may not always work). If stuck, put together a working normal Mifare card and a bricked magic Mifare card, then run nfc-mfsetuid (anticollision will work with first card, but the bricked card will “hear” the change sector commands).

Proxmark currently implements “chinese backdoor check” as extra functionality (tested on version 2.3.0 from April 2016). It's implemented via 0x40 and 0x43 backdoor commands:

proxmark3> hf 14a reader
 UID : 34 79 5f ad           
ATQA : 00 04          
 SAK : 88 [2]          
TYPE : Infineon MIFARE CLASSIC 1K          
proprietary non iso14443-4 card found, RATS not supported          
Answers to chinese magic backdoor commands: YES          
Chinese "Magic" Mifare Classic 4K

Block 0 is writable through normal Mifare Classic commands, i.e. there is not special “unlocked” read/write like in “magic Mifare 1k” version.

Writing block 0 with Proxmark, UID 01020304, using key A being FFFFFFFFFFFF:

hf mf wrbl 0 a FFFFFFFFFFFF 01020304040000000000000000000000

Again, watch out to have correct BCC and avoid Cascading Tag (0x88) as first byte of UID, or you may make the card unselectable (i.e. brick it).

UID emulation with Proxmark
hf mf sim 123456AB

123456AB is card id in this example.

Currently, proxmark have an issue, so you may need to set mode first:

hf mf eset 0 123456AB112233445566778899001122

to tell proxmark to use 8-byte ID. The longe number here is the firs sector of card. (containing ID, btw)

  • ID emulation works fine, however with current code, there are timing problems

with emulation of whole card.

  • If sector data are used to auth to a reader you have to be lucky. If a reader is tolerant enough to wait for Proxmark, it'll work. But most of the times you'll run into timing issues with production readers (NXP cards respond in microseconds while Proxmark does in milliseconds, auch)

Many of proxmark3 revisions are buggy when it comes to simulating, known good revision is for example old SVN rev 839.


Multiple versions available

  • MIFARE DESFire D40

In order to find out you have Desfire, check SAK in anticollision. Then use get version command to see which Desfire version it is.

Has “applications” and several file types, but much more limited than Javacard (read, write, increase, decrease, add record, …, see specs below). Some features:

  • Virtually no limitation on number of applications per PICC (new)
  • Up to 32 files in each application (6 file types available: Standard Data file, Back-up Data file, Value file, Linear Record file, Cyclic Record file and Transaction MAC file)
  • File size is determined during creation (not for Transaction MAC file)
  • DES, 3DES, AES encryption, depending on version
  • EV2 supports proximity check against relay and ECC signature for UID (originality check)

Command specifications (non-NDAed), with detailed formats for command data request and response formats: https://www.jadaktech.com/skyetekfiles/docs/m2/desfire.pdf

Short MF3D(H)x2 MIFARE DESFire EV2 contactless multi-application IC. Contains command list, memory organization, file types, etc.

Desfire Access Tool - old Qt4 application for accessing and managing Desfire cards. Still works as of Nov 2018, though expect bugs. Uses libfreefare, which in turn uses libnfc and PN53x readers.

Has native and wrapped ISO 7816 command modes: https://ridrix.wordpress.com/tag/desfire-commands/

Full read: No working crpyto attack so far, unencrypted sectors can be read, also you can try to look for default keys.

Clone: probably require full read

Emulate: probably require full read

Relay: see Relay attack; EV2 spec says it has relay attack protection, but no details.

Ultralight C, Ultralight EV1 and NTAG2

EV1 compared to old Ultralight has added 32-bit password for read/write access, ECC signature (static over UID, so copyable), OTP.

Ultralight C has 3DES authentication on top of Ultralight features.

NTAG2 is succesor to NTAG1, serves as NDEF Forum Type 2 tag. Has ECC signature, read counter, 7 byte UID, SLEEP mode (enable/disable card).

Proxmark3 can simulate some of the features of Ultralight EV1/C, though the ECC signature seems missing (read works). There is iceman's fork which seems to be able to simulate EV1.

Ultralight EV1 and NTAG2/1 can be copied onto Magic NTAG21x with proxmark.

Magic NTAG2x, magic Ultralight C and magic Desfire

IceSql sells “magic” cards to simulate NTAG2/NTAG1, Ultralight EV1 and others.

There is a special Lua script for proxmark to program them.

Information about the cards from proxmark (hf mfu i):

proxmark3> hf mfu i

--- Tag Information ---------          
      TYPE : MIFARE Ultralight (MF0ICU1) <magic>          
       UID : 11 22 33 55 66 77 88            
    UID[0] : 11, Emosyn-EM Microelectronics USA          
      BCC0 : 44, crc should be 88          
      BCC1 : FF, crc should be CC          
  Internal : FF, not default          
      Lock : ff ff  - 1111111111111111          
OneTimePad : ff ff ff ff  - 11111111111111111111111111111111
proxmark3> hf mfu i

--- Tag Information ---------          
      TYPE : MIFARE Ultralight C (MF0ULC) <magic>          
       UID : 00 00 00 00 00 00 00            
    UID[0] : 00, no tag-info available          
      BCC0 : 00, crc should be 88          
      BCC1 : 00, Ok          
  Internal : 00, not default          
      Lock : 00 00  - 0000000000000000          
OneTimePad : 00 00 00 00  - 00000000000000000000000000000000
--- UL-C Configuration          
 Higher Lockbits [40/0x28] : 00 00 00 00  - 0000000000000000          
         Counter [41/0x29] : 00 00 00 00  - 0000000000000000          
           Auth0 [42/0x2A] : 00 00 00 00  default          
           Auth1 [43/0x2B] : 00 00 00 00  read and write access restricted          
         deskey1 [44/0x2C] : 00 00 00 00  []          
         deskey1 [45/0x2D] : 00 00 00 00  []          
         deskey2 [46/0x2E] : 00 00 00 00  []          
         deskey2 [47/0x2F] : 00 00 00 00  []          

 3des key : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00           

This shop sells lot of different changeable UID cards and keyfobs, 4-byte and 7-byte, including UID changeable Desfire/

Magic Desfire

The “magic Desfire” is far from real Desfire, e.g.

  • writing NDEF file seems to succeed, but read fails, you get just zeros
  • libfreefare segfaults with the magic Desfire
  • any SELECT APDU is responded to with OK, but there are no real applications

In short, waste of money.

Setting UID on magic Desfire with Proxmark:

hf 14a raw -s -c 02 00 ab 00 00 07 UID
other mifare cards

There are some other types of mifare cards, but now widely deployed, at least no in .cz and .sk:

  • SmartMX
  • DESFire EV1
  • Plus
  • SAM AV2

see http://en.wikipedia.org/wiki/Mifare for more info.

Relay attack

All MIFARE cards are prone to relay attack (cz: přepojovací útok). It will be interresting to design a low-cost relaying device. Google 'mifare relay attack' for more…

NXP claims the the upcoming DESFire EV2 will have countermeasures against relay attack, but there is no available documentation as of now.

You need two PN532 devices to use with libnfc and use nfc-relay-picc. There is an issue if you use forwarding over TCP/IP as described in the manual - it doesn't work, see patch.

You need a third reader if you want to test it (not necessarily PN532). Two devices relay and the third will be your “original reader”

If the third device is Proxmark, you can send APDUs like this (an example how to read NDEF 4 Forum tag) :

hf 14a raw -p -b 7 -a 26
hf 14a raw -p 93 20
hf 14a raw -p -c 93 70 88 04 3a 14 a2
hf 14a raw -p 95 20
hf 14a raw -p -c 95 70 82 cc 22 80 ec
hf 14a raw -p -c e0 50
hf 14a raw -p -c 02  00  a4  04  00  07  d2  76  00  00  85  01  01
hf 14a raw -p -c 03  00  a4  00  0c  02  e1  04
hf 14a raw -p -c 02  00  b0  00  00  00

The lines with '93 20' and '95 20' commands contain two halves of Desfire 7-byte UID, 0x88 is the cascading tag. An example with 4-byte UID (happens usually when relaying via nfc-relay-picc) :

hf 14a raw -p -b 7 -a 26
hf 14a raw -p 93 20
hf 14a raw -p -c 93 70 08 3A 14 82 A4
hf 14a raw -p -c e0 50
hf 14a raw -p -c 02  00  a4  04  00  07  d2  76  00  00  85  01  01
hf 14a raw -p -c 03  00  a4  00  0c  02  e1  04
hf 14a raw -p -c 02  00  b0  00  00  00

ISO 15693 cards

These are vicinity cards on 13.56 MHz that are commonly found on ski lifts. In theory ISO15693 is designed to work up to 1.5 m distance.

Proxmark can read them and so can some android phones.

They contain UID and 64 bytes of data. Reading with proxmark can be done with:

hf 15 dumpmemory

Latest proxmark 2.3.0 has some basic ISO 15693 simulation functionality, but it's not working properly yet.

AFAIK there are no “Chinese backdoored clones” that would allow changing of UID.

Low Frequency card

Emulation in general: http://www.t4f.org/en/projects/open-rfid-tag/55 this looks like a very nice generic emulator for LF, some hw guru could look into assembling it? lukash willing to help :)

proxmark - determine LF card type: New: You can use command

lf search

Manual way http://code.google.com/p/proxmark3/wiki/TagOps (outdated, bud principles are still same) in short:

proxmark> lf read

proxmark> data samples 2000

proxmark> data plot



Usage around: Quite common building access system

Get id/Read:

Put tag onto the antenna, following code will read HID tags in a loop:

proxmark3> lf hid fskdemod


proxmark3> lf hid sim 01020304


proxmark3> lf hid clone

Cloning requires writable T55xx card.

Proxmark has a standalone mode that will read and then emulate HID Prox card.

EM Microelectronic

Usage around: several parking lots in Prague, some building access systems

Get id/Read:

proxmark> lf em4x em410xwatch

The em410xwatch command may not always correctly guess the clock speed on some cards. You might have to specify clock speed as last parameter of 'em410xread' command (may take several tries). Here is an example for a 134 kHz card (note the 'h' after 'lf read')

proxmark3> lf read h
proxmark3> data samples 40000
proxmark3> lf em4x em410xread 32


Emulation with Proxmark works great Emulator like this http://www.t4f.org/en/projects/open-rfid-tag/57 in progress (lukash working on it)

EDIT: site is down right now, downloaded data available at http://kyberia.cz/~niekt0/openrfid/ and http://pain.backstep.net/lukash/openrfidtag/


XXX This hw works http://www.dealextreme.com/p/125khz-rfid-card-copier-duplicator-with-writable-rfid-card-and-keychain-standalone-operation-17230 XXX cloning/writing with proxmark?

Cloning to writable T55xx should work.


Get id/Read:

proxmark data samples 1000
proxmark> lf indalademod





Usage around: building access system

This information pertains to model Paradox C704. Full decoding in proxmark is implemented, in the latest git version. The modulation is Fc/8/10 FSK, thus raw data transmitted by the tag can be read with:

proxmark3> lf read
proxmark3> data samples 40000
loaded 40000 samples          
proxmark3> data plot
proxmark3> lf paradox demod
Paradox TAG ID: 000328176 (Full ID: 0ca05dadf) - FC: 50 - Card: 33142 - Checksum: b7 - RAW: 0f555555a5995566a699a6aa          


Latest proxmark code has clone Paradox to T5577 command. Iceman's fork has emulation.

pm3 --> lf paradox sim 50 33142
Simulating Paradox - Facility Code: 50, CardNumber: 33142

T55x7 universal emulation card

The T55x7 card can be configured to emulate many of the 125 kHz tags. Proxmark forum gives general configuration and also some specific configurations for common cards.

HID cards have explicit command in Proxmark client:

lf hid clone 2006ca4b3b

Similarly, there are builtin commands to clone EM410x, Indala cards, for example:

lf indalaclone 50920439d
lf em4x em410xwrite 1a007940fd 1 64


Wiegand is:

  1. A specific reader-to-card interface
  2. A specific binary reader-to-controller interface
  3. An electronic signal carrying data
  4. The standard 26-bit binary card data format
  5. An electromagnetic effect
  6. A card technology

Radio chips XXX

  • hcs300 ( KEELOQ )
    • Can be broken XXX
  • NXP UCODE (passive UHF)

RF Theory and antennas

Magnetic card

Magnetic cards can be relatively easily readed and modified. Typicall card contains 2 or 3 track, each with few dozens of characters. More detailed information can be found on Wikipedia

We made a HIGH POWER MagneticCard emulator based on MAgnetic card sp00fer . We used Brmduino for generating the signal so the coil is powered only by 5V (the laptop is just the power source for brmduino). Source code download. (magnetic_card_emulator.pde)

Another solution is to use professional reader/writer. At brmlab, we have available MSR605 reader/writer supporting 3 tracks, working under Linux.

userland driver and documentation available here

Reading values from the card:

$ python msr.py -r -d /dev/ttyUSB0

Writing values to the card:

$ python msr.py -w -d /dev/ttyUSB0 -t 23 --write "1234" "5678"


Pictures of SALTO iButton, typically used as an access token.

DS1990A - 64 Bit ID (in fact only 56 bits are used)

Datasheet here: http://www.maxim-ic.com/datasheet/index.mvp/id/2829

Get id (~= read): It's very easy to read this tag with Arduino, you need OneWire library to make it even easier, downloadable here: http://www.pjrc.com/teensy/td_libs_OneWire.html

Schematics: http://tushev.org/images/stories/arduino/scheme4ibutton.png (forget the display, code has been modified for Serial only!)

Code for Arduino:

#include <OneWire.h>

OneWire ds(12);
byte addr[8];
String keyStatus="";

void setup(void) {

void loop(void) {
  Serial.println("Reading now..");
      for(int j = 0; j < sizeof(addr); j++) {
           Serial.print(addr[j], HEX);
           if (j<sizeof(addr)-1) {
  else if (keyStatus!="") { Serial.print(keyStatus);}

void getKeyCode(){
  byte present = 0;
  byte data[12];
  if ( !ds.search(addr)) {

  if ( OneWire::crc8( addr, 7) != addr[7]) {
      keyStatus="CRC invalid";
  if ( addr[0] != 0x01) {
      keyStatus="not DS1990A";

Example output:

Reading now..
Reading now..
Reading now..


0x1 - 1 byte - Tag identifier
0xAA - 0xFF - 6 bytes - UID itself
0x2F - 1 byte - CRC8 over previous 7 bytes


nice emulation for ID-only iButtons: http://www.reteam.org/board/showthread.php?t=1332

Writing/cloning: http://www.youtube.com/watch?v=KBX_BcFEcAI XXX

Contact Smart cards

smart card emulator project …


What wikipedia tell us about ISO/IEC 7816


Biometric sensors


Iris recognition

Retinal scan

Voice recognition


Mechanical safes

Physical keys ;)

Proof of concept for printing FAB keys: http://kyberia.cz/~niekt0/fap-fap

TODO: OpenScad program to be released under gnu-gpl, input: long/short, profile number (int), key combination (from 00000 to 99999)

ala http://eclecti.cc/hardware/physical-keygen-duplicating-house-keys-on-a-3d-printer

TODO: key combination extraction from photography, ala http://vision.ucsd.edu/~blaxton/sneakey.html

HW available in brmlab

  • HF reader/writer Touchatag (for mifare cards), (+1 niekt0, +1 lukash), Mifare Classic cards (ruza)
  • Proxmark + LF & HF antenna (niekt0, lukash)
  • Reprap(s)
  • Eclo 1 wire USB reader (niekt0)
  • DIY magnetic strip reader/writer
  • OMRON V3A-1K magnetic stripe reader (lukash - let me know if you want to try something out) - works great as a reader with Arduino, code for reading: omron_binary_read.pde, you can then easily interpret these binary data, it only depends whether it's ALPHA or NUMERIC encoded, refer to this paper to read more. You can use scripts to parse these data: parse_alpha.php and parse_numeric.php

HW missing in brmlab

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki