WEBVTT

00:00.000 --> 00:14.420
So we are Ben and Vladan from IBM X-Force Red and we are involved in a lot of stuff but we like to hack hardware, software and especially if something has wheels and it's moving it is interesting target for us.

00:14.420 --> 00:25.660
So we spend a lot of time actually working with vehicle security testing and today we are here to share a little bit of of stuff that we encounter through the years with you.

00:25.660 --> 00:34.100
So what we are going to cover today is about hacking car infotainment system and how far we can actually go with it.

00:34.100 --> 00:42.800
So where are the dangers and what is the approach that we have discovered which is different than everybody else is using.

00:43.040 --> 00:45.420
So why it is important.

00:45.420 --> 00:52.760
So unfortunately cars are becoming a lot more cars are becoming a lot more complex than they were before.

00:52.760 --> 01:04.660
So this screen we can see different number of lines of code that are used to develop specific systems and we see that Facebook is something about 6.7 million lines of code.

01:05.040 --> 01:16.440
Boeing 787 is a 7 million and we have Ford F150 150 million lines of code including all systems in the car.

01:16.440 --> 01:22.660
So current modern car can have more than 200 kilos of just electronic and wires in it.

01:22.660 --> 01:27.700
So you will find like a hundred different smart computing units.

01:27.700 --> 01:42.340
So i'm not saying computer because they are of different level but smart computer units which control specific functions from your entertainment system from your convenience systems until the suspension motor ignition and and everything else.

01:42.340 --> 01:52.620
So cars become a really complex multi-computer systems which are all connected and they're becoming more and more connected and exposed even to the internet.

01:52.840 --> 01:58.620
So we all like our infotainment system because it gives us constant access to everything.

01:58.620 --> 02:14.360
So we have we can watch movies while we stand fortunately, we can gain information from the internet, we can retrieve data from systems about roads, states of situation on road, if there are congestion, non-congestion, we can do a lot of stuff.

02:14.360 --> 02:18.040
So it needs to be complex in order to support all of this.

02:19.460 --> 02:21.100
What is infotainment system?

02:21.100 --> 02:35.420
It is a not so simple thing that we can think what we see in our car is just a small screen which is presented to us and we interact with this screen by touching it, moving it, abusing it to different ways, spilling our coffee on it.

02:35.420 --> 02:38.940
But it is just what is exposed so we can actually see.

02:38.940 --> 02:42.780
What is behind it is usually much much more complex than it.

02:42.780 --> 02:50.780
So it can contain different features radio, bluetooth, control cameras inside, outside, recording.

02:50.780 --> 02:53.260
In autonomous car it can have even more stuff.

02:53.260 --> 02:58.020
So if you have lane assist it is used to do this lane assist.

02:58.020 --> 03:08.740
So cameras will be picking up the data, sending it to your infotainment system and it will do processing and help you stay out of the lines.

03:08.740 --> 03:11.780
So to keep you straight on.

03:11.780 --> 03:16.260
So there is a lot of stuff that is integrated, that is connected.

03:16.260 --> 03:18.380
We see a lot of radio communication.

03:18.380 --> 03:22.440
So for example your tire pressure monitoring system, it is all wireless.

03:22.840 --> 03:33.080
You can have bluetooth, you can have wi-fi, you can have a lot of different technology and car is becoming actually like mobile phone on the wheels.

03:33.680 --> 03:38.600
So that's unfortunate because we know how bad we are surviving our mobiles.

03:38.600 --> 03:44.120
They take all of the time, we are looking at them all the time and we can hit stuff while we are walking.

03:44.120 --> 03:46.060
Imagine that happening while you are driving.

03:46.060 --> 03:48.180
Not the best situation for sure.

03:49.480 --> 03:56.720
So as I mentioned, what we see is just a single head unit usually, which is displaying all information.

03:56.720 --> 04:05.980
But behind it we have a plethora of different systems which are used to collect this information and to process and in the end to present it to us.

04:05.980 --> 04:19.560
So in a specific case that we are mostly discussing today, we saw that it is a multi-system which has multiple different boxes which are dedicated to different things.

04:19.560 --> 04:38.660
Some of the functionality can overlap between different boxes because for example in a one car manufacturer you can have one level which is basic or you can buy another option which is advanced functionalities or third one which are superb functionalities and all offer something that might be better than the previous box.

04:38.660 --> 04:42.760
And all of them together are connected and communicate between each other.

04:42.760 --> 04:52.520
So they collect information about your car, about the way you are driving, about your location and even maybe some of your personal information which we are going to show a little bit later.

04:52.660 --> 04:55.700
The problem with this is we have a lot of software as I mentioned.

04:55.800 --> 04:57.900
150 million lines of code.

04:57.900 --> 04:59.840
Do you think it is bug free?

05:00.560 --> 05:01.580
No.

05:01.720 --> 05:13.360
And problem is that updating car is much more difficult than updating your mobile or windows operating system or linux or whatever operating system you are using.

05:13.360 --> 05:15.840
So this is a part of the problem.

05:15.840 --> 05:23.120
So manufacturers make it very difficult for you to change your car computer software and beat it.

05:23.120 --> 05:30.260
It's a little bit easier to update your infotainment system but it might be even not done because customers are not used to it.

05:30.260 --> 05:37.000
You need to go on the line to log in with some specific credential that should be provided to you by your vendor.

05:37.000 --> 05:41.400
I hope they are not providing it free for all so you can just download update on the internet.

05:41.400 --> 05:43.100
We saw even that happens.

05:43.420 --> 05:51.360
So it can be really dangerous and long-standing process which might not be done in time.

