0

I'm attempting to write a program to guess a block key of one of my MIFARE Classic 1K cards.

Is it feasible to to maybe run something like this?

int i = 0x0;
while (true)
{
  i += 0x1;
  Console.WriteLine(string.Format("0x{0:x8}", i));
}

I understand that there are impracticalities of running a simple count, but would this have any degree of success?

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
JJC
  • 25
  • 1
  • 1
  • 3
  • You need to check 281474976710656 possible keys. Assuming that you can check one key every 25ms (reader & card delays, etc.) - in the worst case scenario you'd need to wait ~22623 years for a result. – Qiu Dec 01 '14 at 09:00
  • It's not really clear what your specific problem is (although I suspect it's poor understanding of how a [brute force attack](https://en.wikipedia.org/wiki/Brute-force_attack) works in the first place), given that your question title asks about MIFARE cards, but your code has nothing to do with them. I would suggest that you edit your question to clarify it, and to remove any irrelevant details. – Ilmari Karonen Jun 13 '15 at 08:36

1 Answers1

9

There is more effective attack methods against MIFARE Classic than simple bruteforce. There is 2^48 possible MIFARE Classic keys so bruteforce would effectively take forever. A faster attack is, for instance, the offline nested attack (see here for an implementation). However, this attack only works if you know at least one key of the card. Another attack is implemented by the MIFARE Classic Universal Toolkit. This attack does not require knowledge of any of the card's keys.

Michael Roland
  • 39,663
  • 10
  • 99
  • 206