New issue 180 by maxmust...@gmail.com: Format/Overwrite of mifare
classic "fails"
http://code.google.com/p/libnfc/issues/detail?id=180
I cloned a mifare classic card onto an empty card.Now everytime I write to
this card I get a error like this:
[code]failed to write trailer block 3
xnfc_initiator_transceive_bytes: Timeout[/code]
I tried to overwrite the card with the empty dump I got from
http://www.libnfc.org/_media/libnfc/documentation/empty_mfd_example.zip
but it went like this:
[code]thomas@pluto ~ $ nfc-mfclassic w b Downloads/14f1f9d7.mfd clean
Connected to NFC reader: ACS ACR122U 00 00 / ACR122U103 - PN532 v1.6 (0x07)
Found MIFARE Classic card:
ATQA (SENS_RES): 00 04
UID (NFCID1): ec c3 66 d3
SAK (SEL_RES): 08
Guessing size: seems to be a 1024-byte card
Writing 64 blocks |nfc_initiator_transceive_bytes: Timeout
failed to write trailer block 3
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 7
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 11
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 15
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 19
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 23
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 27
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 31
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 35
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 39
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 43
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 47
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 51
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 55
xnfc_initiator_transceive_bytes: Timeout
failed to write trailer block 59
x.|
Done, 4 of 64 blocks written.
thomas@pluto ~ $ nfc-mfclassic w b tim-100 Downloads/14f1f9d7.mfd
Connected to NFC reader: ACS ACR122U 00 00 / ACR122U103 - PN532 v1.6 (0x07)
Expected MIFARE Classic card with UID starting as: 14f1f9d7
Found MIFARE Classic card:
ATQA (SENS_RES): 00 04
UID (NFCID1): ec c3 66 d3
SAK (SEL_RES): 08
Guessing size: seems to be a 1024-byte card
Writing 64 blocks |nfc_initiator_transceive_bytes: Mifare Authentication
Error
!
Error: authentication failed for block 00
thomas@pluto ~ $ nfc-mfclassic w b tim-100
Connected to NFC reader: ACS ACR122U 00 00 / ACR122U103 - PN532 v1.6 (0x07)
Found MIFARE Classic card:
ATQA (SENS_RES): 00 04
UID (NFCID1): ec c3 66 d3
SAK (SEL_RES): 08
Guessing size: seems to be a 1024-byte card
Writing 64 blocks |nfc_initiator_transceive_bytes: Mifare Authentication
Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
nfc_initiator_transceive_bytes: Mifare Authentication Error
!
Error: authentication failed for block 00
thomas@pluto ~ $ mifare-classic-format
Found Mifare Classic 1k with UID ecc366d3. Format [yN] y
Formatting 16 sectors [.mifare-classic-format: No known authentication key
for sector 0
[/code]
I also added the keys that were used to write to the card to the default
keys of mifare-classic-format.
I'm using a touchatag pad 072f:2200 with the acsccid 1.0.2 driver and
libnfc 1.5.1.
Comment #1 on issue 180 by rco...@il4p.fr: Format/Overwrite of mifare
classic "fails"
http://code.google.com/p/libnfc/issues/detail?id=180
Hi,
Don't use this dump nor this tool (nfc-mfclassic) to format a Mifare
Classic tag.
What should I use?mifare-classic-format doesn't work for me.
I get this output:
Found Mifare Classic 1k with UID ec010000. Format [yN] y
Formatting 16 sectors [.mifare-classic-format: No known authentication key
for sector 0
even thought the B key for the sector 0 is known.
Oh and the reason I wrote this post wasn't to say I can't format my cards
this way I posted it because I can't overwrite mifare cards.I got an empty
card and I want to write a modified dump to the card or an old dump and
this just doesn't work (see above)
Comment #4 on issue 180 by rco...@il4p.fr: Format/Overwrite of mifare
classic "fails"
http://code.google.com/p/libnfc/issues/detail?id=180
Which card do you use Mifare Classic or Special Mifare Classic card with
UID customisable ? Because I can't reproduce this bug myself...
About mifare-classic-format, feel free to wrote a patch to support it and
post it under nfc-tools issues system.
I use a mifare classic 1k card and I don't know if the UID is customisable.
It was an "empty card" and the first time I wrote a mc dump it worked
without any problems.After I tried to overwrite the card with another dump
I got this errors even thought I used a dump with all the keys to overwrite
the card.
Hello,
I am experiencing the same error. HW used: Touchatag reader, blank card
from ebay (not changeable UID). What happens is that I can only write to
this card once. Any attempt to write (any mifare dump) after ends with the
error described above. Is there any known fix to this error yet? I did
search at google but no success yet. Or is there any other tool to format
the mifare card? Thanks!
Hello,
I had similar problem and I have found solution. Actually it's workaround.
Before you write new dump into your card you should format it using
mifare-classic-format. But there is problem described in Comment 2: No
known authentication key for sector 0. It's because your card have another
image written - it means KEYs A and B aren't default. You can find those
keys i.e. by breaking your card using mfoc. After that you should edit file
mifare-classic-format.c, actually default_keys[] array, and append there
each of your keys. Each row represents particular key. After that you
should run make, sudo make install.
Now your mifare-classic-format will be able to format your card. After
formatting all KEYs will be reset to 0x00 0x00 0x00 0x00 0x00 0x00. Good
luck!
OK, I have full explenation now. As you know there are 2 different keys:
KEY A and B. Each sector key can have different access permissions. I.e.
read, read-write etc. Those access permissions are stored among other bytes
on card image. It's worth to see Mifare specification;) Now, if you write
your image into blank card, 2 things will happen: Your keys will change and
access permissions will change. After that you will be able to write same
blocks using KEY A, and some blocks using KEY B. You can do that
executing "nfc-mfclassic w a image.img image_with_keys.img", and
next "nfc-mfclassic w b image.img image_with_keys.img". It should work
without card formatting described in my previous comment. I hope this will
help you.
Really good trener.bit !
How do you think nfc-mfclassic should work to prevent from this kind of
annoying ?