WEBVTT

00:00.000 --> 00:00.880
Hi.

00:00.880 --> 00:04.880
Okay, so, as you're aware, there are no screens whatsoever.

00:08.120 --> 00:09.660
But can everyone hear me?

00:10.380 --> 00:11.100
Cool.

00:11.500 --> 00:14.300
So, yeah, there are no screens whatsoever.

00:14.300 --> 00:18.320
I did have a talk on a whole load of contactless card attacks.

00:18.900 --> 00:21.340
I might as well try and do it without slides.

00:21.640 --> 00:23.340
It probably won't make any sense.

00:23.360 --> 00:26.440
If anyone wants to get up and leave while I'm talking, feel free.

00:26.440 --> 00:27.680
I probably would.

00:31.400 --> 00:33.680
So, is everyone here for a payment talk?

00:33.680 --> 00:36.620
Or did people just wander in a place to sit down?

00:38.080 --> 00:38.960
Excellent.

00:39.780 --> 00:43.040
So, I'm part of a group from the University of Birmingham.

00:43.400 --> 00:50.040
I've got to mention my colleagues Andrea, George, Iona and Anna have done a lot of this work.

00:50.400 --> 00:54.540
I've got pictures of them on the slide, which you won't see, but this is very much joint work.

00:55.540 --> 00:57.860
So, I like contactless payment.

00:57.860 --> 00:59.280
I think it's great.

00:59.280 --> 01:05.780
It came in in Britain before it was in the US, quite a long time before.

01:05.780 --> 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.

01:16.460 --> 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.

01:25.080 --> 01:28.500
But I've been looking at contactless payment for a lot, for a long time.

01:29.060 --> 01:35.080
And something I've got to just make clear from the start, is payment rules are very different in Europe.

01:35.580 --> 01:41.460
It's almost impossible to get a bank in Europe to give you money back once it's spent.

01:41.880 --> 01:46.100
So, here in the US, if there's fraud on your card, it's quite easy to get it back.

01:46.540 --> 01:50.120
European banks will typically say, no, you're responsible for that.

01:50.680 --> 01:54.780
And in response, European cards are very locked down.

01:55.320 --> 02:01.520
You cannot spend over $100 contactless without putting a PIN in.

02:02.100 --> 02:04.120
You can't do signatures anymore.

02:04.220 --> 02:11.180
For cards, any high value, you have to put in your PIN number, or do face ID or fingerprint ID.

02:11.960 --> 02:16.300
So, here in the US, I've tapped a card and it's taken $200.

02:16.500 --> 02:18.020
That doesn't really happen.

02:18.020 --> 02:19.920
So, I'm playing by different rules here.

02:19.920 --> 02:26.300
Part of what I'm trying to do is remove that payment limit, in most of the rest of the world.

02:27.020 --> 02:32.540
But, I like looking at EMV as well, because the spec is entirely public.

02:32.540 --> 02:35.020
Has anyone here looked at the EMV spec?

02:36.500 --> 02:38.520
Oh, consider yourselves lucky.

02:38.880 --> 02:42.220
It is thousands and thousands and thousands of pages.

02:42.220 --> 02:44.320
And it's written awfully.

02:44.660 --> 02:47.660
They don't give any kind of overview of the protocols.

02:47.660 --> 02:52.200
They spend pages defining minute details in huge technical detail.

02:53.580 --> 02:57.580
So, we spend a lot of time at the university looking at that spec.

02:58.320 --> 03:01.660
So, we have a pretty good idea of the protocol.

03:01.840 --> 03:06.480
I have some fantastic slides here, which take you through the protocol step by step.

03:06.480 --> 03:07.940
You'll just have to imagine.

03:08.580 --> 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?

03:18.140 --> 03:22.520
And Visa is different from MasterCard, which is different from Amex.

03:22.520 --> 03:25.520
And the card will say, hey, I'm a Visa card.

03:25.900 --> 03:29.020
And then the reader says, OK, I can do Visa cards.

03:29.020 --> 03:30.360
Let's run the protocol.

03:31.480 --> 03:39.220
The next step, in all protocols, the reader basically says, OK, I'd like to start a transaction.

03:39.940 --> 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.

03:48.300 --> 03:50.480
This is different on different cards.

03:50.480 --> 03:55.540
The reader has to send all of that information to the card.

