Lets say I'm using NFC cards for access control. NFC cards/stickers are easily readable and writable, so my worry is that the data on them could easily be cloned onto another card/sticker and bypass the security.

My idea to detect cloning is to include 2 pieces of info on each card:

  • User Id
  • Random value

So lets say the following happens:

  1. User A's card is cloned by user B, so now user B also has a card with that data
  2. When user A enters, a new random value is generated and saved both on the card and in the backend. This random value must be presented in the next access attempt.
  3. User B tries to enter with his cloned card containing user A's "User Id", but has an incorrect "Random value", so he is not allowed to enter.

Does this seem like a good way to fix this issue? Are there other ways?

  • 2
    The FeliCa system developed by Sony does something similar to this. Each time authentication is performed, the encryption key is changed on the card so that impersonation cannot occur. At best, it could occur once (immediately after the card is cloned), and then the real user would be unable to enter and would know their security has been compromised. – Aaron D Jun 27 '15 at 3:26
  • As @AaronD said, even your system is vulnerable to a single access by the impersonated person. You are assuming that the valid user enters his card before the cloned user. But what if the cloned user inserts it first.? Then A gets blocked out and comes to know his card was hacked. – user2339071 Jun 27 '15 at 6:34
  • That comment seems good enough for an answer, but i can't find a source where the authentication method is described. – Juha Kivekäs Jun 27 '15 at 6:45
  • A will really "come to know" that she has been hacked, thus not giving the attacker persistent access. – Juha Kivekäs Jun 27 '15 at 6:48
  • 1
    Yeah, at least for my use case (door access for a gym), it isn't too bad if the impersonator gets access once, or if the original user gets locked out once. It's sufficient to detect the clone and get the user a new card code. – zundi Jun 28 '15 at 3:58

The method you propose is actually what is used by some IC card formats including Sony's FeliCa:

FeliCa's encryption key is dynamically generated each time mutual authentication is performed, preventing fraud such as impersonation. (From Wikipedia)

This could be implemented simply by hashing the card ID (or other unique data) and the last system authentication time (in milliseconds provided by your backend server) with a hidden secret as a salt, and writing that to the card each time authentication is performed. When next used for authentication, the backend would rehash the cardID with the stored last access time and make sure they match.

A cloned card would let an attacker impersonate the real user, but the fraud would be discovered the next time the real user tried to authenticate and was unsuccessful (unless the attacker can get repeated physical access to the original card to clone the updated information back).

Other ways the card could be protected include special format NFC cards that require an encryption code to be sent first before the data area becomes readable/writable, preventing card access without knowing the code for the card (I don't know if this conforms to NFC spec or not), or requiring multiple factors for authentication (such as passcodes, biometric information, etc), which would mean that a single factor would not be enough for impersonation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.