MFKey32: Recovering MIFARE Classic Keys from Flipper Zero NFC Captures
This site's existing Flipper Zero NFC guides cover reading, cloning, and emulating cards you already have full access to. MFKey32 is a narrower, more technical topic that sits one layer underneath that: it's the specific method for recovering the cryptographic keys protecting a MIFARE Classic card's sectors from a captured authentication exchange, using the weaknesses in MIFARE Classic's aging Crypto1 cipher. Understanding it is useful both for legitimate access-control and security research work and for understanding exactly why MIFARE Classic has been considered broken for over a decade.
Why MIFARE Classic Keys Can Be Recovered At All
MIFARE Classic protects each memory sector with a pair of 48-bit keys (A and B) and a proprietary stream cipher called Crypto1. Crypto1 was reverse-engineered and shown to be cryptographically weak years ago — the pseudorandom number generator used during authentication has insufficient entropy, and several published attacks (nested, darkside, and the key-recovery approach MFKey32 automates) exploit that weakness to recover valid keys from captured reader-to-card authentication traffic, rather than needing to brute-force the full 48-bit keyspace. This is different from a brute-force attack against a modern cipher; it's a mathematical weakness specific to Crypto1, which is exactly why MIFARE Classic has been steadily replaced by MIFARE DESFire and other AES-based alternatives in new deployments.
Nested vs Darkside vs MFKey32: What Each Attack Needs
AttackPrerequisiteWhat It Recovers Darkside attackCard with at least one weak/default sector, no known key neededOne key, slowly, from cipher weaknesses alone Nested attackAt least one already-known key for the cardAdditional sector keys, much faster than darkside MFKey32A captured reader authentication (not the card itself) — typically from Flipper's NFC "detect reader" / sniffing featureThe key(s) used by that specific reader during the captured exchangeMFKey32 specifically works on data from a reader authenticating against a card, not from a card in isolation — you're capturing the exchange between a real access-control reader and a card presented to it (with the card owner's knowledge and authorization in a legitimate use case), then extracting the key mathematically from that captured authentication data rather than from the card's memory directly.
Capturing the Data on Flipper Zero
Flipper Zero's NFC app includes a "detect reader" mode that, when a card is presented to a genuine reader while the Flipper is positioned to capture the exchange, logs the authentication data needed for MFKey32 analysis. This capture step happens on-device and produces a log file saved to the SD card; the actual key-recovery computation is not run on the Flipper itself; it's exported and processed on a PC using an MFKey32-compatible tool, since the computation is beyond what the Flipper's hardware needs to do on-device for this workflow.
Running the Recovery
Move the captured log off the Flipper's SD card via qFlipper or the CLI, and run it through an MFKey32 implementation (available as a standalone command-line tool and integrated into several NFC research toolchains). The tool processes each captured authentication attempt and outputs any keys it successfully recovers; a single capture may yield zero, one, or multiple sector keys depending on how many distinct authentications were captured and how many used weak or reused keys. Recovered keys can then be loaded into the Flipper's NFC key dictionary, which improves the success rate of future nested attacks against sectors on the same card or other cards issued from the same system that reuse the same key material.
Why This Matters Beyond the Technique Itself
The reason MFKey32 recovery works at all on real-world deployments is key reuse: many MIFARE Classic access-control systems use the same key (or one from a small known set) across every card and reader in the building, which means recovering one key from one capture can compromise the entire system rather than a single card. This is the practical lesson for anyone specifying or auditing access control: MIFARE Classic with default or shared keys is not meaningfully secure against a motivated attacker with commodity hardware, and any new deployment should default to MIFARE DESFire, iCLASS SE, or another AES-based credential instead.
Legal and Ethical Considerations
Capturing authentication data from a reader and card you do not own or have explicit authorization to test is unauthorized access under computer fraud and unauthorized-access laws in most jurisdictions, regardless of whether the underlying cipher is weak. Legitimate uses are security research on systems you own or are contracted to assess, penetration testing engagements with documented scope and authorization, and understanding your own building's or organization's access-control exposure with permission from whoever owns that system. This site covers Flipper Zero's RFID/NFC capabilities elsewhere in more general terms alongside a dedicated look at what's actually legal to test; the same responsible-disclosure and authorization principles apply here, and apply more sharply given that a recovered key can compromise an entire card population, not just the one card captured from.
Closing Thoughts
MFKey32 is less a "how to clone a card" trick than a demonstration of exactly why MIFARE Classic's cryptography has been considered broken for well over a decade, and why key reuse across a deployment turns a single captured authentication into a system-wide weakness. If you're responsible for access control anywhere still running MIFARE Classic with shared or default keys, treat this as the argument for migrating to an AES-based credential rather than as a party trick.
Related Guides
- How to Analyze EMV Payment Cards with the Flipper Zero: NFC, APDU Commands, and Security Architecture
- How to Hack RFID and NFC with the Flipper Zero: LF, HF, MIFARE, and iButton
- Flipper Zero: Getting Started with BadUSB, Sub-GHz, and NFC
- How to Read Bad Blocks on a Flipper Zero — NFC Deep Dive
- How to Use Flipper Zero to Test Smart Lock Vulnerabilities
- Scanning and Logging NFC Tags on the Go with Flipper Zero
- Flipper Zero NFC Tools — Reading and Analyzing NFC Tags
- Cloning and Emulating RFID/NFC Cards with Flipper Zero