03:56.040 --> 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.

04:07.800 --> 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.

04:16.300 --> 04:18.820
The banks have managed to keep that secure.

04:18.820 --> 04:26.540
So this message authentication code is a key only between the card and the bank.

04:26.540 --> 04:31.340
It's very, very difficult to get that key off the card in any way.

04:32.420 --> 04:36.150
And that message authentication code is sent to the reader.

04:36.480 --> 04:42.240
The reader sends that and all of the information to the bank.

04:42.520 --> 04:47.700
The bank does a cryptographic check, saying this claims to be this person's card.

04:47.700 --> 04:51.380
Look up the cryptographic key for this person's card.

04:51.620 --> 04:53.400
Does the crypto check out?

04:53.540 --> 04:55.020
If so, good.

04:55.020 --> 04:56.780
It then does fraud checks.

04:56.780 --> 05:00.120
It says, does this look suspicious?

05:00.520 --> 05:01.880
And it does balance checks.

05:01.880 --> 05:03.520
Does the person have enough money?

05:03.920 --> 05:10.420
And then it sends a message back to the reader saying, confirmed, payment accepted.

05:10.760 --> 05:13.680
And that all happens as you tap.

05:14.080 --> 05:17.680
You might have noticed four lights on top of the little readers.

05:17.700 --> 05:21.260
That's the four stages I mentioned.

05:21.980 --> 05:24.260
And remarkably quick.

05:24.260 --> 05:25.380
Massively.

05:25.380 --> 05:26.500
Your balance is checked.

05:26.500 --> 05:28.900
It all works extremely well.

05:29.000 --> 05:36.020
And actually, if the EMB companies stopped here, everything would be fine.

05:36.020 --> 05:37.220
It really would.

05:37.220 --> 05:39.240
But these companies can't help themselves.

05:39.240 --> 05:43.260
They're driven to add new features and tweaks and changes.

05:43.260 --> 05:46.020
And this is what this talk is really about.

05:46.020 --> 05:50.840
These new features have introduced a whole load of attacks.

05:53.040 --> 05:58.420
So, yes, and that's Visa's protocol.

05:58.420 --> 06:03.000
Visa also have an offline protocol where there's no bank check.

06:03.540 --> 06:07.940
And to do this, there's also a public key on the card.

06:08.500 --> 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.

06:19.880 --> 06:23.060
And the reader has a certificate chain to check that.

06:23.060 --> 06:29.040
A little bit like TLS certificates, but that means that no one can forge cards.

06:29.460 --> 06:32.700
You've got a public key signed by the bank.

06:32.780 --> 06:34.080
The reader checks it.

06:34.360 --> 06:38.560
The reader checks the card has signed all the data.

06:39.100 --> 06:42.620
And then the reader can be sure it is a real card.

06:45.620 --> 06:47.500
MasterCard's protocol is a little different.

06:47.500 --> 06:49.560
It splits it into two actions.

06:49.560 --> 06:52.100
One, send me the data and get ready.

06:52.100 --> 06:55.460
Two, generate this AC, this MAC.

06:55.580 --> 06:58.420
Amex's protocol is very like Visa's.

06:58.720 --> 07:05.120
One of the biggest is union pay in China, which again copies Visa and MasterCard.

07:05.120 --> 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.

07:18.940 --> 07:21.000
I'm a university academic.

07:21.000 --> 07:25.160
I like getting into the mathematics, the little details of things.

07:25.160 --> 07:30.660
So what we've been doing over the last few years is building formal models of these hugely complex protocols.

07:31.520 --> 07:34.900
These are like mathematical models.

07:35.120 --> 07:41.300
We write simple rules, almost like a simple programming language, to say what these protocols do.

07:41.300 --> 07:46.940
If the card sent this kind of message, it replies with this kind of reply.

07:48.000 --> 07:51.060
And then we can take these models and we can test them.

07:51.060 --> 08:00.400
We can use machinery to say, now for an attacker who tries anything, can we get into a bad state?

08:00.540 --> 08:03.940
So these tools are remarkably powerful.

08:03.940 --> 08:10.240
And the reason why we found attacks which others have missed is these tools can sometimes find them for us.

08:10.240 --> 08:15.880
But more importantly, these tools force us to think about every little detail.

08:16.140 --> 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?

