On Relaying NFC Payment Transactions using Android devices

C
On Relaying NFC Payment
Transactions using Android devices
Pepe Vila
Ricardo J. Rodríguez
other title candidates…
‣ Holystic relay attacks on NFC cyber-
payments with Android mobile cloud
phones
2
‣ ENE-FE-SÉ relai con droides movibles
about
‣D. Pepe Vila
IT security consultant at EY
University of Zaragoza
@cgvwzq
‣Dr. Ricardo J. Rodríguez
PhD by University of Zaragoza
Senior Researcher at University of León
@RicardoJRdez
3
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
4
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
5
1. Near Field Communication
“Set of technologies that enable radio based
communications between two devices in proximity”
William Shakespeare (uncredited)
‣ Based on RFID: ISO/IEC 14443, FeLiCa, and others
- 13.56MHz
‣ Rates: 106 – 424 kbit/s
‣ Two main actors:
- PCD (or reader) generates RF field
- PICC (or tag) active/passive
‣ Distance: ≤10cm
‣ Short read range limitation = SECURITY ? (hard eavesdropping)
6
1. Near Field Communication
7
http://www.nxp.com/documents/application_note/AN78010.pdf
1. Near Field Communication
ISO/IEC 14443: International Standard for contactless
integrated circuit cards
‣ Part 1: Defines size and physical characteristics
‣ Part 2: Powering and modulation schemes (type A & B)
‣ Part 3: Initialisation and anti-collision
‣ Part 4: Transmission protocol
Tags compliant with all parts are named Type 4 (or IsoDep)
Can use ISO/IEC 7816-4 APDUs for communication
8
1. Near Field Communication
Initialisation and anti-collision (ISO/IEC 14443-3A)
9
Distinct for Type A and B
Command set:
• REQA
• WUPA
• ANTICOLLISION
• SELECT
• HLTA
Use of CRCs
Low frame delay timings (FDT)
(e.g., MIFARE Classic)
1. Near Field Communication
Transmission Protocol (ISO/IEC 14443-4)
10
• RATS or Request ATS
• ATS or Answer To Select: tag
connection parameters (e.g., frame
size,timeouts…)
• PPS req/resp: allow PCDs to modify
some parameters (if tag supports it)
Establishes a logical half-duplex
communication channel between
PCD and PICC
1. Near Field Communication
Transmission Protocol (ISO/IEC 14443-4)
11
Block Format used
Three types of blocks (depending on Protocol Control Byte):
• I-block: application layer information
• R-block: acknowledgments (empty INF field)
• S-block: control information (used for WTX and DESELECT)
1. Near Field Communication
“ISO/IEC 7816 is an international standard for
electronic identification cards, specially smart cards.”
Application Protocol Data Unit (or APDU):
‣ Communication unit between a reader and a SC
‣ Defined by ISO/IEC 7816-4
‣ Command-response pair
APDUs are encapsulated in the INS field
12
1. Near Field Communication
13
‣ APDU command: 4 byte header + 0..255 bytes data
‣ APDU response: 0..65536 bytes data + 2 status bytes
1. Near Field Communication
14
‣ Wide set of commands: SELECT, READ/WRITE
BINARY, GET DATA, GENERATE APP CRYPTOGRAM…
‣ Used to interact with smart card applications and
the File System.
‣ Special interest on SELECT:
- Smart cards can have multiple applications
- Each one with its own AID or Application Identifier
- Registered Application Provider Identifier (RID)
- Proprietary Application Identifier Extension (PIX)
- Applications are isolated and have different files
- Before any command the reader have to SELECT the
specific AID that wants to talk (also exists implicit
selection)
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
15
3. EMV (a.k.a. credit card payments)
“Standard Europay-Mastercard-VISA defines communication
between smart cards, POS, and ATMs to authenticate credit/
debit card transactions”
‣ APDU commands (defined by ISO/IEC 7816-3 and ISO/IEC
7816-4)
‣ Support for strong cryptographic (chip & PIN)
‣ Backwards compatibility, always prone to downgrade attacks.
‣ Few architecture changes with NFC payments compared to
chip & PIN
(EMV protocols are another surface attack that we have not covered)
16
3. EMV (a.k.a. credit card payments)
17
NFC payments:
‣ Up to 20 GBP, 20€, US$50, 50CHF, CAD100 or AUD100
‣ Limit of using times without PIN verification
‣ Mag-stripe track emulation (CVV3 or dynamic CVV)
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
18
3. Relay Attacks
‣ Introduced by Conway in
1976
‣ Used in challenge-response
protocol scenarios
‣ Can exploit security based
in proximity concerns
19
3. Relay Attacks
NFC relay over ISO/IEC 14443-4
20
ref
ref
ISO/IEC 14443-4
PICCMoleProxyPCD
3.1: APDU Command response
3: APDU Command response
1.1: APDU Command request
2.1: APDU Command response
2: APDU Command Request
1: APDU Command request
ISO/IEC 14443-4
3. Relay Attacks
Some classical examples of NFC relay attacks
21
Mole Proxy
Gerhard Hancke. A practical relay attack on ISO 14443 proximity cards. February, 2005
3. Relay Attacks
Some classical examples of NFC relay attacks
22
Practical Relay Attack on Contactless
Transactions by Using NFC Mobile Phones. February, 2012
3. Relay Attacks
Some classical examples of NFC relay attacks
23
NFC Proxy with CyanogenMod 9.1. Eddie Lee, DEFCON 20.
3. Relay Attacks
Our contribution?
‣ NFC relay attacks with off-the-shelf Android devices:
- No root
- No custom firmware
‣ Analysis of NFC capabilities on Android
24
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
25
26
27
NFC support began with Android 2.3
“Gingerbread” this is API level 9 and December 2010
4. Android NFC history
‣ Only two operation modes: read/write and P2P (now Android Beam)
‣ Card emulation only via hardware SE (Secure Element):
- Tamper-proof platform to securely store data and execute
applications (Global Platform specifications)
- Isolated from the untrusted host
- Very restricted environment due to Trusted Service Managers
Intermediary authority between network operators,
manufacturers and service providers
- OTA updates and installations
- Virtually exclusive use for Google Wallet (and some banks entities)
28
As a result, many developers asked for an
easier access to this resource
4. Android NFC history
‣ First solution was BlackBerry 7 OS; which included software card
emulation or “soft-SE”
‣ soft-SE (also called Host Card Emulation) allows the OS to receive
APDU commands and to response them by any application instead of by
SE’s applets
‣ In 2011, Doug Year released a set of patches including HCE support for
Android Cyanogen Mod (version 9.1)
- Only for NXP PN544 chipset (Samsung Galaxy S, Nexus 7, etc.)
‣ Finally Android officially supported HCE in October 2013 with the
Android 4.4 “KitKat” release (API level 19)
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
29
5. NFC implementation in Android
30
Event-driven API with two native implementations, depending on the NFC chip:
libnfc-nxp and libnfc-nci.
NCI (or NFC Controller Interface) leads the NFC development:
‣ provides an open architecture not focused on a single chip
‣ offers an open interface between the NFC Controller and the Device Host
‣ has been standardised by the NFC Forum
5. NFC implementation in Android
31
The NCI defines two types of messages:
‣ Control messages; subdivided in commands (only from DH to NFCC),
responses and notifications
‣ Data messages; carry the information addressed to (or originated from) the
NFC endpoint
We have also the NCI modules, such as the RF Interface Modules:
‣ define how the DH can communicate through the NCI with a specific NFC
endpoint
‣ each RF interface support a specific RF protocol
‣ determines how the payload in a data message, fits on a RF message
Other modules focused on RF discovery or AID routing (discussed later)
5. Android NFC: R/W mode
32
Applications are not allowed to directly set the device into read/write mode
1. Register NFC tags of interest (in the AndroidManifest.xml)
2. NFC service selects and starts the registered app whether a tag is
discovered (apps can also ask preference when in foreground mode)
Tags are discovered by the NFCC, which polls the magnetic field
1. The tag protocol and technology is determined
2. An NCI message is sent from NFCC to DH with tag details
3. The DH (or NfcService) handles the message and fills a Tag object
4. The NfcService creates and emits an Intent with the EXTRA_TAG field
with the Tag object
5. Android registered application receives the Intent and the Tag object
33
Android NFC read/write API offers specific classes per tag type:
‣ NfcA and NfcB for ISO/IEC 14443-3A and B compliant tags
‣ IsoDep for ISO/IEC 14443-4 tags using ISO/IEC 7816-4 APDUs
‣ NfcF for FeLiCa cards (standard JIS 6319-4)
‣ NfcV for ISO/IEC 15693 vecinity cards
‣ …
Extend BasicTagTechnology, which in turn implements the TagTechnology
interface. All the classes use a high level I/O blocking method:
byte[] transceive(byte[] data, boolean raw) {
...
mTag.getTagService().transceive(mTag.getServiceHandle(), data, raw);
...
}
To communicate the DH with an NFC remote tag
5. Android NFC: R/W mode
34
HCE mode is supported by extending the HostApduService abstract class to
process commands and generate responses, by implementing:
byte[] processCommandApdu(byte[] commandApdu, Bundle extras);
and
void onDeactivated(int reason);
methods.
‣ The application has to the register AIDs of interest in its manifest (since Lolipop
also dynamic register support)
‣ IsoDep compliant readers initiates NFC communication with a SELECT
command with an specific AID
‣ After a SELECT, the system will route all APDUs to the appropriate service
according to its AID, until another application is selected or a DESELECT
command is received
5. Android NFC: HCE mode
35
5. Android NFC arch.: Summary
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
36
37
6. PoC + attack scenarios
Demo Time
6. PoC + attack scenarios
38
6. PoC + attack scenarios
39
BOT
BOTMASTER
BOT
BOT
BOT
BOT
BOT
Fig: Distributed mafia fraud
6. PoC + attack scenarios
40
Fig: Astral payment
agenda
1.NFC: what and how
2.EMV (a.k.a. credit card payments)
3.Relay attacks
4.Android NFC history
5.NFC implementation in Android
6.PoC + attack scenarios
7.Limitations and conclusions
41
7. Limitations and conclusions
42
Currently, there are several limitations when performing NFC relay
attacks with Android off-the-shelf devices
‣ Not support for raw ISO/IEC 14443-3 commands (no read/write
mode for MIFARE Classic or other proprietary protocols)
‣ Emulation constrained to APDUs over ISO/IEC 14443-4
‣ Pre-registering of AIDs to emulate and explicit SELECTion
‣ Timing restrictions: maximum delay in the relay channel
FWT = 256·(16/fc)·2FWI, 0 ≤ FWI ≤ 14, where fc = 13.56MHz
Frame Waiting Time from 500µs to 5s
Note: about libnfc-nci implementation
7. Limitations and conclusions
43
Countermeasures against NFC relay attacks
‣ Distance-bounding protocols
‣ Hardware or RF fingerprinting identification
‣ Physical activation (button or switch)
‣ Secondary authentication methods within the cards
(e.g., Zwipe cards)
7. Limitations and conclusions
44
Android NFC off-the-shelf devices (no root nor custom firmware)
are able to:
‣ Perform a relay attack over an ISO/IEC 14443-4 communication
‣ Contactless payment transactions affected (regardless the EMV
security)
Thus, a simple Android app can be used to study NFC transactions
without need of custom hardware
But also could be abused by malware…
questions or vinegar?
45
i also manufacture balsamic vinegar :)
1 of 45

