start	end	text
0	3980	So we are Ben and Vladan from IBM X-Force Red and we are
5020	7840	involved in a lot of stuff but we like to hack
7840	12780	hardware, software and especially if something has wheels and it's moving it
12780	16020	is interesting target for us. So we spend a lot of time actually
16020	20620	working with vehicle security testing and today we are
20620	24440	here to share a little bit of of stuff that we encounter through the
24440	27900	years with you. So what we are going to cover today is
27900	31880	about hacking car infotainment system and
31880	35280	how far we can actually go with it. So where are the dangers
36020	39600	and what is the approach that we have discovered which
39600	43240	is different than everybody else is using. So
44220	47780	why it is important. So unfortunately cars are becoming a lot
47780	51800	more cars are becoming a lot more complex than they
51800	56660	were before. So this screen we can see different number of lines of code
56660	60940	that are used to develop specific systems and we see that Facebook is
60940	64660	something about 6.7 million lines of code.
65040	72700	Boeing 787 is a 7 million and we have Ford F150 150 million
72700	76440	lines of code including all systems in the car.
76440	79620	So current modern car can have more than 200 kilos
79620	83800	of just electronic and wires in it. So you will find
84480	88160	like a hundred different smart computing units. So i'm not saying
88160	89880	computer because they are of different level
89880	93400	but smart computer units which control specific functions
93400	98660	from your entertainment system from your convenience systems until the
98660	102340	suspension motor ignition and and everything else.
102340	106180	So cars become a really complex multi-computer systems
106180	110620	which are all connected and they're becoming more and more connected and
110620	115080	exposed even to the internet. So we all like our infotainment system
115080	119780	because it gives us constant access to everything. So we have we can watch
119780	123800	movies while we stand fortunately, we can gain
123800	126440	information from the internet, we can retrieve data from
126440	131780	systems about roads, states of situation on road, if there are
131780	135220	congestion, non-congestion, we can do a lot of stuff. So it needs to
135220	138040	be complex in order to support all of this.
139460	143700	What is infotainment system? It is a not so simple thing that we can think
143700	147400	what we see in our car is just a small screen which is
147400	150060	presented to us and we interact with this screen by
150060	153860	touching it, moving it, abusing it to different ways,
153860	157560	spilling our coffee on it. But it is just what is exposed so we
157560	160900	can actually see. What is behind it is usually much much
160900	164960	more complex than it. So it can contain different features
164960	172040	radio, bluetooth, control cameras inside, outside, recording. In autonomous car it
172040	174280	can have even more stuff. So if you have lane assist
174980	178020	it is used to do this lane assist. So
178020	183040	cameras will be picking up the data, sending it to
183040	185320	your infotainment system and it will do processing and
185320	192640	help you stay out of the lines. So to keep you straight on. So there is a
192640	196500	lot of stuff that is integrated, that is connected. We
196500	199360	see a lot of radio communication. So for example your
199360	202440	tire pressure monitoring system, it is all wireless.
202840	206380	You can have bluetooth, you can have wi-fi, you can have
207300	210700	a lot of different technology and car is becoming actually
210700	216020	like mobile phone on the wheels. So that's unfortunate because we know how
216020	218960	bad we are surviving our mobiles. They take
218960	221520	all of the time, we are looking at them all the time
221520	225260	and we can hit stuff while we are walking. Imagine that happening while
225260	228180	you are driving. Not the best situation for sure.
229480	232460	So as I mentioned, what we see is just a single
233000	238140	head unit usually, which is displaying all information. But behind it we have a
238140	242220	plethora of different systems which are used to collect this
242220	245980	information and to process and in the end to present it to us.
245980	252300	So in a specific case that we are mostly discussing today, we saw that it
252300	256260	is a multi-system which has multiple
256260	259560	different boxes which are dedicated to different things.
259560	261700	Some of the functionality can overlap between
261700	265380	different boxes because for example in a one car manufacturer
265380	269460	you can have one level which is basic or you can buy another
269460	273800	option which is advanced functionalities or third one which are superb
273800	277280	functionalities and all offer something that might be
277280	281120	better than the previous box. And all of them together are connected and
281120	284500	communicate between each other. So they collect information about your
284500	287140	car, about the way you are driving, about your location
287140	291560	and even maybe some of your personal information which we are going to show a
291560	294760	little bit later. The problem with this is we have a lot
294760	297900	of software as I mentioned. 150 million lines of code.
297900	305300	Do you think it is bug free? No. And problem is that updating car is
305300	308980	much more difficult than updating your mobile or
308980	311180	windows operating system or linux or whatever
311180	315840	operating system you are using. So this is a part of the problem.
315840	319420	So manufacturers make it very difficult for you to change
319980	324960	your car computer software and beat it. It's a little bit easier to update your
324960	326940	infotainment system but it might be even
327520	331700	not done because customers are not used to it. You need to go on the line to
331700	336100	log in with some specific credential that should be provided to you by
336100	338580	your vendor. I hope they are not providing it free
338580	341400	for all so you can just download update on the internet.
341400	344960	We saw even that happens. So it can be really
345620	349360	dangerous and long-standing process which might
349360	352900	not be done in time. So you might be exposed.
352900	356260	In worst case, manufacturers need to recall the cars
356260	360780	so they can update them and change the software in case of serious problems.
362480	366720	So as I mentioned, in the head unit we have some basic functionalities
366720	370500	and we have another box which is hidden behind the
370500	373660	dashboard which provides additional features.
373660	379920	It might be connectivity, it might be better FM receiver with more functions,
379920	385460	it can be GPS receiver for navigation and all these boxes are connected
385940	391700	to each other with their own bus. So they are using their own bus to
391700	393420	connect to each other to exchange information
393420	397060	because in the end you always see the basic device
397060	400240	screen. So there is only one device which has screen.
400240	404600	Other device, when connected to it, will communicate and take over the screen
404600	407420	from the base device, so from navigation unit,
407420	410520	from head unit, sorry. So it uses some
411680	415600	inter-equipment communication protocol which can be vendor specific. There are
415600	418380	few that are open and known but mostly they are using
418380	421060	some proprietary communication protocols.
422780	427400	When we open these boxes we can find different hardware inside it.
427400	431440	So in this case what we commonly see is the Texas Instruments chip.
431440	437400	It's big SoC which is optimized to run fun and nice operating system called
437400	440240	QNX which some of you might know was
440240	443360	running on BlackBerry devices some time ago.
443360	446600	Now they are upgrading it and maintaining it
446600	450360	and they are selling it as the main car navigation platform.
450360	453380	So it is new neutrino platform which run on
453380	458920	ARM, ARM v7 in this case. And this chip is very powerful and can do
459160	462000	a lot of stuff for you. It can do a lot of
462000	466700	DSP processing, so it can do video processing, it can process network
466700	470980	information, it can interface with other stuff. So it
470980	475980	is really a powerful device with complex architecture and it is
475980	479480	implemented in such systems. So what we found on these devices is
479480	483200	stuff like NAND flash. We have identified a lot of
484080	489140	positions where we can connect and see what the information are
489140	491420	there. So on these pins there can be a lot
491420	494760	something interesting something not we don't know until we
494760	498900	verify. So as I mentioned, the main operating system
498900	502360	which you can find on most of these cars are
502360	507060	Android and QNX. QNX is becoming really dominant in this place because it is
507060	511240	micro-kernel based, unfortunately it's proprietary,
511240	515260	so it is very difficult to obtain anything open source. If somebody has any
515260	519100	information about any open source tool chain for QNX,
519100	523380	let me know. I'm interested. Otherwise licenses for QNX for
523380	528700	developers are somewhere like 10k dollars per license. So it is
528700	532940	really expensive. What we also see that these devices
532940	536400	are on top of the QNX. They are running some
538820	544900	user interface. It's based on SWF, Flash User Interface,
544900	548020	and it utilizes known technologies which are a little bit
548020	552200	modified and customized for specific purposes like
552200	558340	Lua scripting, Dbus, Java, XLAT. So all of these are standard but they are usually
558340	562080	just enough modified so it's difficult to use pre-existing tools
562080	566740	to do anything with this. So also during this we have discovered that
566740	570400	one of these devices has more than one single
572220	576080	partition. So these partitions are all custom
576680	581040	QNX file systems and they are optimized in order so when you're updating you
581040	583140	overwrite only a single partition.
584720	590220	So as I mentioned QNX is similar to Linux but it is a little bit different
590220	592580	because it implements a little bit different
592580	596020	approach to the kernel. So it is microkernel
596620	601940	which is monolithic and in contrary to Linux which is modular.
602000	606120	So everything should be already in the kernel itself but some of the drivers
606120	610720	which are needed are loaded from user space. So it is a
610720	614420	little bit different than the Linux kernel where everything
614420	616980	is running in ring zero so everything every driver run
616980	620680	in the kernel space unless you're using some hacks and you
620680	623480	fuse or something that enables you to use
624920	629440	user space drivers. So problem it is everything is
629440	632440	proprietary as I already mentioned proprietary file systems which are
632440	637400	mount as read only on device. There is not much documentation. We
637400	642000	spent a few months researching about QNX but as I said
642000	645100	expensive licenses closed source proprietary
645520	650520	there is not much to find open. So we were spending a lot of time
650520	654500	reading development manuals trying to find something that
655380	658720	that exists so few people done something but they are limited
658720	663380	so we built on on other existing tools.
665220	669240	Problem is that it is impossible to cross compile for QNX anything
669240	672180	unless you have QNX development tools which are costing 10k
672180	676000	as I mentioned. So what we started we started to analyze
676000	681020	the boot process first. So boot process starts with IPL which is like
681020	686380	your Linux loader. So it will load first and then
686380	691120	load everything else. It will load this image file system
691120	695180	what is actually Z image in Linux. So it is kernel
695180	698420	and then it will start loading user space programs
698420	702780	and finally it will load flash partitions from flash
702780	706980	memory. So it has fully running system in the end.
710090	714250	So what we see while reading this documentation that I mentioned we have
714250	716530	discovered one interesting recommendation by the vendor
716530	720930	and that is actually what we find really interesting and that is
720930	724030	to eliminate everything that can slow down
724030	727350	the booting process. So all security features like
727350	733550	checksums, signatures, CRC, whatever you have they
734150	738070	strongly advise you to disable it so device boots quickly.
738070	740850	You don't want to be sitting in your car for 20 minutes waiting it
740850	744610	to come up to check image before it loads it
744610	749150	to check if it is consistent. So it is just optimized for quick boot because we
749150	752430	are impatient. We like to be driving from point A to point B and waiting
752430	755690	for our car to boot. We have Windows for that.
757610	760290	Also what we saw that there is no secure boot,
760290	764050	file systems were not encrypted so there was a lot of security
764050	768270	features which are missing and which made our life a little bit easier
768270	771110	easier than than it would be otherwise.
773770	776970	So also one interesting thing devices that
776970	780430	we tested were customized for different car manufacturers.
780490	784630	So we have checked not a single vendor but we have checked every car that we
784630	787050	can find and that people will allow us to play
787050	790790	with. And you would be surprised that not many people will allow you to play
790790	795890	with their car. I don't know why. But we saw that they all use
795890	799230	OEM devices which are kind of similar to each other
799230	802670	and they are just a little bit customized and optimized for each
802670	807850	specific cars. In some specific cases we saw that a
807850	810570	car vendor asked for additional security features
810570	814850	to be included in such devices. So it is possible that the same device
814850	818610	which runs in one car is vulnerable and the same
818610	823170	device with same level of hardware version
823170	827090	runs differently in another car because car manufacturer asked for additional
827090	832090	security features to be on. So when we dumped the firmware from these
832090	835290	devices and we have done analysis we found references actually
835290	839090	that the same firmware is actually baseline for a different car
839090	841930	manufacturers. So we found strings that are relevant
841930	845630	for anything that you can imagine. So I believe they are selling to everybody.
847030	849750	So problem in this area is that you don't
849750	853170	you're not sure even if it is the same hardware if it is the same level of
853170	854910	software and feature packs that are implemented
855550	861430	on this hardware. So our idea is to see what we can do
861430	866470	first without actually dismantling the car. So we reviewed all access
866470	870350	vectors, so radio signals,
871150	876030	available interface for USB, CD, available applications on the
876790	881390	on the devices. So they are having some kind of market where you can download
881390	885590	and install your own applications. Some of them you need to pay, some of them are
885590	888970	free of charge and can be just downloaded.
888970	892290	After we were done with this part then we started
892290	895930	dismantling the devices. So we pulled them out
895930	899490	of the dashboard. We had wires everywhere so
899490	903170	we started analyzing devices. We saw there are flash chips,
903170	906590	there are EPROMs, there are consoles, there are
906590	910370	soldier points, test points where we can maybe do something
910910	916410	with it. But unfortunately car is not the best laboratory that
916410	919270	you can work. This is poor Ben. Ben was not hurt
919270	925310	during this work. So he's safe. He's here. He's just
925310	929570	very cold in this picture, I know. So we were working in the UK in the
929570	934390	winter. It was not the best possible way. It was around zero and we
934390	937290	are sitting on car park with everything open because car is
937290	939850	small and there is two of us and we are not so small.
939850	944110	We need a room. Especially me, yes. Thanks for pointing that out.
944110	951210	It was not obvious. So we removed just the plastic covers of
951210	955970	the dashboard so we can actually access the wires and connections behind the
955970	959550	devices. And we started analyzing how these
959550	964170	devices interact with the car. So our idea was
964170	970690	we don't like to work outside on cold in a very, very low space.
970690	974330	So our idea was can we move the car inside?
974350	980010	Guys maintaining our lab say no. We will not allow you to drive car in.
980430	983910	Elevators might be a little bit smaller than you need.
983910	988930	So then we get another idea and that is let us try to emulate the car outside of
988930	992370	the car. So we need to replicate enough so
992370	996070	devices are operational but without actually
996070	1000130	needing to have the car. In very, very old times I would go to
1000130	1005650	the junkyard and I would try to salvage ECU with everything. But today we do
1005650	1009870	not need to do that because modern cars are not operating on the
1009870	1013650	same principles. Even modern cars do not have lately
1013650	1018430	proper OBD interface. This is emulated. So even in the car you have emulation
1018430	1022510	OBD and behind that it runs whatever you want. So there are
1022510	1026270	different protocols and standards that are used. But in order to make
1026270	1031730	devices operational at this point we needed to check status of the holy
1031730	1036270	grail, CAN bus. So how device is interacting with the
1036270	1040390	car? We started by discovering where
1040390	1043490	CAN bus is connected to device and start with sniffing.
1043710	1048210	In order to find out what device needs from the car so we can set it up
1048210	1054810	in our lab. But we discovered that we might not need to do anything
1054810	1058570	because device is not communicating on the CAN bus.
1058690	1062410	So device is just listening but at that point in time we could not find
1062410	1066710	any single packet injected by device on the CAN bus.
1066710	1072150	So what we saw, we started first, device was removed, we started sniffing
1072150	1075190	the CAN bus, collecting what information we can see.
1075190	1078110	Then we connected everything, start running, comparing
1078110	1082550	and we see exactly the same stuff. So device is not interfering with CAN bus
1082550	1087590	at all. Anyway we just captured this traffic
1087590	1091790	so we can replay it back in the lab. So if we missed something
1091790	1094830	it will still work so we don't have a problem with that.
1095130	1099110	So this is a little bit of hardware that I like to use. It is all small hardware
1099110	1102370	and it is pretty cheap. I like Blue Pill. It is
1102370	1107310	very cheap STM platform. It is less than two dollars on
1107310	1111530	your favorite Chinese supplier and it is cheaper than Arduino. It
1111530	1114110	can be programmed Arduino but it is much more powerful.
1114210	1118530	And what I like it, it has USB and I was very happy when I discovered it
1118530	1123250	has CAN bus on it. When I started developing a sniffer
1123250	1127330	that I needed, I had one sniffer, it is on the right corner,
1127330	1130950	but I needed to have two of them. One to sniff, one to inject. So I needed to create
1130950	1134090	another tool and I like to have my own tools anyway.
1134150	1137670	I discovered one very disappointing thing and that this platform cannot work
1137670	1141810	on USB and CAN at the same time because of some memory overlaps
1141810	1145490	in the architecture of device and you can use only USB
1145490	1149890	or CAN. But luckily I had a CAN shield from Arduino which
1149890	1153310	worked really well in this case. So we have
1153310	1156190	collected all information from CAN bus and started
1156790	1160230	creating our environment in the lab where we had standard
1160950	1165390	power supply units. We have everything else. What we didn't have are actually
1165390	1171030	cameras, antennas, and speakers. But that was not important because
1171030	1173850	devices were fully operational even without that.
1174190	1177110	So we were very lucky because now we can work in
1177110	1181730	much hotter and better environments. Our hands are not freezing, we are not
1181730	1185310	hurting ourselves. Our CAN bus simulation is working, device
1185310	1190230	is happy, not complaining and everything is just fine so we can
1190230	1193550	focus on to the operation. So as I mentioned
1193550	1198650	devices are using wireless connectivity but not on
1198650	1202010	themselves. So they need to connect to
1202010	1205250	your phone. So you as a driver need to set it up,
1205250	1209590	set up the connectivity on your phone and share. So it is like a hotspot
1210350	1215270	or bluetooth depending on devices. Some of them require wi-fi, some of them
1215270	1218730	require bluetooth. But it will use that as a communication
1218730	1221990	channel in order to establish connectivity to the internet
1222480	1226370	and to go to download everything it needs. Applications,
1226370	1229630	configurations, to enable you access to
1229630	1232370	to app markets so you can buy applications
1232370	1236990	that you like to install. So what we see is the device is now having standard
1236990	1243250	IP address which enabled us to to play with it without actually
1243910	1248070	connecting to wires. So we have set up a rough access point
1248070	1253010	which is controlled by us based on host APD, DNS mask, IP tables and
1253010	1259470	our favorite burp tool. And we connected to these devices to our access point
1259470	1263730	and just intercept the traffic to see what device is doing.
1264970	1270810	We have discovered that devices are devices that are using bluetooth were a
1270810	1275150	little bit more pickier than wi-fi devices. So they needed to
1275150	1279070	establish first, before they establish PAN
1279070	1282390	connectivity, so private area network, it needs to be
1282390	1286390	set up as hands-free device. So it needs first to connect
1286390	1290890	your target device that you're sharing with your car as a hands-free device and
1290890	1294130	then it can use it as a network standpoint. So that
1294130	1295970	made our life a little bit complicated but
1295970	1299230	not too much because it was easy for us to create a small
1299230	1303030	Python tool based on PyBluesy which we use to
1303030	1308290	emulate phone in both profiles. So that enabled us to actually
1308910	1312310	establish connection and to sniff the traffic that goes
1312310	1318410	from device to the internet and back. So we implemented only necessary devices,
1318410	1321550	only necessary features in order to have this device connect
1321550	1323610	and operate.
1326730	1330070	So now Ben, I'm tired. So now Vladan has
1330070	1333150	introduced the device, how they work and their specificities.
1333310	1337830	I'm going to detail you what kind of attacks we have conducted on the device.
1337830	1341430	But first of all, because we have described our tool,
1341430	1346850	our talks, sorry, as a new approach, why previous attacks don't work anymore.
1346970	1350650	You remember a couple of years ago here at DEF CON and Black Hat,
1350650	1354830	some researchers have introduced vulnerabilities present on Jeep
1355480	1358950	cars. So these vulnerabilities were exploiting
1358950	1362510	connectivity, they were connecting to the device using Telnet,
1362510	1367190	the password were well known and present on the internet.
1367190	1370710	They were also using Dbus over TCP to connect to the device
1370710	1375010	and last but not least, they were abusing the firmware upgrade process
1375010	1379410	by passing uh, the um, content signature check-in.
1379590	1383550	So now for our test, we still have the IP connectivity to the device,
1383550	1387550	so they have not configured any software firewall to prevent us to access the
1387550	1391170	device. But Dbus over TCP is closed, Telnet is
1391170	1394330	closed and the firmware upgrade process has been
1394330	1397490	hardened. So we couldn't reuse any of the previous
1397490	1403470	vulnerability described uh, on the web and here. So the angle we
1403470	1408810	chose was the third party applications. So on the device we have been testing,
1408810	1411750	we realized that the vendor has provided an app store
1411750	1415790	and when they designed the solution, the goal was for them to open the devices to
1415790	1418630	third party vendors and they could create their own
1418630	1420390	application and they could sell it on the store
1420390	1424770	uh, like for example the Android app store or the app store for iOS.
1425210	1429810	In the reality, uh, there is only a limited set of applications which are on it
1430550	1434470	and they have never I think released uh, the software development kit
1434470	1437970	for third party applications. Which is good, you will realize why
1438390	1443030	a bit later. So the first thing we did is we intercepted the communication
1443030	1447430	between the software app store and its backend. So it was using HTTPS
1447430	1450530	which is good. Problem is uh, the encryption is broken
1450530	1453770	when we try to intercept and replace the certificate by a self-signed
1453770	1457050	certificate, the device did not show any warning and
1457050	1462330	it was continuing operating as normal. So, first problem. The second
1462330	1464970	problem is the device is communicating with its backend
1464970	1471090	using XML messages, a bit like soap, um, and we could easily intercept the
1471090	1473450	content and modify the content on the fly.
1473450	1477810	So, for example, when the device requests the software catalog, the server will
1477810	1481090	reply uh, with a full catalog including the
1481090	1483970	links uh, to the URLs for the install package
1483970	1487670	and just with a status which is buy, install, or installed.
1487730	1491210	So if the status is buy, the device when you will click on it will offer you to
1491210	1493890	buy and pay for it. But if the status is
1493890	1498090	just replay by install, the device will install it without having to pay for it.
1498090	1501550	So the logic control is done at the client side which is very bad and
1501550	1505490	it might remind you the first mobile apps you have been testing a couple of
1505490	1509030	years ago. So, good stuff for us. We could get uh,
1509030	1512010	access to paid apps for free. But our goal is to
1512010	1517210	to go deeper. So, here is an illustration. You see we have just reply,
1517210	1520430	replaced, sorry, the buy status by install and we were
1520430	1524170	able to install the application um, on the device.
1524930	1530670	Now, um, we did some analysis on what was an install package for a third
1530670	1534590	party application. So, in the previous screenshots you've
1534590	1537910	seen that we have the URL for the install package. So we downloaded a
1537910	1540710	couple of them. Uh, you don't need any authentication so
1540710	1542690	just a double you get with the URL and you could
1542690	1546250	access uh, the third party application package. So we downloaded
1546910	1550970	all of them and we started analyzing them. Uh, so what's an installation
1550970	1555990	package? Basically it's a zip archive with inside a jar file so a java
1555990	1559730	archive and one signature file which is a signed
1559730	1565310	message digest uh, using RSA signature. So, we have tried to spend a little bit
1565310	1569970	of time but we were not able to break the signature encryption which
1569970	1573430	is good. Uh, once we opened the jar file we
1573430	1576410	realized that the source code is not obfuscated which means with
1576410	1579890	any of your favorite java decompiler you can access the source code which is
1579890	1582770	good. However, the jar file by itself is signed
1582770	1587450	uh, with some private keys. So, here we are facing a system with two
1587450	1591450	different levels of code signature. So,
1591970	1595470	does this mean game over? So, what we first try
1595470	1601310	our first attempt uh, was to to play with the process of zip
1601310	1604750	extraction. You will understand why. The very first step
1604750	1608270	that the pro the app store is doing when you install an application
1608270	1612090	is storing the zip file in a temporary area and extract it before
1612090	1615630	because to check the checksum of the file its signature
1615630	1622130	it first need to extract it. So, this is the piece of code in charge of
1622130	1626610	unzipping the install package. And if you are good hackers and I believe you
1626610	1630230	all are, you will immediately notice that if you
1630230	1633250	have used a zip entry name you might be able because it's
1633250	1637010	concatenated to do arbitrary file writing. So, what
1637010	1640430	happens if you had a file to the archive with a zip
1640430	1643530	entry something like dot dot slash dot dot slash something.
1644830	1648870	So, we wanted to validate this. Obviously this is not going to work with
1648870	1652670	zip with zip and zip. You will get the message removing trailing slash or
1652670	1655650	whatever. But what happens with this dirty Java
1655650	1660470	code? So, we created a crafted zip archive using any Python lib
1660470	1665150	and you remember we don't yet have control on the device. So, if we want to
1665150	1667210	see if this was successful we need to write
1667210	1669670	somewhere we can check the file is created.
1669670	1672930	So, so far the only thing we can do is plug a USB stick
1672930	1676450	and check if we are able to extract a file to a USB stick.
1676450	1679890	On QNX if you read a little bit of documentation you will find that the
1679890	1684710	location of the USB stick is slash FS USB zero and then your USB
1684710	1688710	device. So, we created this crafted zip file with
1688810	1692730	a directory traversal uh writing an empty file on the USB stick.
1692730	1696050	And you know what? It worked. So, this means that we have an arbitrary
1696050	1699450	file writing without uh creating any warning on the
1699450	1702330	device once you install a crafted installation package.
1702330	1706730	So, good start. But now to take control on the device what we need to do
1706730	1710230	is to be able to copy a file to a place where it can be
1710230	1713930	executed from. So, it it brings you two problems.
1713930	1717270	As we said most of the file system of the device are read only
1717270	1721090	because if the device loses power it need to restart without having to do
1721090	1723610	content integrity, file system checking and whatever.
1723610	1726710	So, most of the file system are read only under normal operation
1726710	1730990	excepting some of them. And the place where third party apps are stored
1730990	1734830	is a read-write file system because you can install the applications, you can
1734830	1738370	remove them, you can upgrade them. So, the file system has to be mounted as
1738370	1740950	read-write. So, we need to write at this place and we
1740950	1745330	need to find this location. The second thing is so this java archive
1745330	1750970	those are uh Vladan mentioned Xlets. So, this is one of the G2ME
1750970	1755870	uh implementation. The problem is we cannot build any application or
1755870	1757870	rebuild the application if we don't have the vendor
1757870	1763570	SDK or API or libraries. So, this is also one of the problem we
1763570	1766490	have been facing and we will explain how we solved it.
1767270	1771590	So, it is possible to decompile the java source code but impossible to recompile
1771590	1773650	it. This is what we just said. But how about
1773650	1777890	backdooring, patching? If you all have done some
1778590	1782050	testing training, you have been doing disassembling,
1782050	1786790	x86 modification, changing instruction, repacking and whatever.
1786790	1790230	And what about doing the same with java? Because basically java what is that is
1790230	1793930	java source code compiled. So, it is java bytecode. It is known as
1793930	1797830	this and this is a portable code to be executed by the java runtime
1797830	1801290	environment. But basically the bytecode is just
1801290	1804770	assembly but for a different kind of machine and the machine is just java
1804770	1808290	runtime. So, if you use java bytecode and you
1808290	1812590	modify it with kind of a disassembler which exists, you can patch the java code
1812590	1817730	without needing the SDK nor IPI. This is what we did. But remember what
1817730	1820750	we said, the java archive itself is signed which
1820750	1824470	means that if we modify the bytecode, the java runtime environment should
1824470	1827870	refuse to execute it. So, because we didn't want to lose too
1827870	1830610	much time, our first attempt was just to change a png
1830610	1835450	icon from the java package. And when we installed the application, it refused to
1835450	1838470	start which means that the jvm, the java virtual machine,
1838470	1841730	refused our modified application which is good.
1841730	1845850	So, here again, game over? No, we tried something
1845850	1850170	desperate. We said, okay the signature is not good but
1850170	1853830	what happens if we just remove the signature? So, guess what?
1854150	1859150	It worked. So, if there is a signature and the signature is not good,
1859150	1862970	reject the program. But if there is no signature, no problem, just start it.
1862990	1869530	And it worked. So, now we are able to write on the file system and we are
1869530	1873470	able to execute malicious code that we have created. So,
1873470	1875810	the next steps are pretty straightforward.
1875850	1879130	We just have to create a malicious payload. So, it is
1879130	1882310	basically java source code. So, you just use the standard
1882310	1885850	java sdk. You just have to pay attention to the java
1885850	1889470	minor and major versions. So, basically your code has to be
1889470	1892970	executable by the target. So, what you do, you analyze the
1892970	1896550	source code you extracted and you are compiling with the same target version
1896550	1900010	and it should work. And then you have to hijack the normal
1900010	1904050	execution flow to redirect it to your malicious payload.
1904270	1907090	So, here we've been using massively the USB
1907730	1910810	connector of the car because we didn't want to recompile
1910810	1914210	at every time our program. So, what we did is
1914210	1918470	we just did a payload executable script shell which is on the USB stick.
1918470	1921410	So, if we want to modify it, it's easy. You just plug the USB stick on your
1921410	1923910	computer, modify the script shell and re-execute
1923910	1927090	the application without having to reinstall or doing nothing.
1927890	1932750	So, haltering the java bytecode. I told you modifying the assembly.
1932750	1936710	So, it's pretty easy. You just have to basically add the invoke starting
1937430	1940990	static, sorry, method which is calling your payload.
1941790	1945790	For various reasons, I'm not going into how the GVM works.
1945790	1949450	You also have to add the instruction to map your assembly code
1949450	1953450	to some virtual line numbers of the source code. This is the way it
1953450	1956230	works. So, it's not just one line but three
1956230	1960590	instructions for it to get it work. But the fundamental instruction here is
1960590	1964410	the invoke static which brings you to your malicious code.
1965890	1969970	So now, every time the patched application is started from the user
1969970	1973910	interface, it executes the script.sh located on
1973910	1977010	our USB key. Um, I'm not going through the details
1977010	1979410	because we have performed maybe hundreds or
1979410	1983430	several hundreds attempts because we have no idea on the device. We are doing
1983430	1986510	blind attack. We don't have the response. So, we were
1986510	1989390	having iterative approach. We were writing commands in the script
1989390	1992950	and collecting the output every time, editing the script and starting over
1992950	1996910	multiple times. Um, in the end, our goal is still to get
1996910	2000470	uh connectivity to the device with an interactive shell.
2000530	2003750	So, remember the target device is using QNX and
2003750	2007110	QNX provides something which is called QCon. And QCon
2007110	2011550	is a debugging daemon for QNX used during the development phases.
2011550	2015190	It allows you to do some profiling but more interesting for us to do remote
2015190	2020190	code execution. Uh, problem, the QCon daemon was not part
2020190	2022690	of the build. Because when you do production build, you
2022690	2026570	remove any useless stuff that you won't need in
2026570	2029510	production because you need to save space and time and whatever.
2029690	2032750	So, QCon was not part of the build. But Telnet was
2032750	2037490	for some reason. So, we couldn't use Telnet as is because Telnet
2037490	2040910	requires authentication and we don't have the root password.
2040910	2045330	But QCon does not. What we were able to do because we still don't have QNX
2045330	2048050	license and our managers were not willing to
2048050	2053410	buy us the license. We found QCon on the web. We were just
2053410	2058750	downloading a Raspberry Pi image for QNX which was using the same
2058750	2061210	distribution and fortunately the Raspberry Pi
2061210	2065270	is using the same CPU instruction which is ARM v7.
2065290	2068670	So, we desperately copied the QCon from the device
2068670	2072070	and we executed and it worked. So, we had a QCon daemon working
2072070	2076530	and we could interact with the device. So, obviously the first thing we tried
2076530	2079810	is getting the root password. So, we got the shadow file
2079810	2085510	and we managed to crack the password. So, now maintaining access and post
2085510	2089790	exploitation. Because we don't want to repeat all of
2089790	2093610	those steps every time we want to get access to the device, we needed to find a
2093610	2097210	way to get persistent access. So, basically that means starting
2097210	2101930	automatically either QCon or Telnet or both. We crack the root
2101930	2105450	password because it's using Descript. The password length is limited to
2105450	2110090	to eight characters. So, this could be cracked with a reasonably powerful
2110090	2113310	system within few hours. This is optional
2113310	2116470	because you can use QCon but it's nice because Telnet is much
2116470	2120670	better for interactive shell than QCon. Because QCon doesn't have for example
2120670	2125950	the background and whatever. So, we have to find a script on the
2125950	2128590	device which reside on the read-write
2128590	2132750	partition and which is executed at every boot time.
2132750	2135550	So, it makes a lot of conditions but we still find one.
2135550	2140050	When you're doing that, you need to be very careful because if you mess with a
2140050	2142910	startup script, there is no reset to factory option
2142910	2145230	because you will prevent the device to boot properly.
2145230	2148630	So, you can't even go to upgrade mode and reinstall it
2148630	2152550	and there is no reset to factory that will restore the content of your flash.
2152550	2155830	So, if you mess, you crash the device. So, you have to be very careful during
2155830	2159830	this step unless you will get a break.
2162030	2165510	So, during the post-exploitation step, we were having some fun.
2165510	2168610	First of all, we realized that all the personal data
2168610	2173390	are stored in SQLite which is very common. This is the same for Android and
2173390	2176450	and many other systems. So, what was funny if
2177030	2180370	you are in a rental car and there has been several drivers
2180370	2184030	before you pairing their phone with the system, you will get
2184030	2187450	all their phone's names, MAC address, Bluetooth MAC address,
2187450	2191610	phone books and if it's Android phones, you will also get the content of SMS
2191610	2196890	inbox which is fun. The second thing is there is a lot of
2196890	2200030	logins so you know where was the car and when
2200030	2203390	with the GPS location, time and date and some events
2204150	2207650	which is also interesting and it has been used in France
2207650	2212150	for a criminal investigation where they could demonstrate that the killer was at
2212150	2215490	the right place because the car had recorded this in the logs.
2216690	2220530	For example, you can do some tuning, customizing the color, get a different
2220530	2224330	GUI because it's just Flash and HTML5 HMI
2224330	2227490	so you can customize it very easily and it's fun.
2228010	2231350	And you can also play with the services. You remember when Vladan introduced the
2231350	2235950	software architecture, it's using Dbus, so a common bus
2235950	2240030	with a lot of services plugged on it. So, for example, the FM tuner, so from the
2240030	2243690	command line you can change the station, you can change the volume from the
2243690	2246850	command line, you can use the text-to-speech service which is used by
2246850	2250110	the navigation to make the car speech to you and it's
2250110	2253850	very fun. It's especially very fun if you re-enable
2253850	2256970	Dbus TCP and remote access to the car. So if
2256970	2259270	it's a rental car and somebody else is connecting the car
2259270	2263490	after you and you get access back to the device, you can talk to the guy for the
2263490	2265910	car which is very fun and that might be very
2265910	2271130	scary for the guy. Most of the systems, uh, so all those
2271130	2275110	services, Dbus services, are written in Lua.
2275570	2278910	It's a modified version because everything is non-standard, but
2278910	2283850	if you modified the decompiler, Lua decompiler, to bypass some checksums,
2283850	2287630	some magic numbers, verifications, you are able to reverse it and obtain
2287630	2291010	the source code. So it was very interesting for the, for
2291010	2294810	the next step. Now the holy grail, the CAN bus, because
2294810	2298510	all of this, we did it, uh, in the objective of getting access to the CAN
2298510	2301010	bus and to the car critical systems.
2302790	2306790	CAN bus is allowing access, we've told you, to the engine ECU,
2306790	2310530	something less critical, air conditionings, uh, windows, whatever.
2310770	2315330	And here we were facing a big frustration. The system we have tested
2315330	2320390	did not have a full access to the CAN bus. It was actually going through a
2320390	2323210	gateway and this gateway was responding to a
2323210	2328390	proprietary protocol. So it was only giving access to, for example, the fuel
2328390	2331770	consumption, the speed of the car, accelerometer, so
2331770	2334610	that, for example, if the car is driving in the tunnel and there is no GPS
2334610	2338070	signal, the GPS navigation system still knows
2338070	2342490	which speed the car is going on. But it was a lot of frustration for us
2342490	2347130	because we were not able to jump on the CAN bus. It was even
2347130	2351110	more frustrating because the reason why it was not possible was not for,
2351110	2355090	it was not a security countermeasure, it was not because, it was just because
2355090	2359330	the device had a whole poor device design. So they
2359330	2361710	had to put this gateway because the device itself
2361710	2364030	didn't have the CAN transceiver on the board.
2364030	2369270	So it was a lot of frustration for us. Now because we are at the hardware
2369270	2372750	hacking village and we've many, we've mainly talked about
2372750	2375850	software, we're gonna talk a little bit about hardware.
2375850	2381170	So the box was dismantled. We have been using standard tools
2381850	2386110	such as clamps, power supply, logic analyzer,
2386110	2389430	oscilloscope and all the tools you can get to your
2389430	2392830	favorite Chinese provider still. And we have been
2392830	2399590	able to identify the pins you see, but we had no idea what was their purpose.
2399590	2403330	So using the logic, the logic analyzer, sorry,
2403330	2410810	we could quickly identify the console. So it's a serial console at 115 200
2411290	2416730	bow. Unfortunately, once you boot, you have authentication required.
2416790	2420310	You know, if you do this on a standard Linux, you can boot in single user mode
2420310	2424210	just by, by altering the kernel command. But with
2424210	2428110	QNX, with the IPL, you cannot do that. The IPL, so initial
2428110	2431890	program loader, which was on the device, did not offer
2431890	2435650	this option. Authentication was required. So here we
2435650	2439870	had to have the root password cracked. Otherwise, we were not able to get into
2439870	2441050	the device.
2442590	2447270	So this is what I just said. We had a problem. We needed this root password.
2447270	2451290	So what other option doing the physical hardware attack?
2451290	2454210	There was a FRAM. So the FRAM is a small uh
2454210	2458990	memory chip using SPI. Because when the device is booting,
2458990	2463890	it doesn't have the drivers to talk, to communicate with the big flash NAND,
2463890	2467310	it needs an intermediate step. And this is what the IPL
2467310	2471470	is doing. The IPL is loading the driver to communicate with the large
2471470	2478050	NAND uh chip. And we found out that in this small eight kilobytes FRAM,
2478050	2481590	there is obviously some uh persistent information
2481590	2485830	such the MAC address of the device, Bluetooth, Wi-Fi, the serial number,
2485830	2489310	maybe the build version. But there is mainly the QNX
2489310	2493070	IPL, which is the driver for the next step.
2493070	2497030	And our idea is if we modify the IPL, if we
2497030	2501430	recompile it, offering the support to boot in single user mode by changing
2501430	2505770	um the initial program from login to just KSH,
2505770	2509570	then we can get access to the device without needing authentication using the
2509570	2513990	serial console. So here, the work is still in progress,
2513990	2517770	but we found the QNX IPL source code because it is provided by Texas
2517770	2520550	Instrument on their website. So you just have to
2520550	2525450	modify it, recompile it, and rewrite it in the FRAM chip. This is not a
2525450	2528450	problem because if you remember, there is no secure boot because
2528450	2531690	everything has been disabled. So you just have to recompile, write it
2531690	2536910	in the device, and then you're good to go. Work is still in progress, maybe in a
2536910	2540830	future talk we might be able to demonstrate it.
2540830	2543790	So just to summarize, because some of you might be a little bit frustrated,
2543790	2547790	our idea is if you are a good software and a good system hacker,
2547790	2551330	don't be afraid of embedded and hardware hacking. Because here,
2551330	2555210	hardware is just basically a computer, a normal computer with some specificities
2555210	2559570	because the operating system is a bit different, you have a bit of constraint,
2559570	2562570	but it's basically a computer which you can hack using
2562570	2565810	the old techniques you've been learning for 10 years.
2566290	2570570	So thank you for attending our talk, and if you have any questions,
2570570	2571610	you're welcome.
2589740	2592880	So the question was, are these disclosed to manufacturers?
2592880	2599620	As far as we know, yes, they should be. So it's disclosed to the manufacturer, but
2599620	2603700	if you remember the problem of OEM, the manufacturers don't necessarily have
2603700	2606400	the capability to patch the firmware themselves.
2606400	2610760	So they might have to go to their OEM provider, ask them to fix the problem,
2610760	2613980	get a build, get it, and push it to the cars
2613980	2617520	in operation, which might be a problem, because you might have maybe one or two
2617520	2621120	millions of cars with vulnerable systems.
2625930	2629610	Okay, if anybody has any questions later, we will be around.
2629990	2633350	So thank you everybody, and see you around. Bye.
