SlideShare a Scribd company logo
Offensive Payment
Security
Finding vulnerabilities in payment systems
Timur Yunusov
About me
• Appsec background
• Deeply into payments since 2013 (XXE OOB attack)
• ATM hacking since 2016
• POS/Cards/Mobile Wallets fraud simulation since 2017
• 0days in Apple Pay, GPay, Samsung Pay, Visa, MC
• Bug bounty in payments since 2019
• Payment Village organizer since 2020
About the workshop
• History of payments
• Background
• Deep dive into card payments
• Finding vulnerabilities
• Practical recommendations
History of payments
• 1960s – wide adoption of cards and card imprinters
• 1968 – first ATM that works with cards
History of payments
• 1970s – magstripe
History of payments
• 1990s – EMV smartcard
• 2000s – NFC payments
History of payments
• 2008-2009 – Bitcoin
• 2011 – QR payments
• 2015 – Mobile Wallets trial (Android Pay)
History of payments
• 2011 – QR payments
• 2015 – Mobile Wallets trial (Android Pay)
Offensive Payment Security
A few strange examples
• Facebook/Instagram Pay
• Amazon, eBay
• Twitter/Signal crypto donations
• Opera DiFy wallet
• A lot of crypto cards
Payment Systems and bug bounty
• IT Giants – eBay, Facebook, Netflix
• Fintech – N26, Revolut, Wise, Monzo, Crypto.com, exchanges
• High-street banks – RBS, Citi, Chase
BB programs/Responsible disclosure
• N26 bank
• AMEX
• Bank of America
• Capital One
• Coinbase
• Crypto.com
• Square
• Ingenico
• Simple bank
• Wells Fargo bank
Offensive Payment Security
Card payments
Card not Present
Magstripe
EMV/NFC
Housekeeping
• Don’t violate the law
• Don’t do this for money
Finding vulnerabilities. Part I
EMV
EMV – Europay MasterCard Visa
• 1959 – first smart cards
• 1986 – first banking cards - Carte Bancaire (France)
• 1993 – EMV (Europay, Mastercard, Visa) 1.0, Java applet ->CAP
• 2003 – First trial in England
• 2005 – Cambridge University
EMV – Europay MasterCard Visa
• EMVCo standard – 7 books, hundreds of pages
• EMV card == smartcard with a Java app tackling magstripe issues:
Transaction authorisation – mandatory but might happen later
Card authentication – not
Cardholder verification – not
EMV – Europay MasterCard Visa
• EMVCo standard – 7 books, hundreds of pages
• EMV card == smartcard with a Java app tackling magstripe issues:
Transaction authorisation
Card authentication
Cardholder verification
EMV – Europay MasterCard Visa
• Introduced in 90s
• EMVCo standard – 7 books, hundreds of pages
• EMV card == smartcard with a Java app tackling magstripe issues:
• Card authentication
• Transaction authorisation
• Cardholder verification
EMV – Europay MasterCard Visa
• Introduced in 90s
• EMVCo standard – 7 books, hundreds of pages
• EMV card == smartcard with a Java app tackling magstripe issues:
• Card authentication
• Transaction authorisation
• Cardholder verification
EMV communication standards
• APDU – protocol for smart cards
• APDU-Request: CLA, INS, P1, P2, Data
• APDU-Response: TLV (Tag Length Value)
• EFTLab EMV Tools
• https://www.eftlab.co.uk/index.php/site-map/knowledge-base/145-
emv-nfc-tags
• https://github.com/binaryfoo/emv-bertlv
EMV communication standards
https://www.youtube.com/c/PaymentVillage
Hands on time
Transaction authorisation – cryptogram
• Transaction cryptogram - 3DES MAC (digital signature)
• Amount, Date, ATC, Cardholder Verification Results, etc
• ARQC, AAC, TC – Tag 9F26
• HSM
Transaction authorisation – cryptogram
Terminal:
• С->T: PDOL, Tag 9F38 (Amount, Terminal Country Code, Date, UN)
• T->C: Generate AC (00000001000826220319ABCDEFGH)
• C->T: 3DES(PDOL,ATC,IAD)=ARQC AD146FE1F419C3D1
HSM:
• Takes all the transaction data 00000001000826220319ABCDEFGH
• Extracts card’s key
• 3DES(PDOL,ATC,IAD)=ARQC AD146FE1F419C3D1
Card authentication
• RSA PKI
• SDA, DDA, CDA
• Not mandatory if POS is connected
• Mandatory in metro, planes, etc
• Other terminals have “0 floor limit”
Cardholder verification
• PIN
• Offline PIN (encrypted or plaintext) – checked on the card
• Online PIN (encrypted) – checked on the HSM during the card auth
• Signature
• NoCVM
• CDCVM/ On-Device CVM
Cardholder Verification Methods List – Tag 8E
java -jar emv-bertlv-0.1.8-shaded.jar constructed
8E160000000000000000420504054203440341031E031F02
• [4205] Encrypted PIN online, If purchase + cash, next
• [0405] Encrypted PIN by ICC, If purchase + cash, FAIL
• [4203] Encrypted PIN online, If terminal supports CVM, next
• [4403] Encrypted PIN by ICC, If terminal supports CVM, next
• [4103] Plain PIN by ICC, If terminal supports CVM, next
• [1E03] Signature, If terminal supports CVM, FAIL
• [1F02] No CVM required, If not (unattended cash, manual cash, purchase
+ cash), FAIL
Cardholder Verification Methods List – Tag 8E
• [4205]
• 4xxx – Transaction will not fail if not chosen
• 42xx – Encrypted PIN online
• xx05 – If purchase + cash
• [1E02]
• 1xxx – Transaction will be canceled if the verification method fails
• 1exx – Signature
• xx02 – If not unattended cash, manual cash, purchase + cash
>> 00A404000E315041592E5359532E4444463031 (SELECT/READ FILE)
<<
C06F1C840E315041592E5359532E4444463031A50A8801015F2D047275656E90
00
> File Control Information (FCI) Template (6F):
|
|-Dedicated File (DF) Name (84)
| 315041592E5359532E4444463031
| 1 P A Y . S Y S . D D F 0 1
|
> FCI Proprietary Template (A5):
|
|-Short File Identifier (SFI) (88)
| 01
|
|-Language Preference (5F2D)
| 7275656E - en
>> 00B2010C00 (READ RECORD)
<< B2701461124F07A00000000310105004566973618701019000
> Application Elementary File (AEF) Data Template (70):
|
> Application Template (61):
|
|-Application Identifier (AID) (4F)
| A0000000031010
|
|-Application Label (50)
| 56697361 - Visa
|
|-Application Priority Indicator (87)
| 01
>> 00B2020C00 (READ RECORD)
<< 6A83 (Checking error: record not found)
>> 80A80000028300 (GET PROCESSING OPTIONS)
<< C0771282023D00940C0802020010010300180101019000
> Response Message Template Format 2 (77):
|
|-Application Interchange Profile (82)
| 3D00
|
|-Application File Locator (AFL) (94)
| 080202001001030018010101
>> 00B2011C00
<< B27081865A08469395xxxxxx07605F3401008C1x
|-Primary Account Number (PAN) (5A) | 469395xxxxxx0760
|-PAN Sequence Number (5F34) | 00
|-Card Risk Management Data Object List 1 (CDOL1) (8C)
| 9F02069F03069F1A0295055F2A029A039C019F3704
|-Card Risk Management Data Object List 2 (CDOL2) (8D)
| 8A029F02069F03069F1A0295055F2A029A039C019F3704
|-Cardholder Verification Method (CVM) List (8E)
| 000000000000000002054203440341031E031F02
|-Issuer Action Code - Default (9F0D) | BC68B49800
|-Issuer Action Code - Denial (9F0E) | 0010080000
|-Issuer Action Code - Online (9F0F) | BC68B49800
|-Application Expiration Date (5F24) | 220930
>> 80AE80001D000000000100000000000000082604000080000826200603004DD9B23E (GENERATE AC)
<< C0771E9F2701809F360200189F2608E0C05563587FF4609F100706010A03A6A0009000
> Response Message Template Format 2 (77):
|
|-Cryptogram Information Data (9F27)
| 80
|
|-Application Transaction Counter (ATC) (9F36)
| 0018
|
|-Application Cryptogram (9F26)
| E0C05563587FF460
|
|-Issuer Application Data (9F10)
| 06010A03A6A000
PIN OK Attack
2005
2010
2011
Attacks
2011
Offensive Payment Security
Cardholder Verification Methods List
• PIN by ICC – first rule
• PIN by ICC – chosen by the POS
• Tampering the first rule during MiTM
Read CVM List
00B2011C00
Get PIN try counter
80CA9F1700
Verify PIN 1234
20008008241234FFFFFFFF
Wrong PIN, 2 attempts left
6c32
**8E16**4103**
9F17 01 03
PIN OK
9000
Generate AC
https://www.cl.cam.ac.uk/~osc22/docs/mphil_acs_osc22.pdf
PIN OK Attack
1. Ensure that the offline PIN is chosen (change the first rule in CVM List)
2. Change Wrong PIN (0x6c32) to PIN OK (0x9000)
3. CVR (Card Verification Results) is meant to protect against the attack
9F10 (issuer application data)
Derivation key index 00
Cryptogram version number 12
Card verification results
Byte 2 Bit 8 = 0, Byte 2 Bit 7 = 0 AAC Returned in Second GENERATE AC
Byte 2 Bit 6 = 1, Byte 2 Bit 5 = 0 ARQC Returned in GPO/first GENERATE AC
Byte 2 Bit 1 = 1 Offline PIN Verification Successful
Questions/ Hands on
Cryptogram replay attack
2015 https://murdoch.is/papers/ieeesp15beprepared.pdf
Generate AC
Application Cryptogram, ARQC
Generate AC Request T->C:
80 ae 80 00 41 000000000100 0826 211106 ecb451692
C->T:
772f 9f270180 9f36020001 9f2608aec095fb09512dbb
CLA INS P1 P2 Len Amount Currency Date UN
Response Tag Type - ARQC Cryptogram
ATC
Application Cryptogram, ARQC
Generate AC Request T->C:
80 ae 80 00 41 000000000100 0826 211106 ecb451692
C->T:
772f 9f270180 9f36020001 9f2608aec095fb09512dbb
CLA INS P1 P2 Len Amount Currency Date UN
Response Tag Type - ARQC Cryptogram
ATC
Cryptogram pre-play
UN ATC Amount ARQC
00AA00A1 0001 £1 aec095fb09512dbb
00AA00A2 0002 £1 152449f1c0831322
00AA00A3 0003 £1 2ba48c52c594d13d
00AA00A4 0004 £1 5fb0951231ddbb9f
Cryptogram pre-play
UN ATC Amount ARQC
AAAAAAAA 0001 £1 aec095fb09512dbb
AAAAAAAA 0002 £1 152449f1c0831322
AAAAAAAA 0003 £1 2ba48c52c594d13d
AAAAAAAA 0004 £1 5fb0951231ddbb9f
ATC Monitoring
Seq No ATC Decision
1 0100 Normal
2 0101 Normal
3 0105 Unusual, but reasonable
4 0FF1 Unusual, unreasonable
5 0010 Unusual, unreasonable
Cryptogram replay
UN ATC Amount ARQC
AAAAAAAA 0001 £1 aec095fb09512dbb
AAAAAAAA 0001 £1 aec095fb09512dbb
AAAAAAAA 0001 £1 aec095fb09512dbb
AAAAAAAA 0001 £1 aec095fb09512dbb
Equipment for tests
• Modified POS
• Malfunctioning POS
• Access to the transaction stream
Transaction stream fraud
demo
Questions/ Hands on
Cryptogram confusion attack
• Found in Samsung Pay in 2021 accidentally
• Later confirmed for many Visa cards
Cryptogram confusion attack
Get PIN try counter
80CA9F1700
Verify PIN 1234
20008008241234FFFFFFFF
Wrong PIN, 2 attempts left
6c32
9F17 01 03
Wrong PIN, 0 attempts left
6c30
Generate AC
Verify PIN 1234
20008008241234FFFFFFFF
?
PIN Try limit exceeded behaviour
• Disable NFC/EMV interface – optional
• Set bytes in CVR/IAD (Tag 9F10)
[Byte 3 Bit 7 = 1] Pin try limit exceeded
• Starts providing AAC cryptogram
• [Byte 1 Bit 6 = 0, Byte 1 Bit 5 = 0] AAC Returned in First Generate AC
• ARQC – Online authorisation
• TC – Offline validation
• AAC – Declined cryptogram for further analysis
AAC cryptogram algorithm
AAC cryptogram algorithm
>>
80AE80001D00000000010000000000000008260400008000082622031900
ABCDEFGH (GENERATE AC)
• <<
C0771E9F2701809F360200189F2608AD146FE1F419C3D19f100706000a
03804000
• С->T: PDOL, Tag 9F38 (Amount, Terminal Country Code, Date, UN)
• T->C: Generate AC (00000001000826220319ABCDEFGH)
• C->T: 3DES(PDOL,ATC,IAD)=AAC AD146FE1F419C3D1
AAC cryptogram algorithm
[9F10 (issuer application data)] 06000A03804000
[Derivation key index] 00
[Cryptogram version number] 0A
[Card verification results] 03804000
[Byte 2 Bit 8 = 1, Byte 2 Bit 7 = 0] Second GENERATE AC not requested
[Byte 2 Bit 6 = 0, Byte 2 Bit 5 = 0] AAC Returned in GPO/first
GENERATE AC
[Byte 3 Bit 7 = 1] Pin try limit exceeded
[Byte 4 Bits 8-5] Issuer Script Commands processed on last transaction = 0
Attack
• Exceed three offline PIN tries on the card
• Request an online ARQC cryptogram using Generate AC request
• Get an AAC cryptogram back (9f270100, 9f10xxxx)
• Change the Cryptogram Type field (9f270180)
• Transaction passes the Risk Management checks at the terminal
• Cryptogram passes HSM integrity checks
• Bank the CVR field bit indicating that the Cryptogram Type = AAC
Demo
Demo 2
Finding vulnerabilities. Part II
NFC
NFC evolution
• Contactless near-field antenna connected to the same smartcard
• Same payment steps
• Same security measures: authorisation, authentication, verification
• Same memory area, same encryption keys (RSA, 3DES)
NFC evolution for MC and Visa
• Visa NFC is less secure than Visa EMV
• MC NFC is more secure than MC EMV
• https://github.com/a66at/NFCMiTM
Hands on time
1. Reading The PPSE
?
Proximity Payment
System
Environment
2. Card responds with AID
“ ” Applicatio
n Identifier
3. Terminal selects AID
Applicatio
n Identifier
4. Card provides PDOL
Currency
Amount
UN
TTQ
Processing
Options Data
Object List
5. Terminal sends requested data
Currency
Amount
UN
TTQ
“GENERATE AC”
MSD?
EMV
chip?
qVSDC?
6. Card provides Application Cryptogr
ATC
Track2
Equiv
CTQ
Online
Pin?
Signature
?
7. Terminal conducts risk analysis
Config
CTQ
TTQ
CVM?
Acquirer
“Limits”
Floor limit
No CDCVM
CDCVM
CVM
Currency
Amount
UN
TTQ
Acquire
r
ATC
Track2
Equiv
CTQ
CDCVM=1
CVM REQUIRED=0
1. Change TTQ “CVM Required”
value from 1 to 0
2. Change CTQ
“CDCVM Performed”
value
from 0 to 1
Practical recommendations/reflection
• How to find new vulnerabilities using the blackbox approach
• What are the most interesting bugs for bb programs?
• How to show the impact of your findings?
Setting up the lab
• How to find new vulnerabilities using the blackbox approach
• What are the most interesting bugs for bb programs?
• How to show the impact of your findings?
• What products could you use? Your own cards and
• Your own terminals
• Unattended terminals
• Publicly available products: MasterCard JS EMV core, Stripe
• SaaS solution
Bug bounty aspects
• BB platform triage team (for public programs)
• Security@ or responsible disclosure pages
• Personal connections for private programs (LI, Twitter)
• Support team?
Bug bounty aspects
Thank you!
@a66ot
www.paymentvillage.org
Finding vulnerabilities. Part III
Magstripe
PSD2 and magstripe
• Magstripe is prohibited in Europe
• Technical Fallback is prohibited in Europe
• Both issuer and acquirer should be from the EU
• https://leigh-annegalloway.com/presentation-materials/
• https://www.paymentvillage.org/archive/defcon-28grayhat/labs
Magstripe Transaction Authorisation
• No transaction authorisation – Magstripe data is static
• No card authentication – Magstripe data can be cloned
Track1:
B46939575xxxx0760^IUNUSOV/TIMUR^22092210000000000445000000
CVC/CVV = DES-MAC(PAN, EXPDATE, SERVICECODE)
Magstripe attacks
• Bruteforce CVC – need access to the Transaction Stream
• EMV/NFC Track2 equivalent also has CVV/CVC
• Read data from EMV/NFC and write it to magstripe
Finding vulnerabilities. Part VI
Online
Scope
Where What How
Online payments
Add/Send/Convert
Merchant accounts
Payment devices
Card details
Cardholder details
Personal information
Making payments
Money withdrawal
Security features
Authentication bypass
Authorisation bypass
One Time Codes
Logic bypass
A few examples
• Enrolling card to Apple Pay without additional OTP
• Getting card requisites: PAN, Expiry Date, CVV
• Sending money (various options)
Protection mechanisms
• OTP
• PIN
• Cryptograms
• Client-side verification (iOS)
One Time Password Top 3 Issues
• OTP Bruteforce
• OTP limit bypass <- Lack of source/destination control
• OTP Integrity <- Race Condition
OTP Bruteforce
• 4 digit OTP code is requested
• 3 attempts for correct OTP entry
• Reset and start over again
OTP Bruteforce - attack
• Request 3 OTP and save them (1212, 2323, 3434)
• Repeat in cycles:
• Request OTP
• Enter one of each pre-recorded OTP
• Start again
• 1,000 OTP requests, 3,000 attempts give 60% chance to guess the OTP
• otp1.php demo
OTP Limit Bypass
• Can try 1,000 users
• Can try OTPs for the same user from 1,000 Ips
• otp2.php demo
OTP Integrity
• OTP checks the transaction integrity
• One OTP – one action/event
• One OTP could be used for more than 1 action
• otp3.php demo