05:51.360 --> 05:52.900
So you might be exposed.

05:52.900 --> 06:00.780
In worst case, manufacturers need to recall the cars so they can update them and change the software in case of serious problems.

06:02.480 --> 06:13.660
So as I mentioned, in the head unit we have some basic functionalities and we have another box which is hidden behind the dashboard which provides additional features.

06:13.660 --> 06:29.280
It might be connectivity, it might be better FM receiver with more functions, it can be GPS receiver for navigation and all these boxes are connected to each other with their own bus.

06:29.500 --> 06:37.800
So they are using their own bus to connect to each other to exchange information because in the end you always see the basic device screen.

06:37.800 --> 06:40.240
So there is only one device which has screen.

06:40.240 --> 06:49.000
Other device, when connected to it, will communicate and take over the screen from the base device, so from navigation unit, from head unit, sorry.

06:49.140 --> 06:55.380
So it uses some inter-equipment communication protocol which can be vendor specific.

06:55.380 --> 07:01.060
There are few that are open and known but mostly they are using some proprietary communication protocols.

07:02.780 --> 07:07.400
When we open these boxes we can find different hardware inside it.

07:07.400 --> 07:11.440
So in this case what we commonly see is the Texas Instruments chip.

07:11.440 --> 07:23.360
It's big SoC which is optimized to run fun and nice operating system called QNX which some of you might know was running on BlackBerry devices some time ago.

07:23.360 --> 07:30.360
Now they are upgrading it and maintaining it and they are selling it as the main car navigation platform.

07:30.360 --> 07:36.380
So it is new neutrino platform which run on ARM, ARM v7 in this case.

07:36.380 --> 07:40.040
And this chip is very powerful and can do a lot of stuff for you.

07:40.040 --> 07:50.700
It can do a lot of DSP processing, so it can do video processing, it can process network information, it can interface with other stuff.

07:50.700 --> 07:57.520
So it is really a powerful device with complex architecture and it is implemented in such systems.

07:57.520 --> 08:01.680
So what we found on these devices is stuff like NAND flash.

08:01.680 --> 08:09.740
We have identified a lot of positions where we can connect and see what the information are there.

08:09.740 --> 08:15.980
So on these pins there can be a lot something interesting something not we don't know until we verify.

08:15.980 --> 08:24.040
So as I mentioned, the main operating system which you can find on most of these cars are Android and QNX.

08:24.040 --> 08:34.400
QNX is becoming really dominant in this place because it is micro-kernel based, unfortunately it's proprietary, so it is very difficult to obtain anything open source.

08:34.400 --> 08:39.600
If somebody has any information about any open source tool chain for QNX, let me know.

08:39.600 --> 08:41.300
I'm interested.

08:41.300 --> 08:47.780
Otherwise licenses for QNX for developers are somewhere like 10k dollars per license.

08:47.860 --> 08:50.280
So it is really expensive.

08:50.700 --> 08:55.240
What we also see that these devices are on top of the QNX.

08:55.240 --> 09:00.640
They are running some user interface.

09:00.640 --> 09:15.860
It's based on SWF, Flash User Interface, and it utilizes known technologies which are a little bit modified and customized for specific purposes like Lua scripting, Dbus, Java, XLAT.

09:15.860 --> 09:24.240
So all of these are standard but they are usually just enough modified so it's difficult to use pre-existing tools to do anything with this.

09:24.280 --> 09:33.500
So also during this we have discovered that one of these devices has more than one single partition.

09:33.600 --> 09:43.140
So these partitions are all custom QNX file systems and they are optimized in order so when you're updating you overwrite only a single partition.

09:44.720 --> 09:54.660
So as I mentioned QNX is similar to Linux but it is a little bit different because it implements a little bit different approach to the kernel.

09:54.660 --> 10:01.940
So it is microkernel which is monolithic and in contrary to Linux which is modular.

10:02.000 --> 10:09.420
So everything should be already in the kernel itself but some of the drivers which are needed are loaded from user space.

10:09.980 --> 10:27.620
So it is a little bit different than the Linux kernel where everything is running in ring zero so everything every driver run in the kernel space unless you're using some hacks and you fuse or something that enables you to use user space drivers.

10:27.920 --> 10:34.520
So problem it is everything is proprietary as I already mentioned proprietary file systems which are mount as read only on device.

10:35.140 --> 10:37.400
There is not much documentation.

10:37.400 --> 10:48.660
We spent a few months researching about QNX but as I said expensive licenses closed source proprietary there is not much to find open.

10:48.660 --> 11:03.380
So we were spending a lot of time reading development manuals trying to find something that that exists so few people done something but they are limited so we built on on other existing tools.

11:05.220 --> 11:13.580
Problem is that it is impossible to cross compile for QNX anything unless you have QNX development tools which are costing 10k as I mentioned.

11:13.860 --> 11:18.040
So what we started we started to analyze the boot process first.

11:18.060 --> 11:24.560
So boot process starts with IPL which is like your Linux loader.

11:24.640 --> 11:27.920
So it will load first and then load everything else.

11:28.080 --> 11:34.540
It will load this image file system what is actually Z image in Linux.

11:34.540 --> 11:43.960
So it is kernel and then it will start loading user space programs and finally it will load flash partitions from flash memory.

11:43.960 --> 11:46.980
So it has fully running system in the end.

11:50.090 --> 12:05.610
So what we see while reading this documentation that I mentioned we have discovered one interesting recommendation by the vendor and that is actually what we find really interesting and that is to eliminate everything that can slow down the booting process.