Recommended

BPF Hardware Offload Deep Dive by
BPF Hardware Offload Deep DiveBPF Hardware Offload Deep Dive
BPF Hardware Offload Deep DiveNetronome
714 views28 slides
Cilium - BPF & XDP for containers by
 Cilium - BPF & XDP for containers Cilium - BPF & XDP for containers
Cilium - BPF & XDP for containersDocker, Inc.
5.7K views15 slides
Apache Knox - Hadoop Security Swiss Army Knife by
Apache Knox - Hadoop Security Swiss Army KnifeApache Knox - Hadoop Security Swiss Army Knife
Apache Knox - Hadoop Security Swiss Army KnifeDataWorks Summit
1.2K views35 slides
HKG18-402 - Build secure key management services in OP-TEE by
HKG18-402 - Build secure key management services in OP-TEEHKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEELinaro
3.4K views38 slides
NETCONF Call Home by
NETCONF Call Home NETCONF Call Home
NETCONF Call Home ADVA
6.4K views16 slides
Ovs dpdk hwoffload way to full offload by
Ovs dpdk hwoffload way to full offloadOvs dpdk hwoffload way to full offload
Ovs dpdk hwoffload way to full offloadKevin Traynor
849 views27 slides

More Related Content

What's hot

DPDK In Depth by
DPDK In DepthDPDK In Depth
DPDK In DepthKernel TLV
5.2K views34 slides
Staring into the eBPF Abyss by
Staring into the eBPF AbyssStaring into the eBPF Abyss
Staring into the eBPF AbyssSasha Goldshtein
3.1K views35 slides
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg by
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegExploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegVMware Tanzu
489 views42 slides
Observability in Java: Getting Started with OpenTelemetry by
Observability in Java: Getting Started with OpenTelemetryObservability in Java: Getting Started with OpenTelemetry
Observability in Java: Getting Started with OpenTelemetryDevOps.com
378 views26 slides
VXLAN and FRRouting by
VXLAN and FRRoutingVXLAN and FRRouting
VXLAN and FRRoutingFaisal Reza
1.4K views68 slides
3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT... by
3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT...3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT...
3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT...Ryuichi Yasunaga
52 views31 slides

