Skip to main content
Be Bitwise

NFC Security

Bluetooth & Wireless Attack Surfaces · Mobile Advanced Security track

10 min read

In this module

Near Field Communication Fundamentals

NFC operates at 13.56 MHz and is built for very short-range communication — usually under 10 centimetres. That physical constraint is both NFC's headline security feature and its most misunderstood property. The short range makes casual eavesdropping harder than with Bluetooth or WiFi, sure, but it doesn't make it impossible. Purpose-built antennas have pulled NFC signals out of the air several metres away in lab conditions.

NFC supports three operating modes:

  • Reader/Writer mode: The device reads or writes data to a passive NFC tag. Used for reading transport cards, smart posters, and asset tags.
  • Peer-to-peer mode: Two active NFC devices exchange data. Used by Android Beam (now deprecated) and similar features.
  • Card Emulation mode: The device emulates a contactless smart card. Used by Apple Pay, Google Pay, and transit card emulation.

NDEF: NFC Data Exchange Format

NDEF is the standard data format used by NFC tags and peer-to-peer exchanges. An NDEF message wraps one or more NDEF records, each with a type and payload:

  • URI record: A URL. Phone reads the tag, browser opens the link.
  • Text record: A plaintext string with a language code attached.
  • MIME record: Arbitrary data carrying a MIME type (e.g., application/json).
  • Smart Poster record: A URI bundled with a title and optional icon, aimed at marketing tags.

NDEF Security Concerns

NDEF ships with zero integrity protection and no authentication. A malicious tag can carry:

  • A URI dropping you on a phishing page or exploit kit.
  • A WiFi configuration record that joins the device to a rogue access point.
  • A Bluetooth pairing record that kicks off pairing with a malicious device.
  • An application launch record that fires a specific app with attacker-controlled parameters.

Slap one of these tags onto a poster, a bus stop, the underside of a restaurant table — anywhere a curious phone might tap — and wait. It's NFC's flavour of QR-code phishing.

NFC Tag Manipulation

NFC tags have no authentication by default. Any device with write capability can overwrite an unprotected tag's contents. Replace the legitimate URL on a smart poster with a phishing link. Stick a malicious tag straight onto a payment terminal. Some tag types do support password-protected writing, but it's spotty in practice — and even where writes are locked, read access stays wide open.

NFC Payment Security

Contactless payments are the highest-value NFC use case, and they wear the most elaborate security model. To assess any of it, you need to understand the split between Secure Element and Host Card Emulation.

Secure Element (SE)