12:05.610 --> 12:18.070
So all security features like checksums, signatures, CRC, whatever you have they strongly advise you to disable it so device boots quickly.

12:18.070 --> 12:26.190
You don't want to be sitting in your car for 20 minutes waiting it to come up to check image before it loads it to check if it is consistent.

12:26.190 --> 12:29.870
So it is just optimized for quick boot because we are impatient.

12:29.870 --> 12:34.250
We like to be driving from point A to point B and waiting for our car to boot.

12:34.250 --> 12:35.690
We have Windows for that.

12:37.610 --> 12:51.110
Also what we saw that there is no secure boot, file systems were not encrypted so there was a lot of security features which are missing and which made our life a little bit easier easier than than it would be otherwise.

12:53.770 --> 13:00.430
So also one interesting thing devices that we tested were customized for different car manufacturers.

13:00.490 --> 13:07.750
So we have checked not a single vendor but we have checked every car that we can find and that people will allow us to play with.

13:07.930 --> 13:11.550
And you would be surprised that not many people will allow you to play with their car.

13:11.550 --> 13:12.650
I don't know why.

13:13.150 --> 13:23.870
But we saw that they all use OEM devices which are kind of similar to each other and they are just a little bit customized and optimized for each specific cars.

13:23.870 --> 13:32.650
In some specific cases we saw that a car vendor asked for additional security features to be included in such devices.

13:32.650 --> 13:48.650
So it is possible that the same device which runs in one car is vulnerable and the same device with same level of hardware version runs differently in another car because car manufacturer asked for additional security features to be on.

13:48.950 --> 14:00.090
So when we dumped the firmware from these devices and we have done analysis we found references actually that the same firmware is actually baseline for a different car manufacturers.

14:00.090 --> 14:03.870
So we found strings that are relevant for anything that you can imagine.

14:03.870 --> 14:05.630
So I believe they are selling to everybody.

14:07.030 --> 14:17.150
So problem in this area is that you don't you're not sure even if it is the same hardware if it is the same level of software and feature packs that are implemented on this hardware.

14:18.470 --> 14:24.550
So our idea is to see what we can do first without actually dismantling the car.

14:24.550 --> 14:38.110
So we reviewed all access vectors, so radio signals, available interface for USB, CD, available applications on the on the devices.

14:38.110 --> 14:43.790
So they are having some kind of market where you can download and install your own applications.

14:43.790 --> 14:48.970
Some of them you need to pay, some of them are free of charge and can be just downloaded.

14:48.970 --> 14:54.830
After we were done with this part then we started dismantling the devices.

14:54.830 --> 14:57.530
So we pulled them out of the dashboard.

14:57.530 --> 15:01.250
We had wires everywhere so we started analyzing devices.

15:01.250 --> 15:12.110
We saw there are flash chips, there are EPROMs, there are consoles, there are soldier points, test points where we can maybe do something with it.

15:12.710 --> 15:17.190
But unfortunately car is not the best laboratory that you can work.

15:17.190 --> 15:18.270
This is poor Ben.

15:18.270 --> 15:22.470
Ben was not hurt during this work.

15:22.610 --> 15:23.690
So he's safe.

15:23.690 --> 15:24.610
He's here.

15:24.910 --> 15:27.070
He's just very cold in this picture, I know.

15:27.330 --> 15:30.110
So we were working in the UK in the winter.

15:30.110 --> 15:33.410
It was not the best possible way.

15:33.410 --> 15:39.850
It was around zero and we are sitting on car park with everything open because car is small and there is two of us and we are not so small.

15:39.850 --> 15:40.910
We need a room.

15:40.910 --> 15:42.250
Especially me, yes.

15:42.590 --> 15:44.110
Thanks for pointing that out.

15:44.110 --> 15:45.630
It was not obvious.

15:46.330 --> 15:57.150
So we removed just the plastic covers of the dashboard so we can actually access the wires and connections behind the devices.

15:57.190 --> 16:02.310
And we started analyzing how these devices interact with the car.

16:02.630 --> 16:10.690
So our idea was we don't like to work outside on cold in a very, very low space.

16:10.690 --> 16:14.330
So our idea was can we move the car inside?

16:14.350 --> 16:16.870
Guys maintaining our lab say no.

16:17.530 --> 16:20.010
We will not allow you to drive car in.

16:20.430 --> 16:23.910
Elevators might be a little bit smaller than you need.

16:23.910 --> 16:29.710
So then we get another idea and that is let us try to emulate the car outside of the car.

16:29.710 --> 16:37.950
So we need to replicate enough so devices are operational but without actually needing to have the car.

16:37.950 --> 16:44.990
In very, very old times I would go to the junkyard and I would try to salvage ECU with everything.

16:44.990 --> 16:51.110
But today we do not need to do that because modern cars are not operating on the same principles.

16:51.210 --> 16:55.070
Even modern cars do not have lately proper OBD interface.

16:55.070 --> 16:56.430
This is emulated.

16:56.750 --> 17:01.930
So even in the car you have emulation OBD and behind that it runs whatever you want.

17:01.930 --> 17:05.330
So there are different protocols and standards that are used.

17:05.330 --> 17:13.190
But in order to make devices operational at this point we needed to check status of the holy grail, CAN bus.

17:13.510 --> 17:17.070
So how device is interacting with the car?

17:17.730 --> 17:23.490
We started by discovering where CAN bus is connected to device and start with sniffing.

17:23.710 --> 17:29.450
In order to find out what device needs from the car so we can set it up in our lab.

17:30.430 --> 17:38.570
But we discovered that we might not need to do anything because device is not communicating on the CAN bus.