08:25.740 --> 08:28.380
And a lot of the times you think, well, we don't know.

08:28.400 --> 08:29.300
That's odd.

08:29.300 --> 08:33.020
And we'll go and look at a card and we'll test it and find out.

08:33.020 --> 08:36.840
And that's how we get a complete picture of what the cards do.

08:37.900 --> 08:43.220
So the spec itself has some issues which have been documented well in the last few years.

08:43.220 --> 08:47.160
But the spec itself is actually pretty good.

08:47.740 --> 08:53.860
However, as I say, companies keep adding stuff to the spec which isn't in the spec.

08:53.860 --> 08:57.360
And as I said, the specification is thousands and thousands of pages.

08:57.980 --> 09:07.600
So for instance, a big one was using your phones with face ID or a fingerprint ID.

09:08.520 --> 09:12.840
In Europe, this completely removes the hard $100 limit.

09:13.880 --> 09:20.300
And also, the reader will send to the bank saying, hey, we checked this person's face.

09:20.360 --> 09:23.600
And that essentially means no fraud checks.

09:23.880 --> 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.

09:35.080 --> 09:36.500
It must be correct.

09:37.020 --> 09:39.340
But none of that is in the spec.

09:39.340 --> 09:44.800
There's nothing in any of the protocols which says it's a plastic card or it's a phone.

09:45.560 --> 09:48.960
They retrofitted that onto the initial spec.

09:49.040 --> 09:51.880
Security-wise, that's the worst thing you can do.

09:51.980 --> 09:56.320
They've done something ad hoc not very well.

09:57.140 --> 09:59.920
This offline mode, that's a bit scary, right?

09:59.920 --> 10:02.620
It doesn't go to the bank for a check.

10:03.140 --> 10:09.740
In Europe, Square readers say you must only use a mobile phone in offline mode.

10:10.280 --> 10:14.420
But there's nothing in the protocol to say it's a mobile phone or not.

10:14.420 --> 10:17.440
So Square have hacked it and done something odd.

10:19.600 --> 10:25.280
Recently, Apple and Visa have added loyalty cards onto the phones as well.

10:25.280 --> 10:27.920
And they've done it independently.

10:28.500 --> 10:32.120
There's also regulation, for instance, in the UK.

10:32.120 --> 10:37.600
The government said you can't do tap and type in your PIN number contactlessly.

10:37.660 --> 10:40.040
Don't know why they said that.

10:40.760 --> 10:46.720
In order to trade in Britain, the card companies had to follow this.

10:46.720 --> 10:47.820
Not in the spec.

10:47.820 --> 10:50.260
They've done something odd and retrofitted it.

10:50.260 --> 10:51.720
None of it's published.

10:51.720 --> 10:53.200
None of it's public.

10:53.340 --> 10:58.760
And worst of all, the companies haven't told each other about this.

10:59.380 --> 11:02.800
So that's bound to lead to security vulnerabilities.

11:03.260 --> 11:06.060
And that's what we've really been looking at.

11:06.480 --> 11:12.080
However, the first thing we looked at was the transit transport mode.

11:12.400 --> 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.

11:24.080 --> 11:28.060
So this is because in big cities, subway systems can be quite aggressive.

11:28.060 --> 11:30.500
You've got to get through the barrier quickly.

11:30.800 --> 11:33.740
If you don't, you make a massive queue behind you.

11:34.340 --> 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.

11:49.380 --> 11:51.620
So that's the primary reason they've done it.

11:51.620 --> 11:53.520
But this is fascinating, right?

11:53.760 --> 11:57.540
They have completely removed the authentication check.

11:58.060 --> 11:59.080
Make a payment.

11:59.620 --> 12:01.860
That's normally a lock screen to make a payment.

12:01.860 --> 12:05.000
They've removed that for transport systems.

12:05.080 --> 12:08.140
So of course, this is something we had to look at.

12:08.680 --> 12:10.480
This was some years ago now.

12:10.480 --> 12:11.900
This was during COVID.

12:13.340 --> 12:18.360
We live in a city called Birmingham, which is 100 miles away from London, which had this system.

12:19.280 --> 12:23.060
It was the height of COVID, but I really, really wanted the data.

12:23.200 --> 12:26.700
So I sent my postdoc, Andrea, to go and get it for me.

12:28.060 --> 12:29.960
I should have done a risk assessment.