More Related Content

PPTX
Banks and cybersecurity v2
PPTX
Introduction to Cybersecurity Fundamentals
PDF
Offensive OSINT
PDF
Red shadows ringing in Japan's Cyberspace
PDF
Welcome to the Jungle: Pentesting AWS
PPTX
Information security
PPTX
Diabetes Mellitus
PPTX
Hypertension
Banks and cybersecurity v2
Introduction to Cybersecurity Fundamentals
Offensive OSINT
Red shadows ringing in Japan's Cyberspace
Welcome to the Jungle: Pentesting AWS
Information security
Diabetes Mellitus
Hypertension

What's hot (20)

PPTX
Introduction to IDS & IPS - Part 1
PPTX
Cyber espionage nation state-apt_attacks_on_the_rise
PPTX
Vulnerabilities in modern web applications
PPTX
Intrusion detection system
PDF
MITRE ATT&CK Framework
PPTX
Intrusion detection and prevention system
PPT
IDS and IPS
PPTX
Mobile Application Security
PPT
Network Intrusion Detection System Using Snort
DOCX
Alumni information database abstract
PDF
Red Team Methodology - A Naked Look
PPTX
iOS Forensics
PDF
Using ATTACK to Create Cyber DBTS for Nuclear Power Plants
PPTX
Cyber threats landscape and defense
PPTX
DDoS ATTACKS
PPTX
Adversary Emulation and Its Importance for Improving Security Posture in Orga...
PDF
Liit tyit sem 5 spm unit 1 notes most imp questions with answers
PPT
Intrusion Detection Systems and Intrusion Prevention Systems
PPT
Software security
PDF
Malware detection-using-machine-learning
Introduction to IDS & IPS - Part 1
Cyber espionage nation state-apt_attacks_on_the_rise
Vulnerabilities in modern web applications
Intrusion detection system
MITRE ATT&CK Framework
Intrusion detection and prevention system
IDS and IPS
Mobile Application Security
Network Intrusion Detection System Using Snort
Alumni information database abstract
Red Team Methodology - A Naked Look
iOS Forensics
Using ATTACK to Create Cyber DBTS for Nuclear Power Plants
Cyber threats landscape and defense
DDoS ATTACKS
Adversary Emulation and Its Importance for Improving Security Posture in Orga...
Liit tyit sem 5 spm unit 1 notes most imp questions with answers
Intrusion Detection Systems and Intrusion Prevention Systems
Software security
Malware detection-using-machine-learning
Ad