17:38.690 --> 17:46.710
So device is just listening but at that point in time we could not find any single packet injected by device on the CAN bus.

17:46.710 --> 17:55.190
So what we saw, we started first, device was removed, we started sniffing the CAN bus, collecting what information we can see.

17:55.190 --> 18:00.510
Then we connected everything, start running, comparing and we see exactly the same stuff.

18:00.570 --> 18:03.830
So device is not interfering with CAN bus at all.

18:05.070 --> 18:09.870
Anyway we just captured this traffic so we can replay it back in the lab.

18:09.870 --> 18:14.830
So if we missed something it will still work so we don't have a problem with that.

18:15.130 --> 18:18.210
So this is a little bit of hardware that I like to use.

18:18.210 --> 18:21.050
It is all small hardware and it is pretty cheap.

18:21.050 --> 18:21.990
I like Blue Pill.

18:21.990 --> 18:24.510
It is very cheap STM platform.

18:24.890 --> 18:31.450
It is less than two dollars on your favorite Chinese supplier and it is cheaper than Arduino.

18:31.450 --> 18:34.110
It can be programmed Arduino but it is much more powerful.

18:34.210 --> 18:41.190
And what I like it, it has USB and I was very happy when I discovered it has CAN bus on it.

18:41.430 --> 18:48.670
When I started developing a sniffer that I needed, I had one sniffer, it is on the right corner, but I needed to have two of them.

18:48.670 --> 18:50.170
One to sniff, one to inject.

18:50.170 --> 18:54.090
So I needed to create another tool and I like to have my own tools anyway.

18:54.150 --> 19:06.810
I discovered one very disappointing thing and that this platform cannot work on USB and CAN at the same time because of some memory overlaps in the architecture of device and you can use only USB or CAN.

19:06.810 --> 19:12.250
But luckily I had a CAN shield from Arduino which worked really well in this case.

19:12.350 --> 19:22.330
So we have collected all information from CAN bus and started creating our environment in the lab where we had standard power supply units.

19:22.330 --> 19:23.870
We have everything else.

19:23.870 --> 19:29.410
What we didn't have are actually cameras, antennas, and speakers.

19:29.410 --> 19:33.850
But that was not important because devices were fully operational even without that.

19:34.190 --> 19:40.110
So we were very lucky because now we can work in much hotter and better environments.

19:40.110 --> 19:43.030
Our hands are not freezing, we are not hurting ourselves.

19:43.450 --> 19:52.890
Our CAN bus simulation is working, device is happy, not complaining and everything is just fine so we can focus on to the operation.

19:52.890 --> 19:59.570
So as I mentioned devices are using wireless connectivity but not on themselves.

19:59.650 --> 20:03.010
So they need to connect to your phone.

20:03.010 --> 20:08.190
So you as a driver need to set it up, set up the connectivity on your phone and share.

20:08.190 --> 20:13.690
So it is like a hotspot or bluetooth depending on devices.

20:13.690 --> 20:16.470
Some of them require wi-fi, some of them require bluetooth.

20:16.470 --> 20:24.850
But it will use that as a communication channel in order to establish connectivity to the internet and to go to download everything it needs.

20:25.010 --> 20:34.470
Applications, configurations, to enable you access to to app markets so you can buy applications that you like to install.

20:34.470 --> 20:45.210
So what we see is the device is now having standard IP address which enabled us to to play with it without actually connecting to wires.

20:45.210 --> 20:54.790
So we have set up a rough access point which is controlled by us based on host APD, DNS mask, IP tables and our favorite burp tool.

20:54.790 --> 21:03.730
And we connected to these devices to our access point and just intercept the traffic to see what device is doing.

21:04.970 --> 21:14.250
We have discovered that devices are devices that are using bluetooth were a little bit more pickier than wi-fi devices.

21:14.250 --> 21:25.090
So they needed to establish first, before they establish PAN connectivity, so private area network, it needs to be set up as hands-free device.

21:25.090 --> 21:33.610
So it needs first to connect your target device that you're sharing with your car as a hands-free device and then it can use it as a network standpoint.

21:33.690 --> 21:46.770
So that made our life a little bit complicated but not too much because it was easy for us to create a small Python tool based on PyBluesy which we use to emulate phone in both profiles.

21:46.770 --> 21:55.190
So that enabled us to actually establish connection and to sniff the traffic that goes from device to the internet and back.

21:55.470 --> 22:03.610
So we implemented only necessary devices, only necessary features in order to have this device connect and operate.

22:06.730 --> 22:08.790
So now Ben, I'm tired.

22:08.790 --> 22:13.150
So now Vladan has introduced the device, how they work and their specificities.

22:13.310 --> 22:17.830
I'm going to detail you what kind of attacks we have conducted on the device.

22:17.830 --> 22:26.850
But first of all, because we have described our tool, our talks, sorry, as a new approach, why previous attacks don't work anymore.

22:26.970 --> 22:36.130
You remember a couple of years ago here at DEF CON and Black Hat, some researchers have introduced vulnerabilities present on Jeep cars.

22:36.130 --> 22:47.190
So these vulnerabilities were exploiting connectivity, they were connecting to the device using Telnet, the password were well known and present on the internet.

22:47.190 --> 22:59.410
They were also using Dbus over TCP to connect to the device and last but not least, they were abusing the firmware upgrade process by passing uh, the um, content signature check-in.

22:59.590 --> 23:08.210
So now for our test, we still have the IP connectivity to the device, so they have not configured any software firewall to prevent us to access the device.