12:30.180 --> 12:34.100
I should have filled in forms, but we just did it.

12:34.100 --> 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.

12:43.700 --> 12:47.420
At the same time, anti-terrorist police were walking around with guns.

12:47.720 --> 12:50.260
But it worked and she got the data.

12:50.480 --> 12:52.780
So I don't know if you're familiar with Proxmarts.

12:52.780 --> 12:57.960
They're little radio devices which scan all radio connections.

12:58.500 --> 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.

13:09.160 --> 13:13.640
What she found was a completely normal EMV transaction.

13:14.460 --> 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.

13:28.680 --> 13:30.260
It's not in the spec.

13:30.900 --> 13:34.740
At the time, it was a complete mystery to us.

13:35.460 --> 13:39.460
We now know this is something called Apple-enhanced contactless polling.

13:40.080 --> 13:49.260
It's a magic code you send at the lowest layer of NFC, the ISO1443 layer, which does the initial handshake.

13:49.260 --> 13:55.940
And if an iPhone sees this magic code, it will unlock a particular application.

13:57.200 --> 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.

14:07.580 --> 14:11.120
And the code tells you which application it will run.

14:11.520 --> 14:13.240
Again, not public.

14:13.240 --> 14:16.080
We found details of this on a patent.

14:16.080 --> 14:19.540
Apple have patented it, and that document is public.

14:19.540 --> 14:21.120
That's how we know about it.

14:21.580 --> 14:28.240
But this code will start up the payment app in a sandboxed method.

14:29.080 --> 14:33.860
Additionally, the protocol will say, I am a transit reader.

14:34.600 --> 14:37.920
It will have a code saying, I'm a transit reader.

14:38.080 --> 14:40.520
Shops have a code saying, I'm a shop.

14:40.800 --> 14:48.260
Gambling institutions have a code saying, I'm gambling, which is how you can block gambling for particular cards.

14:48.560 --> 14:57.160
But we found this code, which lets us unlock iPhones into this transit mode with some restrictions.

14:58.060 --> 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.

15:07.920 --> 15:12.900
And what we found is MasterCard was completely safe.

15:12.900 --> 15:14.040
It worked well.

15:14.040 --> 15:20.240
You couldn't make a high-value payment without a strong ID.

15:20.500 --> 15:22.860
But for Visa, you could.

15:23.700 --> 15:28.220
For Visa, you could bypass all the authentication requirements.

15:30.540 --> 15:33.120
And the tool would give us the attack.

15:33.420 --> 15:40.680
How the attack worked is the attacker would act as a relay, a man in the middle.

15:41.280 --> 15:44.900
And it would broadcast these magic bytes.

15:44.900 --> 15:47.100
It would pretend to be a transit reader.

15:47.140 --> 15:50.980
So it would tell the phone, I'm a transit reader.

15:51.900 --> 15:56.200
Now, you could then ring up a large transaction, $10,000.

15:56.920 --> 16:00.960
And what we also found is the card doesn't look at the amount.

16:01.820 --> 16:08.460
There's a flag in the protocol which says, this is a high amount, or this is a low amount.

16:09.140 --> 16:14.780
So the reader sends a message saying, I want to do a $10,000 amount.

16:14.800 --> 16:17.020
This is a high amount of money.

16:17.020 --> 16:19.200
I need some strong authentication.

16:19.880 --> 16:23.760
What we'd do is we'd flip that bit in the transaction.

16:24.860 --> 16:31.200
And we'd then tell the card, this is a $10,000 amount.

16:31.200 --> 16:33.480
And by the way, that's low.

16:33.800 --> 16:36.100
And the card would accept that.

16:36.100 --> 16:38.960
Now, it does that with very many different currencies.

16:39.220 --> 16:41.300
And you can use your card abroad.

16:41.360 --> 16:47.500
You might want to use your card in a country where $10,000 is a low amount.

16:48.620 --> 16:51.060
So it doesn't have hard limits.

16:51.060 --> 16:52.720
So the card accepts this.

16:52.760 --> 16:57.360
And the card says, fine, I'll make a payment token for that.

16:57.360 --> 16:59.380
And it makes a payment token for that.

16:59.700 --> 17:06.900
And then it sends it back to the reader with a message saying, I have not done any authentication.

17:07.200 --> 17:10.840
By the way, I didn't check face ID.

