emv (chip & pin) protocolkodu.ut.ee/~arnis/emv_slides.pdf · emv = europay, mastercard, visa...

41
EMV (Chip & PIN) Protocol Märt Bakhoff Supervised: Arnis Paršovs

Upload: others

Post on 01-May-2020

53 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

EMV (Chip & PIN) Protocol

Märt BakhoffSupervised: Arnis Paršovs

Page 2: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Objective

observe and describe a real world transaction

Page 3: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Agenda

● Tools & setup● Quick overview of transaction processing● High level overview of captured data

Page 4: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Tools & setup

● Osmocom Simtrace

● “upgraded” cardreader

● Visa Electron card

● friendly merchant

Page 5: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

SimtraceMITM board for SIM cards

< PCCHIP >

TERMINAL >

Page 6: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of
Page 7: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of
Page 8: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of
Page 9: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Reading binary dumps for the win?

● EMV = Europay, Mastercard, Visa● standardized payment cards (currently v4.3)● released as 4 “books” with a total of 747 pages

Page 10: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Candidate list creation

iterate applications on the card

read application ids

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 11: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Application selection

select the application in the terminal

activate application in the chip

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 12: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Read Application Data

expiration date

pin options

online/offline support

crypto keys

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 13: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Data authentication

offline mode:verify data on the card using digital signature

online mode:challenge&response

with card's private key

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 14: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Cardholder verification

online pin / offline pin / handwritten signature

pinpad->icc encrypted

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 15: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Processing restrictions

check expiration date

check “application usage controls”

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 16: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Terminal risk management

decide online/offline

“floor limits”

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 17: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Card action analysis

decide online/offline/reject

can upgrade to online

can't upgrade to offline

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 18: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Online processing

send ARQC to issuer

send response to chip

can downgrade to offline

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 19: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Transaction flow

Final card analysis

verify issuer online response

decide to accept/reject

generate transaction certificate (TC)

Candidate List Creation

Application Selection

Read Application Data

Data Authentication

Cardholder Verification

Processing Restrictions

Terminal Risk Management

Card Action Analysis

Online Processing

Final Action Analysis

Page 20: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Captured data(19 request/response pairs)

Page 21: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: file '1PAY.SYS.DDF01'

Response: ShortFileIdentifier of directory element: 1language preference: et,en,ru,de

00 A4 SELECT

Page 22: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: ShortFileIdentifier: 1; record: 1

Response: application identifier: VISA electronapplication priority: 1

00 B2 READ RECORD

Page 23: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: ShortFileIdentifier: 1; record: 2

Response: File not found

00 B2 READ RECORD

Page 24: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request:empty

Response: application id: Visa Electronapplication priority: 1language preference: et,en,ru,deissuer url: 0x9f4d020b14

00 C0 GET RESPONSE

Page 25: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: empty list

Response: dynamic data authentication (DDA) supported,cardholder verification supported,perform terminal risk mgmt supported,issuer authentication supportedlocations of data records: SFI1, record 1-1 SFI2, record 1-6

80 A8 GET PROCESSING OPTS

Page 26: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: SFI:1, record: 1

Response: card number: xx xx xx xx 37 64 61 73expiration date: 14 12cardholder name: BAKHOFF/MART

00 B2 READ RECORD

Page 27: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: SFI:2, record: 1

Response: Application Effective Date: 12 10 01Application Expiration Date: 14 12 31Application Usage Control: all allowedPrimary Account Number: xxxx xxxx 3764 6173CDOL1, CDOL2, CVMIssuer country code: 0x0233

00 B2 READ RECORD

Page 28: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: SFI:2, record: 2

Response: Issuer Public Key CertificateIssuer Public Key ExponentIssuer Public Key Remainder

00 B2 READ RECORD

Page 29: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: SFI:2, record: 3

Response: DDOLICC Public Key Exponent

00 B2 READ RECORD

Page 30: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: SFI:2, record: 4

Response: ICC Public Key Certificate

00 B2 READ RECORD

Page 31: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: SFI:2, record: 5

Response: ICC PIN Encipherment Public Key CertificateICC PIN Encipherment Public Key Exponent

00 B2 READ RECORD

Page 32: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: SFI:2, record: 6

Response: Application Version Number: 0x008cService Code: 0x0221Application Currency Code: 0x0978Application Currency Exponent: 2

00 B2 READ RECORD

Page 33: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: (DDOL) 4 bytes nonce 0xd6834217

Response: Signed Dynamic Application Data

00 88 INTERNAL AUTHENTICATE

Page 34: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: pin try counter

Response: PIN Try Counter: 3 remaining

80 CA GET DATA

Page 35: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: empty

Response:6e 46 d1 ff 7f 6e 61 30 (8-byte nonce generated by the ICC)

00 84 GET CHALLENGE

Page 36: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: encrypted pin

Response: ok

00 20 VERIFY

Page 37: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request:request ARQC (online mode) amount: 0.99terminal country code: 0x0233TVR: transaction exeeds floor limittransaction date: 14 09 25nonce: 4 bytes

Response: Application Transaction Counter (ATC): 0x0377Application Cryptogram: ac 74 08 bb 16 b2 b8 6d

80 AE GENETATE AC

Page 38: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: Issuer Authentication Data: 83 1c 2b df 91 08 e0 70 30 30

Response: ok

00 82 EXTERNAL AUTHENTICATE

Page 39: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Request: request transaction certificateauthorization response code: 0x3030amount: 0.99terminal country code: 0x0233TVR: transaction exeeds floor limittransaction date: 14 09 25nonce: 4 bytes

Response: Application Transaction Counter (ATC): 0x0377Application Cryptogram: c2 f1 92 98 bd 19 a7 fe

80 AE GENERATE AC

Page 40: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

Q/A

Page 41: EMV (Chip & PIN) Protocolkodu.ut.ee/~arnis/emv_slides.pdf · EMV = Europay, Mastercard, Visa standardized payment cards (currently v4.3) released as 4 “books” with a total of

References

● www.emvco.com/specifications.aspx● www.level2kernel.com/flow-chart.html● cotignac.co.nz/emv-offline-data-authentication