23:08.210 --> 23:15.010
But Dbus over TCP is closed, Telnet is closed and the firmware upgrade process has been hardened.

23:15.030 --> 23:21.050
So we couldn't reuse any of the previous vulnerability described uh, on the web and here.

23:21.450 --> 23:26.270
So the angle we chose was the third party applications.

23:26.450 --> 23:41.010
So on the device we have been testing, we realized that the vendor has provided an app store and when they designed the solution, the goal was for them to open the devices to third party vendors and they could create their own application and they could sell it on the store uh,

23:41.010 --> 23:44.770
like for example the Android app store or the app store for iOS.

23:45.210 --> 23:56.170
In the reality, uh, there is only a limited set of applications which are on it and they have never I think released uh, the software development kit for third party applications.

23:56.170 --> 23:59.330
Which is good, you will realize why a bit later.

23:59.610 --> 24:05.910
So the first thing we did is we intercepted the communication between the software app store and its backend.

24:05.910 --> 24:08.550
So it was using HTTPS which is good.

24:08.550 --> 24:20.410
Problem is uh, the encryption is broken when we try to intercept and replace the certificate by a self-signed certificate, the device did not show any warning and it was continuing operating as normal.

24:20.470 --> 24:21.950
So, first problem.

24:21.950 --> 24:33.450
The second problem is the device is communicating with its backend using XML messages, a bit like soap, um, and we could easily intercept the content and modify the content on the fly.

24:33.450 --> 24:47.670
So, for example, when the device requests the software catalog, the server will reply uh, with a full catalog including the links uh, to the URLs for the install package and just with a status which is buy, install, or installed.

24:47.730 --> 24:52.710
So if the status is buy, the device when you will click on it will offer you to buy and pay for it.

24:52.710 --> 24:58.090
But if the status is just replay by install, the device will install it without having to pay for it.

24:58.090 --> 25:06.270
So the logic control is done at the client side which is very bad and it might remind you the first mobile apps you have been testing a couple of years ago.

25:06.430 --> 25:07.770
So, good stuff for us.

25:07.770 --> 25:10.670
We could get uh, access to paid apps for free.

25:10.670 --> 25:13.450
But our goal is to to go deeper.

25:13.870 --> 25:15.770
So, here is an illustration.

25:15.770 --> 25:24.170
You see we have just reply, replaced, sorry, the buy status by install and we were able to install the application um, on the device.

25:24.930 --> 25:31.890
Now, um, we did some analysis on what was an install package for a third party application.

25:31.890 --> 25:36.950
So, in the previous screenshots you've seen that we have the URL for the install package.

25:36.950 --> 25:38.650
So we downloaded a couple of them.

25:38.650 --> 25:45.570
Uh, you don't need any authentication so just a double you get with the URL and you could access uh, the third party application package.

25:45.570 --> 25:49.430
So we downloaded all of them and we started analyzing them.

25:49.510 --> 25:51.510
Uh, so what's an installation package?

25:51.510 --> 26:03.570
Basically it's a zip archive with inside a jar file so a java archive and one signature file which is a signed message digest uh, using RSA signature.

26:03.570 --> 26:10.790
So, we have tried to spend a little bit of time but we were not able to break the signature encryption which is good.

26:10.790 --> 26:20.250
Uh, once we opened the jar file we realized that the source code is not obfuscated which means with any of your favorite java decompiler you can access the source code which is good.

26:20.250 --> 26:24.970
However, the jar file by itself is signed uh, with some private keys.

26:25.050 --> 26:30.670
So, here we are facing a system with two different levels of code signature.

26:30.670 --> 26:33.650
So, does this mean game over?

26:34.010 --> 26:42.330
So, what we first try our first attempt uh, was to to play with the process of zip extraction.

26:42.330 --> 26:43.670
You will understand why.

26:43.670 --> 26:57.810
The very first step that the pro the app store is doing when you install an application is storing the zip file in a temporary area and extract it before because to check the checksum of the file its signature it first need to extract it.

26:58.470 --> 27:04.530
So, this is the piece of code in charge of unzipping the install package.

27:04.590 --> 27:16.690
And if you are good hackers and I believe you all are, you will immediately notice that if you have used a zip entry name you might be able because it's concatenated to do arbitrary file writing.

27:16.690 --> 27:23.530
So, what happens if you had a file to the archive with a zip entry something like dot dot slash dot dot slash something.

27:24.830 --> 27:27.050
So, we wanted to validate this.

27:27.050 --> 27:30.330
Obviously this is not going to work with zip with zip and zip.

27:30.330 --> 27:33.390
You will get the message removing trailing slash or whatever.

27:33.470 --> 27:36.330
But what happens with this dirty Java code?

27:36.330 --> 27:44.490
So, we created a crafted zip archive using any Python lib and you remember we don't yet have control on the device.

27:44.490 --> 27:49.670
So, if we want to see if this was successful we need to write somewhere we can check the file is created.

27:49.670 --> 27:56.450
So, so far the only thing we can do is plug a USB stick and check if we are able to extract a file to a USB stick.

27:56.450 --> 28:05.610
On QNX if you read a little bit of documentation you will find that the location of the USB stick is slash FS USB zero and then your USB device.

28:05.610 --> 28:12.730
So, we created this crafted zip file with a directory traversal uh writing an empty file on the USB stick.

28:12.730 --> 28:13.470
And you know what?

28:13.470 --> 28:14.230
It worked.

28:14.230 --> 28:22.330
So, this means that we have an arbitrary file writing without uh creating any warning on the device once you install a crafted installation package.

28:22.330 --> 28:24.110
So, good start.