17:10.880 --> 17:12.440
I didn't check a fingerprint.

17:13.080 --> 17:15.140
So the reader should reject that.

17:15.200 --> 17:16.440
But we can do the same trick.

17:16.440 --> 17:18.140
We can flip those bits.

17:18.620 --> 17:19.920
And we lie.

17:19.980 --> 17:25.920
And we tell the shop reader, yes, this phone did check face ID when it didn't.

17:27.240 --> 17:31.340
Reader looks at that and thinks it's a fully authenticated transaction.

17:31.340 --> 17:39.300
The reader sends it to a bank with a message saying, face ID was done on this transaction.

17:39.840 --> 17:45.300
So the bank's fraud checks approve it and say, payment can go ahead.

17:45.600 --> 17:49.220
I have a really nice video of Andrea actually doing this.

17:49.220 --> 17:50.940
You'll just have to imagine that.

17:50.940 --> 17:51.320
Yep.

17:54.620 --> 17:57.360
They're not covered by the Mac.

17:57.360 --> 18:01.160
They are covered by this signature I mentioned.

18:02.220 --> 18:06.820
But the signature is only checked in offline mode.

18:07.900 --> 18:13.500
The reader thinks it's running in offline, online mode.

18:13.620 --> 18:21.360
So even more complicated, the card signs something to say, I haven't done any checks.

18:21.360 --> 18:23.280
Here's proof I haven't done any checks.

18:23.280 --> 18:24.680
Please check.

18:24.760 --> 18:26.720
But we just throw that away.

18:27.380 --> 18:31.320
So the phone thinks it's running in offline mode.

18:31.340 --> 18:34.460
The reader thinks it's running in online mode.

18:34.840 --> 18:41.740
Again, they should have put a flag in the protocol which said, I'm a phone running in offline mode.

18:42.080 --> 18:42.980
They didn't.

18:45.480 --> 18:46.600
Yep.

18:47.300 --> 18:47.860
Cool.

18:47.860 --> 18:51.040
So that's kind of fun.

18:53.640 --> 18:55.140
We bypassed the Apple...

18:56.340 --> 19:02.660
So, of course, being responsible academics, we went to Apple and we gave them an entire pack.

19:02.660 --> 19:06.320
We gave them a TAC code, videos, everything, and we sent it to them.

19:06.680 --> 19:08.080
And we heard nothing.

19:09.040 --> 19:13.080
So two months later, we sent them an email again and said, hey, what's going on?

19:13.520 --> 19:17.020
And then they sent us a reply saying, thanks for your submission.

19:17.020 --> 19:18.520
Of course, this doesn't work.

19:20.040 --> 19:23.640
And then we sent them back, look, video, see the video.

19:24.440 --> 19:26.260
And again, a few weeks went by.

19:26.260 --> 19:28.900
They got back to us and said, no, we still think this doesn't work.

19:28.900 --> 19:37.320
So we actually sent them scans of our bank statements, showing thousands of pounds coming out of the bank accounts.

19:37.320 --> 19:39.960
We sent them a track in numbers so they couldn't...

19:40.860 --> 19:45.480
So we could actually find the transactions in the backend banking system.

19:45.780 --> 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.

19:53.440 --> 19:57.200
It was a very long, useful meeting where we went through it step by step.

19:58.000 --> 20:00.240
They fully understood it and appreciated it.

20:00.240 --> 20:03.560
And they said it was completely Visa's fault.

20:05.920 --> 20:10.740
They offer a hundred thousand bounty for bypassing a lock screen.

20:11.080 --> 20:13.880
We bypassed their payment lock screen.

20:13.940 --> 20:16.760
But apparently that's not the lock screen they meant.

20:17.020 --> 20:19.220
So we didn't even get a bounty for it.

20:19.940 --> 20:23.780
And we went to Visa and Visa...

20:26.080 --> 20:28.760
This isn't being recorded, right?

20:30.100 --> 20:32.060
No, no one's recording this.

20:32.060 --> 20:36.930
Visa initially unofficially said they couldn't believe Apple had been so irresponsible.

20:40.380 --> 20:42.620
Then that was Visa research.

20:42.620 --> 20:44.420
Then Visa corporate got involved.

20:44.420 --> 20:49.200
And Visa corporate said it's a lab attack, which doesn't work in practice.

