1 00:00:00,000 --> 00:00:00,880 Hi. 2 00:00:00,880 --> 00:00:04,880 Okay, so, as you're aware, there are no screens whatsoever. 3 00:00:08,120 --> 00:00:09,660 But can everyone hear me? 4 00:00:10,380 --> 00:00:11,100 Cool. 5 00:00:11,500 --> 00:00:14,300 So, yeah, there are no screens whatsoever. 6 00:00:14,300 --> 00:00:18,320 I did have a talk on a whole load of contactless card attacks. 7 00:00:18,900 --> 00:00:21,340 I might as well try and do it without slides. 8 00:00:21,640 --> 00:00:23,340 It probably won't make any sense. 9 00:00:23,360 --> 00:00:26,440 If anyone wants to get up and leave while I'm talking, feel free. 10 00:00:26,440 --> 00:00:27,680 I probably would. 11 00:00:31,400 --> 00:00:33,680 So, is everyone here for a payment talk? 12 00:00:33,680 --> 00:00:36,620 Or did people just wander in a place to sit down? 13 00:00:38,080 --> 00:00:38,960 Excellent. 14 00:00:39,780 --> 00:00:43,040 So, I'm part of a group from the University of Birmingham. 15 00:00:43,400 --> 00:00:50,040 I've got to mention my colleagues Andrea, George, Iona and Anna have done a lot of this work. 16 00:00:50,400 --> 00:00:54,540 I've got pictures of them on the slide, which you won't see, but this is very much joint work. 17 00:00:55,540 --> 00:00:57,860 So, I like contactless payment. 18 00:00:57,860 --> 00:00:59,280 I think it's great. 19 00:00:59,280 --> 00:01:05,780 It came in in Britain before it was in the US, quite a long time before. 20 00:01:05,780 --> 00:01:16,160 And in fact, one of my trips to the US some time ago, before you had contactless payment here, I had my contactless card and I was tapping it against the payment terminal here. 21 00:01:16,460 --> 00:01:24,460 And the shop assistant just stared at me in total disbelief, thinking I'm someone who doesn't know how card works, and explained I had to put it in the slot at the front. 22 00:01:25,080 --> 00:01:28,500 But I've been looking at contactless payment for a lot, for a long time. 23 00:01:29,060 --> 00:01:35,080 And something I've got to just make clear from the start, is payment rules are very different in Europe. 24 00:01:35,580 --> 00:01:41,460 It's almost impossible to get a bank in Europe to give you money back once it's spent. 25 00:01:41,880 --> 00:01:46,100 So, here in the US, if there's fraud on your card, it's quite easy to get it back. 26 00:01:46,540 --> 00:01:50,120 European banks will typically say, no, you're responsible for that. 27 00:01:50,680 --> 00:01:54,780 And in response, European cards are very locked down. 28 00:01:55,320 --> 00:02:01,520 You cannot spend over $100 contactless without putting a PIN in. 29 00:02:02,100 --> 00:02:04,120 You can't do signatures anymore. 30 00:02:04,220 --> 00:02:11,180 For cards, any high value, you have to put in your PIN number, or do face ID or fingerprint ID. 31 00:02:11,960 --> 00:02:16,300 So, here in the US, I've tapped a card and it's taken $200. 32 00:02:16,500 --> 00:02:18,020 That doesn't really happen. 33 00:02:18,020 --> 00:02:19,920 So, I'm playing by different rules here. 34 00:02:19,920 --> 00:02:26,300 Part of what I'm trying to do is remove that payment limit, in most of the rest of the world. 35 00:02:27,020 --> 00:02:32,540 But, I like looking at EMV as well, because the spec is entirely public. 36 00:02:32,540 --> 00:02:35,020 Has anyone here looked at the EMV spec? 37 00:02:36,500 --> 00:02:38,520 Oh, consider yourselves lucky. 38 00:02:38,880 --> 00:02:42,220 It is thousands and thousands and thousands of pages. 39 00:02:42,220 --> 00:02:44,320 And it's written awfully. 40 00:02:44,660 --> 00:02:47,660 They don't give any kind of overview of the protocols. 41 00:02:47,660 --> 00:02:52,200 They spend pages defining minute details in huge technical detail. 42 00:02:53,580 --> 00:02:57,580 So, we spend a lot of time at the university looking at that spec. 43 00:02:58,320 --> 00:03:01,660 So, we have a pretty good idea of the protocol. 44 00:03:01,840 --> 00:03:06,480 I have some fantastic slides here, which take you through the protocol step by step. 45 00:03:06,480 --> 00:03:07,940 You'll just have to imagine. 46 00:03:08,580 --> 00:03:17,400 But when you walk into a shop and you tap your contactless card, the first message from the reader asks the card, what kind of card are you? 47 00:03:18,140 --> 00:03:22,520 And Visa is different from MasterCard, which is different from Amex. 48 00:03:22,520 --> 00:03:25,520 And the card will say, hey, I'm a Visa card. 49 00:03:25,900 --> 00:03:29,020 And then the reader says, OK, I can do Visa cards. 50 00:03:29,020 --> 00:03:30,360 Let's run the protocol. 51 00:03:31,480 --> 00:03:39,220 The next step, in all protocols, the reader basically says, OK, I'd like to start a transaction. 52 00:03:39,940 --> 00:03:48,300 And the card sends back a list of things it needs, like the amount of the transaction, the currency, the date, all that kind of information. 53 00:03:48,300 --> 00:03:50,480 This is different on different cards. 54 00:03:50,480 --> 00:03:55,540 The reader has to send all of that information to the card. 55 00:03:56,040 --> 00:04:07,180 The card then creates a cryptographic MAC, a message authentication code, with a cryptographic key shared just between your card and the bank. 56 00:04:07,800 --> 00:04:16,300 I think it's a hash of your card number and some secret, master secret, which if you've got, you can just make your own cards. 57 00:04:16,300 --> 00:04:18,820 The banks have managed to keep that secure. 58 00:04:18,820 --> 00:04:26,540 So this message authentication code is a key only between the card and the bank. 59 00:04:26,540 --> 00:04:31,340 It's very, very difficult to get that key off the card in any way. 60 00:04:32,420 --> 00:04:36,150 And that message authentication code is sent to the reader. 61 00:04:36,480 --> 00:04:42,240 The reader sends that and all of the information to the bank. 62 00:04:42,520 --> 00:04:47,700 The bank does a cryptographic check, saying this claims to be this person's card. 63 00:04:47,700 --> 00:04:51,380 Look up the cryptographic key for this person's card. 64 00:04:51,620 --> 00:04:53,400 Does the crypto check out? 65 00:04:53,540 --> 00:04:55,020 If so, good. 66 00:04:55,020 --> 00:04:56,780 It then does fraud checks. 67 00:04:56,780 --> 00:05:00,120 It says, does this look suspicious? 68 00:05:00,520 --> 00:05:01,880 And it does balance checks. 69 00:05:01,880 --> 00:05:03,520 Does the person have enough money? 70 00:05:03,920 --> 00:05:10,420 And then it sends a message back to the reader saying, confirmed, payment accepted. 71 00:05:10,760 --> 00:05:13,680 And that all happens as you tap. 72 00:05:14,080 --> 00:05:17,680 You might have noticed four lights on top of the little readers. 73 00:05:17,700 --> 00:05:21,260 That's the four stages I mentioned. 74 00:05:21,980 --> 00:05:24,260 And remarkably quick. 75 00:05:24,260 --> 00:05:25,380 Massively. 76 00:05:25,380 --> 00:05:26,500 Your balance is checked. 77 00:05:26,500 --> 00:05:28,900 It all works extremely well. 78 00:05:29,000 --> 00:05:36,020 And actually, if the EMB companies stopped here, everything would be fine. 79 00:05:36,020 --> 00:05:37,220 It really would. 80 00:05:37,220 --> 00:05:39,240 But these companies can't help themselves. 81 00:05:39,240 --> 00:05:43,260 They're driven to add new features and tweaks and changes. 82 00:05:43,260 --> 00:05:46,020 And this is what this talk is really about. 83 00:05:46,020 --> 00:05:50,840 These new features have introduced a whole load of attacks. 84 00:05:53,040 --> 00:05:58,420 So, yes, and that's Visa's protocol. 85 00:05:58,420 --> 00:06:03,000 Visa also have an offline protocol where there's no bank check. 86 00:06:03,540 --> 00:06:07,940 And to do this, there's also a public key on the card. 87 00:06:08,500 --> 00:06:19,860 And as well as this MAC, this cryptographic token the reader sends to the bank, the reader will sign all of the data with a public key. 88 00:06:19,880 --> 00:06:23,060 And the reader has a certificate chain to check that. 89 00:06:23,060 --> 00:06:29,040 A little bit like TLS certificates, but that means that no one can forge cards. 90 00:06:29,460 --> 00:06:32,700 You've got a public key signed by the bank. 91 00:06:32,780 --> 00:06:34,080 The reader checks it. 92 00:06:34,360 --> 00:06:38,560 The reader checks the card has signed all the data. 93 00:06:39,100 --> 00:06:42,620 And then the reader can be sure it is a real card. 94 00:06:45,620 --> 00:06:47,500 MasterCard's protocol is a little different. 95 00:06:47,500 --> 00:06:49,560 It splits it into two actions. 96 00:06:49,560 --> 00:06:52,100 One, send me the data and get ready. 97 00:06:52,100 --> 00:06:55,460 Two, generate this AC, this MAC. 98 00:06:55,580 --> 00:06:58,420 Amex's protocol is very like Visa's. 99 00:06:58,720 --> 00:07:05,120 One of the biggest is union pay in China, which again copies Visa and MasterCard. 100 00:07:05,120 --> 00:07:14,320 A lot of this work is based on Visa and MasterCard because they've defined the key protocols and other companies really take those and just tweak them. 101 00:07:18,940 --> 00:07:21,000 I'm a university academic. 102 00:07:21,000 --> 00:07:25,160 I like getting into the mathematics, the little details of things. 103 00:07:25,160 --> 00:07:30,660 So what we've been doing over the last few years is building formal models of these hugely complex protocols. 104 00:07:31,520 --> 00:07:34,900 These are like mathematical models. 105 00:07:35,120 --> 00:07:41,300 We write simple rules, almost like a simple programming language, to say what these protocols do. 106 00:07:41,300 --> 00:07:46,940 If the card sent this kind of message, it replies with this kind of reply. 107 00:07:48,000 --> 00:07:51,060 And then we can take these models and we can test them. 108 00:07:51,060 --> 00:08:00,400 We can use machinery to say, now for an attacker who tries anything, can we get into a bad state? 109 00:08:00,540 --> 00:08:03,940 So these tools are remarkably powerful. 110 00:08:03,940 --> 00:08:10,240 And the reason why we found attacks which others have missed is these tools can sometimes find them for us. 111 00:08:10,240 --> 00:08:15,880 But more importantly, these tools force us to think about every little detail. 112 00:08:16,140 --> 00:08:24,760 So we have to write out a rule in our formal model to say, if this field has this value, what do we do? 113 00:08:25,740 --> 00:08:28,380 And a lot of the times you think, well, we don't know. 114 00:08:28,400 --> 00:08:29,300 That's odd. 115 00:08:29,300 --> 00:08:33,020 And we'll go and look at a card and we'll test it and find out. 116 00:08:33,020 --> 00:08:36,840 And that's how we get a complete picture of what the cards do. 117 00:08:37,900 --> 00:08:43,220 So the spec itself has some issues which have been documented well in the last few years. 118 00:08:43,220 --> 00:08:47,160 But the spec itself is actually pretty good. 119 00:08:47,740 --> 00:08:53,860 However, as I say, companies keep adding stuff to the spec which isn't in the spec. 120 00:08:53,860 --> 00:08:57,360 And as I said, the specification is thousands and thousands of pages. 121 00:08:57,980 --> 00:09:07,600 So for instance, a big one was using your phones with face ID or a fingerprint ID. 122 00:09:08,520 --> 00:09:12,840 In Europe, this completely removes the hard $100 limit. 123 00:09:13,880 --> 00:09:20,300 And also, the reader will send to the bank saying, hey, we checked this person's face. 124 00:09:20,360 --> 00:09:23,600 And that essentially means no fraud checks. 125 00:09:23,880 --> 00:09:35,080 You can literally walk into a car dealership and buy a car, scan it with face ID, tap your phone, and the bank will say, that's good, we scanned this person's face. 126 00:09:35,080 --> 00:09:36,500 It must be correct. 127 00:09:37,020 --> 00:09:39,340 But none of that is in the spec. 128 00:09:39,340 --> 00:09:44,800 There's nothing in any of the protocols which says it's a plastic card or it's a phone. 129 00:09:45,560 --> 00:09:48,960 They retrofitted that onto the initial spec. 130 00:09:49,040 --> 00:09:51,880 Security-wise, that's the worst thing you can do. 131 00:09:51,980 --> 00:09:56,320 They've done something ad hoc not very well. 132 00:09:57,140 --> 00:09:59,920 This offline mode, that's a bit scary, right? 133 00:09:59,920 --> 00:10:02,620 It doesn't go to the bank for a check. 134 00:10:03,140 --> 00:10:09,740 In Europe, Square readers say you must only use a mobile phone in offline mode. 135 00:10:10,280 --> 00:10:14,420 But there's nothing in the protocol to say it's a mobile phone or not. 136 00:10:14,420 --> 00:10:17,440 So Square have hacked it and done something odd. 137 00:10:19,600 --> 00:10:25,280 Recently, Apple and Visa have added loyalty cards onto the phones as well. 138 00:10:25,280 --> 00:10:27,920 And they've done it independently. 139 00:10:28,500 --> 00:10:32,120 There's also regulation, for instance, in the UK. 140 00:10:32,120 --> 00:10:37,600 The government said you can't do tap and type in your PIN number contactlessly. 141 00:10:37,660 --> 00:10:40,040 Don't know why they said that. 142 00:10:40,760 --> 00:10:46,720 In order to trade in Britain, the card companies had to follow this. 143 00:10:46,720 --> 00:10:47,820 Not in the spec. 144 00:10:47,820 --> 00:10:50,260 They've done something odd and retrofitted it. 145 00:10:50,260 --> 00:10:51,720 None of it's published. 146 00:10:51,720 --> 00:10:53,200 None of it's public. 147 00:10:53,340 --> 00:10:58,760 And worst of all, the companies haven't told each other about this. 148 00:10:59,380 --> 00:11:02,800 So that's bound to lead to security vulnerabilities. 149 00:11:03,260 --> 00:11:06,060 And that's what we've really been looking at. 150 00:11:06,480 --> 00:11:12,080 However, the first thing we looked at was the transit transport mode. 151 00:11:12,400 --> 00:11:23,140 I don't know if anyone's familiar with this, but if you've got your phone, you can often use it on the subway system or some transport systems without doing face ID. 152 00:11:24,080 --> 00:11:28,060 So this is because in big cities, subway systems can be quite aggressive. 153 00:11:28,060 --> 00:11:30,500 You've got to get through the barrier quickly. 154 00:11:30,800 --> 00:11:33,740 If you don't, you make a massive queue behind you. 155 00:11:34,340 --> 00:11:48,860 So if you go up to a transport barrier and you take out your iPhone and you hold up the entire queue and you start typing on your iPhone to unlock it, there's an entire queue of a line of people behind you who hate you and hate iPhones. 156 00:11:49,380 --> 00:11:51,620 So that's the primary reason they've done it. 157 00:11:51,620 --> 00:11:53,520 But this is fascinating, right? 158 00:11:53,760 --> 00:11:57,540 They have completely removed the authentication check. 159 00:11:58,060 --> 00:11:59,080 Make a payment. 160 00:11:59,620 --> 00:12:01,860 That's normally a lock screen to make a payment. 161 00:12:01,860 --> 00:12:05,000 They've removed that for transport systems. 162 00:12:05,080 --> 00:12:08,140 So of course, this is something we had to look at. 163 00:12:08,680 --> 00:12:10,480 This was some years ago now. 164 00:12:10,480 --> 00:12:11,900 This was during COVID. 165 00:12:13,340 --> 00:12:18,360 We live in a city called Birmingham, which is 100 miles away from London, which had this system. 166 00:12:19,280 --> 00:12:23,060 It was the height of COVID, but I really, really wanted the data. 167 00:12:23,200 --> 00:12:26,700 So I sent my postdoc, Andrea, to go and get it for me. 168 00:12:28,060 --> 00:12:29,960 I should have done a risk assessment. 169 00:12:30,180 --> 00:12:34,100 I should have filled in forms, but we just did it. 170 00:12:34,100 --> 00:12:43,700 So I sent Andrea, during the height of COVID, halfway across the country, with a bag with lots of wires sticking out of it. 171 00:12:43,700 --> 00:12:47,420 At the same time, anti-terrorist police were walking around with guns. 172 00:12:47,720 --> 00:12:50,260 But it worked and she got the data. 173 00:12:50,480 --> 00:12:52,780 So I don't know if you're familiar with Proxmarts. 174 00:12:52,780 --> 00:12:57,960 They're little radio devices which scan all radio connections. 175 00:12:58,500 --> 00:13:08,040 So what she did is she went around London, doing a contactless payment, using a Proxmark, so we could actually see what was going on. 176 00:13:09,160 --> 00:13:13,640 What she found was a completely normal EMV transaction. 177 00:13:14,460 --> 00:13:28,140 But at the start of the low layer, the initial handshake, before you actually get to any of the protocol messages, there was an extra code which was just sent randomly. 178 00:13:28,680 --> 00:13:30,260 It's not in the spec. 179 00:13:30,900 --> 00:13:34,740 At the time, it was a complete mystery to us. 180 00:13:35,460 --> 00:13:39,460 We now know this is something called Apple-enhanced contactless polling. 181 00:13:40,080 --> 00:13:49,260 It's a magic code you send at the lowest layer of NFC, the ISO1443 layer, which does the initial handshake. 182 00:13:49,260 --> 00:13:55,940 And if an iPhone sees this magic code, it will unlock a particular application. 183 00:13:57,200 --> 00:14:07,580 So if an iPhone sees this, it goes into a special mode where the main user account is still locked, but it will run one application. 184 00:14:07,580 --> 00:14:11,120 And the code tells you which application it will run. 185 00:14:11,520 --> 00:14:13,240 Again, not public. 186 00:14:13,240 --> 00:14:16,080 We found details of this on a patent. 187 00:14:16,080 --> 00:14:19,540 Apple have patented it, and that document is public. 188 00:14:19,540 --> 00:14:21,120 That's how we know about it. 189 00:14:21,580 --> 00:14:28,240 But this code will start up the payment app in a sandboxed method. 190 00:14:29,080 --> 00:14:33,860 Additionally, the protocol will say, I am a transit reader. 191 00:14:34,600 --> 00:14:37,920 It will have a code saying, I'm a transit reader. 192 00:14:38,080 --> 00:14:40,520 Shops have a code saying, I'm a shop. 193 00:14:40,800 --> 00:14:48,260 Gambling institutions have a code saying, I'm gambling, which is how you can block gambling for particular cards. 194 00:14:48,560 --> 00:14:57,160 But we found this code, which lets us unlock iPhones into this transit mode with some restrictions. 195 00:14:58,060 --> 00:15:07,080 So we went back to our formal model, and we could change these rules to say, now it works like this, and run it, and look for attacks. 196 00:15:07,920 --> 00:15:12,900 And what we found is MasterCard was completely safe. 197 00:15:12,900 --> 00:15:14,040 It worked well. 198 00:15:14,040 --> 00:15:20,240 You couldn't make a high-value payment without a strong ID. 199 00:15:20,500 --> 00:15:22,860 But for Visa, you could. 200 00:15:23,700 --> 00:15:28,220 For Visa, you could bypass all the authentication requirements. 201 00:15:30,540 --> 00:15:33,120 And the tool would give us the attack. 202 00:15:33,420 --> 00:15:40,680 How the attack worked is the attacker would act as a relay, a man in the middle. 203 00:15:41,280 --> 00:15:44,900 And it would broadcast these magic bytes. 204 00:15:44,900 --> 00:15:47,100 It would pretend to be a transit reader. 205 00:15:47,140 --> 00:15:50,980 So it would tell the phone, I'm a transit reader. 206 00:15:51,900 --> 00:15:56,200 Now, you could then ring up a large transaction, $10,000. 207 00:15:56,920 --> 00:16:00,960 And what we also found is the card doesn't look at the amount. 208 00:16:01,820 --> 00:16:08,460 There's a flag in the protocol which says, this is a high amount, or this is a low amount. 209 00:16:09,140 --> 00:16:14,780 So the reader sends a message saying, I want to do a $10,000 amount. 210 00:16:14,800 --> 00:16:17,020 This is a high amount of money. 211 00:16:17,020 --> 00:16:19,200 I need some strong authentication. 212 00:16:19,880 --> 00:16:23,760 What we'd do is we'd flip that bit in the transaction. 213 00:16:24,860 --> 00:16:31,200 And we'd then tell the card, this is a $10,000 amount. 214 00:16:31,200 --> 00:16:33,480 And by the way, that's low. 215 00:16:33,800 --> 00:16:36,100 And the card would accept that. 216 00:16:36,100 --> 00:16:38,960 Now, it does that with very many different currencies. 217 00:16:39,220 --> 00:16:41,300 And you can use your card abroad. 218 00:16:41,360 --> 00:16:47,500 You might want to use your card in a country where $10,000 is a low amount. 219 00:16:48,620 --> 00:16:51,060 So it doesn't have hard limits. 220 00:16:51,060 --> 00:16:52,720 So the card accepts this. 221 00:16:52,760 --> 00:16:57,360 And the card says, fine, I'll make a payment token for that. 222 00:16:57,360 --> 00:16:59,380 And it makes a payment token for that. 223 00:16:59,700 --> 00:17:06,900 And then it sends it back to the reader with a message saying, I have not done any authentication. 224 00:17:07,200 --> 00:17:10,840 By the way, I didn't check face ID. 225 00:17:10,880 --> 00:17:12,440 I didn't check a fingerprint. 226 00:17:13,080 --> 00:17:15,140 So the reader should reject that. 227 00:17:15,200 --> 00:17:16,440 But we can do the same trick. 228 00:17:16,440 --> 00:17:18,140 We can flip those bits. 229 00:17:18,620 --> 00:17:19,920 And we lie. 230 00:17:19,980 --> 00:17:25,920 And we tell the shop reader, yes, this phone did check face ID when it didn't. 231 00:17:27,240 --> 00:17:31,340 Reader looks at that and thinks it's a fully authenticated transaction. 232 00:17:31,340 --> 00:17:39,300 The reader sends it to a bank with a message saying, face ID was done on this transaction. 233 00:17:39,840 --> 00:17:45,300 So the bank's fraud checks approve it and say, payment can go ahead. 234 00:17:45,600 --> 00:17:49,220 I have a really nice video of Andrea actually doing this. 235 00:17:49,220 --> 00:17:50,940 You'll just have to imagine that. 236 00:17:50,940 --> 00:17:51,320 Yep. 237 00:17:54,620 --> 00:17:57,360 They're not covered by the Mac. 238 00:17:57,360 --> 00:18:01,160 They are covered by this signature I mentioned. 239 00:18:02,220 --> 00:18:06,820 But the signature is only checked in offline mode. 240 00:18:07,900 --> 00:18:13,500 The reader thinks it's running in offline, online mode. 241 00:18:13,620 --> 00:18:21,360 So even more complicated, the card signs something to say, I haven't done any checks. 242 00:18:21,360 --> 00:18:23,280 Here's proof I haven't done any checks. 243 00:18:23,280 --> 00:18:24,680 Please check. 244 00:18:24,760 --> 00:18:26,720 But we just throw that away. 245 00:18:27,380 --> 00:18:31,320 So the phone thinks it's running in offline mode. 246 00:18:31,340 --> 00:18:34,460 The reader thinks it's running in online mode. 247 00:18:34,840 --> 00:18:41,740 Again, they should have put a flag in the protocol which said, I'm a phone running in offline mode. 248 00:18:42,080 --> 00:18:42,980 They didn't. 249 00:18:45,480 --> 00:18:46,600 Yep. 250 00:18:47,300 --> 00:18:47,860 Cool. 251 00:18:47,860 --> 00:18:51,040 So that's kind of fun. 252 00:18:53,640 --> 00:18:55,140 We bypassed the Apple... 253 00:18:56,340 --> 00:19:02,660 So, of course, being responsible academics, we went to Apple and we gave them an entire pack. 254 00:19:02,660 --> 00:19:06,320 We gave them a TAC code, videos, everything, and we sent it to them. 255 00:19:06,680 --> 00:19:08,080 And we heard nothing. 256 00:19:09,040 --> 00:19:13,080 So two months later, we sent them an email again and said, hey, what's going on? 257 00:19:13,520 --> 00:19:17,020 And then they sent us a reply saying, thanks for your submission. 258 00:19:17,020 --> 00:19:18,520 Of course, this doesn't work. 259 00:19:20,040 --> 00:19:23,640 And then we sent them back, look, video, see the video. 260 00:19:24,440 --> 00:19:26,260 And again, a few weeks went by. 261 00:19:26,260 --> 00:19:28,900 They got back to us and said, no, we still think this doesn't work. 262 00:19:28,900 --> 00:19:37,320 So we actually sent them scans of our bank statements, showing thousands of pounds coming out of the bank accounts. 263 00:19:37,320 --> 00:19:39,960 We sent them a track in numbers so they couldn't... 264 00:19:40,860 --> 00:19:45,480 So we could actually find the transactions in the backend banking system. 265 00:19:45,780 --> 00:19:53,280 And when we said, oh, and two days later, we had a meeting with their head of security, the head of payment security. 266 00:19:53,440 --> 00:19:57,200 It was a very long, useful meeting where we went through it step by step. 267 00:19:58,000 --> 00:20:00,240 They fully understood it and appreciated it. 268 00:20:00,240 --> 00:20:03,560 And they said it was completely Visa's fault. 269 00:20:05,920 --> 00:20:10,740 They offer a hundred thousand bounty for bypassing a lock screen. 270 00:20:11,080 --> 00:20:13,880 We bypassed their payment lock screen. 271 00:20:13,940 --> 00:20:16,760 But apparently that's not the lock screen they meant. 272 00:20:17,020 --> 00:20:19,220 So we didn't even get a bounty for it. 273 00:20:19,940 --> 00:20:23,780 And we went to Visa and Visa... 274 00:20:26,080 --> 00:20:28,760 This isn't being recorded, right? 275 00:20:30,100 --> 00:20:32,060 No, no one's recording this. 276 00:20:32,060 --> 00:20:36,930 Visa initially unofficially said they couldn't believe Apple had been so irresponsible. 277 00:20:40,380 --> 00:20:42,620 Then that was Visa research. 278 00:20:42,620 --> 00:20:44,420 Then Visa corporate got involved. 279 00:20:44,420 --> 00:20:49,200 And Visa corporate said it's a lab attack, which doesn't work in practice. 280 00:20:49,740 --> 00:20:53,180 So we went out to a shop and we did it in practice. 281 00:20:53,860 --> 00:20:58,880 We actually thought about buying an Apple laptop using this attack. 282 00:20:59,300 --> 00:21:01,360 But we didn't have that kind of money. 283 00:21:01,900 --> 00:21:03,340 And we sent it back to Visa. 284 00:21:03,620 --> 00:21:10,300 And then Visa said, OK, it does work, but we will refund anyone who has this happen to them. 285 00:21:11,200 --> 00:21:14,120 So Visa said it was Apple's fault and they were fine with it. 286 00:21:14,120 --> 00:21:16,700 Apple said it was Visa's fault and they were fine with it. 287 00:21:16,760 --> 00:21:18,600 So we went ahead and published this. 288 00:21:18,600 --> 00:21:21,720 So this attack completely works in practice. 289 00:21:22,040 --> 00:21:25,340 Anyone who wants to do this, you absolutely can. 290 00:21:25,920 --> 00:21:27,600 And I appreciate you being here. 291 00:21:27,600 --> 00:21:35,640 This was a great talk next door as well, which I'm really disappointed I clashed with, looking at actual people who do real attacks. 292 00:21:36,160 --> 00:21:41,300 And apparently people are actually using this in real malware attacks to steal money. 293 00:21:41,300 --> 00:21:52,720 So if you have Apple Pay and Visa and transit mode, people can take any amount of money from your phone whatsoever. 294 00:21:53,000 --> 00:21:55,980 I don't recommend having those three things together. 295 00:21:57,120 --> 00:21:59,680 OK, so that's the first attack. 296 00:21:59,680 --> 00:22:02,380 I want to give a shout out to Timo. 297 00:22:03,000 --> 00:22:05,700 He's a researcher in the UK as well. 298 00:22:05,740 --> 00:22:09,060 He got the same results at more or less the same time as us. 299 00:22:09,240 --> 00:22:11,280 He published a couple of months after we did. 300 00:22:13,000 --> 00:22:17,480 So he's a great researcher who had done very similar work. 301 00:22:19,520 --> 00:22:20,080 So the next... 302 00:22:20,080 --> 00:22:31,160 So of course, this is following a theme of payment companies added these features without explaining them and without telling people how they worked. 303 00:22:31,800 --> 00:22:36,440 So the next thing we looked at was Square's offline mode. 304 00:22:37,000 --> 00:22:52,740 This was interesting because Square said, to protect you offline, if we're not going to check clear this transaction with your bank, we will limit it to phones where we've checked for person's face or fingerprint. 305 00:22:54,460 --> 00:22:58,600 But there's no way to do this in the transaction. 306 00:22:58,600 --> 00:23:02,400 There's no flag in EMV which says I'm a phone and I'm not. 307 00:23:02,400 --> 00:23:06,640 So another Square are doing something odd. 308 00:23:06,640 --> 00:23:08,980 Someone at Square's made something up. 309 00:23:08,980 --> 00:23:12,380 It's not part of a public spec and they just run it. 310 00:23:14,080 --> 00:23:15,880 We did exactly the same thing. 311 00:23:15,880 --> 00:23:17,180 We got our relay. 312 00:23:17,180 --> 00:23:18,380 We got our equipment. 313 00:23:18,460 --> 00:23:19,840 We got a Square reader. 314 00:23:19,840 --> 00:23:23,300 We did a whole lot of transactions and we looked at how they worked. 315 00:23:23,700 --> 00:23:25,400 And it's actually very similar. 316 00:23:25,520 --> 00:23:30,360 We saw some strange messages at the start. 317 00:23:31,080 --> 00:23:32,560 Not at the low level. 318 00:23:32,560 --> 00:23:37,860 Before that initial select message which says, are you a payment card? 319 00:23:37,860 --> 00:23:40,840 There was another message which we didn't recognize. 320 00:23:41,860 --> 00:23:47,560 We did some googling and we found a great GitHub repo which explains some of it. 321 00:23:47,560 --> 00:23:51,580 And this was Apple and Google's new loyalty card scheme. 322 00:23:52,120 --> 00:24:01,320 They've added something at the front of EMV where you can have some personal data about you which the reader can just read off. 323 00:24:01,320 --> 00:24:04,460 From privacy reasons, it's horrific. 324 00:24:04,600 --> 00:24:11,800 But it allows you to use your normal payment card and have loyalty schemes at particular vendors. 325 00:24:12,460 --> 00:24:16,740 Now, of course, this Square reader wasn't doing that. 326 00:24:16,740 --> 00:24:21,080 All it said is, is there any loyalty card information? 327 00:24:21,600 --> 00:24:24,420 And if it got a yes or a no, it continued. 328 00:24:25,040 --> 00:24:28,750 If it got an error message, it stopped. 329 00:24:29,720 --> 00:24:34,500 So what Square thought was, phones might have loyalty cards. 330 00:24:34,960 --> 00:24:38,130 We'll just ask, do you have loyalty cards? 331 00:24:38,480 --> 00:24:41,070 And if I don't get an error, I will assume you're a phone. 332 00:24:42,140 --> 00:24:46,080 I'm sure you can all see the problem here. 333 00:24:46,220 --> 00:24:49,380 The cryptographic check comes later in the loyalty scheme. 334 00:24:49,380 --> 00:24:51,980 We could just record this and replay it. 335 00:24:53,280 --> 00:24:56,980 So we could have our relay, we could have a plastic card. 336 00:24:57,420 --> 00:25:01,280 Our relay sends, I have no loyalty card first. 337 00:25:01,320 --> 00:25:03,840 And then we just relay the card, and it worked. 338 00:25:04,400 --> 00:25:05,760 So that was one thing. 339 00:25:07,520 --> 00:25:10,720 Now, I can't remember if I mentioned this, whether it's just in the slides. 340 00:25:11,720 --> 00:25:14,540 Apple, check if you've done strong ident... 341 00:25:14,540 --> 00:25:22,430 Sorry, MasterCard, check if you've done strong identification in a proprietorial field called the AID. 342 00:25:22,880 --> 00:25:25,160 They do not publish the spec of this. 343 00:25:25,160 --> 00:25:28,540 That is their private field for MasterCard only. 344 00:25:28,980 --> 00:25:36,340 That means to send, to check it, the reader must send it back to MasterCard. 345 00:25:36,880 --> 00:25:39,660 For online transactions, that works great. 346 00:25:40,100 --> 00:25:42,630 For online transactions, I do my face ID. 347 00:25:43,080 --> 00:25:46,100 The reader sends it back to MasterCard. 348 00:25:46,100 --> 00:25:52,740 MasterCard says, aha, this person did face ID and sends the approved message to the reader. 349 00:25:53,180 --> 00:25:57,160 That doesn't work for offline transactions. 350 00:25:57,260 --> 00:26:01,860 Because the reader can't check that field, and it can't check MasterCard. 351 00:26:02,260 --> 00:26:10,120 So what's happened is MasterCard have designed one system where phone transactions must be processed online. 352 00:26:10,940 --> 00:26:14,440 Square independent... and MasterCard didn't explain it to Square. 353 00:26:15,380 --> 00:26:28,180 Square did their own system where their transactions, they will check for a phone using their own personal method, and they didn't explain that to MasterCard. 354 00:26:28,380 --> 00:26:34,440 Put them together, we trick the Square reader into thinking we're a phone. 355 00:26:34,660 --> 00:26:40,040 We do a completely normal transaction without authentication from a card. 356 00:26:40,040 --> 00:26:42,380 We charge $20,000. 357 00:26:43,760 --> 00:26:46,040 We send it to the card. 358 00:26:46,040 --> 00:26:49,700 The card sends it back with a message saying, don't accept this. 359 00:26:50,380 --> 00:26:54,940 But that cannot be checked offline, and the offline reader accepts it. 360 00:26:55,520 --> 00:26:57,540 So I have another video of that. 361 00:26:57,540 --> 00:26:59,660 Unfortunately, I can't show it. 362 00:26:59,700 --> 00:27:11,600 But yes, Square with offline mode, up to about a couple of months ago, you could do this simple trick and do any amount with a plastic card offline. 363 00:27:12,380 --> 00:27:13,800 Square were great. 364 00:27:13,800 --> 00:27:17,720 Unlike Apple, they fixed this very quickly and very effectively. 365 00:27:18,440 --> 00:27:26,900 However, when they did the fix, they changed it slightly, and they delayed when they checked that signature. 366 00:27:26,900 --> 00:27:29,280 I mentioned the signature in offline mode. 367 00:27:30,140 --> 00:27:33,440 They actually switched to a different mode. 368 00:27:33,840 --> 00:27:39,660 They would request that signature, but they wouldn't check it until the device went online. 369 00:27:40,460 --> 00:27:55,500 So all that meant, for a couple of months, you could just record anyone's card data, go to any Square reader, and send it the garbage signature, and the Square reader would have accepted it online. 370 00:27:55,780 --> 00:27:56,610 So offline. 371 00:27:57,120 --> 00:28:00,420 And when it went online, the bank would reject it. 372 00:28:01,160 --> 00:28:10,180 So there was a short window last summer where Square readers were effectively completely open and you didn't even need a card. 373 00:28:10,180 --> 00:28:15,420 You could invent your own card and print your own money. 374 00:28:16,060 --> 00:28:19,320 We were kind of tempted to retire from our jobs as academics. 375 00:28:20,900 --> 00:28:23,520 But we were already talking to Square. 376 00:28:23,620 --> 00:28:26,680 And Square gave us a nice bounty for this as well, unlike Apple. 377 00:28:27,860 --> 00:28:30,360 So that's all now fixed from Square. 378 00:28:30,360 --> 00:28:37,120 But it's the same pattern of inventing similar features, companies acting independently. 379 00:28:39,240 --> 00:28:42,040 So there's a question of what we can do about it. 380 00:28:42,320 --> 00:28:53,320 Going back to this formal modelling, this kind of mathematical language, we use a tool called Tamrin, which lets us write this down. 381 00:28:53,320 --> 00:28:56,780 You can write a reference model for this in any language. 382 00:28:56,880 --> 00:29:08,060 But if these companies actually tested their proposed additional features against everyone else's and made them public, payments would be a lot safer. 383 00:29:08,700 --> 00:29:10,040 Unfortunately, they're not. 384 00:29:10,040 --> 00:29:16,340 There's a lot of drive to get the new feature to market, to be the company with the feature no one else has. 385 00:29:16,380 --> 00:29:19,440 And that's really making payments unsafe. 386 00:29:20,340 --> 00:29:24,320 So there's something else we're working on to try and make payments safer. 387 00:29:24,960 --> 00:29:31,260 Most of these attacks, most attacks you'll see against payment cards, are some form of relay attack. 388 00:29:31,260 --> 00:29:42,600 You'll have mobile phones, or NFC readers, or Proxmarks, and you will read from a card, forward it to the reader, and back again. 389 00:29:42,600 --> 00:29:45,740 And you'll probably tweak some bits along the way. 390 00:29:47,060 --> 00:29:50,700 And what we're interested in is trying to stop this. 391 00:29:50,820 --> 00:29:54,420 And that relay takes time. 392 00:29:54,420 --> 00:29:55,940 It adds milliseconds. 393 00:29:56,610 --> 00:30:09,070 To receive it on one device, send it over USB or Wi-Fi, to process it over USB and Wi-Fi again, that takes maybe 20 milliseconds. 394 00:30:10,020 --> 00:30:14,080 Normal connections to the card are much, much faster. 395 00:30:14,460 --> 00:30:19,420 So as a solution, we propose actually timing this exchange. 396 00:30:19,420 --> 00:30:23,320 So the idea is, it's its first key message. 397 00:30:24,060 --> 00:30:27,580 The reader starts the clock when it sends the message back. 398 00:30:27,960 --> 00:30:31,580 And when it receives the answer from the card, it stops the clock. 399 00:30:32,400 --> 00:30:40,380 If it is above about 15 milliseconds, we say it's been relayed, and we stop. 400 00:30:40,720 --> 00:30:46,060 If it's below, we say that's fine, and it continues. 401 00:30:46,060 --> 00:30:53,840 And that would cut the attacker out and make relay attacks impossible, meaning I couldn't switch those bits. 402 00:30:53,840 --> 00:30:56,300 It would stop all of these attacks. 403 00:30:57,160 --> 00:30:59,960 We've been pushing this idea for some time. 404 00:31:00,120 --> 00:31:07,480 MasterCard have a spec which puts it at the application layer, a higher layer. 405 00:31:08,740 --> 00:31:12,080 We got some cards from MasterCard, and we checked them. 406 00:31:12,080 --> 00:31:26,280 What we found is there's a big time difference between if your card is at an angle about three centimeters away from the reader, or if it is pushed as close to the reader as possible. 407 00:31:27,640 --> 00:31:36,900 So if, because the card gets its power from the field, if it's right on the edge, it takes longer. 408 00:31:36,900 --> 00:31:44,120 So actually, there's no safe time measurement you can put in to make that time bound impossible. 409 00:31:44,400 --> 00:31:52,120 However, if you do it at the low layer, the ISO1443 layer, right on that initial handshake, it does work. 410 00:31:52,580 --> 00:31:59,820 So for the past two years, we've actually been working with the ISO standardization committee to try to get this added to the standard. 411 00:32:01,140 --> 00:32:03,860 I don't know if anyone's worked with standardization committees. 412 00:32:04,600 --> 00:32:05,920 It's tough. 413 00:32:05,920 --> 00:32:08,760 I have an example of the standard. 414 00:32:08,840 --> 00:32:13,100 So we have an amendment being voted on right now. 415 00:32:13,140 --> 00:32:15,200 It's gone through two years of revisions. 416 00:32:15,480 --> 00:32:17,680 Every country in the world gets a vote. 417 00:32:17,800 --> 00:32:19,760 About half of them will use it. 418 00:32:19,940 --> 00:32:22,980 So we're waiting to see what random countries vote. 419 00:32:22,980 --> 00:32:25,280 We're pretty confident it will go ahead. 420 00:32:25,740 --> 00:32:28,880 But I have an example of a standard on this slide. 421 00:32:28,880 --> 00:32:35,900 And for instance, one of the things we wanted to change was, 422 00:32:43,000 --> 00:32:46,200 That change was two days of my life. 423 00:32:46,380 --> 00:32:49,840 As we debated, was that fine? 424 00:32:49,920 --> 00:32:53,780 And the Dutch group would walk out if we didn't make the change. 425 00:32:53,780 --> 00:32:55,920 The French group objected to it strongly. 426 00:32:56,820 --> 00:32:59,120 But we think that's going ahead. 427 00:32:59,300 --> 00:33:07,780 And that amendment should be added to the low-level standard soon, which means it will get out into cards and readers. 428 00:33:08,200 --> 00:33:13,140 And it will stop a lot of these attacks and make EMV much, much safer. 429 00:33:14,600 --> 00:33:16,740 Okay, so that's all I wanted to say. 430 00:33:17,140 --> 00:33:18,860 Thanks for bearing with me. 431 00:33:19,060 --> 00:33:21,240 I did have a really nice slide deck. 432 00:33:22,520 --> 00:33:24,620 And I have videos of those attacks. 433 00:33:24,620 --> 00:33:27,140 I guess that will go up online later. 434 00:33:28,000 --> 00:33:41,540 By the way, if anyone is interested in this, if anyone has good access to American Express or Discovery Cards, or even the Chinese Union Pay, we would be very interested in working with you. 435 00:33:41,960 --> 00:33:47,320 So if anyone feels like working in this area, please send me an email or let me know. 436 00:33:47,840 --> 00:33:54,400 Because I'm pretty sure the same attacks of work against Visa would work against American Express. 437 00:33:54,500 --> 00:33:59,320 But we have no access to work in American Express payment machines in Britain. 438 00:33:59,880 --> 00:34:01,820 Same with Discover Cards. 439 00:34:02,500 --> 00:34:10,240 A lot of research has been focused on Visa and MasterCard, because that's what's available internationally. 440 00:34:10,720 --> 00:34:18,360 I bet Visa attacks are waiting to be discovered in a whole lot of US cards as well. 441 00:34:18,500 --> 00:34:21,260 So this is a great area to work in. 442 00:34:21,580 --> 00:34:24,060 If you'd like to work with us, just let me know. 443 00:34:24,060 --> 00:34:27,980 If you'd like to work on it yourself, our relay code is publicly available. 444 00:34:27,980 --> 00:34:30,160 The specs are publicly available. 445 00:34:30,480 --> 00:34:37,340 Anyone here can get those specs, read them, get a simple NFC setup, and get things working quite nicely. 446 00:34:37,760 --> 00:34:41,820 So this is a fantastic area to get into and tinker with. 447 00:34:41,900 --> 00:34:43,640 It's pretty easy. 448 00:34:43,640 --> 00:34:48,460 And you can be reading your own card with your own phone in a matter of hours. 449 00:34:49,060 --> 00:34:50,680 Cool, so that's my talk. 450 00:34:51,140 --> 00:34:55,440 Again, apologies for no slides, and thanks for sticking with me.