Skip to content
← Payment Systems: Magstripe, Tokenization, NFC and EMV

Module 1 of 22 · Foundations · 60 min

Payment systems and security

The fundamentals: how a transaction is verified and processed against the terminal, why the APDU protocol is not encrypted, and what protects the transaction instead.

Free preview
ListenRead aloud · about 60 min
What this module covers
  1. 01A card is also a system that produces data
  2. 02Four parties, and why it matters
  3. 03Four technologies, still all in use
  4. 04The channel does not have to be secret
  5. 05From bytes to fraud
  6. 06The protocol from another angle
  7. 07The first skill in the lab
  8. 08Where the field is, as of 2026
  9. 09Read one exchange, before anything else
  10. 10What the rest of the course does with that
  11. 11The tools this course brings with it
  12. 12How to work through this course

A card transaction can finish in a few seconds. In that window the terminal opens a conversation with the card, runs a sequence of commands and responses, processes application data, performs cryptographic checks and, depending on the authorization flow, may talk to the acquirer and the issuer before deciding whether to approve or decline. What the cardholder experiences as one simple act is an interaction between several systems that do not share a trust domain.

Understanding payment security starts with one distinction. The exchange between an EMV card and a terminal is not an encrypted channel in which everything stays secret. Over contact or NFC it is structured as APDU commands and responses, defined by ISO/IEC 7816 and by the EMV specifications. Confidentiality is not the mechanism EMV relies on for integrity and authenticity. The architecture uses authentication, cryptography, secret keys, certificates, counters and cryptograms to protect particular decisions and particular data.

That distinction matters to anyone doing security research. Being able to observe an APDU trace does not by itself mean being able to modify a transaction usefully, or to exploit it. The question is not only which data can be observed. It is which component produces each field, who can change it, who can verify it, and which decision depends on it.

A transaction has no single point of control either. The cardholder presents the instrument; the merchant supplies the terminal and requests the operation; the acquirer receives and processes the merchant's transactions; the payment network provides the infrastructure and the rules for routing them; and the issuer holds the relationship with the cardholder and takes part in authorization. Each component holds different information and different capabilities, and those differences are exactly what determines where trust sits.

In an EMV transaction the card can produce cryptographic data using keys the terminal does not hold. Depending on the flow, the issuer may later verify a cryptogram the card generated, or validate other cryptographic data tied to the operation. This is why it is wrong to describe EMV as a mechanism in which the terminal verifies the card. The architecture distributes authentication and authorization across the card, the terminal and the systems in the backend.

The situation changes when the terminal has to decide without an online authorization from the issuer. There it can use the mechanisms EMV defines to work out whether the transaction may continue offline, whether because the terminal has no connectivity or because it has been forced offline. That is not the terminal issuing an authorization equivalent to the issuer's. It is the terminal applying the rules and risk mechanisms available locally to decide whether the operation can complete under those conditions.

To analyze a payment system properly, ask the same questions every time. Who generates this data? Who can modify it? Is it authenticated? Who can verify that authenticity? Which component trusts it? What happens if it is wrong, and what does that decision cost the rest of the system? Those questions carry a security investigation much further than memorizing a list of EMV tags in isolation.

A card is also a system that produces data#

The perspective gets clearer with the technologies that came before EMV. A magnetic stripe does not offer the cryptographic properties of an EMV chip. It stores information that a reader recovers through the electromagnetic interaction between the stripe and the magnetic head.

In 2015 Samy Kamkar presented MagSpoof, a device that generates a varying magnetic field a stripe reader can interpret as card data. The project is far more interesting than the device itself, because it demonstrates a principle of hardware security: if a system interprets a physical phenomenon as information, an attacker can study which properties of that phenomenon have to be reproduced for the system to accept the data it is given.

On the stripe, certain fields let the terminal learn characteristics of the application associated with the card. One of them is the service code, whose values can indicate, among other things, that chip processing is available. Be precise here: those stripe fields do not by themselves carry the cryptographic authenticity a chip-based EMV transaction provides. But they are where you can start relating what the stripe says to what the EMV chip holds.

So the problem is not that a magnetic stripe can be emulated. Emulating a signal or a set of data is not very interesting on its own. What matters is identifying which decisions the system takes from that data, and what guarantees exist about its integrity and authenticity.

The pattern repeats throughout modern payment systems. A decision depends on a field; the field arrives from another component; that component may not sit in the same trust domain; and the system finally making the decision may have no independent way to establish whether what it received is correct.

That is why this training does not stop at protocols and data formats. It works on the trust boundaries between card, terminal, firmware, physical interfaces, payment applications, acquirers, networks and issuers. At every one of them the same question applies: what does this component have to believe, what evidence does it have for believing it, and how do you test the implementation?