20:49.740 --> 20:53.180
So we went out to a shop and we did it in practice.

20:53.860 --> 20:58.880
We actually thought about buying an Apple laptop using this attack.

20:59.300 --> 21:01.360
But we didn't have that kind of money.

21:01.900 --> 21:03.340
And we sent it back to Visa.

21:03.620 --> 21:10.300
And then Visa said, OK, it does work, but we will refund anyone who has this happen to them.

21:11.200 --> 21:14.120
So Visa said it was Apple's fault and they were fine with it.

21:14.120 --> 21:16.700
Apple said it was Visa's fault and they were fine with it.

21:16.760 --> 21:18.600
So we went ahead and published this.

21:18.600 --> 21:21.720
So this attack completely works in practice.

21:22.040 --> 21:25.340
Anyone who wants to do this, you absolutely can.

21:25.920 --> 21:27.600
And I appreciate you being here.

21:27.600 --> 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.

21:36.160 --> 21:41.300
And apparently people are actually using this in real malware attacks to steal money.

21:41.300 --> 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.

21:53.000 --> 21:55.980
I don't recommend having those three things together.

21:57.120 --> 21:59.680
OK, so that's the first attack.

21:59.680 --> 22:02.380
I want to give a shout out to Timo.

22:03.000 --> 22:05.700
He's a researcher in the UK as well.

22:05.740 --> 22:09.060
He got the same results at more or less the same time as us.

22:09.240 --> 22:11.280
He published a couple of months after we did.

22:13.000 --> 22:17.480
So he's a great researcher who had done very similar work.

22:19.520 --> 22:20.080
So the next...

22:20.080 --> 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.

22:31.800 --> 22:36.440
So the next thing we looked at was Square's offline mode.

22:37.000 --> 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.

22:54.460 --> 22:58.600
But there's no way to do this in the transaction.

22:58.600 --> 23:02.400
There's no flag in EMV which says I'm a phone and I'm not.

23:02.400 --> 23:06.640
So another Square are doing something odd.

23:06.640 --> 23:08.980
Someone at Square's made something up.

23:08.980 --> 23:12.380
It's not part of a public spec and they just run it.

23:14.080 --> 23:15.880
We did exactly the same thing.

23:15.880 --> 23:17.180
We got our relay.

23:17.180 --> 23:18.380
We got our equipment.

23:18.460 --> 23:19.840
We got a Square reader.

23:19.840 --> 23:23.300
We did a whole lot of transactions and we looked at how they worked.

23:23.700 --> 23:25.400
And it's actually very similar.

23:25.520 --> 23:30.360
We saw some strange messages at the start.

23:31.080 --> 23:32.560
Not at the low level.

23:32.560 --> 23:37.860
Before that initial select message which says, are you a payment card?

23:37.860 --> 23:40.840
There was another message which we didn't recognize.

23:41.860 --> 23:47.560
We did some googling and we found a great GitHub repo which explains some of it.

23:47.560 --> 23:51.580
And this was Apple and Google's new loyalty card scheme.

23:52.120 --> 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.

24:01.320 --> 24:04.460
From privacy reasons, it's horrific.

24:04.600 --> 24:11.800
But it allows you to use your normal payment card and have loyalty schemes at particular vendors.

24:12.460 --> 24:16.740
Now, of course, this Square reader wasn't doing that.

24:16.740 --> 24:21.080
All it said is, is there any loyalty card information?

24:21.600 --> 24:24.420
And if it got a yes or a no, it continued.

24:25.040 --> 24:28.750
If it got an error message, it stopped.

24:29.720 --> 24:34.500
So what Square thought was, phones might have loyalty cards.

24:34.960 --> 24:38.130
We'll just ask, do you have loyalty cards?

24:38.480 --> 24:41.070
And if I don't get an error, I will assume you're a phone.

24:42.140 --> 24:46.080
I'm sure you can all see the problem here.

24:46.220 --> 24:49.380
The cryptographic check comes later in the loyalty scheme.

24:49.380 --> 24:51.980
We could just record this and replay it.

24:53.280 --> 24:56.980
So we could have our relay, we could have a plastic card.

24:57.420 --> 25:01.280
Our relay sends, I have no loyalty card first.

25:01.320 --> 25:03.840
And then we just relay the card, and it worked.