What's hot(20)

DPDK In Depth by Kernel TLV
DPDK In DepthDPDK In Depth
DPDK In Depth
Kernel TLV5.2K views
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg by VMware Tanzu
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegExploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
VMware Tanzu489 views
Observability in Java: Getting Started with OpenTelemetry by DevOps.com
Observability in Java: Getting Started with OpenTelemetryObservability in Java: Getting Started with OpenTelemetry
Observability in Java: Getting Started with OpenTelemetry
DevOps.com378 views
VXLAN and FRRouting by Faisal Reza
VXLAN and FRRoutingVXLAN and FRRouting
VXLAN and FRRouting
Faisal Reza1.4K views
3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT... by Ryuichi Yasunaga
3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT...3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT...
3GPP 5G NSA Detailed explanation 2(EN-DC SgNB additional call flow include LT...
Ryuichi Yasunaga52 views
introduction to linux kernel tcp/ip ptocotol stack by monad bobo
introduction to linux kernel tcp/ip ptocotol stack introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack
monad bobo12.9K views
P2P Container Image Distribution on IPFS With containerd and nerdctl by Kohei Tokunaga
P2P Container Image Distribution on IPFS With containerd and nerdctlP2P Container Image Distribution on IPFS With containerd and nerdctl
P2P Container Image Distribution on IPFS With containerd and nerdctl
Kohei Tokunaga1.4K views
LF_DPDK17_GRO/GSO Libraries: Bring Significant Performance Gains to DPDK-base... by LF_DPDK
LF_DPDK17_GRO/GSO Libraries: Bring Significant Performance Gains to DPDK-base...LF_DPDK17_GRO/GSO Libraries: Bring Significant Performance Gains to DPDK-base...
LF_DPDK17_GRO/GSO Libraries: Bring Significant Performance Gains to DPDK-base...
LF_DPDK372 views
Everything You wanted to Know About Distributed Tracing by Amuhinda Hungai
Everything You wanted to Know About Distributed TracingEverything You wanted to Know About Distributed Tracing
Everything You wanted to Know About Distributed Tracing
Amuhinda Hungai228 views
Hardware-assisted Isolated Execution Environment to run trusted OS and applic... by Kuniyasu Suzaki
Hardware-assisted Isolated Execution Environment to run trusted OS and applic...Hardware-assisted Isolated Execution Environment to run trusted OS and applic...
Hardware-assisted Isolated Execution Environment to run trusted OS and applic...
Kuniyasu Suzaki1.5K views
eBPF/XDP by Netronome
eBPF/XDP eBPF/XDP
eBPF/XDP
Netronome3.3K views
Linux kernel tracing by Viller Hsiao
Linux kernel tracingLinux kernel tracing
Linux kernel tracing
Viller Hsiao16.9K views
How Apache Kafka® Works by confluent
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Works
confluent11.4K views
Cilium - Bringing the BPF Revolution to Kubernetes Networking and Security by Thomas Graf
Cilium - Bringing the BPF Revolution to Kubernetes Networking and SecurityCilium - Bringing the BPF Revolution to Kubernetes Networking and Security
Cilium - Bringing the BPF Revolution to Kubernetes Networking and Security
Thomas Graf2.6K views
Using GTP on Linux with libgtpnl by Kentaro Ebisawa
Using GTP on Linux with libgtpnlUsing GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnl
Kentaro Ebisawa6.6K views
Enabling new protocol processing with DPDK using Dynamic Device Personalization by Michelle Holley
Enabling new protocol processing with DPDK using Dynamic Device PersonalizationEnabling new protocol processing with DPDK using Dynamic Device Personalization
Enabling new protocol processing with DPDK using Dynamic Device Personalization
Michelle Holley3.1K views
Cilium - Container Networking with BPF & XDP by Thomas Graf
Cilium - Container Networking with BPF & XDPCilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDP
Thomas Graf4.8K views
MPLS-TP (MPLS Transport Profile) by Shivlu Jain
MPLS-TP (MPLS Transport Profile)MPLS-TP (MPLS Transport Profile)
MPLS-TP (MPLS Transport Profile)
Shivlu Jain15.7K views

Viewers also liked

NFC technical presentation by
NFC technical presentationNFC technical presentation
NFC technical presentationAkshat Rohatgi
91.4K views23 slides
Near Field Communication (NFC Architecture and Operating Modes) by
Near Field Communication (NFC Architecture and Operating Modes)Near Field Communication (NFC Architecture and Operating Modes)
Near Field Communication (NFC Architecture and Operating Modes)Deepak Kl
17.6K views43 slides
Near field Technology by
Near field TechnologyNear field Technology
Near field Technologyshrien_sahi
16K views26 slides
Nfc by
NfcNfc
Nfcducquoc_vn
23.6K views26 slides
NFC on Android - Near Field Communication by
NFC on Android - Near Field CommunicationNFC on Android - Near Field Communication
NFC on Android - Near Field CommunicationSven Haiges
23.2K views57 slides
Tap into NFC Meetup - Boston by
Tap into NFC Meetup  - Boston Tap into NFC Meetup  - Boston
Tap into NFC Meetup - Boston NFC Forum
17.5K views108 slides

Viewers also liked(20)

NFC technical presentation by Akshat Rohatgi
NFC technical presentationNFC technical presentation
NFC technical presentation
Akshat Rohatgi91.4K views
Near Field Communication (NFC Architecture and Operating Modes) by Deepak Kl
Near Field Communication (NFC Architecture and Operating Modes)Near Field Communication (NFC Architecture and Operating Modes)
Near Field Communication (NFC Architecture and Operating Modes)
Deepak Kl17.6K views
Near field Technology by shrien_sahi
Near field TechnologyNear field Technology
Near field Technology
shrien_sahi16K views
NFC on Android - Near Field Communication by Sven Haiges
NFC on Android - Near Field CommunicationNFC on Android - Near Field Communication
NFC on Android - Near Field Communication
Sven Haiges23.2K views
Tap into NFC Meetup - Boston by NFC Forum
Tap into NFC Meetup  - Boston Tap into NFC Meetup  - Boston
Tap into NFC Meetup - Boston
NFC Forum17.5K views
Near field communication (nfc) technology by Ankur Sharma
Near field communication (nfc) technologyNear field communication (nfc) technology
Near field communication (nfc) technology
Ankur Sharma50.3K views
Vodafone Cash Service - NFC tag by Deyaa Ahmed
Vodafone Cash Service - NFC tagVodafone Cash Service - NFC tag
Vodafone Cash Service - NFC tag
Deyaa Ahmed4.9K views
Nfc tutorial by Roy Chen
Nfc tutorialNfc tutorial
Nfc tutorial
Roy Chen3.1K views
Guide du tag NFC : quels usages dans quels contextes ? by Olivier Devillers
Guide du tag NFC : quels usages dans quels contextes ?Guide du tag NFC : quels usages dans quels contextes ?
Guide du tag NFC : quels usages dans quels contextes ?
Olivier Devillers3.9K views
NFC Everywhere Brochure 2016 by Laurent Dardé
NFC Everywhere Brochure 2016NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016
Laurent Dardé6.3K views
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP by Droidcon Berlin
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXPdroidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP
Droidcon Berlin10.9K views
Near field communication by Siddharth Dc
Near field communication Near field communication
Near field communication
Siddharth Dc7.2K views
Nfc-Full Presentation by DILIN RAJ DS
Nfc-Full PresentationNfc-Full Presentation
Nfc-Full Presentation
DILIN RAJ DS14.4K views
Near field communication by Nagesh Mishra
Near field communicationNear field communication
Near field communication
Nagesh Mishra13.4K views
NFC(Near Field Communication) by ADARSH KUMAR
NFC(Near Field Communication)NFC(Near Field Communication)
NFC(Near Field Communication)
ADARSH KUMAR18.5K views
VISIONFC – an NFC Forum event: The future of NFC in Wearables, Health Care & ... by NFC Forum
VISIONFC – an NFC Forum event: The future of NFC in Wearables, Health Care & ...VISIONFC – an NFC Forum event: The future of NFC in Wearables, Health Care & ...
VISIONFC – an NFC Forum event: The future of NFC in Wearables, Health Care & ...
NFC Forum5.4K views

Similar to On Relaying NFC Payment Transactions using Android devices

NFC Basic Concepts by
NFC Basic ConceptsNFC Basic Concepts
NFC Basic ConceptsAde Okuboyejo
14.9K views30 slides
Nfc by
NfcNfc
NfcRobin Dabur
6.9K views25 slides
Nfc technology by
Nfc technologyNfc technology
Nfc technologymanasvi sarkar
5.2K views36 slides
Cryptanalaysis of an EPCC1G2 Standard Compliant Ownership Transfer Scheme Jor... by
Cryptanalaysis of an EPCC1G2 Standard Compliant Ownership Transfer Scheme Jor...Cryptanalaysis of an EPCC1G2 Standard Compliant Ownership Transfer Scheme Jor...
Cryptanalaysis of an EPCC1G2 Standard Compliant Ownership Transfer Scheme Jor...Information Security Awareness Group
551 views14 slides
Need NFC RFID-Tomorrow Is Today in This Constant State of Innovation by
Need NFC RFID-Tomorrow Is Today in This Constant State of InnovationNeed NFC RFID-Tomorrow Is Today in This Constant State of Innovation
Need NFC RFID-Tomorrow Is Today in This Constant State of InnovationHamed M. Sanogo
4.7K views13 slides
Wireless RF module by
Wireless RF moduleWireless RF module
Wireless RF modulerapper13_32
2K views76 slides

Similar to On Relaying NFC Payment Transactions using Android devices(20)

NFC Basic Concepts by Ade Okuboyejo
NFC Basic ConceptsNFC Basic Concepts
NFC Basic Concepts
Ade Okuboyejo14.9K views
Need NFC RFID-Tomorrow Is Today in This Constant State of Innovation by Hamed M. Sanogo
Need NFC RFID-Tomorrow Is Today in This Constant State of InnovationNeed NFC RFID-Tomorrow Is Today in This Constant State of Innovation
Need NFC RFID-Tomorrow Is Today in This Constant State of Innovation
Hamed M. Sanogo4.7K views
Near FIeld Communication by Maajidleo
Near FIeld Communication Near FIeld Communication
Near FIeld Communication
Maajidleo1.1K views
NEAR FIELD COMMUNICATION (NFC) TECHNOLOGY: A SURVEY by IJCI JOURNAL
NEAR FIELD COMMUNICATION (NFC)  TECHNOLOGY: A SURVEY NEAR FIELD COMMUNICATION (NFC)  TECHNOLOGY: A SURVEY
NEAR FIELD COMMUNICATION (NFC) TECHNOLOGY: A SURVEY
IJCI JOURNAL551 views
Architecture and Development of NFC Applications by Thomas de Lazzari
Architecture and Development of NFC ApplicationsArchitecture and Development of NFC Applications
Architecture and Development of NFC Applications
Thomas de Lazzari110.8K views
NEAR FIELD COMMUNICATION, IT’S VULNERABILITY AND COUNTER MEASURES by IRJET Journal
NEAR FIELD COMMUNICATION, IT’S VULNERABILITY AND COUNTER MEASURESNEAR FIELD COMMUNICATION, IT’S VULNERABILITY AND COUNTER MEASURES
NEAR FIELD COMMUNICATION, IT’S VULNERABILITY AND COUNTER MEASURES
IRJET Journal3 views
NFCRFID Ripe for Application Expansion_ElectronicDesign by Hamed M. Sanogo
NFCRFID Ripe for Application Expansion_ElectronicDesignNFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesign
Hamed M. Sanogo4.3K views
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE... by ijasuc
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...
ijasuc12 views
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE... by ijasuc
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...
ijasuc12 views
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE... by ijasuc
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...
INTEGRATION OF AN RFID READER TO A WIRELESS SENSOR NETWORK AND ITS USE TO IDE...
ijasuc16 views
International Journal of Engineering Research and Development by IJERD Editor
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
IJERD Editor278 views
Near Field Communication in m-Commerce by ThejasK8
Near Field Communication in m-CommerceNear Field Communication in m-Commerce
Near Field Communication in m-Commerce
ThejasK83.4K views
NFC Bootcamp Seattle Day 2 by traceebeebe
NFC Bootcamp Seattle Day 2 NFC Bootcamp Seattle Day 2
NFC Bootcamp Seattle Day 2
traceebeebe3.3K views

Recently uploaded

Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
27 views43 slides
ChatGPT and AI for Web Developers by
ChatGPT and AI for Web DevelopersChatGPT and AI for Web Developers
ChatGPT and AI for Web DevelopersMaximiliano Firtman
181 views82 slides
The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
121 views24 slides
Melek BEN MAHMOUD.pdf by
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 views1 slide
Special_edition_innovator_2023.pdf by
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdfWillDavies22
16 views6 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
17 views1 slide

Recently uploaded(20)

Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 views
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2216 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma17 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10209 views
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... by NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS28 views
[2023] Putting the R! in R&D.pdf by Eleanor McHugh
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh38 views
Future of Learning - Khoong Chan Meng by NUS-ISS
Future of Learning - Khoong Chan MengFuture of Learning - Khoong Chan Meng
Future of Learning - Khoong Chan Meng
NUS-ISS33 views
Spesifikasi Lengkap ASUS Vivobook Go 14 by Dot Semarang
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14
Dot Semarang35 views
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst470 views
Attacking IoT Devices from a Web Perspective - Linux Day by Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 views
DALI Basics Course 2023 by Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 views
AI: mind, matter, meaning, metaphors, being, becoming, life values by Twain Liu 刘秋艳
AI: mind, matter, meaning, metaphors, being, becoming, life valuesAI: mind, matter, meaning, metaphors, being, becoming, life values
AI: mind, matter, meaning, metaphors, being, becoming, life values
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... by NUS-ISS
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
NUS-ISS37 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi120 views

On Relaying NFC Payment Transactions using Android devices

  • 1. On Relaying NFC Payment Transactions using Android devices Pepe Vila Ricardo J. Rodríguez
  • 2. other title candidates… ‣ Holystic relay attacks on NFC cyber- payments with Android mobile cloud phones 2 ‣ ENE-FE-SÉ relai con droides movibles
  • 3. about ‣D. Pepe Vila IT security consultant at EY University of Zaragoza @cgvwzq ‣Dr. Ricardo J. Rodríguez PhD by University of Zaragoza Senior Researcher at University of León @RicardoJRdez 3
  • 4. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 4
  • 5. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 5
  • 6. 1. Near Field Communication “Set of technologies that enable radio based communications between two devices in proximity” William Shakespeare (uncredited) ‣ Based on RFID: ISO/IEC 14443, FeLiCa, and others - 13.56MHz ‣ Rates: 106 – 424 kbit/s ‣ Two main actors: - PCD (or reader) generates RF field - PICC (or tag) active/passive ‣ Distance: ≤10cm ‣ Short read range limitation = SECURITY ? (hard eavesdropping) 6
  • 7. 1. Near Field Communication 7 http://www.nxp.com/documents/application_note/AN78010.pdf
  • 8. 1. Near Field Communication ISO/IEC 14443: International Standard for contactless integrated circuit cards ‣ Part 1: Defines size and physical characteristics ‣ Part 2: Powering and modulation schemes (type A & B) ‣ Part 3: Initialisation and anti-collision ‣ Part 4: Transmission protocol Tags compliant with all parts are named Type 4 (or IsoDep) Can use ISO/IEC 7816-4 APDUs for communication 8
  • 9. 1. Near Field Communication Initialisation and anti-collision (ISO/IEC 14443-3A) 9 Distinct for Type A and B Command set: • REQA • WUPA • ANTICOLLISION • SELECT • HLTA Use of CRCs Low frame delay timings (FDT) (e.g., MIFARE Classic)
  • 10. 1. Near Field Communication Transmission Protocol (ISO/IEC 14443-4) 10 • RATS or Request ATS • ATS or Answer To Select: tag connection parameters (e.g., frame size,timeouts…) • PPS req/resp: allow PCDs to modify some parameters (if tag supports it) Establishes a logical half-duplex communication channel between PCD and PICC
  • 11. 1. Near Field Communication Transmission Protocol (ISO/IEC 14443-4) 11 Block Format used Three types of blocks (depending on Protocol Control Byte): • I-block: application layer information • R-block: acknowledgments (empty INF field) • S-block: control information (used for WTX and DESELECT)
  • 12. 1. Near Field Communication “ISO/IEC 7816 is an international standard for electronic identification cards, specially smart cards.” Application Protocol Data Unit (or APDU): ‣ Communication unit between a reader and a SC ‣ Defined by ISO/IEC 7816-4 ‣ Command-response pair APDUs are encapsulated in the INS field 12
  • 13. 1. Near Field Communication 13 ‣ APDU command: 4 byte header + 0..255 bytes data ‣ APDU response: 0..65536 bytes data + 2 status bytes
  • 14. 1. Near Field Communication 14 ‣ Wide set of commands: SELECT, READ/WRITE BINARY, GET DATA, GENERATE APP CRYPTOGRAM… ‣ Used to interact with smart card applications and the File System. ‣ Special interest on SELECT: - Smart cards can have multiple applications - Each one with its own AID or Application Identifier - Registered Application Provider Identifier (RID) - Proprietary Application Identifier Extension (PIX) - Applications are isolated and have different files - Before any command the reader have to SELECT the specific AID that wants to talk (also exists implicit selection)
  • 15. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 15
  • 16. 3. EMV (a.k.a. credit card payments) “Standard Europay-Mastercard-VISA defines communication between smart cards, POS, and ATMs to authenticate credit/ debit card transactions” ‣ APDU commands (defined by ISO/IEC 7816-3 and ISO/IEC 7816-4) ‣ Support for strong cryptographic (chip & PIN) ‣ Backwards compatibility, always prone to downgrade attacks. ‣ Few architecture changes with NFC payments compared to chip & PIN (EMV protocols are another surface attack that we have not covered) 16
  • 17. 3. EMV (a.k.a. credit card payments) 17 NFC payments: ‣ Up to 20 GBP, 20€, US$50, 50CHF, CAD100 or AUD100 ‣ Limit of using times without PIN verification ‣ Mag-stripe track emulation (CVV3 or dynamic CVV)
  • 18. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 18
  • 19. 3. Relay Attacks ‣ Introduced by Conway in 1976 ‣ Used in challenge-response protocol scenarios ‣ Can exploit security based in proximity concerns 19
  • 20. 3. Relay Attacks NFC relay over ISO/IEC 14443-4 20 ref ref ISO/IEC 14443-4 PICCMoleProxyPCD 3.1: APDU Command response 3: APDU Command response 1.1: APDU Command request 2.1: APDU Command response 2: APDU Command Request 1: APDU Command request ISO/IEC 14443-4
  • 21. 3. Relay Attacks Some classical examples of NFC relay attacks 21 Mole Proxy Gerhard Hancke. A practical relay attack on ISO 14443 proximity cards. February, 2005
  • 22. 3. Relay Attacks Some classical examples of NFC relay attacks 22 Practical Relay Attack on Contactless Transactions by Using NFC Mobile Phones. February, 2012
  • 23. 3. Relay Attacks Some classical examples of NFC relay attacks 23 NFC Proxy with CyanogenMod 9.1. Eddie Lee, DEFCON 20.
  • 24. 3. Relay Attacks Our contribution? ‣ NFC relay attacks with off-the-shelf Android devices: - No root - No custom firmware ‣ Analysis of NFC capabilities on Android 24
  • 25. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 25
  • 26. 26
  • 27. 27 NFC support began with Android 2.3 “Gingerbread” this is API level 9 and December 2010 4. Android NFC history ‣ Only two operation modes: read/write and P2P (now Android Beam) ‣ Card emulation only via hardware SE (Secure Element): - Tamper-proof platform to securely store data and execute applications (Global Platform specifications) - Isolated from the untrusted host - Very restricted environment due to Trusted Service Managers Intermediary authority between network operators, manufacturers and service providers - OTA updates and installations - Virtually exclusive use for Google Wallet (and some banks entities)
  • 28. 28 As a result, many developers asked for an easier access to this resource 4. Android NFC history ‣ First solution was BlackBerry 7 OS; which included software card emulation or “soft-SE” ‣ soft-SE (also called Host Card Emulation) allows the OS to receive APDU commands and to response them by any application instead of by SE’s applets ‣ In 2011, Doug Year released a set of patches including HCE support for Android Cyanogen Mod (version 9.1) - Only for NXP PN544 chipset (Samsung Galaxy S, Nexus 7, etc.) ‣ Finally Android officially supported HCE in October 2013 with the Android 4.4 “KitKat” release (API level 19)
  • 29. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 29
  • 30. 5. NFC implementation in Android 30 Event-driven API with two native implementations, depending on the NFC chip: libnfc-nxp and libnfc-nci. NCI (or NFC Controller Interface) leads the NFC development: ‣ provides an open architecture not focused on a single chip ‣ offers an open interface between the NFC Controller and the Device Host ‣ has been standardised by the NFC Forum
  • 31. 5. NFC implementation in Android 31 The NCI defines two types of messages: ‣ Control messages; subdivided in commands (only from DH to NFCC), responses and notifications ‣ Data messages; carry the information addressed to (or originated from) the NFC endpoint We have also the NCI modules, such as the RF Interface Modules: ‣ define how the DH can communicate through the NCI with a specific NFC endpoint ‣ each RF interface support a specific RF protocol ‣ determines how the payload in a data message, fits on a RF message Other modules focused on RF discovery or AID routing (discussed later)
  • 32. 5. Android NFC: R/W mode 32 Applications are not allowed to directly set the device into read/write mode 1. Register NFC tags of interest (in the AndroidManifest.xml) 2. NFC service selects and starts the registered app whether a tag is discovered (apps can also ask preference when in foreground mode) Tags are discovered by the NFCC, which polls the magnetic field 1. The tag protocol and technology is determined 2. An NCI message is sent from NFCC to DH with tag details 3. The DH (or NfcService) handles the message and fills a Tag object 4. The NfcService creates and emits an Intent with the EXTRA_TAG field with the Tag object 5. Android registered application receives the Intent and the Tag object
  • 33. 33 Android NFC read/write API offers specific classes per tag type: ‣ NfcA and NfcB for ISO/IEC 14443-3A and B compliant tags ‣ IsoDep for ISO/IEC 14443-4 tags using ISO/IEC 7816-4 APDUs ‣ NfcF for FeLiCa cards (standard JIS 6319-4) ‣ NfcV for ISO/IEC 15693 vecinity cards ‣ … Extend BasicTagTechnology, which in turn implements the TagTechnology interface. All the classes use a high level I/O blocking method: byte[] transceive(byte[] data, boolean raw) { ... mTag.getTagService().transceive(mTag.getServiceHandle(), data, raw); ... } To communicate the DH with an NFC remote tag 5. Android NFC: R/W mode
  • 34. 34 HCE mode is supported by extending the HostApduService abstract class to process commands and generate responses, by implementing: byte[] processCommandApdu(byte[] commandApdu, Bundle extras); and void onDeactivated(int reason); methods. ‣ The application has to the register AIDs of interest in its manifest (since Lolipop also dynamic register support) ‣ IsoDep compliant readers initiates NFC communication with a SELECT command with an specific AID ‣ After a SELECT, the system will route all APDUs to the appropriate service according to its AID, until another application is selected or a DESELECT command is received 5. Android NFC: HCE mode
  • 35. 35 5. Android NFC arch.: Summary
  • 36. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 36
  • 37. 37 6. PoC + attack scenarios Demo Time
  • 38. 6. PoC + attack scenarios 38
  • 39. 6. PoC + attack scenarios 39 BOT BOTMASTER BOT BOT BOT BOT BOT Fig: Distributed mafia fraud
  • 40. 6. PoC + attack scenarios 40 Fig: Astral payment
  • 41. agenda 1.NFC: what and how 2.EMV (a.k.a. credit card payments) 3.Relay attacks 4.Android NFC history 5.NFC implementation in Android 6.PoC + attack scenarios 7.Limitations and conclusions 41
  • 42. 7. Limitations and conclusions 42 Currently, there are several limitations when performing NFC relay attacks with Android off-the-shelf devices ‣ Not support for raw ISO/IEC 14443-3 commands (no read/write mode for MIFARE Classic or other proprietary protocols) ‣ Emulation constrained to APDUs over ISO/IEC 14443-4 ‣ Pre-registering of AIDs to emulate and explicit SELECTion ‣ Timing restrictions: maximum delay in the relay channel FWT = 256·(16/fc)·2FWI, 0 ≤ FWI ≤ 14, where fc = 13.56MHz Frame Waiting Time from 500µs to 5s Note: about libnfc-nci implementation
  • 43. 7. Limitations and conclusions 43 Countermeasures against NFC relay attacks ‣ Distance-bounding protocols ‣ Hardware or RF fingerprinting identification ‣ Physical activation (button or switch) ‣ Secondary authentication methods within the cards (e.g., Zwipe cards)
  • 44. 7. Limitations and conclusions 44 Android NFC off-the-shelf devices (no root nor custom firmware) are able to: ‣ Perform a relay attack over an ISO/IEC 14443-4 communication ‣ Contactless payment transactions affected (regardless the EMV security) Thus, a simple Android app can be used to study NFC transactions without need of custom hardware But also could be abused by malware…
  • 45. questions or vinegar? 45 i also manufacture balsamic vinegar :)