Breaking and building encryption in NFC digital wallets 📳

NFC technology is now just a part of everyday life. One day, you can meet it as a developer building new firmware for an NFC device that serves as a digital wallet. Get prepared for the security challenges when using NFC.

Tap-and-go operations are …


This content originally appeared on DEV Community and was authored by Cossack Labs

NFC technology is now just a part of everyday life. One day, you can meet it as a developer building new firmware for an NFC device that serves as a digital wallet. Get prepared for the security challenges when using NFC.

Tap-and-go operations are used so widely and the assembly of an NFC intercepting device is so simple and inexpensive, that NFC exploits are common “in the wild”.

Crypto wallets, unmanned vehicles, access control devices, FIDO2 tokens, NFC tags, or contactless payments—NFC devices are everywhere and are often used for critical actions! And in each case, there must be proper security measures based on a threat model, as the risks may vary. But as a security-aware developer, you can reduce the chances of exploits.

We’ve seen many security problems in NFC key vaults, some of them literally migrate from project to project.

⚠️ For example, developers tend to use “encrypt-then-CRC” (Cyclic Redundancy Check) or “CRC-then-encrypt”, but both those options are unsuitable because the CRC is not designed for cryptographic integrity. The CRC is computed without secret and can be easily changed.

# CRC-then-encrypt example
# NEVER USE IT
def encrypt(key, message):
    iv = b'\x00' * 16
    tag = crc16(message)
    plaintext = tag + message
    ciphertext = aes_cbc_encrypt(key, plaintext, iv)
    return ciphertext

⚠️ Instead of crafting your own integrity checks, prefer AEAD encryption (like AES-GCM), and use a proper MAC, like HMAC, GMAC, or Poly1305.

And this is not a rare thing. Just check other problems NFC devices can bring: replay, passive MITM, timing attacks, encryption flaws, buffer overflow, etc.

💡 Well, so how to mitigate the NFC security risks? First, consider proper threat modelling and suitable secure architecture. Then implement proper security controls. Talk to cryptographers if your system involves encryption (as it should!). And, for sure, do not ignore testing, auditing, and reacting on incident stages.

Click on the image to read in-depth:

Exploring security vulnerabilities in NFC digital wallets

Follow us on Twitter for more.


This content originally appeared on DEV Community and was authored by Cossack Labs


Print Share Comment Cite Upload Translate Updates
APA

Cossack Labs | Sciencx (2023-03-28T21:00:56+00:00) Breaking and building encryption in NFC digital wallets 📳. Retrieved from https://www.scien.cx/2023/03/28/breaking-and-building-encryption-in-nfc-digital-wallets-%f0%9f%93%b3/

MLA
" » Breaking and building encryption in NFC digital wallets 📳." Cossack Labs | Sciencx - Tuesday March 28, 2023, https://www.scien.cx/2023/03/28/breaking-and-building-encryption-in-nfc-digital-wallets-%f0%9f%93%b3/
HARVARD
Cossack Labs | Sciencx Tuesday March 28, 2023 » Breaking and building encryption in NFC digital wallets 📳., viewed ,<https://www.scien.cx/2023/03/28/breaking-and-building-encryption-in-nfc-digital-wallets-%f0%9f%93%b3/>
VANCOUVER
Cossack Labs | Sciencx - » Breaking and building encryption in NFC digital wallets 📳. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/28/breaking-and-building-encryption-in-nfc-digital-wallets-%f0%9f%93%b3/
CHICAGO
" » Breaking and building encryption in NFC digital wallets 📳." Cossack Labs | Sciencx - Accessed . https://www.scien.cx/2023/03/28/breaking-and-building-encryption-in-nfc-digital-wallets-%f0%9f%93%b3/
IEEE
" » Breaking and building encryption in NFC digital wallets 📳." Cossack Labs | Sciencx [Online]. Available: https://www.scien.cx/2023/03/28/breaking-and-building-encryption-in-nfc-digital-wallets-%f0%9f%93%b3/. [Accessed: ]
rf:citation
» Breaking and building encryption in NFC digital wallets 📳 | Cossack Labs | Sciencx | https://www.scien.cx/2023/03/28/breaking-and-building-encryption-in-nfc-digital-wallets-%f0%9f%93%b3/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.