25:04.400 --> 25:05.760
So that was one thing.

25:07.520 --> 25:10.720
Now, I can't remember if I mentioned this, whether it's just in the slides.

25:11.720 --> 25:14.540
Apple, check if you've done strong ident...

25:14.540 --> 25:22.430
Sorry, MasterCard, check if you've done strong identification in a proprietorial field called the AID.

25:22.880 --> 25:25.160
They do not publish the spec of this.

25:25.160 --> 25:28.540
That is their private field for MasterCard only.

25:28.980 --> 25:36.340
That means to send, to check it, the reader must send it back to MasterCard.

25:36.880 --> 25:39.660
For online transactions, that works great.

25:40.100 --> 25:42.630
For online transactions, I do my face ID.

25:43.080 --> 25:46.100
The reader sends it back to MasterCard.

25:46.100 --> 25:52.740
MasterCard says, aha, this person did face ID and sends the approved message to the reader.

25:53.180 --> 25:57.160
That doesn't work for offline transactions.

25:57.260 --> 26:01.860
Because the reader can't check that field, and it can't check MasterCard.

26:02.260 --> 26:10.120
So what's happened is MasterCard have designed one system where phone transactions must be processed online.

26:10.940 --> 26:14.440
Square independent... and MasterCard didn't explain it to Square.

26:15.380 --> 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.

26:28.380 --> 26:34.440
Put them together, we trick the Square reader into thinking we're a phone.

26:34.660 --> 26:40.040
We do a completely normal transaction without authentication from a card.

26:40.040 --> 26:42.380
We charge $20,000.

26:43.760 --> 26:46.040
We send it to the card.

26:46.040 --> 26:49.700
The card sends it back with a message saying, don't accept this.

26:50.380 --> 26:54.940
But that cannot be checked offline, and the offline reader accepts it.

26:55.520 --> 26:57.540
So I have another video of that.

26:57.540 --> 26:59.660
Unfortunately, I can't show it.

26:59.700 --> 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.

27:12.380 --> 27:13.800
Square were great.

27:13.800 --> 27:17.720
Unlike Apple, they fixed this very quickly and very effectively.

27:18.440 --> 27:26.900
However, when they did the fix, they changed it slightly, and they delayed when they checked that signature.

27:26.900 --> 27:29.280
I mentioned the signature in offline mode.

27:30.140 --> 27:33.440
They actually switched to a different mode.

27:33.840 --> 27:39.660
They would request that signature, but they wouldn't check it until the device went online.

27:40.460 --> 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.

27:55.780 --> 27:56.610
So offline.

27:57.120 --> 28:00.420
And when it went online, the bank would reject it.

28:01.160 --> 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.

28:10.180 --> 28:15.420
You could invent your own card and print your own money.

28:16.060 --> 28:19.320
We were kind of tempted to retire from our jobs as academics.

28:20.900 --> 28:23.520
But we were already talking to Square.

28:23.620 --> 28:26.680
And Square gave us a nice bounty for this as well, unlike Apple.

28:27.860 --> 28:30.360
So that's all now fixed from Square.

28:30.360 --> 28:37.120
But it's the same pattern of inventing similar features, companies acting independently.

28:39.240 --> 28:42.040
So there's a question of what we can do about it.

28:42.320 --> 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.

28:53.320 --> 28:56.780
You can write a reference model for this in any language.

28:56.880 --> 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.

29:08.700 --> 29:10.040
Unfortunately, they're not.

29:10.040 --> 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.

29:16.380 --> 29:19.440
And that's really making payments unsafe.

29:20.340 --> 29:24.320
So there's something else we're working on to try and make payments safer.

29:24.960 --> 29:31.260
Most of these attacks, most attacks you'll see against payment cards, are some form of relay attack.

29:31.260 --> 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.

29:42.600 --> 29:45.740
And you'll probably tweak some bits along the way.

29:47.060 --> 29:50.700
And what we're interested in is trying to stop this.

29:50.820 --> 29:54.420
And that relay takes time.

29:54.420 --> 29:55.940
It adds milliseconds.

29:56.610 --> 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.

30:10.020 --> 30:14.080
Normal connections to the card are much, much faster.

30:14.460 --> 30:19.420
So as a solution, we propose actually timing this exchange.

30:19.420 --> 30:23.320
So the idea is, it's its first key message.