Similar to Offensive Payment Security (20)

PPTX
EMV 201 EMF June 2016
PDF
EMV Payments: Changes at the Point of Sale
PPTX
Hack in Cash out OWASP London
PDF
EMV Credit Card Technology in Parking
PPT
Atm technology and operations
PDF
7 Ways to Make EMV Easier / Webinar
PPTX
EMV chip cards
PPTX
Parktron company profile 2021
PPTX
The Long Road to EMV: An In-Depth Look at EMV and How It Will Impact IADs
PDF
Transactions Using Bio-Metric Authentication
PDF
EMV COMPLIANCE & SECURE EMV CHIP TECHNOLOGY FOR EVERY RETAILER ACROSS CANADA
PPTX
Emv for f_is_webinar
PPTX
Introduction to e-Commerce Payments
PPT
NetMatrix TLE Terminal Line Encryption. SPVA certified, DUKPT, 3DES, DES, AES...
PDF
QR BASED CARD-LESS ATM TRANSACTIONS
PDF
BIOMETRIC AND MAGIC PIN AUTHENTICATION SYSTEM FOR ATM
PPTX
Chip Cards: EMV Updates for Parking
PDF
EMV Migration Webinar / Lessons Learned + Next Steps
EMV 201 EMF June 2016
EMV Payments: Changes at the Point of Sale
Hack in Cash out OWASP London
EMV Credit Card Technology in Parking
Atm technology and operations
7 Ways to Make EMV Easier / Webinar
EMV chip cards
Parktron company profile 2021
The Long Road to EMV: An In-Depth Look at EMV and How It Will Impact IADs
Transactions Using Bio-Metric Authentication
EMV COMPLIANCE & SECURE EMV CHIP TECHNOLOGY FOR EVERY RETAILER ACROSS CANADA
Emv for f_is_webinar
Introduction to e-Commerce Payments
NetMatrix TLE Terminal Line Encryption. SPVA certified, DUKPT, 3DES, DES, AES...
QR BASED CARD-LESS ATM TRANSACTIONS
BIOMETRIC AND MAGIC PIN AUTHENTICATION SYSTEM FOR ATM
Chip Cards: EMV Updates for Parking
EMV Migration Webinar / Lessons Learned + Next Steps
Ad