28:24.290 --> 28:31.450
But now to take control on the device what we need to do is to be able to copy a file to a place where it can be executed from.

28:31.450 --> 28:33.930
So, it it brings you two problems.

28:33.930 --> 28:43.610
As we said most of the file system of the device are read only because if the device loses power it need to restart without having to do content integrity, file system checking and whatever.

28:43.610 --> 28:48.310
So, most of the file system are read only under normal operation excepting some of them.

28:48.310 --> 28:56.390
And the place where third party apps are stored is a read-write file system because you can install the applications, you can remove them, you can upgrade them.

28:56.390 --> 28:59.130
So, the file system has to be mounted as read-write.

28:59.130 --> 29:02.350
So, we need to write at this place and we need to find this location.

29:02.670 --> 29:08.930
The second thing is so this java archive those are uh Vladan mentioned Xlets.

29:08.930 --> 29:12.790
So, this is one of the G2ME uh implementation.

29:12.810 --> 29:20.830
The problem is we cannot build any application or rebuild the application if we don't have the vendor SDK or API or libraries.

29:20.910 --> 29:26.490
So, this is also one of the problem we have been facing and we will explain how we solved it.

29:27.270 --> 29:31.790
So, it is possible to decompile the java source code but impossible to recompile it.

29:31.790 --> 29:33.050
This is what we just said.

29:33.050 --> 29:35.070
But how about backdooring, patching?

29:35.230 --> 29:46.790
If you all have done some testing training, you have been doing disassembling, x86 modification, changing instruction, repacking and whatever.

29:46.790 --> 29:48.650
And what about doing the same with java?

29:48.650 --> 29:51.930
Because basically java what is that is java source code compiled.

29:51.930 --> 29:53.390
So, it is java bytecode.

29:53.390 --> 29:58.910
It is known as this and this is a portable code to be executed by the java runtime environment.

29:58.910 --> 30:05.570
But basically the bytecode is just assembly but for a different kind of machine and the machine is just java runtime.

30:05.630 --> 30:15.610
So, if you use java bytecode and you modify it with kind of a disassembler which exists, you can patch the java code without needing the SDK nor IPI.

30:15.770 --> 30:16.890
This is what we did.

30:16.890 --> 30:25.990
But remember what we said, the java archive itself is signed which means that if we modify the bytecode, the java runtime environment should refuse to execute it.

30:25.990 --> 30:32.830
So, because we didn't want to lose too much time, our first attempt was just to change a png icon from the java package.

30:32.830 --> 30:41.730
And when we installed the application, it refused to start which means that the jvm, the java virtual machine, refused our modified application which is good.

30:41.730 --> 30:43.890
So, here again, game over?

30:44.430 --> 30:47.090
No, we tried something desperate.

30:47.670 --> 30:52.430
We said, okay the signature is not good but what happens if we just remove the signature?

30:52.650 --> 30:53.830
So, guess what?

30:54.150 --> 30:55.310
It worked.

30:56.150 --> 31:00.330
So, if there is a signature and the signature is not good, reject the program.

31:00.330 --> 31:02.970
But if there is no signature, no problem, just start it.

31:02.990 --> 31:04.130
And it worked.

31:04.990 --> 31:13.190
So, now we are able to write on the file system and we are able to execute malicious code that we have created.

31:13.190 --> 31:15.810
So, the next steps are pretty straightforward.

31:15.850 --> 31:18.690
We just have to create a malicious payload.

31:18.690 --> 31:21.050
So, it is basically java source code.

31:21.050 --> 31:23.910
So, you just use the standard java sdk.

31:23.910 --> 31:27.530
You just have to pay attention to the java minor and major versions.

31:27.530 --> 31:31.370
So, basically your code has to be executable by the target.

31:31.390 --> 31:37.730
So, what you do, you analyze the source code you extracted and you are compiling with the same target version and it should work.

31:38.050 --> 31:44.050
And then you have to hijack the normal execution flow to redirect it to your malicious payload.

31:44.270 --> 31:53.430
So, here we've been using massively the USB connector of the car because we didn't want to recompile at every time our program.

31:53.430 --> 31:58.470
So, what we did is we just did a payload executable script shell which is on the USB stick.

31:58.470 --> 32:00.210
So, if we want to modify it, it's easy.

32:00.210 --> 32:07.090
You just plug the USB stick on your computer, modify the script shell and re-execute the application without having to reinstall or doing nothing.

32:07.890 --> 32:09.850
So, haltering the java bytecode.

32:09.850 --> 32:12.750
I told you modifying the assembly.

32:12.750 --> 32:13.910
So, it's pretty easy.

32:13.910 --> 32:20.990
You just have to basically add the invoke starting static, sorry, method which is calling your payload.

32:21.790 --> 32:25.790
For various reasons, I'm not going into how the GVM works.

32:25.790 --> 32:32.570
You also have to add the instruction to map your assembly code to some virtual line numbers of the source code.

32:32.570 --> 32:34.170
This is the way it works.

32:34.170 --> 32:38.390
So, it's not just one line but three instructions for it to get it work.

32:38.390 --> 32:44.410
But the fundamental instruction here is the invoke static which brings you to your malicious code.

32:45.890 --> 32:55.270
So now, every time the patched application is started from the user interface, it executes the script.sh located on our USB key.

32:55.370 --> 33:03.110
Um, I'm not going through the details because we have performed maybe hundreds or several hundreds attempts because we have no idea on the device.

33:03.110 --> 33:04.530
We are doing blind attack.

33:04.530 --> 33:05.770
We don't have the response.