30:24.060 --> 30:27.580
The reader starts the clock when it sends the message back.

30:27.960 --> 30:31.580
And when it receives the answer from the card, it stops the clock.

30:32.400 --> 30:40.380
If it is above about 15 milliseconds, we say it's been relayed, and we stop.

30:40.720 --> 30:46.060
If it's below, we say that's fine, and it continues.

30:46.060 --> 30:53.840
And that would cut the attacker out and make relay attacks impossible, meaning I couldn't switch those bits.

30:53.840 --> 30:56.300
It would stop all of these attacks.

30:57.160 --> 30:59.960
We've been pushing this idea for some time.

31:00.120 --> 31:07.480
MasterCard have a spec which puts it at the application layer, a higher layer.

31:08.740 --> 31:12.080
We got some cards from MasterCard, and we checked them.

31:12.080 --> 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.

31:27.640 --> 31:36.900
So if, because the card gets its power from the field, if it's right on the edge, it takes longer.

31:36.900 --> 31:44.120
So actually, there's no safe time measurement you can put in to make that time bound impossible.

31:44.400 --> 31:52.120
However, if you do it at the low layer, the ISO1443 layer, right on that initial handshake, it does work.

31:52.580 --> 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.

32:01.140 --> 32:03.860
I don't know if anyone's worked with standardization committees.

32:04.600 --> 32:05.920
It's tough.

32:05.920 --> 32:08.760
I have an example of the standard.

32:08.840 --> 32:13.100
So we have an amendment being voted on right now.

32:13.140 --> 32:15.200
It's gone through two years of revisions.

32:15.480 --> 32:17.680
Every country in the world gets a vote.

32:17.800 --> 32:19.760
About half of them will use it.

32:19.940 --> 32:22.980
So we're waiting to see what random countries vote.

32:22.980 --> 32:25.280
We're pretty confident it will go ahead.

32:25.740 --> 32:28.880
But I have an example of a standard on this slide.

32:28.880 --> 32:35.900
And for instance, one of the things we wanted to change was,

32:43.000 --> 32:46.200
That change was two days of my life.

32:46.380 --> 32:49.840
As we debated, was that fine?

32:49.920 --> 32:53.780
And the Dutch group would walk out if we didn't make the change.

32:53.780 --> 32:55.920
The French group objected to it strongly.

32:56.820 --> 32:59.120
But we think that's going ahead.

32:59.300 --> 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.

33:08.200 --> 33:13.140
And it will stop a lot of these attacks and make EMV much, much safer.

33:14.600 --> 33:16.740
Okay, so that's all I wanted to say.

33:17.140 --> 33:18.860
Thanks for bearing with me.

33:19.060 --> 33:21.240
I did have a really nice slide deck.

33:22.520 --> 33:24.620
And I have videos of those attacks.

33:24.620 --> 33:27.140
I guess that will go up online later.

33:28.000 --> 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.

33:41.960 --> 33:47.320
So if anyone feels like working in this area, please send me an email or let me know.

33:47.840 --> 33:54.400
Because I'm pretty sure the same attacks of work against Visa would work against American Express.

33:54.500 --> 33:59.320
But we have no access to work in American Express payment machines in Britain.

33:59.880 --> 34:01.820
Same with Discover Cards.

34:02.500 --> 34:10.240
A lot of research has been focused on Visa and MasterCard, because that's what's available internationally.

34:10.720 --> 34:18.360
I bet Visa attacks are waiting to be discovered in a whole lot of US cards as well.

34:18.500 --> 34:21.260
So this is a great area to work in.

34:21.580 --> 34:24.060
If you'd like to work with us, just let me know.

34:24.060 --> 34:27.980
If you'd like to work on it yourself, our relay code is publicly available.

34:27.980 --> 34:30.160
The specs are publicly available.

34:30.480 --> 34:37.340
Anyone here can get those specs, read them, get a simple NFC setup, and get things working quite nicely.

34:37.760 --> 34:41.820
So this is a fantastic area to get into and tinker with.

34:41.900 --> 34:43.640
It's pretty easy.

34:43.640 --> 34:48.460
And you can be reading your own card with your own phone in a matter of hours.

34:49.060 --> 34:50.680
Cool, so that's my talk.

34:51.140 --> 34:55.440
Again, apologies for no slides, and thanks for sticking with me.