More from Payment Village (8)

PPTX
How I opened a fake bank account and didn't go to prison
PDF
Unlocking Any Door In The 21st Century. Immersion In Biometric Security.
PDF
The white whales of fraud and where to find them
PPTX
Breaking banks or saving them
PDF
Ради денег. Безопасность платежных терминалов
PPTX
Launch Impossible Current State of Application Control Bypasses on ATMs.
PPTX
How to build Big Brother
PPTX
СМС – «золотой» стандарт двухфакторной аутентификации. Актуальные проблемы
How I opened a fake bank account and didn't go to prison
Unlocking Any Door In The 21st Century. Immersion In Biometric Security.
The white whales of fraud and where to find them
Breaking banks or saving them
Ради денег. Безопасность платежных терминалов
Launch Impossible Current State of Application Control Bypasses on ATMs.
How to build Big Brother
СМС – «золотой» стандарт двухфакторной аутентификации. Актуальные проблемы

Recently uploaded (20)

PPTX
Chapter 5: Probability Theory and Statistics
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
August Patch Tuesday
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Mushroom cultivation and it's methods.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
project resource management chapter-09.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
Encapsulation theory and applications.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
DP Operators-handbook-extract for the Mautical Institute
Chapter 5: Probability Theory and Statistics
A comparative analysis of optical character recognition models for extracting...
August Patch Tuesday
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Group 1 Presentation -Planning and Decision Making .pptx
1. Introduction to Computer Programming.pptx
Mushroom cultivation and it's methods.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
project resource management chapter-09.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
OMC Textile Division Presentation 2021.pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Getting Started with Data Integration: FME Form 101
Encapsulation theory and applications.pdf
A novel scalable deep ensemble learning framework for big data classification...
DP Operators-handbook-extract for the Mautical Institute

