1
votes

I can't authenticate the sector with "key A" after I write new content to the sector trailer block.

My tag is MIFARE Classic 1K and I use "MF_API.dll".

I do this:

  • On a new tag with default config, I authenticate with "key A" and value "FFFFFFFFFFFF", and the result is success.
  • Then, I write AAAAAAAAAAAA078069BBBBBBBBBBBB to the sector trailer.
  • When I then try to authenticate with "key A" and value "AAAAAAAAAAAA", it fails. The same thing happens when I try to authenticate with "key B" and value "BBBBBBBBBBBB".

Where is my mistake?

And my second question: Is there any free software for writing and reading on MIFARE Classic 1K tags?

1

1 Answers

0
votes

The value that you write to the sector trailer seems to miss one byte (the value is only 15 bytes long, but the trailer block is 16 bytes long). See Changing authentication key of a sector in MIFARE Classic for the format of the sector trailer block.

Moreover, the access bits (078069) that you have in your trailer block don't seem to be valid since this would be

C1 = 0x8 and nC1 = 7 (-> check okay)
C2 = 0x9 but nC2 = 0 (-> check not okay, since not(C2) would be 0x6)
C3 = 0x6 but nC3 = 0 (-> check not okay, since not(C3) would be 0x9)

As a result, if you managed to write this to the sector trailer, the sector will be permanently blocked (due to the checksum mismatch in the access bits), see Can I recover a MIFARE Classic card?.

Based on the values you used, I would guess that you actually wanted to write this to the sector trailer:

AAAAAAAAAAAAFF078069BBBBBBBBBBBB

Note that these permissions mean that you can authenticate to that sector with key A only, Key B is readable with those permissions and, consequently, cannot be used for authentication.

Regarding your second question: I would not recommend any specific software. Also, please be aware that this type of question is off-topic here.