33:05.770 --> 33:07.990
So, we were having iterative approach.

33:07.990 --> 33:14.270
We were writing commands in the script and collecting the output every time, editing the script and starting over multiple times.

33:14.510 --> 33:20.470
Um, in the end, our goal is still to get uh connectivity to the device with an interactive shell.

33:20.530 --> 33:26.430
So, remember the target device is using QNX and QNX provides something which is called QCon.

33:26.430 --> 33:31.550
And QCon is a debugging daemon for QNX used during the development phases.

33:31.550 --> 33:36.450
It allows you to do some profiling but more interesting for us to do remote code execution.

33:37.250 --> 33:40.830
Uh, problem, the QCon daemon was not part of the build.

33:40.830 --> 33:49.510
Because when you do production build, you remove any useless stuff that you won't need in production because you need to save space and time and whatever.

33:49.690 --> 33:52.110
So, QCon was not part of the build.

33:52.110 --> 33:54.150
But Telnet was for some reason.

33:54.190 --> 34:00.910
So, we couldn't use Telnet as is because Telnet requires authentication and we don't have the root password.

34:00.910 --> 34:02.470
But QCon does not.

34:02.510 --> 34:09.770
What we were able to do because we still don't have QNX license and our managers were not willing to buy us the license.

34:10.830 --> 34:12.890
We found QCon on the web.

34:12.890 --> 34:25.270
We were just downloading a Raspberry Pi image for QNX which was using the same distribution and fortunately the Raspberry Pi is using the same CPU instruction which is ARM v7.

34:25.290 --> 34:30.670
So, we desperately copied the QCon from the device and we executed and it worked.

34:30.670 --> 34:34.650
So, we had a QCon daemon working and we could interact with the device.

34:34.970 --> 34:38.330
So, obviously the first thing we tried is getting the root password.

34:38.330 --> 34:42.850
So, we got the shadow file and we managed to crack the password.

34:43.450 --> 34:46.490
So, now maintaining access and post exploitation.

34:47.230 --> 34:55.310
Because we don't want to repeat all of those steps every time we want to get access to the device, we needed to find a way to get persistent access.

34:55.490 --> 35:00.830
So, basically that means starting automatically either QCon or Telnet or both.

35:00.830 --> 35:03.890
We crack the root password because it's using Descript.

35:03.890 --> 35:07.230
The password length is limited to to eight characters.

35:07.230 --> 35:12.410
So, this could be cracked with a reasonably powerful system within few hours.

35:12.450 --> 35:18.890
This is optional because you can use QCon but it's nice because Telnet is much better for interactive shell than QCon.

35:18.890 --> 35:22.390
Because QCon doesn't have for example the background and whatever.

35:22.930 --> 35:32.750
So, we have to find a script on the device which reside on the read-write partition and which is executed at every boot time.

35:32.750 --> 35:35.550
So, it makes a lot of conditions but we still find one.

35:35.550 --> 35:45.150
When you're doing that, you need to be very careful because if you mess with a startup script, there is no reset to factory option because you will prevent the device to boot properly.

35:45.150 --> 35:52.370
So , you can't even go to upgrade mode and reinstall it and there is no reset to factory that will restore the content of your flash.

35:52.370 --> 35:54.250
So , if you mess, you crash the device.

35:54.250 --> 35:59.830
So, you have to be very careful during this step unless you will get a break.

36:02.030 --> 36:05.510
So, during the post-exploitation step, we were having some fun.

36:05.510 --> 36:11.730
First of all, we realized that all the personal data are stored in SQLite which is very common.

36:11.730 --> 36:14.790
This is the same for Android and and many other systems.

36:15.210 --> 36:34.250
So, what was funny if you are in a rental car and there has been several drivers before you pairing their phone with the system, you will get all their phone's names, MAC address, Bluetooth MAC address, phone books and if it's Android phones, you will also get the content of SMS inbox which is fun.

36:34.530 --> 36:55.490
The second thing is there is a lot of logins so you know where was the car and when with the GPS location, time and date and some events which is also interesting and it has been used in France for a criminal investigation where they could demonstrate that the killer was at the right place because the car had recorded this in the logs.

36:56.690 --> 37:07.490
For example, you can do some tuning, customizing the color, get a different GUI because it's just Flash and HTML5 HMI so you can customize it very easily and it's fun.

37:08.010 --> 37:09.610
And you can also play with the services.

37:09.610 --> 37:17.710
You remember when Vladan introduced the software architecture, it's using Dbus, so a common bus with a lot of services plugged on it.

37:17.710 --> 37:30.990
So, for example, the FM tuner, so from the command line you can change the station, you can change the volume from the command line, you can use the text-to-speech service which is used by the navigation to make the car speech to you and it's very fun.

37:31.010 --> 37:36.690
It's especially very fun if you re-enable Dbus TCP and remote access to the car.

37:36.690 --> 37:47.090
So if it's a rental car and somebody else is connecting the car after you and you get access back to the device, you can talk to the guy for the car which is very fun and that might be very scary for the guy.

37:48.330 --> 37:55.110
Most of the systems, uh, so all those services, Dbus services, are written in Lua.

37:55.570 --> 38:08.690
It's a modified version because everything is non-standard, but if you modified the decompiler, Lua decompiler, to bypass some checksums, some magic numbers, verifications, you are able to reverse it and obtain the source code.

38:09.130 --> 38:12.030
So it was very interesting for the, for the next step.

38:12.670 --> 38:21.010
Now the holy grail, the CAN bus, because all of this, we did it, uh, in the objective of getting access to the CAN bus and to the car critical systems.