Offensive Payment Security

  • 1. Offensive Payment Security Finding vulnerabilities in payment systems Timur Yunusov
  • 2. About me • Appsec background • Deeply into payments since 2013 (XXE OOB attack) • ATM hacking since 2016 • POS/Cards/Mobile Wallets fraud simulation since 2017 • 0days in Apple Pay, GPay, Samsung Pay, Visa, MC • Bug bounty in payments since 2019 • Payment Village organizer since 2020
  • 3. About the workshop • History of payments • Background • Deep dive into card payments • Finding vulnerabilities • Practical recommendations
  • 4. History of payments • 1960s – wide adoption of cards and card imprinters • 1968 – first ATM that works with cards
  • 5. History of payments • 1970s – magstripe
  • 6. History of payments • 1990s – EMV smartcard • 2000s – NFC payments
  • 7. History of payments • 2008-2009 – Bitcoin • 2011 – QR payments • 2015 – Mobile Wallets trial (Android Pay)
  • 8. History of payments • 2011 – QR payments • 2015 – Mobile Wallets trial (Android Pay)
  • 10. A few strange examples • Facebook/Instagram Pay • Amazon, eBay • Twitter/Signal crypto donations • Opera DiFy wallet • A lot of crypto cards
  • 11. Payment Systems and bug bounty • IT Giants – eBay, Facebook, Netflix • Fintech – N26, Revolut, Wise, Monzo, Crypto.com, exchanges • High-street banks – RBS, Citi, Chase
  • 12. BB programs/Responsible disclosure • N26 bank • AMEX • Bank of America • Capital One • Coinbase • Crypto.com • Square • Ingenico • Simple bank • Wells Fargo bank
  • 14. Card payments Card not Present Magstripe EMV/NFC
  • 15. Housekeeping • Don’t violate the law • Don’t do this for money
  • 17. EMV – Europay MasterCard Visa • 1959 – first smart cards • 1986 – first banking cards - Carte Bancaire (France) • 1993 – EMV (Europay, Mastercard, Visa) 1.0, Java applet ->CAP • 2003 – First trial in England • 2005 – Cambridge University
  • 18. EMV – Europay MasterCard Visa • EMVCo standard – 7 books, hundreds of pages • EMV card == smartcard with a Java app tackling magstripe issues: Transaction authorisation – mandatory but might happen later Card authentication – not Cardholder verification – not
  • 19. EMV – Europay MasterCard Visa • EMVCo standard – 7 books, hundreds of pages • EMV card == smartcard with a Java app tackling magstripe issues: Transaction authorisation Card authentication Cardholder verification
  • 20. EMV – Europay MasterCard Visa • Introduced in 90s • EMVCo standard – 7 books, hundreds of pages • EMV card == smartcard with a Java app tackling magstripe issues: • Card authentication • Transaction authorisation • Cardholder verification
  • 21. EMV – Europay MasterCard Visa • Introduced in 90s • EMVCo standard – 7 books, hundreds of pages • EMV card == smartcard with a Java app tackling magstripe issues: • Card authentication • Transaction authorisation • Cardholder verification
  • 22. EMV communication standards • APDU – protocol for smart cards • APDU-Request: CLA, INS, P1, P2, Data • APDU-Response: TLV (Tag Length Value) • EFTLab EMV Tools • https://www.eftlab.co.uk/index.php/site-map/knowledge-base/145- emv-nfc-tags • https://github.com/binaryfoo/emv-bertlv
  • 26. Transaction authorisation – cryptogram • Transaction cryptogram - 3DES MAC (digital signature) • Amount, Date, ATC, Cardholder Verification Results, etc • ARQC, AAC, TC – Tag 9F26 • HSM
  • 27. Transaction authorisation – cryptogram Terminal: • С->T: PDOL, Tag 9F38 (Amount, Terminal Country Code, Date, UN) • T->C: Generate AC (00000001000826220319ABCDEFGH) • C->T: 3DES(PDOL,ATC,IAD)=ARQC AD146FE1F419C3D1 HSM: • Takes all the transaction data 00000001000826220319ABCDEFGH • Extracts card’s key • 3DES(PDOL,ATC,IAD)=ARQC AD146FE1F419C3D1
  • 28. Card authentication • RSA PKI • SDA, DDA, CDA • Not mandatory if POS is connected • Mandatory in metro, planes, etc • Other terminals have “0 floor limit”
  • 29. Cardholder verification • PIN • Offline PIN (encrypted or plaintext) – checked on the card • Online PIN (encrypted) – checked on the HSM during the card auth • Signature • NoCVM • CDCVM/ On-Device CVM
  • 30. Cardholder Verification Methods List – Tag 8E java -jar emv-bertlv-0.1.8-shaded.jar constructed 8E160000000000000000420504054203440341031E031F02 • [4205] Encrypted PIN online, If purchase + cash, next • [0405] Encrypted PIN by ICC, If purchase + cash, FAIL • [4203] Encrypted PIN online, If terminal supports CVM, next • [4403] Encrypted PIN by ICC, If terminal supports CVM, next • [4103] Plain PIN by ICC, If terminal supports CVM, next • [1E03] Signature, If terminal supports CVM, FAIL • [1F02] No CVM required, If not (unattended cash, manual cash, purchase + cash), FAIL
  • 31. Cardholder Verification Methods List – Tag 8E • [4205] • 4xxx – Transaction will not fail if not chosen • 42xx – Encrypted PIN online • xx05 – If purchase + cash • [1E02] • 1xxx – Transaction will be canceled if the verification method fails • 1exx – Signature • xx02 – If not unattended cash, manual cash, purchase + cash
  • 32. >> 00A404000E315041592E5359532E4444463031 (SELECT/READ FILE) << C06F1C840E315041592E5359532E4444463031A50A8801015F2D047275656E90 00 > File Control Information (FCI) Template (6F): | |-Dedicated File (DF) Name (84) | 315041592E5359532E4444463031 | 1 P A Y . S Y S . D D F 0 1 | > FCI Proprietary Template (A5): | |-Short File Identifier (SFI) (88) | 01 | |-Language Preference (5F2D) | 7275656E - en
  • 33. >> 00B2010C00 (READ RECORD) << B2701461124F07A00000000310105004566973618701019000 > Application Elementary File (AEF) Data Template (70): | > Application Template (61): | |-Application Identifier (AID) (4F) | A0000000031010 | |-Application Label (50) | 56697361 - Visa | |-Application Priority Indicator (87) | 01
  • 34. >> 00B2020C00 (READ RECORD) << 6A83 (Checking error: record not found) >> 80A80000028300 (GET PROCESSING OPTIONS) << C0771282023D00940C0802020010010300180101019000 > Response Message Template Format 2 (77): | |-Application Interchange Profile (82) | 3D00 | |-Application File Locator (AFL) (94) | 080202001001030018010101
  • 35. >> 00B2011C00 << B27081865A08469395xxxxxx07605F3401008C1x |-Primary Account Number (PAN) (5A) | 469395xxxxxx0760 |-PAN Sequence Number (5F34) | 00 |-Card Risk Management Data Object List 1 (CDOL1) (8C) | 9F02069F03069F1A0295055F2A029A039C019F3704 |-Card Risk Management Data Object List 2 (CDOL2) (8D) | 8A029F02069F03069F1A0295055F2A029A039C019F3704 |-Cardholder Verification Method (CVM) List (8E) | 000000000000000002054203440341031E031F02 |-Issuer Action Code - Default (9F0D) | BC68B49800 |-Issuer Action Code - Denial (9F0E) | 0010080000 |-Issuer Action Code - Online (9F0F) | BC68B49800 |-Application Expiration Date (5F24) | 220930
  • 36. >> 80AE80001D000000000100000000000000082604000080000826200603004DD9B23E (GENERATE AC) << C0771E9F2701809F360200189F2608E0C05563587FF4609F100706010A03A6A0009000 > Response Message Template Format 2 (77): | |-Cryptogram Information Data (9F27) | 80 | |-Application Transaction Counter (ATC) (9F36) | 0018 | |-Application Cryptogram (9F26) | E0C05563587FF460 | |-Issuer Application Data (9F10) | 06010A03A6A000
  • 40. Cardholder Verification Methods List • PIN by ICC – first rule • PIN by ICC – chosen by the POS • Tampering the first rule during MiTM
  • 41. Read CVM List 00B2011C00 Get PIN try counter 80CA9F1700 Verify PIN 1234 20008008241234FFFFFFFF Wrong PIN, 2 attempts left 6c32 **8E16**4103** 9F17 01 03 PIN OK 9000 Generate AC
  • 43. PIN OK Attack 1. Ensure that the offline PIN is chosen (change the first rule in CVM List) 2. Change Wrong PIN (0x6c32) to PIN OK (0x9000) 3. CVR (Card Verification Results) is meant to protect against the attack 9F10 (issuer application data) Derivation key index 00 Cryptogram version number 12 Card verification results Byte 2 Bit 8 = 0, Byte 2 Bit 7 = 0 AAC Returned in Second GENERATE AC Byte 2 Bit 6 = 1, Byte 2 Bit 5 = 0 ARQC Returned in GPO/first GENERATE AC Byte 2 Bit 1 = 1 Offline PIN Verification Successful
  • 45. Cryptogram replay attack 2015 https://murdoch.is/papers/ieeesp15beprepared.pdf
  • 47. Application Cryptogram, ARQC Generate AC Request T->C: 80 ae 80 00 41 000000000100 0826 211106 ecb451692 C->T: 772f 9f270180 9f36020001 9f2608aec095fb09512dbb CLA INS P1 P2 Len Amount Currency Date UN Response Tag Type - ARQC Cryptogram ATC
  • 48. Application Cryptogram, ARQC Generate AC Request T->C: 80 ae 80 00 41 000000000100 0826 211106 ecb451692 C->T: 772f 9f270180 9f36020001 9f2608aec095fb09512dbb CLA INS P1 P2 Len Amount Currency Date UN Response Tag Type - ARQC Cryptogram ATC
  • 49. Cryptogram pre-play UN ATC Amount ARQC 00AA00A1 0001 £1 aec095fb09512dbb 00AA00A2 0002 £1 152449f1c0831322 00AA00A3 0003 £1 2ba48c52c594d13d 00AA00A4 0004 £1 5fb0951231ddbb9f
  • 50. Cryptogram pre-play UN ATC Amount ARQC AAAAAAAA 0001 £1 aec095fb09512dbb AAAAAAAA 0002 £1 152449f1c0831322 AAAAAAAA 0003 £1 2ba48c52c594d13d AAAAAAAA 0004 £1 5fb0951231ddbb9f
  • 51. ATC Monitoring Seq No ATC Decision 1 0100 Normal 2 0101 Normal 3 0105 Unusual, but reasonable 4 0FF1 Unusual, unreasonable 5 0010 Unusual, unreasonable
  • 52. Cryptogram replay UN ATC Amount ARQC AAAAAAAA 0001 £1 aec095fb09512dbb AAAAAAAA 0001 £1 aec095fb09512dbb AAAAAAAA 0001 £1 aec095fb09512dbb AAAAAAAA 0001 £1 aec095fb09512dbb
  • 53. Equipment for tests • Modified POS • Malfunctioning POS • Access to the transaction stream
  • 56. Cryptogram confusion attack • Found in Samsung Pay in 2021 accidentally • Later confirmed for many Visa cards
  • 57. Cryptogram confusion attack Get PIN try counter 80CA9F1700 Verify PIN 1234 20008008241234FFFFFFFF Wrong PIN, 2 attempts left 6c32 9F17 01 03 Wrong PIN, 0 attempts left 6c30 Generate AC Verify PIN 1234 20008008241234FFFFFFFF ?
  • 58. PIN Try limit exceeded behaviour • Disable NFC/EMV interface – optional • Set bytes in CVR/IAD (Tag 9F10) [Byte 3 Bit 7 = 1] Pin try limit exceeded • Starts providing AAC cryptogram • [Byte 1 Bit 6 = 0, Byte 1 Bit 5 = 0] AAC Returned in First Generate AC • ARQC – Online authorisation • TC – Offline validation • AAC – Declined cryptogram for further analysis
  • 60. AAC cryptogram algorithm >> 80AE80001D00000000010000000000000008260400008000082622031900 ABCDEFGH (GENERATE AC) • << C0771E9F2701809F360200189F2608AD146FE1F419C3D19f100706000a 03804000 • С->T: PDOL, Tag 9F38 (Amount, Terminal Country Code, Date, UN) • T->C: Generate AC (00000001000826220319ABCDEFGH) • C->T: 3DES(PDOL,ATC,IAD)=AAC AD146FE1F419C3D1
  • 61. AAC cryptogram algorithm [9F10 (issuer application data)] 06000A03804000 [Derivation key index] 00 [Cryptogram version number] 0A [Card verification results] 03804000 [Byte 2 Bit 8 = 1, Byte 2 Bit 7 = 0] Second GENERATE AC not requested [Byte 2 Bit 6 = 0, Byte 2 Bit 5 = 0] AAC Returned in GPO/first GENERATE AC [Byte 3 Bit 7 = 1] Pin try limit exceeded [Byte 4 Bits 8-5] Issuer Script Commands processed on last transaction = 0
  • 62. Attack • Exceed three offline PIN tries on the card • Request an online ARQC cryptogram using Generate AC request • Get an AAC cryptogram back (9f270100, 9f10xxxx) • Change the Cryptogram Type field (9f270180) • Transaction passes the Risk Management checks at the terminal • Cryptogram passes HSM integrity checks • Bank the CVR field bit indicating that the Cryptogram Type = AAC
  • 63. Demo
  • 66. NFC evolution • Contactless near-field antenna connected to the same smartcard • Same payment steps • Same security measures: authorisation, authentication, verification • Same memory area, same encryption keys (RSA, 3DES)
  • 67. NFC evolution for MC and Visa • Visa NFC is less secure than Visa EMV • MC NFC is more secure than MC EMV • https://github.com/a66at/NFCMiTM
  • 69. 1. Reading The PPSE ? Proximity Payment System Environment
  • 70. 2. Card responds with AID “ ” Applicatio n Identifier
  • 71. 3. Terminal selects AID Applicatio n Identifier
  • 72. 4. Card provides PDOL Currency Amount UN TTQ Processing Options Data Object List
  • 73. 5. Terminal sends requested data Currency Amount UN TTQ “GENERATE AC” MSD? EMV chip? qVSDC?
  • 74. 6. Card provides Application Cryptogr ATC Track2 Equiv CTQ Online Pin? Signature ?
  • 75. 7. Terminal conducts risk analysis Config CTQ TTQ CVM? Acquirer “Limits” Floor limit No CDCVM CDCVM CVM
  • 76. Currency Amount UN TTQ Acquire r ATC Track2 Equiv CTQ CDCVM=1 CVM REQUIRED=0 1. Change TTQ “CVM Required” value from 1 to 0 2. Change CTQ “CDCVM Performed” value from 0 to 1
  • 77. Practical recommendations/reflection • How to find new vulnerabilities using the blackbox approach • What are the most interesting bugs for bb programs? • How to show the impact of your findings?
  • 78. Setting up the lab • How to find new vulnerabilities using the blackbox approach • What are the most interesting bugs for bb programs? • How to show the impact of your findings? • What products could you use? Your own cards and • Your own terminals • Unattended terminals • Publicly available products: MasterCard JS EMV core, Stripe • SaaS solution
  • 79. Bug bounty aspects • BB platform triage team (for public programs) • Security@ or responsible disclosure pages • Personal connections for private programs (LI, Twitter) • Support team?
  • 83. PSD2 and magstripe • Magstripe is prohibited in Europe • Technical Fallback is prohibited in Europe • Both issuer and acquirer should be from the EU • https://leigh-annegalloway.com/presentation-materials/ • https://www.paymentvillage.org/archive/defcon-28grayhat/labs
  • 84. Magstripe Transaction Authorisation • No transaction authorisation – Magstripe data is static • No card authentication – Magstripe data can be cloned Track1: B46939575xxxx0760^IUNUSOV/TIMUR^22092210000000000445000000 CVC/CVV = DES-MAC(PAN, EXPDATE, SERVICECODE)
  • 85. Magstripe attacks • Bruteforce CVC – need access to the Transaction Stream • EMV/NFC Track2 equivalent also has CVV/CVC • Read data from EMV/NFC and write it to magstripe
  • 87. Scope Where What How Online payments Add/Send/Convert Merchant accounts Payment devices Card details Cardholder details Personal information Making payments Money withdrawal Security features Authentication bypass Authorisation bypass One Time Codes Logic bypass
  • 88. A few examples • Enrolling card to Apple Pay without additional OTP • Getting card requisites: PAN, Expiry Date, CVV • Sending money (various options)
  • 89. Protection mechanisms • OTP • PIN • Cryptograms • Client-side verification (iOS)
  • 90. One Time Password Top 3 Issues • OTP Bruteforce • OTP limit bypass <- Lack of source/destination control • OTP Integrity <- Race Condition
  • 91. OTP Bruteforce • 4 digit OTP code is requested • 3 attempts for correct OTP entry • Reset and start over again
  • 92. OTP Bruteforce - attack • Request 3 OTP and save them (1212, 2323, 3434) • Repeat in cycles: • Request OTP • Enter one of each pre-recorded OTP • Start again • 1,000 OTP requests, 3,000 attempts give 60% chance to guess the OTP • otp1.php demo
  • 93. OTP Limit Bypass • Can try 1,000 users • Can try OTPs for the same user from 1,000 Ips • otp2.php demo
  • 94. OTP Integrity • OTP checks the transaction integrity • One OTP – one action/event • One OTP could be used for more than 1 action • otp3.php demo