That question connects things usually studied apart. An observable APDU, a counter, an unexpected firmware response, a CVM decision, an offline authentication mechanism or a contactless interaction can look like separate problems. From a researcher's perspective they all yield to the same model: identify the information, determine where it came from, establish who can modify it, and check what mechanism exists, if any, to detect a modification or an inconsistency.

Four parties, and why it matters#

PartyRole
CardholderHolds the card. Usually the only party who notices when something goes wrong.
MerchantOwns the terminal. Wants the sale to go through, and absorbs the loss on a chargeback.
AcquirerThe merchant's bank. Routes the transaction into the scheme network.
IssuerThe cardholder's bank. Holds the keys, and is the only party that can verify a cryptogram.
Cardholderholds the cardMerchantowns the terminalAcquirermerchant's bankIssuerholds the keystapsauthorization requestvia the scheme network
Each component holds different information and different capabilities, and those differences are what decide where trust sits. Only the issuer can verify a cryptogram.

From your bench

Which Application Identifier does your card offer?

Your card's answer to the PPSE, the directory a terminal reads first.

Checked in your browser. Nothing you paste is uploaded.

No hardware? Do it virtually.

No reader yet: paste the PPSE response from any capture in the corpus. The workbench shows it as the first card response.

Cardpeek card view, EMV tree: FCI Template 6F with Dedicated File (DF) Name 1PAY.SYS.DDF01, and under file 7, record 1, an ADF 70 whose TLV 61 holds Application Identifier (AID) 4F A0000000421010h and Application Label 50 CB.
The PSE directory in Cardpeek
Open the original
Cardpeek card view, EMV tree: FCI Template 6F with Dedicated File (DF) Name 1PAY.SYS.DDF01, and under file 7, record 1, an ADF 70 whose TLV 61 holds Application Identifier (AID) 4F A0000000421010h and Application Label 50 CB.
Fig. 01The PSE directory in CardpeekThe card answers the directory with a list of its applications. Tag 4F is one application's identifier and tag 50 is its name, here CB. None of this is encrypted or signed: it is the first thing anyone with a reader can read.779 × 601

Four technologies, still all in use#

The payment ecosystem today is the result of several generations of technology layering on top of each other rather than replacing each other. One card can support magnetic stripe, EMV over contact and EMV contactless, while the same credential may also be represented by a token in certain payment environments.

Each technology solves different problems and provides different security properties. The magnetic stripe uses data stored physically on the card and, by its nature, produces no new cryptographic value per transaction. EMV introduces an integrated circuit able to run logic and generate cryptographic data tied to the operation. Contactless processing uses EMV mechanisms over an NFC interface, with its own flow differences and timing constraints. Tokenization replaces a credential, or a card number, with an alternative identifier whose use may be limited to a given context.

TechnologyDefining characteristic
Magnetic stripeStatic data that can be read and reproduced. Module 3.
EMV over contactA chip with dynamic processing that generates cryptographic data. Modules 4 and 5.
EMV contactlessEMV processing over an NFC interface, with flows optimized for fast transactions. Module 8.
TokenizationAn alternative credential used to represent a payment instrument within a given context. Modules 7 and 10.
Magstripesame bytes everytimeEMV contactfresh cryptogrameach timeContactlessthe same, on abudgetTokenizednot even the realnumberadds freshnessadds a clockreplaces it
Generations that layered rather than replaced each other. One card can carry all four, and the same instrument travels a different processing path depending on how it is presented.

The most important difference can be put as a question. What information does the payment instrument have to present for a new transaction to be processed?

On a magnetic stripe a significant part of that information stays constant between operations. In EMV the card takes an active part in each transaction and can produce cryptographic values bound to the data of that operation. In contactless those mechanisms run inside a wireless exchange with specific timing and communication requirements. In a tokenized environment the token moving through processing may not be the primary account number originally associated with the instrument.

The channel does not have to be secret#

The captures used in this training contain commands and responses you can inspect directly. That does not mean the system lacks security mechanisms. It means the protection of an EMV transaction does not depend on hiding the whole exchange between the card and the terminal.

APDU traces carry the information needed to run the protocol: application selection, record reads, data processing, authentication and the other operations the payment application defines. Part of that information has to stay interpretable by the terminal for the flow to run at all.

The relevant security property appears when that data later takes part in cryptographic mechanisms, or in decisions governed by specific rules. A capture can reveal the content of a communication without providing the secret keys needed to generate valid cryptographic values.

So a traffic capture has to be analyzed at two levels. First, work out what information the participants exchanged. Then work out what information can be used or altered to produce a new valid transaction.

From bytes to fraud#

