1
votes

When I'm triying to read or write a MIFARE Classic card I get the following output:

nfc-mfclassic r a mfoc_output.mfd mfoc_output.mfd 
NFC reader: ACS / ACR122U PICC Interface opened
Expected MIFARE Classic card with UID starting as: 00000000
Got card with UID starting as:                     049f30b2
Aborting!

Any ideas?

Thank you for your answer Michael, but that's not working either This is the output:

nfc-mfclassic r a mfoc_output.mfd
NFC reader: ACS / ACR122U PICC Interface opened
Found MIFARE Classic card:
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04  
       UID (NFCID1): 04  9f  30  b2  
      SAK (SEL_RES): 08  
Guessing size: seems to be a 1024-byte card
Reading out 64 blocks |nfc_initiator_transceive_bytes: Mifare Authentication Failed
nfc_initiator_transceive_bytes: Mifare Authentication Failed
nfc_initiator_transceive_bytes: Mifare Authentication Failed
nfc_initiator_transceive_bytes: Mifare Authentication Failed
nfc_initiator_transceive_bytes: Mifare Authentication Failed
nfc_initiator_transceive_bytes: Mifare Authentication Failed
nfc_initiator_transceive_bytes: Mifare Authentication Failed
!
failed to read trailer block 0x3f

The problem is that I lost the key file and now I can't write or read that tag, i'm triying to generate a key file using mfoc but after dumping keys to a file, nfc-mfclassic still says authentication failed

1

1 Answers

1
votes
nfc-mfclassic r a mfoc_output.mfd mfoc_output.mfd

You are using the file mfoc_output.mfd both as the destination file for dumping the card contents and as a source file for the key material to access the sectors of the card. Typically this is not what you want as this would overwrite your key file.

Expected MIFARE Classic card with UID starting as: 00000000
Got card with UID starting as:                     049f30b2
Aborting!

The problem here is that your key file (specified by the second file name) starts with the bytes 00 00 00 00. However, nfc-mfclassic checks if that file starts with the first 4 bytes of the UID of the MIFARE CLassic tag and will abort the dump procedure if they don't match.

If using the file mfoc_output.mfd as both, the destination file and the key file is really what you want, you can either edit the file to start with the first 4 bytes of the tag UID (i.e. with 04 9f 30 b2), or you can force nfc-mfclassic to use the file anyways, by specifying the "force" parameter:

 nfc-mfclassic r a mfoc_output.mfd mfoc_output.mfd f

If you don't want to use mfoc_output.mfd as the key file, you can simply use

 nfc-mfclassic r a mfoc_output.mfd

instead, which will try to access the MIFARE sectors using some set of default/well-known keys.