start	end	text
0	9560	Hi, today I'd like to share my experience on how to relay NFC traffic for Tesla Model 3.
11800	19660	So my name is Kevin2600. I'm currently working for a company called InGeek in Shanghai, China,
19660	24080	and we're focused on research and pen testing for smart car security.
24080	29980	We also built a project called CarSRC, which is China's first car security response center.
31520	38520	So you're welcome to follow me on Twitter on Kevin2600 or just if you're interested
38520	47720	and check out a barcode here for a company website, right? Okay, so here's our content
47720	53740	for today. First, I'd like to talk about some basic knowledge and the applications regarding
53740	58240	to NFC. And then I think maybe I should...
61540	69660	And then I will talk about the key fobs architecture for Tesla Model 3. And eventually,
69660	77340	I will walk through the challenge we have faced and how do we bypass it during the NFC relay
77340	85780	research, right? So NFC 101. I don't think we need to talk about too much on this at this point
85780	92940	because a lot of people already know about NFC. But basically, NFC stands for Near Field
92940	100980	Communication. It's most likely operating on passive mode and it's really working in
100980	106400	close range. We are talking about centimeters here. And the operation frequency is usually
106400	116480	going to be 13.56 MHz. And you can use things called NDEF to change the data back and forth,
116480	124260	right? So the NFC technology is already widely developed, right? So we can see a lot of applications
124260	132460	based on it in today's world. So for example, our payment system, our passport, and our card for
132460	142360	access our business buildings are all most likely NFC or RFID based. And then there's a new trend
142360	149940	for using NFC for car keys. And here's some of car manufacturers already using it. As we can see,
149940	159080	like BMW or BYD and like our main target today, Tesla, they're using it. And they come with
159080	167340	different size of forms, right? So interestingly, even Apple has enabled a new feature called car
167340	177200	key for the latest. So yeah, I think the digital car keys is really the future. And
178640	185660	now speaking of Tesla, Elon Musk, he's so proud of it. He mentioned that Tesla is a sophisticated
185660	193280	computer on wheels, right? So if it's a computer, the hackers or security research will be interested
193280	200440	in it. And so here's a small list that I grabbed from the Tesla website. As you can see, there are
200440	207340	many researches, researchers has found vulnerability and report to Tesla for the past few years.
207340	209500	And so for example...
211980	218520	Oh, sorry. Okay. So for example, the famous hacks from Tencent King Labs,
218520	223980	they were able to exploit the Wi-Fi stack on Tesla Model S. And then they also
223980	231880	done a great experiment on Tesla Autopilot. So if you guys are interested, I recommend that you
231880	238780	check it out. Also, there's some more independent researcher. So for example, one guy called
238780	246220	Richard Zhu, he won the last year Pwn2Own competition. He basically able to pawn the
246220	253700	Tesla IVI system. Also, there is another researcher from Belgian. He's able to successfully
254660	261980	crack the key, the encryptions used by Tesla Model S. And then he's able to
262820	270400	successfully clone the entire key. So I think this is quite cool, right?
272700	279480	However, it turns out that not just the hackers or security researchers are interested in Tesla.
279480	285840	So are those professional thieves, right? But they don't care about how to write perfect
285840	293600	exploits for RCE. They only want to steal the vehicles or something left inside, right? So
293600	299640	they only want some very simple way. And it turns out that one of the simplest ways for them
299640	305060	is called a key file relay attack. I think this is all over the news for the past few
305800	313740	months or even last year. You're going to see some guy come to your neighborhood with some
313740	322760	mystery device that it can amplify your key file and then somehow turn on your vehicles and drive
322760	330180	away. And this is also the reason why we start to research on Tesla. Because we must try to see
330180	341860	if it's possible to do the NFC relay for the Tesla Model 3, right? Okay, so Tesla key file
341860	348200	architecture. So let's talk about this. Okay, so before I start, I'd like to talk about some
348200	356260	research procedures. The first, usually when we start to research something, we usually start
356260	363160	with some reconnaissance, right? So basically, at this stage, we try to read as many as possible
363160	370060	the menus regarding your target. And also you can sit down with your friends, your colleagues,
370060	377720	and to do some brainstorm to see what kind of attack factors that you can have, right? And
377720	384640	once you have that ready, then you can really just sit down and actually implement some attack
384640	394760	plans. And then you can go to actually doing it, right? So usually when we're testing
394760	403340	for like Tesla here, we are not expecting that it will success in the first time.
403340	409340	So usually it will fail, but that's okay. We just try harder and repeat. Eventually, we'll find
409340	420520	something, right? Cool. So for Tesla, now in order to access the Model 3, Tesla has provided us
420520	429780	three different ways, right? For example, we can use NFC tag, and Tesla also provided mobile
430300	438860	apps for us to try to control your car through Bluetooth. And later, they also provided
438860	447000	the physical key fob, also have been using Bluetooth and NFC here, okay? And just like
447000	454380	any other radio device, Tesla key fobs, we can find a thing called FCCID. So this is important
454380	462280	for us at a recon stage, because first we need to know as much as possible regarding your
462280	472120	target, right? So from here, we search the FCCID to the website, and then we can find,
472120	482140	say, for example, we can find that Tesla Model 3 key fob using a CC2640 chipset. And also,
482140	490840	this is also for key fob reader, the reader module, and also having to using CC2640. So by this
490840	498960	information, really, we can have even without even actually open the... even without own one
498960	504860	of these vehicles, you already know something about it, right? That's pretty cool. Now,
504860	511720	regarding the NFC key tag itself,
511720	526040	actually, it's just like any other NFC tag, it supports ISO 14443 type A, and also ISO 7864
527760	536630	standards. And basically, it's a Java smart cards. So we can use in some already already exist
537060	544340	application to group graph this information, right? There's a lot of application can do as
544340	553380	you can see here. Yeah, the difference between those two ISO standards, one is contact, and one
553380	560020	is contacts. They are very similar. And on top of application layer, they all the same, just using
560020	571300	APTU to talk to your car. Okay, so and, and then I recommend that people serious about researching
571300	581140	on RFID security, you definitely need to go get one of the PM ProSmart 3. Yeah, I think this is
581140	590240	very important. So basically, we can use in PM3 to, to identify your, your targets, which is key
590240	605620	file here. And I can see identify as an XP MyFair DeathFire 4k EV1 type card. Okay, so and here's
605740	610960	a little summary here. So the test NFC key tag is seven bytes.
611700	616840	He uses seven byte UID. And it is a Java based card.
617800	624580	The most important part is here is the actually using the ECDH for a challenge response for
624580	633240	authentication. So and as I mentioned, ProSmart 3 is really helpful during the research, as you can
633240	640980	see the picture right here. I, we are able to use in ProSmart 3 to talk to, to send different
640980	649440	commands, APTU commands to your target, to the tag. And we can able to get some information out,
649440	655880	for example, a public key, or different Java updates, like sending different AID to require
655880	666000	different Java update to do some testing. So yeah. And right. So now I think it's time for
666000	674580	some real hacks, right? Cool. Um, so since our goal here is actually to get NIC relay working,
674580	680980	and there are many research has done great jobs in this area already. So in beginning, we don't
680980	688420	want to reinvent the wheels. So we've, we just do some research and find there's a very cool
688420	696520	application called NLC gate. And NLC gate is basically is Android application is the mean for
696520	702660	capture, analyzing, or even modified NLC traffic on file. So basically, it's pretty cool. It's
702660	709960	perfect for us, right? And he operated it, basically, we need to mobile phone at running
709960	718700	the NLC gate. And we need to set our Wi Fi server in the middle, right? So can true to send to relay
718700	729620	through the traffic. Um, so yeah, so for the first for the test run, um, we're, we're trying to
729620	737340	target our credit card system to see if we can buy a coffee for free, right? So with someone's,
737340	742960	with my colleague's card, basically. So, and so here's the result I would like to show you.
744380	751920	Right, so basically, we try to was one of the colleague to pretend to be a bad guys and me just
751920	758440	try to read out the someone else's card, right?
765630	769010	Yeah, as you can see, the traffic is already go through.
772110	783030	We're successfully to buy, to get coffee for free. And by this point, we're very, yeah. Yeah,
783030	791350	by this point, we're very happy. So we run to a parking lot for hours to test the Model 3.
794070	801070	Unfortunately, it failed for the first attempt, right? As I mentioned, usually it will fail for
801070	810330	the first time. But let's find out why it happened. What happened exactly, right? Okay, so
812350	820010	and again, we brought out our Porsche Model 3 and start to capture and compare the NX traffic
820010	828910	between the actual Tesla key tag and the other which relate by the NFC gate to do some, to see
828910	840310	if there's anything I'm, we were missed. And yeah, so here are the traffic data we
840310	848010	captured by PM3, Porsche Model 3. And also here are the traffic we captured by NFC gate itself.
848010	856330	It has a logging file function. So as you can see, one of the response by the tag is it can convert
856330	864410	back to convert the hex string to something we can read as a Tesla logic, which indicate that
864410	875030	it is Tesla's NFC key tag. Okay, so let's walk through some
876470	882470	those hex strings, try to understand what's going on here. So first,
882470	886830	yeah, so this is important here, right? So first, the
890290	902070	the reader, the sorry, the reader will send out a request asking for Tesla logic AID for
903470	913250	like TBK, which stands for Tesla phone key. But because we are actually using the NFC key tag,
913250	920510	our reader, our tag will respond with 6D00, which means instruction invalid, which is,
920510	928350	which means this particular AID doesn't exist. So and then the Tesla will send another request,
928350	937250	will send another request asking for TKC, which is Tesla key card. And yes, executed successfully
937250	948330	by like 9T00. And because we are using Tesla key card, so yeah, it does exist. So then the reader
948330	955910	will send and select this particular AID. Okay, now, like this is a Tesla logic update list,
955910	961030	right? And then the reader will send out authentication command for this particular
961590	969210	AID. And like they send out a vehicle public key and followed by a 16-byte challenge.
969210	976190	Now for the tag itself, we have to respond with a 16-byte response.
976830	984990	And once we have that sorted out, then we are authenticated to the reader and then we can do
985550	990990	action like open the car, open the door or close the door and stuff, something like that, right?
991190	999270	So as you can see, the whole authentication process is kind of simple. But why we
999870	1006750	endlessly read a tag on credit card system, it works. The Model 3 is not. And turns out,
1006750	1014650	the reason is the payment terminal, the POR system is not required to stop the transaction
1014650	1021130	if it takes longer time. But the Tesla, on the other hand, has more restriction on timing.
1021130	1027910	It has to respond in a very specific time. Otherwise, it will be time out.
1028050	1034450	If we say, if we didn't respond to the correct answer on AID on time and then it failed, right?
1034450	1040390	So because we are related, remember we are related traffic through Wi-Fi network and there's a lot
1040390	1053370	lot of things can happen during this transaction. So now our job is to increase our speed. And
1053370	1059710	luckily, there's a great researcher called Stefano. He is kind enough to give us some advice.
1060550	1067930	But unfortunately, this second attempt also failed. But thanks for him.
1069450	1079390	Let's try harder, right? Let's see. And then my colleague, Alex, he came up with some idea
1079390	1085850	to verify because at that point, we're not really sure if it is a timing issue only or maybe
1085850	1093550	something else blocked the way. So his idea is instead related traffic by Wi-Fi, maybe we're
1093550	1103910	using the USB cables because all the traffic then you transfer locally. So it's supposed to be very
1103910	1114490	very fast, right? Let's see if that works. So here's our first video. You can always check out
1114490	1125090	YouTube on this for later, right? Yeah, cool. As you can see, we actually relay by the USB. It
1125090	1135470	works. So it is timing. It is where you have to find a way to increase the speed. But how?
1138660	1149560	And then, yes, we found another trick from the same guy, Salvador, which is inspiring us
1149800	1159320	a lot. Because basically, he has given a talk at DEF CON 26. Basically, he was able to
1159800	1167480	bypass the payment limit by simply replacing a certain value during the transaction.
1167700	1174960	And also, he can able to replay. Also, again, same trick, replace different values in order to
1176420	1184520	instead of using EMV, he actually turned to using MACDRIVE for payment systems.
1184520	1188600	So let's get us thinking. Can we do the same?
1191160	1195780	So let's go back to the traffic we captured by
1196660	1209380	ProSmart 3. So basically, remember we mentioned that the first reader will send out...
1210000	1217780	they're asking for a particular Java update AID, which never exists. It actually starts at 4.
1217800	1225560	And then, because it doesn't exist, it will be failed. So they send another request asking for
1225560	1234060	another Java update called Star Wars 74. So can we do something about here?
1236420	1245240	And definitely, yes. So let's... sorry, I draw a very ugly picture here, but let me try to
1245240	1251740	explain what happened. So basically, first, Test.mod3 will send out... the reader will send out
1252520	1260480	a request looking for a Java update F4. But because it doesn't exist,
1260480	1269060	the tag will reply response with 60.0.0, so it doesn't exist.
1269780	1279620	And so that... instead we redirect the 60.0.0, we send...
1282720	1289130	we actually forwarding... instead of looking for F4, we're forwarding that...
1290060	1295880	you're asking for 74, because we know that 74, a Java update, does exist. And
1298140	1303900	because... and then, obviously, tag will receive this request, will say, okay, you are... you're
1303900	1311100	asking for 74, then we... it doesn't exist, and then we just respond with 90.0.0. And you will...
1311100	1321820	and then we're using another MVC gate to send those response back. Because... and that takes
1321820	1331300	some time here. So by the time we're processing this command, the Test.mod3 will send another
1331300	1337940	request looking for... the actual request sending... looking for 74. And that's the one actual... the
1337940	1346920	real one sent by the models, read module. But we... because we are in the middle, so we drop it,
1346920	1358580	right? We don't need a second 74. So now by the time we finish... we've done this, the 90.0.0 has
1358580	1366320	already arrived. So by this end, so we can just forward it to the Test.mod3. And once Test.mod3...
1366880	1372000	seems interesting here now. Once they... we bypass those
1375400	1385780	AID selection, we go to a challenge response stage. At this stage, it seems... it seems like
1385780	1390640	during the test, it seems like we don't have any time limit anymore. We can send and wait
1390640	1400240	as long as we want, right? So yeah, basically we just dropped one... instead of looking for two
1400240	1407220	different AIDs, like F4 and 74, we just dropped one of them, and sent in... looking for 74
1407220	1419840	directly. We will simply... by doing this, we successfully bypass the time limit, right? So
1421820	1428580	and here's... we just play this... we do the demo to show the whole process, okay?
1436290	1445010	As you can see, we... because it's a traffic relayed by Wi-Fi, and you can
1445010	1448730	experience a little bit slow, but it still works, right? As you can see,
1448730	1459960	it will open, and you can check out the current phone... the firmware,
1462080	1468520	right? And then we drop...
1470980	1484920	and driving away. Okay, cool. Now, because we want to see how practical this NFC relay attack
1484920	1492040	is, so we're testing with a lot of... we want to see if it works in long distance, right?
1492040	1498220	So here's another video I want to show... demo I want to show you, as we are actually testing
1498220	1508580	in kind of far away. Let's see the results, right? So as you can see,
1508580	1514740	my car is kind of far away in the parking lot. Yeah, it still works, right?
1514920	1527180	Cool, beautiful. So by this stage, we're very happy and report our founding to Tesla, and
1529200	1537540	however, Tesla replied our email and said that the relay attack are no limitation for their
1537540	1547200	systems. And we recommend customers who are concerned about relay attack enable pin-to-drive.
1547200	1556000	So basically, there's no bounty, and they know the vulnerability exists, but they don't think
1556000	1562020	it's very important, because they think they already have something called a pin-to-drive ready.
1562020	1565160	So here's our work result.
1569500	1577640	So first, basically, even... so basically, what we need to... I need to address here is pin-to-drive
1577640	1584160	is actually not protecting from the relay attack. It's only protecting you... once you open the...
1584160	1590600	we open the door, you cannot stop engine. You have to enter in some pin, right? But
1591120	1597660	we are still able to open the door. And so basically, the risk is still there, right?
1597660	1604760	So once we get in, or bad guy get in, they can't... yes, they may not able to steal your vehicle,
1604760	1612040	but they still can steal some stuff inside your car, or even worse, they can put something in,
1612040	1620920	spare camera, or some cheap... and yeah, so I think the pin-to-drive is really a debatable
1620920	1629680	solution from Tesla. But anyway, we apply a CVE, and we get a CVE here, and we're happy enough,
1629680	1640900	right? But what is pin-to-drive anyway? So basically, I found this pin-to-drive description
1640900	1649800	from the Tesla website. The most interesting part here is that pin-to-drive allows you to set a
1649800	1658880	secure four-digit modification, right? Four digits. So what could possibly go wrong there,
1658880	1664860	right? Only four-digit numbers. Now, we also, during the research, we found there's no pin
1664860	1674660	position randomization, so it's always fixed in the middle. Now, at least,
1675520	1681140	because this research has been done for some time now, and at the time we're testing
1681520	1691720	on different firmware version, we can, at least at that moment, there's no brute force
1691720	1700700	rate limitation and no brute force back-off time. But maybe they are fixed now, but a lot of time,
1700700	1709420	it doesn't have anything. So, four-digit numbers, no brute force protections, yeah? You get the idea?
1711120	1725720	So, oops. So, we actually built a hardware based on something called M5Stack.
1726600	1733000	I named it pin-to-crack, right? So, basically, we can use that to...
1734660	1740160	of course, we can do with, maybe we can do it with Raspberry Pi or with Arduino. It doesn't
1740160	1747840	have to be M5Stack. Basically, the idea is just... instead we push the pin number itself,
1747840	1754480	we can do it automatically, right? So, now, but there's a catch though. Oh, by the way, there's
1754480	1766160	another guy doing a similar attack on his Tesla as well. But this is our solution, so similar,
1766160	1775340	same idea. However, the catch is we have to finish the whole setup process under two minutes.
1775440	1782340	Otherwise, we have to relay the Tesla key attack again. Now, by just... what we found is by just
1782340	1790100	setting up those... because we have to focus on the exact position on the screen. By just setting
1790100	1797720	up everything set up already, it's already a lot of times. So, we maybe... instead of
1798340	1803540	using the device, we're just using our first fingers, right?
1805000	1814680	So, here we're going to just show you the first finger will work. So, first, we are able to
1815900	1821900	open the door, we get in, but because there's a pin to drive function already, we have to
1821900	1828920	enter the pin, right? So, as you can see the firmware version, verify the firmware version,
1828920	1834840	right? Yeah, the pin drive. So, as you can see, in the beginning we pretend we don't know
1834840	1842700	anything about a pin, so we just randomly or brute force try to try our luck. Now, the point here
1842700	1853720	is we can see there's no brute force protection. We can just run... maybe not random, we open...
1853720	1861320	we just entering... keep entering a different pin, even try to see if we get a lock. So,
1861320	1865860	let me speed up a little bit.
1868360	1878430	Okay, okay. See, there's nothing stop us to keep entering the pin, right? Let me see...
1884250	1897860	Let me see where's the... actually, I don't know where's the actual key,
1897860	1903060	so I don't know where to start. Oh, see, here, we got it, right? So, as you can see,
1903060	1909320	during this lock... this is only demonstration, the actual attack maybe take longer, but yeah,
1909320	1913360	the point is they don't have anything protecting it, right? So, we can just,
1913360	1918860	using our first finger, maybe you can get them. Yeah, so, good to go.
1922080	1934800	Okay, all right. So, the summary here. So, really, the security by obscurity is not going to work,
1934800	1945120	right? So, the 100% security does not exist. We have to test properly. We need to... even like,
1945120	1952900	vehicles, you may think like those high-end cars are very secure, but once they implement some
1955100	1962000	latest technology, then it actually opens more attack vectors for the attackers. So,
1962000	1972160	we need to really think this carefully, okay? Yeah, so, here are some references. If you guys
1972160	1976940	are interested to continue your research, I definitely recommend you can try those
1976940	1988180	I just mentioned, and you go to... all those guys are very good in this area. Yeah, so,
1988180	1993400	go check them out, all right? Okay, thank you. I'm done.