Exploiting a payment vulnerability is rarely a single operation. There is a considerable distance between obtaining information from a card and getting that information to produce an economically valid transaction. One useful way to picture it: obtain, then reproduce or modify, then get accepted, then extract value.

Obtaincapture or extractReproduceor modify the dataBe acceptedclear the conditionsExtract valueand evade latercontrols
Four links, and the evidence for a finding stops at whichever one it actually reached. Only the first two are technical.

The first step can be capturing communications or extracting data. The second can involve emulation, protocol manipulation or replaying information. The third depends on the conditions a transaction has to clear to be accepted. The last belongs to a different stage: turning an approved operation into economic gain, and getting past the controls that come after.

That precision matters when you study published attacks. Some manage to alter a processing condition; others manage to change the behavior of the terminal; and only certain scenarios reach a transaction with a demonstrable financial impact.

The protocol from another angle#

So far this has been technologies and security properties. Now look at what actually happens during a transaction. An APDU capture lets you follow the operation from the first command. In a contactless transaction, one of the first steps the application takes can be selecting a structure the terminal already knows about.

Check yourself

The terminal's very first command carries fourteen bytes of name: 325041592E5359532E4444463031. Decode them as ASCII text.

00 A4 04 00 0E 32 50 41 59 2E 53 59 53 2E 44 44 46 30 31 00
00 A4 04 00
SELECT
The command header. It identifies a SELECT operation.
0E
14 bytes
It indicates that the data field carries fourteen bytes.
32 50 41 …
2PAY.SYS.DDF01
The following bytes can be interpreted as ASCII: 2PAY.SYS.DDF01. The terminal is requesting the selection of that identifier.
The terminal's first command. Twenty bytes, and most of it reads without opening a specification.

No cryptographic operation is needed to interpret this part of the capture. It is enough to know the APDU structure and to represent the bytes according to their encoding.

The response can contain TLV structures describing the applications available. Tag 4F identifies an AID, tag 50 provides an application label intended mainly for display, and tag 87 can indicate the priority associated with an application during selection.

A few dozen bytes are enough to establish something important. A card does not necessarily represent a single payment application. It can offer several, and hand the terminal information that takes part in choosing which one gets used. That turns an apparently trivial operation into a sequence of observable decisions: the terminal discovers the applications, obtains their identifiers, evaluates the information available, selects one, and only then begins the processing specific to that application. The capture lets you see every one of those steps.

The first skill in the lab#

This is the kind of analysis the rest of the training uses. It does not start from a theory about what should have happened. It starts from the bytes and reconstructs the processing out of them. One command. One response. One tag. One value. One decision. And then the next interaction.

As the course goes on, more complex structures appear: application records, certificates, public keys, authentication data, CVM, Terminal Verification Results, cryptograms and authorization decisions. The difficulty is not in recognizing each individual field. It is in understanding the relationship between them.

Where the field is, as of 2026#

This is not a closed subject with a fixed syllabus. Results land every year, and some of the ones this course is built on are newer than the course. If you are new here, three papers will orient you faster than anything else, and I would read all three before going far into the modules.

The references page lists everything this course stands on, with a line on each saying why it matters here. If a lesson and a source disagree, the source is right and the lesson is a bug. That has happened a few times. Each correction goes into the module instead of being patched quietly.

Read one exchange, before anything else#

You have read the terminal's half. Now read the card's. What follows comes from the Visa capture in this corpus: a real card at a real terminal, sanitized so the account number is a published test number. Nothing else was touched.

Try it

The card's reply. Find tag 50, twice. Those are application labels, and they are ASCII too.

9000Completed successfully.

  • 84 Dedicated File Name
  • 4F Application Identifier (AID)
  • 50 Application Label
  • 87 Application Priority Indicator
  • 42 Issuer Identification Number
  • 5F55 Issuer Country Code (alpha2)
  • 4F Application Identifier (AID)
  • 50 Application Label
  • 87 Application Priority Indicator
  • 42 Issuer Identification Number
  • 5F55 Issuer Country Code (alpha2)

Found tag 50.

The card did not answer with one application. It answered with two, each in its own template, each with a name a person can read and a priority saying which one the terminal should prefer.

  • Tag
    4F
    Value
    A0000000031010
    What it is
    The first application's identifier. Visa's registered prefix is A000000003; every Visa application on earth starts with those five bytes.
  • Tag
    50
    Value
    "VISA DEBIT"
    What it is
    Its label, as text. This is what a terminal shows on screen, and it is a display string with no security meaning at all. A card can claim anything here.
  • Tag
    87
    Value
    01, then 02
    What it is
    Priority. The card is telling the terminal which application to choose first, and which is the fallback.
  • Tag
    4F / 50
    Value
    A0000000980840
    What it is
    The second application, labeled "US DEBIT". A different network, on the same card, reachable by asking for it by name.
