Wiki » History » Version 6
Peter, 12/27/2012 02:52 PM
1 | 2 | Peter | h1. RFID Tools |
---|---|---|---|
2 | |||
3 | *Welcome to the RFID Tools Project* |
||
4 | |||
5 | We want to provide a compilation of OpenSource RFID Tools in a "ready to use" state. To make it as easy as possible for you to start "hacking" RFID we decided to provide some Software packages. |
||
6 | |||
7 | 6 | Peter | *Downloads* |
8 | |||
9 | attachment:rfid-tools_1.0.0_amd64.deb |
||
10 | attachment:rfid_tool_usb_stick.img |
||
11 | |||
12 | 2 | Peter | {{toc}} |
13 | |||
14 | h2. RFID Reader Hardware |
||
15 | |||
16 | The Tools provided are tested for the ACS122u NFC Reader alias "touchatag". But the are supposed to work with any reader supported by libnfc. |
||
17 | |||
18 | h3. Where to buy a reader? |
||
19 | |||
20 | |||
21 | *ACS122u "touchatag"* |
||
22 | * *HURRY!* The "touchatag" reader can be purchased with the touchatag project for €19,99 till *31.12.2012*. Afterwards it will be more difficult and much more expansive to get a decent NFC reader to use with this tools. |
||
23 | http://store.touchatag.com/acatalog/touchatag_starter_pack.html |
||
24 | |||
25 | *Proxmark* |
||
26 | * Shops that ship Proxmark are listed here: http://www.proxmark.org/order |
||
27 | |||
28 | *Other Readers* |
||
29 | * In general all readers that are supported by "libnfc":http://www.libnfc.org/documentation/introduction are supported by your tools. Readers are not always cheap and easy to find. Probably the best way is to check ebay or alibaba. |
||
30 | |||
31 | h2. Tools |
||
32 | |||
33 | *NOTICE*: These tools are *not* running in a Virtual Machine as far as we know. There are timing problems communicating with the reader. |
||
34 | |||
35 | *RFID Tools as .deb* |
||
36 | * binary .deb Package for Ubuntu x64 *only* |
||
37 | * containing mfok, fcuk and RFIDLab |
||
38 | 5 | Peter | * download attachment:rfid-tools_1.0.0_amd64.deb |
39 | 2 | Peter | * install prequesists: |
40 | <pre> sudo apt-get install pcscd</pre> |
||
41 | * edit /etc/libccid_Info.plist |
||
42 | <pre><key>ifdDriverOptions</key> |
||
43 | <string>0x0004</string></pre> |
||
44 | * install: |
||
45 | <pre> sudo dpkg -i rfid-tools_1.0.0_amd64.deb </pre> |
||
46 | |||
47 | *Bootable USB-Stick image* |
||
48 | * bootable Debian USB-Stick image file |
||
49 | * containing mfoc, fcuk, RFIDLab and the cyberflex-shell |
||
50 | 4 | Peter | * download attachment:rfid_tool_usb_stick.img |
51 | 2 | Peter | * write to USB-Stick: |
52 | <pre> sudo dd if=rfid-tools_usb.img of=/dev/sdX bs=4096 count=262144 </pre> |
||
53 | * user: root pw: toor |
||
54 | |||
55 | h2. Howto |
||
56 | |||
57 | These are some small Tutorials that show you how to |
||
58 | |||
59 | * Recover Keys on Micfare Classic |
||
60 | * Editing Mifare Classic Cards |
||
61 | * Change UIDS on Mifare Classic Crads |
||
62 | * Read (german) Passports |
||
63 | |||
64 | |||
65 | h3. Key Recovery on Mifare Classic |
||
66 | |||
67 | The short summary is: |
||
68 | Mifare Classic 1k card is organized in 16(0 until 15) sectors with 4(0 until 3) Blocks each with 16 bytes each. |
||
69 | Every 4th Block contains Keys A and B and accessbits, which set the rights to access the according sector. |
||
70 | |||
71 | *mfcuk* |
||
72 | |||
73 | * Can be used if all keys on a Card have been set to non default keys |
||
74 | * Takes ~20 min to recover one key |
||
75 | * Recover a key of a single sector an write it to a keyfile: |
||
76 | <pre>mfcuk -C -v 1 -R 0:A -k keys.mfcuk</pre> |
||
77 | This will recover the key of the first sector(A), which can now be used to recover all keys with mfoc |
||
78 | |||
79 | *mfoc* |
||
80 | |||
81 | * Can be used if at least one key on the Card is a default key and dump the cards content: |
||
82 | <pre>mfoc -O out.mfd</pre> |
||
83 | * or if one key already have been recovered with mfcuk |
||
84 | <pre>mfoc -O out.mfd -K keys.mfcuk</pre> |
||
85 | |||
86 | h3. Editing Mifare Classic Cards |
||
87 | |||
88 | *RFIDLab* |
||
89 | |||
90 | * Get the current dump as *.mfd file |
||
91 | * Dump the card you want to edit. |
||
92 | * Use mfoc or, if the card doesn't use any default keys use mfcuk. |
||
93 | |||
94 | *Editing and writing back to the card* |
||
95 | |||
96 | Start by using RFID-LABS with: <pre>rl</pre> |
||
97 | You can always see the menu again with <pre>?</pre> |
||
98 | Enter mifare classic terminal: <pre>c</pre> |
||
99 | Maybe you have to adjust the size of the console to see the entire menu. |
||
100 | Import the dumped card <pre>n</pre>. Use the *.mdf fiel you made in Step 1. |
||
101 | Look whether you have the rights, to write onto the blocks, you want to change <pre>L</pre> then <pre>Y</pre> |
||
102 | If you have the rights good, if not look in the table, whether you have the rights to change the accesbits. |
||
103 | If you have the rights to change the accessbits, do it with <pre>I</pre> |
||
104 | If you don't have the rights to change the accessbits and can't write values to the desired block you can't change the value on that card. You may need a new empty or old card for your project. You can never edit the values of Sector 0 Block 0. |
||
105 | Now that you have the rights to write to the block start editing the values on the card. |
||
106 | Edit the values in the buffer content with <pre>E</pre> or <pre>B</pre> to the values you wish. |
||
107 | Edit the values with the commands shown, if you make a mistake you can always recover the buffer, before you save. |
||
108 | Afterwards don't forget to save with <pre>S</pre>, before you leave with <pre>X</pre> |
||
109 | Then write the buffer content to the card with <pre>H</pre> |
||
110 | You can verify your work with <V>, note that Blocks with keys are often falsfully recognized as wrong because keys can |
||
111 | 't always be read. So just look for your block. |
||
112 | If necessary for your application, you now have to change the accesbits back to normal. |
||
113 | |||
114 | Done! |
||
115 | |||
116 | Complete card modifications can either be made step by step with the above method or by using a common hexeditor to change all values in your dump to the desired ones (maybe values from a dump from a card you want to clone), before importing it into rfid-lab. But be careful not to overwrite the key and accessbits block, because rfid-lab needs real ones for accessing the card. |
||
117 | |||
118 | You also have the option to use a changeable-uid-mifare card. These are counterfied mifare-cards which are available on the chinese market. The changeable-uid function originally intended to replace cards in a legacy installation. We will use this function to make an exact copy of an existing mifare card. |
||
119 | |||
120 | *Changing the UID* |
||
121 | |||
122 | The UID is stored in sector 0, block 0 right at the beginning but it is a non writeable section. This is also the same with the chinese mifare card so special commands are required. Fortunately this is all mainline and when you have a properly installed libnfc on your computer you already have all the necessary tools installed. |
||
123 | |||
124 | First look up the original card: |
||
125 | |||
126 | <pre> |
||
127 | $ nfc-list |
||
128 | nfc-list uses libnfc 1.5.1 (r1175) |
||
129 | Connected to NFC device: ACS ACR122U PICC Interface 00 00 / ACR122U203 - PN532 v1.4 (0x07) |
||
130 | 1 ISO14443A passive target(s) found: |
||
131 | ATQA (SENS_RES): 00 04 |
||
132 | UID (NFCID1): de ad be ef |
||
133 | SAK (SEL_RES): 08 |
||
134 | </pre> |
||
135 | |||
136 | Then lay down the chinese card and to this: |
||
137 | |||
138 | <pre> |
||
139 | $ nfc-mfsetuid deadbeef |
||
140 | </pre> |
||
141 | |||
142 | |||
143 | And now the uid should be changed: |
||
144 | |||
145 | <pre> |
||
146 | $ nfc-list |
||
147 | nfc-list uses libnfc 1.5.1 (r1175) |
||
148 | Connected to NFC device: ACS ACR122U PICC Interface 00 00 / ACR122U203 - PN532 v1.4 (0x07) |
||
149 | 1 ISO14443A passive target(s) found: |
||
150 | ATQA (SENS_RES): 00 04 |
||
151 | UID (NFCID1): de ad be ef |
||
152 | SAK (SEL_RES): 08 |
||
153 | </pre> |
||
154 | |||
155 | h3. Reading Passports |
||
156 | |||
157 | *cyberflex-shell* |
||
158 | |||
159 | The cyberflex-shell is only available on USB-Stick Package or from "github":https://github.com/henryk/cyberflex-shell |
||
160 | |||
161 | * Start X |
||
162 | <pre> startx </pre> |
||
163 | |||
164 | * Open xterm an start the passport reader application |
||
165 | <pre> cd cyberflex-shell |
||
166 | ./readpass -i -r 1</pre> |
||
167 | |||
168 | * Type the second line of the MTR into the correspondent form an click "open" |
||
169 | |||
170 | h2. Licenses and Credits |
||
171 | |||
172 | *mfoc* |
||
173 | mfoc is available under "GPLv3":https://www.gnu.org/licenses/gpl.html at https://code.google.com/p/nfc-tools/wiki/mfoc |
||
174 | |||
175 | *mfcuk* |
||
176 | mfcuk is available under "GPLv2":https://www.gnu.org/licenses/old-licenses/gpl-2.0.html at https://code.google.com/p/mfcuk/ |
||
177 | |||
178 | *RFIDLab* |
||
179 | RFIDLab is available under "GPLv2":https://www.gnu.org/licenses/old-licenses/gpl-2.0.html at http://runningserver.com/?page=runningserver.content.download.rfidlab |
||
180 | |||
181 | *cyberflex-shell* |
||
182 | cyberflex-shell is available under "GPLv2":https://www.gnu.org/licenses/old-licenses/gpl-2.0.html at https://github.com/henryk/cyberflex-shell |