Hacker trio breaks encryption for MIFARE

March 18, 2008
Researchers peeled back MIFARE chip layer by layer to discover 48-bit key

People are starting to wake up to the fact that some RFID-enabled smartcards now can be far more easily, and cheaply,cracked than ever before, as a trio of young computer experts recently showed.

These are a particular type of processor-embedded cards, and are different from credit cards. The actual decryption work by the researchers was done on the widely deployed Mifare Classic wireless smartcard, now manufactured by a Philips spinoff, NXP Semiconductors. It's deployed for contactless payments, such as the nationwide public transit ticketing system in The Netherlands. If decrypted, the card could be rewritten to access additional services, certain limited personal data such as a birth date could be recovered, and the dollar value of the card's electronic "purse" could be changed.

A recently de-classified study, by a nonprofit Dutch research group, of the claims by the decryption researchers concluded that it is likely they will succeed in recovering the entire encryption algorithm, and eventually build a key cracker. But that will take about six months, the study estimates, and concludes that there are no immediate risks to the Dutch system or its users, and that additional, existing security mechanisms may offer adequate protection.

The earlier version of this story said that the card can be used in debit/credit transactions with the user's bank account.

This is false. The earlier version also said a user's bank data is exposed in this decryption. But according to NXP and the research group's assessment, banking transactions and data are unaffected.

That MiFare Classic card is the basis of such new systems as the Dutch OV-Chipkaart, being rolled out in The Netherlands as part of a multibillion-dollar nationwide transportation ticketing system, and the so-called CharlieCard, used in the Boston, Mass., subway system. The decryption breach triggered a firestorm of controversy in The Netherlands.  The card uses a proprietary encryption scheme, known as the Crypto1 algorithm, to scramble the data exchanged between the card and the card reader, and to securely authenticate the card and reader to each other.

The newest attack was discussed but not (as previously reported) fully demonstrated at the 24th Congress of the Chaos Computer Club in Berlin last December. Interest in the study has been spreading steadily from the arcane world of security hackers.

In a March 6 statement, NXP says it "has established an open dialogue with the researchers and is evaluating possible attacks and countermeasures that could be taken in an overall systems to prevent those."

One of the researchers is Karsten Nohl, a graduate student in the University of Virginia's Computer Science Department, in Charlottesville. The other two are Henryk Plotz and "Starbug." At the Chaos conference, Nohl and Plotz gave some details of an apparently practical, effective way to break the Mifare encryption key, confirming what many cryptographers had suspected.

Nohl has not yet responded to several questions sent via e-mail.

The team used an inexpensive RFID reader to collect encrypted data, and then reverse-engineered the chip to figure out the encryption key to decipher that data. They examined the chip under an optical microscope, used micro-polishing sandpaper to remove a few microns of the surface at a time, photographing each of the five layers of circuitry. Nohl wrote his own optical recognition software to refine and clarify the images, and then patiently worked through the arrangement of the logic gates to deduce the encryption algorithm, a task made possible by the fact that the Mifare Classic relies on a secret key of no more than 48 bits.

"Regardless of the cryptographic strength of the cipher, the small key space therefore permits counterfeiting of any card that is read wirelessly," the team wrote in a follow-up statement issued on Jan. 8. "Knowing the details of the cipher would permit anyone to try all possible keys in a matter of days," the researchers noted. "Given basic knowledge of cryptographic trade-offs and sufficient storage, the secret keys of cards can be found in a matter of minutes."

The Dutch smartcard transit system is overseen by Trans Link Systems, a joint venture created for this purpose in 2002. After the Chaos presentation, Trans Link and the Dutch government asked the Netherlands Organization for Applied Scientific Research (known as TNO) to quickly assess the immediate risks posed to the system, and then to do a more thorough study on the long-term implications. The initial six-page evaluation is dated Jan. 14, and a copy of the declassified report was made available by NXP.

TNO says the researchers' claim to have fully recovered the MiFare Classic encryption algorithm can't be fully verified. But if they haven't, TNO expects them to do so in the near future.

The report confirms that if the algorithm is in fact known, then the MiFare Classic card is vulnerable to a key search attack because of the 48-bit key length. TNO remains convinced that the costs of building a key cracker, in dollars and time, still is far higher than the researchers say. But a sufficient investment would indeed allow an attacker who retrieves a card's encryption key to write fraudulent travel products to the card, manipulate existing products, and increase the card's purse value. It's labor intensive: "Each card has to be broken individually with a newly initiated attack," according to the TNO report.

A critical finding by TNO is that these discoveries do not yet warrant the conclusion that the MiFare Classic is "unfit for public transportation applications." In part that's due to the fact that there are other security mechanisms in place, such as fraud detection and blacklisting, to detect fraudulent transactions and refuse the card. But a full assessment of the overall system security is needed, according to the study, and is the focus of TNO's next investigation.

In the short term, for at least the next six months, the Dutch card system is not at risk from a key breaking attack, according to TNO.

The Dutch transit system actually uses two other types of tickets or cards, and both have been successfully attacked by other researchers.

Nohl and his colleagues noted that other types of NXP RFID tags, such as the Hitag2+ and Mifare DESfire, are not affected by their findings. In its statement, NXP noted that the MiFare Classic is a "low-end chip in a family of products for contactless smartcard applications" but not intended for applications such as banking or auto security or ePassports.

RFID security concerns have become pronounced over the past year or so, as hackers and researchers make more concerted efforts to understand the vulnerabilities. In mid-2007, one team used readily available RFID gear to read the Electronic Product Code data on tagged boxes loaded on a tractor-trailer. A year earlier, another group raised the specter that RFID tags could be infected with computer viruses.