A Secure Element is a tamper-resistant hardware chip — typically a smartcard microcontroller — soldered into the device. Payment credentials (card number, cryptographic keys) live inside the SE and never leave. When a payment runs:

  1. The payment terminal sends a command to the phone via NFC.
  2. The NFC controller routes the command to the Secure Element.
  3. The SE processes the command, generates a cryptogram (a one-time signature proving the transaction's authenticity), and returns it.
  4. The phone transmits the cryptogram to the terminal via NFC.

The application processor — where apps actually live — never sees the payment credentials. A rooted, malware-riddled phone still can't pull keys out of the SE, because the SE is its own physical chip running its own operating system.

Host Card Emulation (HCE)

HCE, introduced in Android 4.4, lets the application processor emulate a contactless card without a Secure Element behind it. Payment credentials sit in software (or in a cloud-side token vault) rather than locked inside tamper-resistant hardware.

HCE compensates with tokenisation: instead of holding the real card number, it holds a token — a substitute number good for a small number of transactions or a short time window. Steal the token and you've stolen something with a quickly-expiring shelf life.

Apple Pay vs Google Pay

Apple Pay rides on a dedicated Secure Element inside every iPhone. The real card number (PAN) never gets stored at all — Apple Pay keeps a Device Account Number (DAN) in the SE, and each transaction produces a dynamic security code from the SE's keys.

Google Pay (now Google Wallet) is built on HCE with cloud-based tokenisation. The phone holds a network token and a supply of limited-use keys that it tops up from Google's servers, and the transaction runs in the app processor. The device's TEE or StrongBox guards the keys that bind the wallet to the device and check the user's unlock, but there's no payment applet sitting in a secure element the way there is on iPhone.

NFC Relay Attacks

The Wormhole attack — an NFC relay — is the practical threat that should keep contactless payment designers up at night. It exploits a single oversight: NFC payment protocols never verify the physical distance between card and terminal.

How It Works

Two attacker devices, one job:

  1. The Mole: A modified phone or piece of custom hardware held near the victim's contactless card or phone. It speaks NFC to the card.
  2. The Proxy: A device shoved up against a real payment terminal, emulating a contactless card.
  3. The Mole and Proxy stay tethered over WiFi, cellular, or Bluetooth.

Tap the Proxy on the terminal and the terminal fires ISO 14443 commands. The Proxy forwards them across the network to the Mole. The Mole presents them to the victim's card over NFC. Responses ride back through the same chain. As far as the terminal can tell, it just talked to a card sitting on top of it.

Here's a simplified EMV contactless transaction with the relay spliced in. Every command and response takes the long way round, including the one that matters: the cryptogram that signs the amount and the terminal's fresh unpredictable number. The card signs exactly what the real terminal asked for, so nothing in the cryptography looks wrong.

Timing Constraints

NFC protocols set a Frame Waiting Time (FWT) — the longest the terminal will sit waiting for a response. A relay has to round-trip inside that window. The card announces that window itself, anywhere from about 0.3 ms to about 5 seconds, and in a relay the terminal hears that announcement from the Proxy, which can simply ask for the maximum. That much slack covers network hops of any realistic length.

Mitigations

  • Distance bounding protocols: Cryptographic schemes that measure card-to-terminal distance by timing challenge-response exchanges. Mostly absent from real payment systems.
  • Transaction limits: Contactless taps are capped per transaction before a PIN gets demanded.
  • Behavioural analysis: Payment networks flag impossible patterns — a card hitting two distant terminals within minutes, that kind of thing.
  • EMV Relay Resistance Protocol: newer EMV contactless kernels (Mastercard's first) time a dedicated exchange of fresh random numbers and reject the card if the answer comes back too slowly. Terminal and card support is still patchy.

Relay research hasn't stood still either. In 2021, researchers at the Universities of Birmingham and Surrey showed that Apple Pay's Express Transit mode with a Visa card could be relayed from a locked iPhone to a non-transit terminal and charged for large amounts, because the phone thought it was talking to a ticket barrier.

NFC Tag Cloning

Mifare Classic Vulnerabilities

Mifare Classic is one of the most widely deployed NFC card types on Earth — transport systems, building access, payment cards. It runs a proprietary algorithm called Crypto-1, which has been thoroughly and embarrassingly broken.

The headline attacks:

  • Darkside attack: A flaw in the authentication protocol (encrypted error codes and leaky parity bits) gives up a first key with nothing more than wireless access to the card. No known key needed, but it only works on older cards with the weak random number generator.
  • Nested attack: If you know one sector key (from darkside, or a default key, which many cards still ship with), a weakness in Crypto-1's RNG recovers the rest of the sector keys in seconds.
  • Hardnested attack: The answer to "hardened" cards that fixed the RNG. Statistical biases in the Crypto-1 keystream still leak the other keys, given one known key to start from and a lot more samples to chew on.
  • Static encrypted nonce attacks (Quarkslab, 2024): the newest "hardened" clones, such as Fudan's FM11RF08S, closed the earlier holes with a static encrypted nonce, and Philippe Teuwen still found attacks on it, along with a hardware backdoor key that unlocks every sector.

MFOC (Mifare Classic Offline Cracker) and MFCUK automate the attacks end-to-end. The Proxmark3 and Flipper Zero are the go-to hardware for tag analysis and cloning.

Mifare Classic Insecurity

Crypto-1 is fundamentally broken. Darkside gets a first key from nothing more than wireless access to older cards; nested and hardnested turn one known key, including a default one, into every sector key. Once you have the keys, you can clone the card to a blank Mifare Classic or emulate it from a Proxmark3. Any system still leaning on Mifare Classic for access control or payment is running on broken cryptography. Mifare DESFire (which uses AES) is the standard upgrade path.

Mifare DESFire

Mifare DESFire (and DESFire EV2/EV3) swaps Crypto-1 for AES-128 or 3DES. It supports mutual authentication, encrypted communication, and configurable access control per application and per file. No practical cryptographic attack against DESFire is publicly known.

Implementation flaws can still bite, though. Differential power analysis against the DESFire chip has been demonstrated in academic settings, and a poorly configured deployment — default keys, unencrypted files — wipes out the cryptographic upgrades you paid for.

NFC on Mobile: Security Models

Mobile NFC stacks layer their own policies on top of the NFC protocol itself:

  • iOS: Tag reading is gated behind specific app capabilities. For years card emulation belonged to Apple Pay and the Secure Element alone. Since iOS 17.4 in the EU, and iOS 18.1 in a growing list of other countries, Apple lets approved apps use the NFC and Secure Element APIs or host card emulation, but only under an entitlement Apple grants case by case. The attack surface is still small next to Android's.
  • Android: HCE lets any app register as a card emulator, and NFC read/write is open to any app holding the NFC permission. That flexibility comes with a wider attack surface: a malicious app with NFC permission can hijack NFC intents and answer back to readers.

Transit Card Emulation

Both platforms now support transit card emulation (Express Transit on iOS, Express Mode on Android) that works without unlocking the device or authenticating. Convenient, yes. It also means a stolen phone can be used for transit without the thief ever knowing the passcode — though the damage caps out at transit fares, and you can switch the feature off.

Key Concept
NFC Attack Surface

NFC's attack surface spans three domains: tag manipulation (overwriting unprotected tags with malicious content), relay attacks (extending NFC range through network-connected proxy devices to perform unauthorised transactions), and card cloning (recovering cryptographic keys from legacy card types like Mifare Classic). The short range of NFC provides limited physical security, but it is not a substitute for cryptographic authentication, distance bounding, or tamper-resistant key storage.