00:00:00.167-->00:00:05.072 >>So we had a bit of an interesting morning and um if you want to see the uncensored 00:00:05.072-->00:00:10.077 version of this presentation, it’s available on the media server, so go ahead and pull 00:00:10.077-->00:00:16.083 that up. Uh while it lasts. Um we had a few issues with some of the vendors that are affected by 00:00:16.083-->00:00:22.589 our presentation so like I said if you want to access the uncensored version go for it. 00:00:22.589-->00:00:27.494 And we really apprec- you all c- appreciate you all coming out this morning. I know last night 00:00:27.494-->00:00:32.900 was a big night for most of you so thank you very much. We’ve not had breakfast yet and we 00:00:32.900-->00:00:39.706 hoped that we can all wake up together with this presentation. So let’s talk about mobile point 00:00:39.706-->00:00:44.511 of sales terminals. Mobile point of sales terminals has seen a huge growth over the last few 00:00:44.511-->00:00:49.383 years. We've moved from a single vendor which has dominated the marketplace, so we’ve seen 00:00:49.383-->00:00:55.489 Square dominating this space for the last uh 8 years and now we have a number of different 00:00:55.489-->00:01:01.228 vendors in this space. You can open an account in less than 5 minutes and typically these 00:01:01.228-->00:01:06.433 readers cost less than 50 dollars. So for these reasons they have grown really in their 00:01:06.433-->00:01:11.438 popularity over the last 2 years. You can find them pretty much everywhere, so those-these 00:01:11.438-->00:01:17.010 are some of the pictures that we’ve taken. So I’ve seen them in taxis, in cafes, that’s my 00:01:17.010-->00:01:22.015 gym as well. Uh completely unintended. And like traditional ATMs and like traditional point 00:01:24.017-->00:01:29.022 of sales terminals they sit at the end point of payment infrastructure. For so- so for 00:01:29.022-->00:01:33.860 these reasons they’re very attractive to criminal- criminals both for the testing 00:01:33.860-->00:01:39.800 of cards and for the movement of money. But of course we weren’t the first to investigate mobile 00:01:39.800-->00:01:44.805 point of sales terminals. In 2014 MWR Labs gave they’re presentation at BlackHat and- in 00:01:47.441-->00:01:53.013 which they discussed findings around the MWR Shuttle Reader. So at this time this was being 00:01:53.013-->00:01:57.851 white labeled and used by a number of different vendors and of course this kind of practice 00:01:57.851-->00:02:03.357 is still very common today. So in they’re presentation they documented a number of 00:02:03.357-->00:02:08.362 vulnerabilities, of which many had overlap with traditional point of sales terminals. Then 00:02:10.764-->00:02:15.836 in 2015, 3 undergraduate students from the Boston University presented their 00:02:15.836-->00:02:22.609 findings on the Square Magstripe Reader at BlackHat. We felt that both of these research projects 00:02:22.609-->00:02:28.415 were really significant contributions in this area but they focused on single products 00:02:28.415-->00:02:32.853 and the market has matured considerably. So for this reason we didn't feel that they dealt 00:02:32.853-->00:02:37.858 with the more contemporary broader issues associated with this marketplace. At the 00:02:40.027-->00:02:45.766 beginning of this project we started with just 2 card readers and 2 vendors and very quickly 00:02:45.766-->00:02:50.771 this has grown into a project which encompasses 7 card readers, uh 4 vendors and 2 00:02:53.373-->00:02:59.646 geographic reason- regions. We chose to assess the most popular devices both in Europe and in 00:02:59.646-->00:03:04.584 the US. We’ve chosen to focus on Paypal, Square, IZETTLE, and SumUp . Now some of these 00:03:08.488-->00:03:13.260 vendors operate in both geographic locations and where possible we chose to obtain the 00:03:13.260-->00:03:18.598 accounts and the readers for both locations. And this is because there are quite 00:03:18.598-->00:03:23.003 considerable differences between the processes and the applications and even the 00:03:23.003-->00:03:28.809 readers depending on the region. Now the beginning of this project we had a pretty good 00:03:28.809-->00:03:33.346 idea of the kind of attack factors that these devices would be vulnerable to, but we wanted 00:03:33.346-->00:03:38.351 to see how probable these were in practice. Still we had a very simple question which is how 00:03:40.620-->00:03:45.625 much security can really be embedded in a device that’s potentially free? So we chose to 00:03:48.161-->00:03:53.800 assess 5 different areas of the payment ecosystem of these devices. We chose to look at the 00:03:53.800-->00:03:58.538 communication between the phone and the payment server. Communication between the device 00:03:58.538-->00:04:05.011 and the phone. Physical security mechanisms within the hardware of these devices. The mobile 00:04:05.011-->00:04:10.484 application and the associated mobile ecosystem. And finally, secondary factors. So secondary 00:04:10.484-->00:04:16.123 factors are things that affect the overall risk and security of the ecosystem such as the kind 00:04:16.123-->00:04:21.995 of checks that are being carried out during the enrollment process. So before we progress a 00:04:21.995-->00:04:25.766 bit further into the presentation, I’m just gonna give you a bit of background on 00:04:25.766-->00:04:30.437 how payments traditionally work, for those of you that are not so familiar with that. And then 00:04:30.437-->00:04:36.376 we’ll talk about how mobile point of sales terminals fit into this process. So normally 00:04:36.376-->00:04:41.414 when you go into a shop and you go to pay for services or goods, you’ll either interact directly 00:04:41.414-->00:04:46.520 with the terminal or you’ll hand your card over to the merchant. Once your information has been 00:04:46.520-->00:04:52.192 read by the terminal, this’ll be passed to the acquiring bank for the merchant. Now at this point 00:04:52.192-->00:04:56.496 in the process they don’t actually know who your issuing bank is, so they’ll ask the card 00:04:56.496-->00:05:01.968 brand such as Visa or Mastercard to determine this information. Once it’s been passed to your 00:05:01.968-->00:05:06.206 issuing bank, they’ll jeck- check that you have the necessary funds to complete the 00:05:06.206-->00:05:10.977 process and then they’ll carry out some fraud checks. If they’re happy for you to go 00:05:10.977-->00:05:15.549 ahead and make the purchase they’ll send the response along the chain and you can go ahead 00:05:15.549-->00:05:21.721 and make the transaction. Now if we compare this process to the mobile point of sales terminal, 00:05:21.721-->00:05:26.059 you can see that the key difference is that the mobile s- the merchant no longer has a 00:05:26.059-->00:05:31.198 direct relationship with the acquiring bank. Instead the mobile point of sales terminal 00:05:31.198-->00:05:37.003 provider acts as a payment aggregator. So this means that they will or won’t assess risk 00:05:37.003-->00:05:42.309 at the same level as a traditional acquiring bank. They also may choose to mitigate some 00:05:42.309-->00:05:47.013 of the risk in other ways for example contractually. But essentially what you end up with 00:05:47.013-->00:05:52.986 is 2 merchants in this model. From there things are pretty similar to how I’ve described in 00:05:52.986-->00:05:58.959 the previous slide. So we’re gonna be focusing on card payments. This is because the 00:05:58.959-->00:06:04.130 core functionality of a mobile point of sales terminal is around taking card payments. But 00:06:04.130-->00:06:08.468 it’s just worth account uh worth noting that within the mobile application of all of these 00:06:08.468-->00:06:14.474 devices, they do have features to account for things like cash transactions. So when you go to 00:06:14.474-->00:06:18.879 make a payment, what happens is there’s a list which broadly describes in terms of 00:06:18.879-->00:06:23.683 priorities, the types of payments that your card can make. And this is confirmed with 00:06:23.683-->00:06:29.823 the configuration on a terminal. This list will vary depend on- depending on the issuer, the- 00:06:29.823-->00:06:35.895 the card brand, and also the geographic location. But generally speaking we can 00:06:35.895-->00:06:41.568 understand that certain types of payments are more secure than others. So for example chip 00:06:41.568-->00:06:47.507 reading is commonly considered most secure and this is actually because there’s a high level of 00:06:47.507-->00:06:52.746 assurance at that the card holder was present during the transaction. If you compare this 00:06:52.746-->00:06:57.517 to a swipe transaction, this is considered low in its level of security, and that’s because 00:06:57.517-->00:07:02.756 most of us in this room know that if you take a Magstripe you can clone the data off the 00:07:02.756-->00:07:08.261 Magstripe. You can also forge a signature relatively easily as well. And there’s no signing of 00:07:08.261-->00:07:13.266 the transaction so there's no cryptogram. Next we need to understand that whilst EMV has 00:07:15.769-->00:07:20.640 been incredibly successful in its adoption globally, it’s actually been much lower in the 00:07:20.640-->00:07:26.046 US than compared to many other parts of the world. And this is just primarily due- due to the 00:07:26.046-->00:07:31.418 number of parties that are involved in the rollout process. But what’s help- helpful in this 00:07:31.418-->00:07:36.823 scenario is that we can look to places like Europe and we can look at the kind of attack 00:07:36.823-->00:07:40.727 factors that are happening in Europe and use them as a good indicator of what might take 00:07:40.727-->00:07:47.500 place in the US. You can see that for credit cards, adoption of EMV is actually quite high so 00:07:47.500-->00:07:53.540 96 percent but less than 50 percent of all transactions are made using a chip. So this is a 00:07:53.540-->00:07:57.777 really important fact that we need to keep in mind as we go through the process of 00:07:57.777-->00:07:59.813 presenting these findings. If we look at the picture for debit cards, it’s actually even worse, 00:07:59.813-->00:08:01.748 so less than a quarter of all transactions are made using a chip. And if we look at the 00:08:01.748-->00:08:05.518 overall growth of mobile- mobile point of sales terminals you can see that only within a couple of 00:08:05.518-->00:08:10.523 years, almost 50 percent of all transactions will be made by a mobile point of sales terminal. 00:08:25.038-->00:08:30.877 So how do these devices work? So this schematic overview represents quite simply how each 00:08:30.877-->00:08:37.150 of the components in the system work. So we have the terminal which communicates via bluetooth 00:08:37.150-->00:08:42.422 to the mobile application in the phone. This in turn communicates to the payment server of the 00:08:42.422-->00:08:48.862 mobile point of sales terminal provider via a network connection or over uh wifi. So 00:08:48.862-->00:08:53.466 now that we have a broad understanding of how payments traditionally work and how 00:08:53.466-->00:08:59.739 mobile point of sales terminals fit into this process, we can begin to discuss our findings. 00:08:59.739-->00:09:04.577 So we’re gonna be talking about the sending of arbitrary commands. So with this attack 00:09:04.577-->00:09:09.115 factor, what you can do is you can socially engineer a cardholder to carry out 00:09:09.115-->00:09:14.988 additional payments or to carry out a less secure payment such as swiped. Then we'll talk about 00:09:14.988-->00:09:19.259 how for some of the terminals we looked at, we were able to modify the amount, so the 00:09:19.259-->00:09:24.164 cardholder thinks that they’re actually authorizing a much lower value. We’re also gonna 00:09:24.164-->00:09:28.468 talk about how we obtained remote code execution on 1 of the readers, so this provides us 00:09:28.468-->00:09:33.039 with full access to the file system. This means that we can capture track 2 information 00:09:33.039-->00:09:38.978 before its encrypted and we can even collect pins. Then we’ll discuss our hardware 00:09:38.978-->00:09:44.250 observations, so looking at the physical c- security mechanisms within the terminals themselves. 00:09:44.250-->00:09:48.288 And finally we’ll we will discuss the secondary factors which affect the overall risk 00:09:48.288-->00:09:54.828 and security of these systems. So bluetooth is the main form of communication between the 00:09:54.828-->00:09:59.799 terminal and the phone and the mobile application. So therefore it’s important for us to have a 00:09:59.799-->00:10:04.270 good understanding of how this protocol works. I’m sure many people do have an understanding 00:10:04.270-->00:10:09.876 of this, but I’m gonna assume that not everyone in the room does. So let’s continue. So 00:10:09.876-->00:10:16.416 bluetooth can be roughly divided into 2 parts: the host and controller layers. So the 00:10:16.416-->00:10:21.287 bluetooth profiles in GATT and ATT, they deal with the actual transfer of information. L2Cap 00:10:21.287-->00:10:27.660 deals with segmentation and reassembly of packets. The host controller interface, now this 00:10:27.660-->00:10:33.132 is the lowest level that we can directly interact with. It’s commonly used for debugging the 00:10:33.132-->00:10:38.838 communication of bluetooth, but if you’re a security researcher, it’s also super helpful to try 00:10:38.838-->00:10:43.643 and work out how the device works. So this is something that we're going to look at during 00:10:43.643-->00:10:49.649 this process. Then the link manager protocol, eh link manager protocol this deals with 00:10:49.649-->00:10:55.121 pairing negotiation and encryption. And then baseband is the last layer of framing before 00:10:55.121-->00:11:01.327 we have bluetooth radio itself. When we talk about bluetooth we’re actually talking about 2 00:11:01.327-->00:11:06.799 different protocols. Bluetooth classic and bluetooth low energy. Now how these 00:11:06.799-->00:11:11.571 communicate is quite different. So bluetooth classic uses something called bluetooth 00:11:11.571-->00:11:16.676 profiles to communicate and all of the terminals that we looked at that use bluetooth classic 00:11:16.676-->00:11:22.849 use RFCOMM. So what this does is when you communicate from the terminal to the phone and vice 00:11:22.849-->00:11:28.154 versa what happens is it simulates a cereal port which allows you to send large chunks 00:11:28.154-->00:11:34.394 of data. If you look at the way that bluetooth low energy on the other hand communicates it’s 00:11:34.394-->00:11:38.998 [audio breaks]. So with this you have a much smaller packet size and it produces a hierarchical 00:11:38.998-->00:11:45.538 structure under which some characteristics are defined. So each characteristic has a value 00:11:45.538-->00:11:50.543 and it also has a number of properties such as read, write, and notify. In order to attack a 00:11:53.413-->00:11:58.518 bluetooth device or even just to communicate with it, we need to understand what its address is. 00:11:58.518-->00:12:03.890 So its address consists of 3 main parts. We have the upper address part, uh sorry, the non 00:12:03.890-->00:12:08.194 significant address part, which isn’t significant for any functions. Then we have the 00:12:08.194-->00:12:12.799 upper address part, and the lower address part, which is unique to each device and that’s 00:12:12.799-->00:12:17.971 present in every frame of communication. Now the non-significant address part and 00:12:17.971-->00:12:23.810 upper address part is what is known as the organizationally unique identifier. So if you 00:12:23.810-->00:12:29.015 know a range of organizationally unique identifiers, it’s possible to sit in a public 00:12:29.015-->00:12:34.420 place and identify a potentially vulnerable device. For example you can go to a cafe, you can 00:12:34.420-->00:12:39.959 use one of these um bluetooth scanners and you can identify both how close you are to the 00:12:39.959-->00:12:44.964 device based on the frequency, and also the type of device it is. There are r- uh many 00:12:47.800-->00:12:52.972 different attack factors for bluetooth but we’re gonna be focusing on 2. So the first is 00:12:52.972-->00:12:58.544 man in the middle, or eavesdropping, and the second is malicious device manipulation. 00:12:58.544-->00:13:02.882 So in the first instance what you’re trying to do is you’re trying to intercept the 00:13:02.882-->00:13:07.754 communication between the master and the slave in the network. In the second instance we’re gonna 00:13:07.754-->00:13:13.626 try and connect directly to the device and get it to carry out some functions for us. Some of 00:13:13.626-->00:13:19.232 those functions might be intended by design but m- many times that isn’t the case. So 00:13:19.232-->00:13:23.403 we're gonna try and get it to do some things that we want it to do but that the developers never 00:13:23.403-->00:13:30.209 intended it to do. So in order to carry out a man in the middle attack what you need to do is to 00:13:30.209-->00:13:34.781 follow the connection process between the master and the slave. You’re trying to collect 00:13:34.781-->00:13:41.487 enough information to actually decrypt the connection. In order to carry out this attack, uh it 00:13:41.487-->00:13:46.793 really depends on the type of bluetooth that the device is using. So if the device is using 00:13:46.793-->00:13:51.731 bluetooth classic, using an enhanced data ray, you’ll need something like this frontline 00:13:51.731-->00:13:57.904 BPA 600. Which for all of us in the room is not really an affordable option, but if you’re 00:13:57.904-->00:14:02.275 looking at a device that communicates using bluetooth low energy, you can use the Texas 00:14:02.275-->00:14:07.280 Instrument CC2540 Kit or an Ubertooth One. And both of those cost less than 150 dollars. But 00:14:10.717-->00:14:15.988 this kind of attack factor is actually not the easiest to carry out. And we're looking at 00:14:15.988-->00:14:20.727 payment terminals so when you think about payment terminals, most of the pertinent 00:14:20.727-->00:14:25.498 information is going to be encrypted from the payment terminal to uh sorry from the 00:14:25.498-->00:14:30.036 payment terminal to the payment server. So for this reason, sniffing or man in the middle 00:14:30.036-->00:14:35.041 isn’t really a viable attack method for us. So just a quick note on enhanced data rays. So 00:14:37.510-->00:14:42.548 when we were carrying out this research there isn’t a wh- a lot of information online talking 00:14:42.548-->00:14:48.821 about how you can determine what a device is using to communicate. So the first thing 00:14:48.821-->00:14:53.893 you can do is you can carry out a r- reconnaissance scan using something like a HCI tool which 00:14:53.893-->00:15:00.767 is natively available in Linux. And this is gonna lis- enlist EDR as a feature for the device. 00:15:00.767-->00:15:04.470 The second thing that you can do is you can capture some of the packets using a tool such as 00:15:04.470-->00:15:09.742 Ubertooth. And this is gonna just display headers only. So you're not gonna see any data 00:15:09.742-->00:15:14.781 payloads in this. So that, in that way you can confirm that a device is using enhanced data 00:15:14.781-->00:15:19.619 rays and you know that it’s not really viable for you to try and attack it using a man in the 00:15:19.619-->00:15:26.626 middle attack. So this brings us on to our first finding, which is the sending of arbitrary 00:15:26.626-->00:15:31.631 commands. So what happens if you connect directly to a device? Well you can get it to initiate 00:15:34.400-->00:15:39.906 a function such as a payment, you can get it to display some text, or you might be able to 00:15:39.906-->00:15:45.044 turn it off or on. But we also need to keep in mind that the pairing process might actually 00:15:45.044-->00:15:50.383 introduce some obstacles. We might need to physically interact with the device. And 00:15:50.383-->00:15:55.788 it’s worth noting to- for developers that bluetooth as a protocol doesn't actually um 00:15:55.788-->00:16:02.028 feature any user authentication or any input at sanitisation so you have to implement this at 00:16:02.028-->00:16:07.700 the application level. So in order to carry out attack where we connect directly to the 00:16:07.700-->00:16:14.140 device and we use this device to carry out some sort of malif- malicious operation, the first 00:16:14.140-->00:16:18.477 thing that we need to do is we’re gonna have to carry out some prerequisite work to 00:16:18.477-->00:16:24.684 understand what features and functions are available on the device and how we can use them. 00:16:24.684-->00:16:30.656 So what you need to do this is you’re gonna need access to a mobile phone or a cell phone 00:16:30.656-->00:16:35.962 which has the ability to enable developers options. So within that you want to enable HCI 00:16:35.962-->00:16:41.767 logging. You’ll need access to the mobile application for the device, and you'll need access 00:16:41.767-->00:16:47.773 to the physical device itself. The next thing that you want to do is you want to carry out a 00:16:47.773-->00:16:52.812 sample of transactions for the terminal. And the reason for doing this is it’s the best way 00:16:52.812-->00:16:58.851 to just get a broad spectrum of how the device works. So once we’ve done that we can take the 00:16:58.851-->00:17:03.789 HCI log from the phone, we can import it into something like Wireshark to analyze the output. 00:17:06.192-->00:17:12.632 So here you can see the sending of the message insert or swipe card to the display. So we can 00:17:12.632-->00:17:19.305 use the information within the HCI log and the mobile application to work out how all 00:17:19.305-->00:17:24.644 of the features and functions work. So in this next example you can see that I’ve inserted 00:17:24.644-->00:17:30.383 my card incorrectly into this device and so it says please remove card. So we’re looking at 00:17:30.383-->00:17:35.187 2 packets of information that’s because this terminal communicates using bluetooth low 00:17:35.187-->00:17:40.660 energy. So here we can see the UUID value so this is really important we’ll need to know 00:17:40.660-->00:17:46.232 what this value is in order to send information to the terminal. So if we look at this 00:17:46.232-->00:17:51.904 in greater detail, you can see that the value is actually made up of 5 parts. The first is a 00:17:51.904-->00:17:58.244 leading part and this contains a command ID, a counter, and a intended payload size for the 00:17:58.244-->00:18:04.016 message. Then we have the message itself which is in ASCII so please remove card, then we 00:18:04.016-->00:18:10.589 have a trailing part and we have a checksum which is an ex modem and then an end value. So now 00:18:10.589-->00:18:15.861 that we know this information for this specific terminal, we can basically calculate anything 00:18:15.861-->00:18:20.866 we want to send to the display of this terminal. So we found that 3 of the terminals we 00:18:23.402-->00:18:28.407 looked at, so IZETTLE, Sumup and the MWR M010 reader which is- was available via Square and 00:18:30.876-->00:18:35.948 also Paypal are vulnerable to this kind of attack method. So this means that we can send a 00:18:35.948-->00:18:40.886 message such as “please swipe now” and get the cardholder to sort of downgrade the method 00:18:40.886-->00:18:45.725 that they’re using to authorize a payment for. Or we can send a message where it says “payment 00:18:45.725-->00:18:50.730 declined” or “payment cancelled” and get them to carry out a- an additional transaction. So let’s 00:18:52.999-->00:18:59.438 have a look at this in action. So I’m just using a simple script here and we’re going to 00:18:59.438-->00:19:04.377 force the cardholder to carry out a transaction using the mugs- magstripe instead of the 00:19:06.612-->00:19:11.617 chip. So if we have a look at this next example, this terminal is using bluetooth classic so 00:19:31.871-->00:19:36.909 the data looks a little bit different from the previous example. So we can see the 00:19:36.909-->00:19:43.783 sending of insert or swipe card to the display. Similar to the previous example, it’s made up 00:19:43.783-->00:19:50.790 of 3 parts. So in the leading part we again we have an ID, a command ID value, a counter and 00:19:50.790-->00:19:55.961 the intended payload size. And then we have the message which is “insert or swipe card” and 00:19:55.961-->00:20:01.033 then we have the checksum which is just a simple x or value. So again now that we know this 00:20:01.033-->00:20:05.971 information we can calculate anything we want to send to the d- the display. It doesn’t have 00:20:05.971-->00:20:12.545 to be “insert card” it can be any kind of message we want to send. So what we’re gonna do in 00:20:12.545-->00:20:16.849 the next example is I’m gonna show you how we can actually interrupt the payment process. 00:20:16.849-->00:20:20.653 And we’re gonna display a message which says “payment cancelled” but you’re gonna see 00:20:20.653-->00:20:25.658 in fact the payment has been authorized. So we can see payment cancelled but in just a 00:20:46.479-->00:20:50.783 moment we’re gonna see on the phone that we receive an SMS which shows that it’s actually 00:20:50.783-->00:20:55.788 been authorized for that value. There we go. So this brings us onto our next finding which is 00:21:02.027-->00:21:07.266 how we can modify the amount for certain types of transactions. We’re gonna use the information 00:21:07.266-->00:21:12.271 that we’ve learned in the first process and apply this to the next process. >>Yeah now let’s 00:21:16.175-->00:21:21.180 try to affect uh payment comments. So there are actually many ways to intercept payment 00:21:24.216-->00:21:29.488 comments, reverse engineer them, understand their structure and of course tamper them. So first 00:21:29.488-->00:21:34.493 of all all comments uh surprisingly are uh readers getting from the server side, 00:21:39.198-->00:21:44.537 which means uh you can intercept them by, it should be as man in middle. And for this purpose you 00:21:44.537-->00:21:51.510 need to bypass SSL pinning somehow and obviously there are a lot of ways to do this. Next 00:21:51.510-->00:21:58.384 was already mentioned is just to enable each cell login and then get access uh via Wireshock to 00:21:58.384-->00:22:05.224 do lock and to see comments. Next you also can rebuild an application, enable uh login 00:22:05.224-->00:22:11.597 messages, and then get in access to them by Android debug breach. Uhh this method is also very 00:22:11.597-->00:22:16.202 useful just to understand the structure of comments, finding code examples of other comments 00:22:16.202-->00:22:21.207 and for other purposes. And finally if you also don’t have any other options you can also 00:22:23.309-->00:22:28.314 use some external device such as Nimbatus, such as Nimbatus to get access to traffic. So here 00:22:30.983-->00:22:35.988 are 2 examples from 2 different readers and for both readers we used 2 channels just to see the 00:22:38.524-->00:22:43.862 correlation. And there are payment comments and in first case we made a payment for- we 00:22:43.862-->00:22:48.867 initialized payment for 750 and uh bytes which are responsible for this value are sent in hex 00:22:51.937-->00:22:56.942 so 02EE and in second case uh we also uh so in first case we used uh android debug breach and also 00:23:02.448-->00:23:07.453 got access by uh HCI 2. And for second case, we rebuilt application, enabled android 00:23:09.488-->00:23:15.094 debug breach messages and also got access to traffic by HTTPS man in the middle. And in that 00:23:15.094-->00:23:20.099 case uh amount was sent in plain text so 0100. Uh and as you can imagine uh in both cases just to 00:23:24.136-->00:23:30.442 send any amount in the reader you want you just need to change this byte and then recall the 00:23:30.442-->00:23:36.749 checksum. So what actually will happen a fraudulent merchant will change an amount between 00:23:36.749-->00:23:41.754 the reader and the phone. Uh so he can force customer to make higher value amount by sending 00:23:44.056-->00:23:49.228 lower value on the reader but in fact sending a higher value to the server site, to the 00:23:49.228-->00:23:55.367 merchant, to the service provider’s site. So that’s exactly what we did. So we sent 00:23:55.367-->00:24:00.306 to the service provider 1 pound 23 pence but we actually show only 1 pound uh to the customer. 00:24:04.310-->00:24:09.315 He make a payment and then he signing so we don’t even need to forge a signature, which is 00:24:12.818-->00:24:17.823 pretty good. Uh so this fraudulent payment will pass at least for magstripe. Why? Well 00:24:21.260-->00:24:27.866 simply because during magstripe transactions, a reader will send only track 2 data. When for 00:24:27.866-->00:24:32.871 example for E and V transactions a reader will send inside of a payment cryptogram amount, 00:24:35.040-->00:24:40.079 currency and all additional information. For example for contactless transactions there 00:24:40.079-->00:24:45.084 are also certain molds, legacy molds, which allow to send uh less information and it will be 00:24:48.654-->00:24:54.893 no amount instead of a cryptogram and all these operations also can be affected. 00:24:54.893-->00:24:59.965 And the last problem is that surprisingly for all service providers, limits for 00:24:59.965-->00:25:06.605 transactions such as magstripe are completely insane for like up to 50-->000 dollars. Which 00:25:06.605-->00:25:11.610 means they rely only on the issuing or acquiring bank in terms of uh stopping of 00:25:14.279-->00:25:20.486 suspicious transactions. So let’s imagine ourselves. We can open account, merchant account, 00:25:20.486-->00:25:25.491 in less than 5 minutes. Then we can force customer to use less secure for- form of payment like 00:25:27.593-->00:25:32.698 MagStripe instead of chip and pin. Then we’re going to show him completely arbitrary amount 00:25:32.698-->00:25:38.470 like 1 dollar on the screen of a reader and on the phone. But actually we’ll be, it will be 00:25:38.470-->00:25:44.243 possible to carry out transactions for up to 50-->000 dollars at a time. And last 00:25:44.243-->00:25:51.183 problem is that these fraudulent transactions can be made for example 10 minutes after 00:25:51.183-->00:25:56.522 customer has already swiped card and has already left the building which is pretty good 00:25:56.522-->00:26:01.460 for fraudulent merchant. Uh what we will recommend to vendors obviously uh even if you as a 00:26:06.298-->00:26:12.237 service provider can’t affect firmware, you can’t uh affect the specification of 00:26:12.237-->00:26:17.209 communication between reader and the phone, you still can mitigate these risks. First of 00:26:17.209-->00:26:21.680 all you should control your mobilic system and should not allow the user the devices 00:26:21.680-->00:26:27.686 because rooted devices is a way to get access to traffic and make reverse engineer uh make 00:26:27.686-->00:26:34.259 reverse engineering work, and to basically get. For customers, recommendations are much easier. 00:26:34.259-->00:26:41.233 Just do not use magstripe. Uh what we also found is that sometimes it’s much easier to 00:26:41.233-->00:26:47.072 compromise mobile point of sale terminal than uh traditional terminals. So all we need for 00:26:47.072-->00:26:53.178 this is just to get a good reverse engineer guy and obtain him unencrypted firmware. Uh so 00:26:53.178-->00:26:58.884 let’s talk about uh obtaining firmware and how firmware process works. So normally 00:26:58.884-->00:27:03.822 firmware starts on the server side, which means it’ll be sent to the phone by HTTPS and then 00:27:06.458-->00:27:08.460 to reader via bluetooth which means you can basically get access to firmware exactly the 00:27:08.460-->00:27:10.462 same way as to every other comments like HTTPS man in the middle, right? So sometimes 00:27:10.462-->00:27:12.464 firmware and uh configuration files are stored and sent to a reader as a set of encrypted 00:27:12.464-->00:27:17.469 comments. Uh sometimes they are stored as links to encrypted firmware such here. Uh and um in 00:27:23.609-->00:27:28.614 this case you can try to enumerate uh versions of firmware and sometimes you'll be 00:27:35.220-->00:27:40.225 it’ll be possible to obtain some out of date f- versions and then you can try to downgrade them on 00:27:46.498-->00:27:53.405 the reader. But sometimes you don’t even need to do this and you don’t even need to open a 00:27:53.405-->00:27:59.378 merchant account, use a mobile phone. So all we need for this is just to use Google and find 00:27:59.378-->00:28:05.584 some Github repositories which will contain out of the dated firmware. Uh what an encrypted 00:28:05.584-->00:28:11.990 firmware will contain? Yep first of all it is a whole set of configuration files which will 00:28:11.990-->00:28:18.330 send what messages should be shown in the reader, what type of operations can be used, which 00:28:18.330-->00:28:23.869 means that you can for example disable chip and pin on the reader. And finally, there's a 00:28:23.869-->00:28:30.342 whole set of binary files on the reader side uh where you can find some remote code execution 00:28:30.342-->00:28:36.148 by a buffer or stacker file and that’s exactly what our reverse engineer did in the end. So he 00:28:36.148-->00:28:41.153 found out of date version, downgraded data on the reader, and got uh full access on the 00:28:43.589-->00:28:48.126 reader. So we got root access in the end which is pretty good because initially we didn’t 00:28:48.126-->00:28:53.131 expect anything like that. Why it is so important. Why it is a holy grail of get- uh fully 00:28:55.534-->00:29:02.307 compromised mobile point of sale terminal. Uh one of my favorite cases when in 2014 it was very 00:29:02.307-->00:29:07.312 unusual type of fraud in Brazil when hackers sta- reach- sta- uh, who steal, who’ve stolen uhh 00:29:10.782-->00:29:15.787 track 2 data uh from cards, used this information to make some payments on uh compromised 00:29:18.757-->00:29:23.061 mobile point of sale terminal so basically probably they compromised it pretty much the 00:29:23.061-->00:29:29.868 same way as we did. And what they did is they used track 2 data but sent information to a 00:29:29.868-->00:29:34.873 bank by saying that operations were chip and pin. And the most curios part was that those cards 00:29:37.609-->00:29:43.849 didn’t even have chip on board. That’s how uh basically bank understood that that was a 00:29:43.849-->00:29:50.289 fraud. Uh next of course we can just start to collect track 2 data before it will be 00:29:50.289-->00:29:56.294 encrypted. So if you will get access over um binary file which is responsible for encryption 00:29:56.294-->00:30:02.501 you can get access to unencrypted track 2 as well as unencrypted pin codes because 00:30:02.501-->00:30:06.938 well, mobile point of sale terminals work pretty much the same way as traditional point of 00:30:06.938-->00:30:11.943 sale terminals or ATMs so keypad has 2 modes, uh encrypted mode and plain text mode. And if you 00:30:14.246-->00:30:19.618 get access over a binary file which is responsible for switching between these 2 modes, 00:30:19.618-->00:30:26.324 you can basically force a customer to enter pin code unencrypted. And finally just to 00:30:26.324-->00:30:31.563 understand how payment ecosystem works how payment researches works, this small piece of 00:30:31.563-->00:30:38.437 advice is very useful. It’s basically what we did and why we did it. Uh and last problem is 00:30:38.437-->00:30:44.910 that how to keep persistence on uh an infected device be- because for example in our case 00:30:44.910-->00:30:50.615 after rebooting after each rebooting mobile point of sale checked uh the integrity of 00:30:50.615-->00:30:56.555 their own file system via digital signatures. We bypassed this check but the last problem 00:30:56.555-->00:31:03.395 was that uh mobile application also has to check out of date firmware on the reader and 00:31:03.395-->00:31:09.601 should not allow the use out of date firmware on the readers. But surprisingly in our case all 00:31:09.601-->00:31:14.973 you had to do is just to drop a packet to a server which requests a response about 00:31:14.973-->00:31:20.412 version of firmware, mobile application took like couple seconds and came up to you by 00:31:20.412-->00:31:26.384 saying “Ah! I don’t care what firmware version is, I’m ready to work. “ Which means you can 00:31:26.384-->00:31:31.389 use these infected devices in a merchant’s hands for long long time to collect track 2 data for 00:31:33.391-->00:31:38.630 example. So let’s imagine yeah you as a fraudulent mer- uh customer get a physical access 00:31:38.630-->00:31:44.536 to reader for a couple seconds during a payment, switch on the pairing mode, connect your own 00:31:44.536-->00:31:49.541 malicious device, uh downgrade the firmware on the reader, and then send an exploit to get a 00:31:51.710-->00:31:56.715 full access to a reader. Then you bypass updating process and keep uh persistence on the 00:31:59.718-->00:32:04.656 device and just basically collect track 2 data uh on the merchant’s hands. So this- in 00:32:08.994-->00:32:13.999 this case our recommendations obviously it is very important to check that uh your customers 00:32:16.001-->00:32:22.007 don’t use out of date firmware as well as this is completely unnecessary to, to allow 00:32:22.007-->00:32:28.747 customers to downgrade firmware on their own devices. We also found where a interesting uh 00:32:28.747-->00:32:33.752 practice for 1 particular vendor which were checking potentially infected devices. Potentially 00:32:36.488-->00:32:41.493 infected entities and when 1 entity was connected with another entity such as for 00:32:43.762-->00:32:48.667 example reader with mobile phone, mobile phone with account, all these sets of 00:32:48.667-->00:32:53.171 entities appeared to be potentially infected and locked in the end. So it’s a very 00:32:53.171-->00:32:59.444 unusual practice that you found on the market and just obviously as soon as we get our full 00:32:59.444-->00:33:04.349 access to a mobile point of sale terminal well it’s really hard to launch doom there, you know? 00:33:04.349-->00:33:09.354 Uh we just decided to put more cats on the internet. Um and last about the hardware 00:33:14.759-->00:33:21.099 observations. Yes surprisingly in these devices which cost less than 50 dollars, uh the hardware 00:33:21.099-->00:33:26.638 security was pretty good. For example very good protection, normally very good protection, 00:33:26.638-->00:33:32.210 against anti-tampering such as anti-tampering foil uh which protects against opening, 00:33:32.210-->00:33:38.316 foiling. Sometimes even pressure sensors. And the last problem is that uh even if you’ll get 00:33:38.316-->00:33:43.555 access to read internals without alerting anti-tampering mechanisms, all you’ll see is 00:33:43.555-->00:33:49.027 just a set of proprietary protocols, sometimes no gtech which means that without 00:33:49.027-->00:33:54.032 developers certificates without developers uh manuals, you hardly will get anything. >>So 00:33:58.470-->00:34:04.209 this brings us on to our secondary factors. So a lot of the vendors that we looked at 00:34:04.209-->00:34:10.081 tend to take very different approaches. So some of the vendors we looked at tended to 00:34:10.081-->00:34:15.053 focus on the onboarding checks during the enrollment process, where the- whereas others 00:34:15.053-->00:34:19.958 focused on the transaction monitoring. So as Tim mentioned one of the vendors we looked at 00:34:19.958-->00:34:25.997 carried out quite complicated correlation between different devices different accounts so we 00:34:25.997-->00:34:31.136 had quite a lot of difficulty during this assessment process trying to keep access 00:34:31.136-->00:34:36.675 maintaining access to an account. But this is a really sophisticated and effective way 00:34:36.675-->00:34:42.981 of identifying a fraudulent merchant. As I mentioned at the start there are significant 00:34:42.981-->00:34:48.386 differences depending on the geographic location. So generally speaking we noted that 00:34:48.386-->00:34:54.125 readers and accounts in Europe were far more restrictive than those in the US. So for example 00:34:54.125-->00:34:59.965 Square who operates in both locations they permit amnesty transactions and offline 00:34:59.965-->00:35:04.970 processing in the US but this isn’t possible in Europe. And finally, uh with regards to the 00:35:07.405-->00:35:12.744 mobile ecosystem, we were pretty disappointed to notice that almost all of the vendors didn't 00:35:12.744-->00:35:18.183 protect the mobile ecosystem at all. And the [unintelligible] approach of course is that it’s 00:35:18.183-->00:35:23.088 the very thing that allows us to gain access to much of the knowledge we needed in order to 00:35:23.088-->00:35:28.093 understand how these readers work. So this table represents a broad overview of all the 00:35:31.296-->00:35:36.301 different readers, vendors, manufacturers, and areas of assessment that we carried out. 00:35:38.603-->00:35:44.109 Obviously this marketplace places emphasis on user enrollment and onboarding. So 00:35:44.109-->00:35:49.247 they want it to be easy for customers, they want it to be simple. But it doesn't take into 00:35:49.247-->00:35:55.320 account the fact that security should in fact be incredibly high in all areas to counteract 00:35:55.320-->00:36:00.258 the incredibly low barriers for entry. So as I mentioned at the start, if you want to see the 00:36:02.761-->00:36:07.932 unversion- uncensored version of our presentation, go ahead and access that on the media server 00:36:07.932-->00:36:13.471 today. You’re welcome to do that. We- we spoke to all of the vendors that were affected by 00:36:13.471-->00:36:18.476 this process and most of them were very cooperative with us. So during this process we 00:36:20.812-->00:36:25.884 noticed that these devices actually provide a really unique opportunity, especially for 00:36:25.884-->00:36:30.822 security researchers. So traditionally in order to carry out payment testing or payment 00:36:30.822-->00:36:37.028 research we have to engage with the customer or we have to work in a financial institution. The 00:36:37.028-->00:36:42.033 interesting thing about these products is that anyone can enroll with an- with an account 00:36:42.033-->00:36:47.439 within 5 minutes. So you don’t have to be a business for example in Europe you can be a 00:36:47.439-->00:36:53.445 sole trader which is very simple to do and you can just open an account. So you can use these 00:36:53.445-->00:36:57.816 devices to actually carry out payment research, you can just use them to carry out 00:36:57.816-->00:37:04.456 confirmation of someone else’s research. You can use them to understand how a payment works. 00:37:04.456-->00:37:09.427 So for this reason we wanted to talk about this because we think that everyone in this room can 00:37:09.427-->00:37:16.034 benefit from understanding how they can use mobile point of sales terminals. So what does 00:37:16.034-->00:37:20.905 this actually mean for businesses in assessing risk? It means that if you take card 00:37:20.905-->00:37:25.577 payments, you shouldn’t take swipe transactions. We’ve mentioned that there is a 00:37:25.577-->00:37:30.048 vulnerability associated with some of these readers that we’ve looked at, but more specifically 00:37:30.048-->00:37:35.120 Magstripe is actually a deprecated protocol. So as I mentioned a Magstripe can be 00:37:35.120-->00:37:39.691 cloned, a signature can be forged, and of course there’s no signing of the transaction. So 00:37:39.691-->00:37:45.130 every time a merchant accepts a card that’s swiped, they’re actually accepting liability for 00:37:45.130-->00:37:50.301 the full value of that transaction. More broadly speaking, I think all of us in 00:37:50.301-->00:37:55.673 this room know that embedded systems have become incredibly popular over the last few years. 00:37:55.673-->00:37:59.978 Especially with consumers but also we’re seeing them being incorporated much more into 00:37:59.978-->00:38:05.583 business infrastructure. But that means that all of us need to understand that there’s not 00:38:05.583-->00:38:10.522 gonna be a high level of security testing in products like this. Typically the vendors 00:38:10.522-->00:38:14.893 have only been around for a few years. And many of these products cost less than 100 00:38:14.893-->00:38:21.065 dollars. So it’s just something that we all need to keep in mind. So at the beginning of 00:38:21.065-->00:38:25.970 this project we started with just 2 card readers and 2 vendors, and this quickly grew 00:38:25.970-->00:38:30.975 into a really ambitious project encompassing 7 card readers and 2 geographic locations. So we 00:38:33.611-->00:38:38.082 found that over 50 percent of the readers that we looked at were affected by our 00:38:38.082-->00:38:42.487 vulnerabilities and our findings, and all of the vendors that we looked at were affected 00:38:42.487-->00:38:48.826 by our findings. We found that you can send arbitrary commands to the MWR M010 reader, the 00:38:48.826-->00:38:54.566 IZettle reader, the SumUp reader, and for this reason it allows us to socially engineer 00:38:54.566-->00:38:59.237 the cardholder. So we can get them to carry out a swiped payment or we can send a message 00:38:59.237-->00:39:03.741 which says “payment cancelled” or “payment declined” and force them to carry out additional 00:39:03.741-->00:39:08.746 payments. We also found that for 3 of the readers, so the same readers, it’s also possible to 00:39:10.748-->00:39:16.421 modify the amount for magnetic stripe transactions. So this means that we can display a much 00:39:16.421-->00:39:21.125 lower value on the card terminal itself, and force the card holder to carry out a much 00:39:21.125-->00:39:26.130 higher value transaction. We found that on the M- uh MWR M010 reader we can gain we could gain 00:39:28.766-->00:39:33.838 access to the full file system using the remote code execution vulnerability so this means that 00:39:33.838-->00:39:39.010 we can do almost anything. We can enable command mode on the on the pin pad so we can start 00:39:39.010-->00:39:45.149 to collect uh pins in plain text. Surprisingly the surprising mechanisms in most of 00:39:45.149-->00:39:50.555 these products is quite sophisticated but overall security wasn't good. It tends 00:39:50.555-->00:39:56.527 to be considered in isolation. So it’s high in the level of the physical security mechanisms but 00:39:56.527-->00:40:03.034 more broadly speaking the entire ecosystem is relatively weak. So this brings us onto our 00:40:03.034-->00:40:08.506 conclusions. For manufacturers, we recommend that security is implemented during the 00:40:08.506-->00:40:13.077 development process. We can see really strong evidence of this in the physical security 00:40:13.077-->00:40:19.517 mechanisms, but we can’t see it in other areas of the ecosystem. You should use a bluetooth uh 00:40:19.517-->00:40:24.188 pairing mode that visually allows the confirmation that the correct device and the correct 00:40:24.188-->00:40:30.995 terminal has been paired. And of course you should control firmware wersh- versions. So 00:40:30.995-->00:40:36.134 encrypt and control firmware so you can prevent it from interception via sniffing and 00:40:36.134-->00:40:41.139 obviously modification. For vendors we recommend that you do not allow the use of Magstripe 00:40:44.442-->00:40:48.880 or you need to implement a solution which allows for the signing of the transaction or 00:40:48.880-->00:40:54.819 the checking of the transaction on the server side. Use preventive monitoring is bes- 00:40:54.819-->00:40:59.290 best practice. So this means looking for transaction anomalies but it also means 00:40:59.290-->00:41:03.594 using things like correlation because this is a really effective way of identifying 00:41:03.594-->00:41:09.033 fraudulent merchants. We also recommend that vendors implement really strong enrollment checks 00:41:09.033-->00:41:15.773 because this is the first point of entry into the ecosystem. For merchants we recommend that you 00:41:15.773-->00:41:21.279 control physical access to the devices. This is because many of the attacks that we’ve mentioned 00:41:21.279-->00:41:27.051 in some way or other involve some level of physical proximity to carry out the attack. We 00:41:27.051-->00:41:32.223 recommend that merchants also if at all possible assess the ecosystem. This isn't obviously 00:41:32.223-->00:41:37.128 viable for a small business like a cafe that just has 1 reader but there are larger business 00:41:37.128-->00:41:42.300 which- businesses which have many more units. For card holders we recommend that you 00:41:42.300-->00:41:46.337 don’t actually carry out swipe transactions but instead use chip and signature or chip and 00:41:46.337-->00:41:52.877 pin where possible. And of course it’s always good practice to just check your transactions 00:41:52.877-->00:41:57.882 on a monthly bay- basis and report anything that you think is anomolous to your issuing 00:41:57.882-->00:42:03.855 bank. So this concludes our presentation and I just want to thank you all for listening to 00:42:03.855-->00:42:08.659 our findings at this early moment in the morning. We also want to thank a few of our 00:42:08.659-->00:42:12.997 colleagues and friends who assisted us with this project. So we want to thank Artem ‘cause 00:42:12.997-->00:42:18.503 he carried out a huge amount of work to identify the remote code execution vulnerability. And 00:42:18.503-->00:42:23.775 thanks to Alexey and Mark who helped us look at the physical devices to assess their physical 00:42:23.775-->00:42:28.780 security mechanisms. So thank you very much! [applause]