38:22.790 --> 38:30.530
CAN bus is allowing access, we've told you, to the engine ECU, something less critical, air conditionings, uh, windows, whatever.

38:30.770 --> 38:33.990
And here we were facing a big frustration.

38:33.990 --> 38:38.490
The system we have tested did not have a full access to the CAN bus.

38:38.490 --> 38:44.830
It was actually going through a gateway and this gateway was responding to a proprietary protocol.

38:44.950 --> 39:00.430
So it was only giving access to, for example, the fuel consumption, the speed of the car, accelerometer, so that, for example, if the car is driving in the tunnel and there is no GPS signal, the GPS navigation system still knows which speed the car is going on.

39:00.670 --> 39:05.630
But it was a lot of frustration for us because we were not able to jump on the CAN bus.

39:06.570 --> 39:18.770
It was even more frustrating because the reason why it was not possible was not for, it was not a security countermeasure, it was not because, it was just because the device had a whole poor device design.

39:18.770 --> 39:24.030
So they had to put this gateway because the device itself didn't have the CAN transceiver on the board.

39:24.030 --> 39:27.030
So it was a lot of frustration for us.

39:27.350 --> 39:35.850
Now because we are at the hardware hacking village and we've many, we've mainly talked about software, we're gonna talk a little bit about hardware.

39:35.850 --> 39:38.670
So the box was dismantled.

39:38.810 --> 39:51.950
We have been using standard tools such as clamps, power supply, logic analyzer, oscilloscope and all the tools you can get to your favorite Chinese provider still.

39:51.950 --> 39:59.590
And we have been able to identify the pins you see, but we had no idea what was their purpose.

39:59.590 --> 40:06.350
So using the logic, the logic analyzer, sorry, we could quickly identify the console.

40:06.570 --> 40:12.250
So it's a serial console at 115 200 bow.

40:12.770 --> 40:16.730
Unfortunately, once you boot, you have authentication required.

40:16.790 --> 40:23.490
You know, if you do this on a standard Linux, you can boot in single user mode just by, by altering the kernel command.

40:23.490 --> 40:26.550
But with QNX, with the IPL, you cannot do that.

40:26.550 --> 40:32.970
The IPL, so initial program loader, which was on the device, did not offer this option.

40:33.250 --> 40:34.950
Authentication was required.

40:34.950 --> 40:37.710
So here we had to have the root password cracked.

40:37.710 --> 40:41.050
Otherwise, we were not able to get into the device.

40:42.590 --> 40:44.790
So this is what I just said.

40:44.790 --> 40:45.790
We had a problem.

40:45.790 --> 40:47.270
We needed this root password.

40:47.270 --> 40:51.290
So what other option doing the physical hardware attack?

40:51.290 --> 40:52.370
There was a FRAM.

40:52.370 --> 40:56.750
So the FRAM is a small uh memory chip using SPI.

40:57.010 --> 41:05.750
Because when the device is booting, it doesn't have the drivers to talk, to communicate with the big flash NAND, it needs an intermediate step.

41:05.750 --> 41:07.870
And this is what the IPL is doing.

41:07.870 --> 41:13.390
The IPL is loading the driver to communicate with the large NAND uh chip.

41:13.650 --> 41:27.470
And we found out that in this small eight kilobytes FRAM, there is obviously some uh persistent information such the MAC address of the device, Bluetooth, Wi-Fi, the serial number, maybe the build version.

41:27.470 --> 41:33.070
But there is mainly the QNX IPL, which is the driver for the next step.

41:33.070 --> 41:50.670
And our idea is if we modify the IPL, if we recompile it, offering the support to boot in single user mode by changing um the initial program from login to just KSH, then we can get access to the device without needing authentication using the serial console.

41:50.790 --> 41:59.670
So here, the work is still in progress, but we found the QNX IPL source code because it is provided by Texas Instrument on their website.

41:59.670 --> 42:04.510
So you just have to modify it, recompile it, and rewrite it in the FRAM chip.

42:04.550 --> 42:09.590
This is not a problem because if you remember, there is no secure boot because everything has been disabled.

42:09.590 --> 42:13.610
So you just have to recompile, write it in the device, and then you're good to go.

42:14.890 --> 42:19.530
Work is still in progress, maybe in a future talk we might be able to demonstrate it.

42:20.410 --> 42:30.390
So just to summarize, because some of you might be a little bit frustrated, our idea is if you are a good software and a good system hacker, don't be afraid of embedded and hardware hacking.

42:30.390 --> 42:45.810
Because here, hardware is just basically a computer, a normal computer with some specificities because the operating system is a bit different, you have a bit of constraint, but it's basically a computer which you can hack using the old techniques you've been learning for 10 years.

42:46.290 --> 42:51.610
So thank you for attending our talk, and if you have any questions, you're welcome.

43:09.740 --> 43:12.880
So the question was, are these disclosed to manufacturers?

43:12.880 --> 43:15.100
As far as we know, yes, they should be.

43:17.800 --> 43:26.400
So it's disclosed to the manufacturer, but if you remember the problem of OEM, the manufacturers don't necessarily have the capability to patch the firmware themselves.

43:26.400 --> 43:41.120
So they might have to go to their OEM provider, ask them to fix the problem, get a build, get it, and push it to the cars in operation, which might be a problem, because you might have maybe one or two millions of cars with vulnerable systems.

43:45.930 --> 43:49.610
Okay, if anybody has any questions later, we will be around.

43:49.990 --> 43:52.670
So thank you everybody, and see you around.

43:52.670 --> 43:53.350
Bye.