PracticeOpen that capture and keep going. Command 2 selects one of the two applications by its identifier; command 3 asks the card what it needs before it will authorize anything. Both are free to read, with or without an account.Open in the workbench →

What the rest of the course does with that#

This module is the free one and the shortest, and I would rather tell you than let you find out. What you just did, twenty bytes, one response and a real observation at the end of it, is the small version of what the other twenty-one modules do at length.

WhereWhat you take apart
Modules 3–5The stripe first, then the rest of this conversation to the end: the command set, the certificate chain a card carries, and the one cryptogram only the issuer can verify. Module 5 is the longest of the foundations, and it is where the protocol stops being a filesystem and starts being cryptography.
Modules 6–12How a terminal decides it trusts you: the cardholder verification list and the way a card ranks the methods it will accept, the limits that send a transaction online, tokenization, and PCI DSS read as a tester rather than an auditor.
Modules 13–20The published attacks, byte by byte, against the captures in the corpus: cloning and downgrade, pre-play, relay and the distance bounding built to stop it, tap-to-phone, and offline terminals. Module 17 is the longest in the course.
Modules 21–22Researcher level. The authorization leg, meaning what the issuer actually decides on and a real message that admits nineteen different readings, and then the research that is still open, written as questions rather than results.

The tools this course brings with it#

Nearly everything you need is already on this page: the workbench, the decoder you just used and the capture corpus. Beyond that there are three tools this course carries with it, and it is worth knowing they exist from the start, because the modules ahead are built on them. Module 2 goes through all of them, and through the ordinary hardware, in detail.

  • Tool
    ATRIUM
    What it does
    Sits between a card and a terminal and reads, decodes, records and rewrites what crosses.
    Where you meet it
    From module 2 onward. It replays a capture with no hardware, and with a reader it traces a live transaction. Its host layer speaks ISO 8583, which is module 19.
  • Tool
    Plexus
    What it does
    Draws a rig as a graph of nodes, checks it, and runs it.
    Where you meet it
    In the relay work of module 16, where the shape of the rig is the attack, and a chain whose timing runs long is the thing to notice.
  • Tool
    SIMtrace2 T=1
    What it does
    The published T=1 block layer that lets a SIMtrace2 answer an EMV terminal rather than only a modem.
    Where you meet it
    Behind the contact captures you will read here, and in module 22, which says how far that work has been taken.
ATRIUM Mission Control, a six-stage EMV relay pipeline. Stage badges: Hardware NO DEVICE, Relay Session READY, Fingerprint NEEDS SESSION, Attack Surface ARMED with 16 rules, AI Agent NEEDS MODEL, Results 4 CAPTURES.
ATRIUM Mission Control
Open the original
ATRIUM Mission Control, a six-stage EMV relay pipeline. Stage badges: Hardware NO DEVICE, Relay Session READY, Fingerprint NEEDS SESSION, Attack Surface ARMED with 16 rules, AI Agent NEEDS MODEL, Results 4 CAPTURES.
Fig. 03ATRIUM Mission ControlThe six stages of a session, each saying what it still needs before it can run. I would always start on this screen: it tells you whether the problem is the reader, the session or the model before you go looking elsewhere.2880 × 1800

How to work through this course#

Every module from here refers to a real captured transaction, and you can open any of them whenever you like. Reading about an APDU is worth an hour. Seeing one in the workbench and recognizing the field being described is worth much more. If you want your own hardware, an ACR122U for contactless and an SCR3310 for contact will get you through most of this course; a PN532 board, a Proxmark3 and SIMtrace2 come in later, and module 2 covers the setup. None of it is required to read the captures here.

PracticeOpen a short contactless transaction now, before you know how to read it. Seven exchanges. Come back after module 4 and see how much has become legible.Open in the workbench →

Figures and recordings

The history of payment systems
The history of payment systems
Open the original
The history of payment systems
Fig. 03The history of payment systemsPhoto: Ryan Hodnett · CC BY-SA 4.0 · via Wikimedia Commons4904 × 2452

That was module 1 of 22

The rest of the course takes the same method through the whole transaction: the command set and the certificate chain, how a terminal decides it trusts you, and then the published attacks byte by byte against these same captures.

Sign in to buy · $350

The course is tied to your account, so you sign in first and come straight back here.

Pay in Bitcoin insteadSee the whole course →

One payment for this course. Access for as long as the course exists, with every update and new research module that follows, at no further cost.

No hardware is sold here, and none is needed to read the course.

Payments are final. Module 1 is free so you can judge the course before you pay. Terms

Sign in to keep track of what you have finished.