Hello. Thank you to be here today. We're going to start. We're going to talk about NFC payments, the outdoor relay and replay attacks. Basically, who am I? I'm a security researcher, a freelancer. I work in California. I present here in DEF CON like two years ago about Samsung Pay. Also last year I present about exploiting all my information with Bluetooth audio. This is my third time in DEF CON in a row. I'm probably a woman in DEF CON which basically is a foundation that helps women to come to a conference like security and technology calls. Basically, this tag is how we can move transactions from one place to another. And we are going to research about how we can implement replay attacks and relays using this technology. And of course, using open source tools to do that. In this case, I'm using a same device to move one transaction from one place to another. I'm using one device, in this case, a Samsung device, acting as POS on a Samsung Pay technology. A little bit about the content of this tag. It's about an intro to NFC. We're going to talk about MEV flow process. And also the fraud vector of this technology. We're going to talk about also the previous work from Peter Fillmore and Mr. Roland. Also about the NFC environment. We're going to talk about the simulation, which is one of the keys in these attacks. Replay attacks from, in this case, I'm going to use Google Pay flow. And relay attacks for any kind of device. Implementing HTC or secure elements for Apple Pay. Also how we can strike chips data implementing NFC. A new attack that I call a relay for replay. I also call it a smart relay attack. And how this could affect new technology to come. Basically, NFC technology, it's part of, like, you can have two devices that they need to be close to each other to make a transaction or a communication between them. We're talking about 10 centimeters. But that doesn't mean that we can make an amplitude of this signal to communicate to devices in a large range. NFC is in the high frequency and the RFID spectrum. Basically, it's implemented in the high frequency range. It's implemented in passive technology. One of the characteristics of NFC technology and the payment systems is that it implements 13.56 megahertz passive mode, which basically it needs another device to boot up another, for example, in this case, it could be the cell phone or a smart card, credit card. It's widely implemented. Basically, many devices implement NFC. And you use the ESO 14.4. It's a 3A. In this particular case, we're going to talk just about bank systems. One of the main questions that many people ask is how this process starts. Basically, when you approach to a terminal to make a payment, the terminal starts the transaction, not the smart card or the device like Apple Pay or Samsung Pay. Always, the terminal starts the communication with the devices. For example, this is a transaction that we're going to implement in the smart watch. Basically, you have to have in mind how this works. Basically, you are in the shell. You test a command and the system responds back. It could be with right answer or wrong answer. But basically, it's in the way they works. With four commands, we can make a transaction, basically. This is how NFC works. We're going to get into details about these transactions in a few slides. A little bit about how this transaction works. First, we're going to talk about the tokenization process. The POS detects the card or the smart card. List the applications. Select applications to get data. Implements the fraud vectors. Also, the managed risk. Some actions from the card and from the POS simultaneously. And after that, the complete transaction. The complete transaction doesn't mean it could be a successful transaction. It could be a declined transaction. But the transaction has to be finished some way or another. A little bit about the tokenization process. Basically, the tokenization process is how you convert a physical card to a virtual credit card. This process basically is when you're making a payment with Samsung Pay, let's say. Every time you're making a purchase, the system is generating a new card. This is for to avoid fraud attacks. For example, if someone is able to intercept a token, he can use just for one time. But not for more times. The idea of this tokenization process is to add security to the physical cards. Instead of using the physical card numbers, you're using the scramble data, let's say. How the tokenization process works. Basically, when you use your cell phone to make a payment, it could be Apple Pay or Samsung Pay or whatever. The terminal detects the token. On this token, it sends to the payment network. And we have another party working on it, which basically is a token service provider, which relates the token with the physical card number. So, this is how the tokenization process works. After it relates the transaction, it sends out to the bank, and it accepts or reclines the transaction. Some of the technology about NFC, basically, we have secure element for Apple Pay, Samsung Pay, and for Google Pay, the new version of Android Pay. Some of the characteristics of this technology is that secure element is more than 20 years implemented. It has smart card, received access, and also it has self-encryption. Self-encryption, I mean you have cryptograms inside of the device so you can validate the transactions. In the host card emulation, on the other side, we have limit use keys, tokenization process, cloud cryptograms, and transaction risk analysis. And this part is like the Google Pay technology. Basically, when you add your card to the Google Pay, it unloads four or five tokens to your device, and you can use these tokens to make payments. After you finish this pile of tokens, it unloads four or five more tokens. So you can use them. The NFC fraud vector. The motivation about this attack is because you have low limits but higher in other countries. Basically, if you stole $50 in the United States, if you move this $50 to another country, that $50 will increase in value in another country. You don't have any additional calculation verification, which basically, if it's less than $50, you don't need a PIN or a signature or anything like that. So you don't have any additional verification or anything like that. And also, from our perspective, the fraud is considered an accepted risk. And the main thing is that NFC is implemented in many IoT devices. Attack is the while. We noticed that a few years ago, in 2015, one guy was in the metro on the subway using a POS, basically, to make, to get close to people and try to get the NFC transactions, making offline transactions. And after that, he convalidated them with, using online transactions. The previous work about this NFC, basically, Mr. Roland presented a replay attack about MasterCard in 2013, which he said, if you implement the unique number to zero, you can, let's say, guess it, which is going to be the CBC. And for four transactions, three of them went through. So it was a very good attack. In 2015, we had a very good attack against Black Hat. And a lot of people are saying, Peter Fillmore presented Black Hat about how you can turn on the master bit and the IP. Instead of using all the security in the NFC transaction, you can reduce it to the max type level. Which basically you can use this against the Visa card. Also, about the hardware side, previous work in last year, the man in the NFC, guys from Asia present two boards, which basically was a client on a server, which you can implement to make a relay attack using SDR technology. Basically, it's a specific channel to make this relay attack. Some of the limitations, it was a private prototype, and it has a special design. Let's talk a little bit about NFC emulation. NFC emulation is where you can have a NFC reader and behaves like a smart card, or like NFC. Basically, NFC has three modes, which is reader and writer, peer-to-peer communication, and emulation mode. And you can change the configuration of the reader to do different things. So the art of this part is how we can put the emulation mode in a NFC reader. In this case, it's a ACR122. Basically, you can initialize as target this NFC reader, implementing some native commands or APD commands. You can see all these commands in the data sheet of this reader. But thanks to NFC, you can use NFC to do a lot of different things. To go to Adam Lurie, he created a library which basically, you have all the commands to this reader so you can put it right away into emulation mode. Also, he has a Python script to emulate something just for testing, basically. So having this idea, how we can make a replay attack. A replay attack, basically, is how we can block a transaction from a device to the POS, or the point of sale systems, or the terminal, and we can intercept that token. Intercepting the token is like, I can have that transaction and replay it later, probably two or three hours later in a different location. So I present a bug to Google Pay. I discover a bug about that you can make a replay in the Google Pay this year. And I basically report it. And the answer that I got was it couldn't be fitted because it is in that behavior of the payment system. Basically the flexibility that we have in the system who gets to the vulnerabilities that we can find different devices. So, for example, in this case, I'm going to make a replay attack. I have this Google Pay device. And I'm going to make a replay attack. And I'm going to make a replay attack. And I have a Square device which I'm going to validate the transaction. This one is a pocket chip which I have. It's ACR122, which basically is going to act a reader initially to read the transaction from Google Pay. I'm going to capture the token. And after that, I'm going to put the same reader in emulation mode. So I'm going to emulate the transaction using the Square, in this case, MFPS, to make a transaction for $1.01. And then I'm going to run that transaction. And then the transaction goes through. Basically this type of attack, I'm using, I get the transaction and basically I convert it to magnetic stripe data transaction, putting lower the levels of security of the NFC. It could be with different kind of devices. This example was a pocket chip, but it could be an Arduino. It could be Raspberry Pi or any other devices. In this case, it's a Raspberry Pi implementing a PM532 chip, which basically is very cheap, around $15. But this is the project I made. It was called NFCopy. Basically it's a Raspberry Pi 0, ACR122, a leap of 3.7 volts, and a booster, which basically moves the 3.7 volts to 5 volts. Some of the characteristics of this attack is that this device is portable. You have reader and emulator simultaneously. You have Wi-Fi connectivity and, of course, it's customizable. So let's try to make a replay demo. Basically, in this case, sorry, I have a Google Pay. And I'm going to use a transaction in different ATM, in this case, a grocery machine. I'm going to capture the token of Google Pay, using the same technique, intercepting the transaction, moving the, loading the security level and the transaction. I make a payment in a terminal. This kind of transaction goes through because we are implementing a, I can say, cryptogram. It's already validated before, which basically is going to go through the transaction. I call it Cloud Validated Cryptograms. Let's talk a little bit about relay attacks. Relay attacks is when you have, it's a man in the middle and you have two nodes. Basically, you have two devices. One close to the NFC device and another one close to the NPRS or POS or terminal, which is going to make a transaction in the same time that another person is making them. If we talk about the distance between the two devices, we can increase this distance implementing SDR, for example, or Wi-Fi connectivity. But many people have started using the cloud. This is a in SDR because you have a specific channel to make a relay attack. Some of the inconvenience of these attacks is that you have delays on timeouts and the protocol. MFBA specifies that you need to make a transaction in 500 milliseconds. But that doesn't force the terminal, the POS, to finish the transactions if it takes longer. Which basically I can make transactions in 4.5 seconds without any problem. That means if I'm making a relay, it could take 2 or 3 seconds to make a transaction and it's going to go through. For this project I make a call called sentinels which basically is the same kind of device I use for the NFC copy but I have a SDR transceiver which basically is a CC1101. The CC1101 is the same kind of device I use for the NFC copies. The CC1101 basically is a cheap device, $5. It has different frequencies, different modulations. I'm not using that one because it's powerful. I'm using it because it's cheap. So you can try it at home. The configuration to connect to the Raspberry Pi is very straightforward. It's using the SPI protocol but we notice that we have many cables so we design a small board so you can plug and play with it. And this is when we have a lot of problems and you can problems with the SDRs. The SDRs are not the same thing. The SDRs are different. The SDRs have not the same Another inconvenience in the library of this C1101 is that you only can send 60 bytes in each packet. So, for example, if we have a common APDU for 200 bytes, we need to make chunks of it. Basically chunks of 60 bytes. We are in time and waiting time of this kind of attack, but because of the flexibility, we can make a relay attack. So basically, this project is that we have two readers and two emulators simultaneously, Wi-Fi connectivity, a chip, and we have a SDR support, which basically is the C1101. So the demo of this attack, basically, I'm using this device as MPOS. And I'm going to show you how it works. It's acting a terminal, and I'm going to make a relay attack. You are going to see what is in our device that I'm getting this data, which basically is a smart card from Visa. Sorry, it's kind of framing a little bit. So you see it was very quickly a transition, implementing the SDR. In less than one second, you can have all the data. And we are attacking the terminal. And we are going to make a relay attack. We are talking about around 15 meters of distance. So basically, here is another device, and the smart card is under it. Another type of attack I want to talk about is how to extract data from chip and PIN cards using NFC. If we think about it, we have two different ISOs. We have contact and contactless. But they share the same APDU layer, which basically, you can send comments from one to the other. And you can send comments from one technology to another, and they are going to respond. It could be wrong answer or right answer, but they are going to respond. It's like when you are making a SQL injection and you got these kind of errors, and you know that something is there. It's the same thing with APDUs. For this project, I changed the reader. Instead of using the ACR122, I'm using a USB smart card reader. And I changed the protocol. Instead of using a block byte protocol, I'm using a byte-to-byte protocol. So let's play a demo to show you how this works. Basically, it's a relay attack. In this place, we have the card connected to the USB. We have the SDR connection to this device. And this device, the Samsung device, is going to act as POS or terminal. So I'm going to run it. The MPOS is going to start sending NFC comments, and you can see it's not going to respond. So I'm going to run it. And I'm going to start reading the chip and PIN card data, which could be useful to strike, let's say, RSA certificates, but also data like the name of the card, which is user two, and things like that. So let's talk a little bit about relay for replay attacks. Basically, relay for replay attacks, how we can make smart relays. If we talk about security, we talk about security. So we have two elements, which is one of the best secure technologies. The main point about this technology is you cannot make a replay attack. Why? Because basically, when you intercept a transaction, it has a cryptogram on it, which basically is a challenge that the terminal sends to the device, and the device has to answer it correctly at the same time. So in this particular case, I'm using a Fitbit Ionic. I'm going to talk a little bit more about this. So the Fitbit Ionic is a chip that is going to be a different cryptogram. And this part, where is the red tag, which basically is the cryptogram section, and the blue one, which basically is the application transaction counter, are the two only things that are changing in each transaction in the secure element. So the question here is, I intercept a transaction, and when the terminal sends me the challenge and I answer with a captured transaction, it's going to be a different cryptogram, or it's going to be the right cryptogram. So the transaction is going to be declined. But what happens is we intercept the transaction, and we make a relay just using the cryptogram and the application transaction counter. So instead of making a relay with hundreds and hundreds of bytes, we just need 20 bytes, which basically are the cryptogram and application transaction counter. So let's say I capture a transaction from someone using secure element, and I have, I put it in one of the devices. So let's say I have computer one and computer two. When the computer, when the POS asks me for the PPC, the computer is going to answer with a previous safe transaction. And after I got the challenge, the computer one is going to send the challenge to computer two, and the computer two to the smart device, and it's going to get it straight forward with the cryptogram and transmit it back to the POS. So in this case, I'm using the computer two to the smart device, and I'm using this previous data to have less time making the relay attack, which basically I improve it, like, in three seconds. So instead of using, like, not, let's say 3.5 seconds, I can do it in 1.5, using this technique for secure elements. So basically, I have a smartwatch, the Fitbit. I use the Fitbit, and the Fitbit is going to run the transaction. So if you already have a previous, previous safe transaction, probably you can see in the back there, which all the APDs. And I'm going to run it using a secure element of this tool. When I run it, instead of sending all the data back and forward, I am just going to get the cryptogram and the application transaction counter, and the transaction is approved. Because the only thing that changed in the transaction is the cryptogram and the application transaction counter. So if after all of these relay and replay attacks you think that you can make it better, probably you can use something like this which is more interesting. And Twitter. Get close to the person and get a transaction accepted. So about new technology. We have new technology for the cards implementing NFC. Basically to get into the cards. And some of the boards I am implementing uses NFC. How this could affect this new technology to come. They are not going to use a, let's say in this case encryption and the communication. We're going to have problems making relays and replay attacks. This is a problem that we're going to have to fix. So we're going to have to do a new protocol. The board I am implementing, the NFC 3320. We're basically, they are in some cards already. So I don't have the, I didn't have the chance to test it. But I would love to do it. So new attack vectors. We can make relay with a new technology like Lora's. She's cheap and very useful. In this particular case I have a smart card. I'm using a, another device, the Samsung. I'm using a card that is behaving as MPOS. And I can get the data from the card basically. Using this technology. With Lora you can have kilometers of distance in some of the cases. Depending on how it's set up. Also let's talk a little bit about how you can use NFC in web browsers. Which is something that nobody talks about it. Many people start trying to work with ACR wanting to connect into the computer. And they don't know how to connect. And trying to use a library in the browsers. But they have many problems to communicate with it. I found a reason to it. I found that they have experimental web platform, the Chrome, that you can use USB. And they have a specific library to do that. And this library they have support for Arduinos already. So what about instead of connecting directly the NFC reader, what about you connect the NFC and the Arduino and we communicate with the Arduino and the Arduino communicates with the NFC. So we can do that. So basically it's very straight forward technology. You can have basically terminal in the web browser and communicate with the NFC reader to put it in emulation mode peer to peer communication or whatever. So in this case we're going to read, we're going to emulate NFC transaction using a web browser. So in this case I'm going to run a script using the Chrome. And I can get a transaction very quickly. So this is a new type of attack that you can use it in different web browsers. In this case Chrome web browser. Some of the protocols that probably could implement to prevent this type of attacks is distance bounding protocols. Which is very difficult. Because you need to know the timing exactly when a transaction is happening. And it's very difficult if you have many different applications open already at the same time. So you need to know the timing exactly when you're making a transaction. The transaction can be delayed. So it's very difficult to do it. What we need basically is a new update of the MEV in the United States and all America continent. But the problem is the hardware. Basically you make an update in the MEV. You need to replace all this hardware for all the stores. Which basically is very difficult. Very expensive. So some of the conclusion of this talk. An attack attack. This is an attack attack. This is an attack and if somebody represents a typical attacker. So if you spray that S means the attacker doesn't need a specializedshirts or software to make transactions.rat transactions. The my phone can be used as a sintl asyou can use a player. If you keep designing this product with proper protections against the new technologies, they are going to be in effect for many years. Sorry. It doesn't matter which card. It could be any kind of Visa card, MasterCard or whatever. I'm using West Fargo because it's the only I have in my hand. I need Spire so you can use it. You have any questions? Thank you. Thank you to be here.