For MIFARE® 1K sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15. The W option allows writing of special MIFARE cards that can be 'unlocked' to allow block 0 to be overwritten. This includes UID and manufacturer data. Take care when amending UIDs to set the correct BCC (UID checksum). Currently only 4 byte UIDs are supported. Similarly, the R option allows an 'unlocked' read.
So I have successfully extracted Mifare Classic 1k keys using
mfoc
:now I duplicate the file into dump-new.mdf and I modify this with corresponding values. I only intend to edit sector 02, so I do my changes, save file and proceed with upload to card using
As I understand, this looks up every 4th block in
dump.mdf
, extracts key B (the b
after w
in command), and uses this key to write dump-new.mdf
contents into corresponding sectors/blocks on the card.Now it happened to me that I blocked sector 00 by writing probably a damaged version of the file onto the card (access bits were not set properly as mentioned here), so in order to prevent this in future,
- Id like to write only to specific sectors. How to do that?
- If not possible, what happens if some of the sectors do not have write enabled for B but just for key A. by putting arg b into
nfc-mfclassic
call this will result in error. How should I upload an image of the card back to the card? Using key A, key B or both in some specific order?
Thanks guys
Community♦
michnovkamichnovka
1 Answer
After few days of researching and working with libnfc, the answer is no, it is not possible. Always use the dump of the card and edit it with desired values, then save and upload to card using
nfc-mfclassic
michnovkamichnovka