start	end	text
0	780	Okay.
1720	4360	Good afternoon, every hacker.
5020	8600	For me it's a pleasure to be here for the second time in the Car Hacking Village.
8900	10940	So, yeah, let's go ahead.
10940	13400	Hacking a hard unit with a malicious PNG.
13400	15280	This is a zero‑day technique.
16540	18500	I hope you enjoy it.
18500	19120	Okay.
19300	27300	I'm the founder of Reverse Everything, the founder of the Pwn or Die, the most underground conference in all over the world.
27300	28280	It's in Ecuador.
28440	29500	You are invited.
29500	30380	It's very underground.
30380	31440	I really like it.
31440	39400	The founder of the Car Hacking Village, you are invited in Buenos Aires, the most important, biggest Latin American conference.
39400	41960	I am Howard Segura, my free time.
42680	47140	And my YouTube channel, if you scan the QR.
47540	52200	So we are talking about the KIA infotainment console, okay?
52200	61860	So in this case we have that KIA, KIA Motor Group manufactured the KIA infotainment console.
61860	66780	So in Europe, Russia, Australia use Linux Automotive OS.
66860	71260	In most of the cases the model G5WB.
71260	77500	In the case of the United States, Canada, Saudi Arabia, India and so on use Android Automotive OS.
77500	84400	But what about the rest of the countries, Latin America, what about the rest of the countries that I don't mention here?
84800	91300	So let's start with a reversing in all the ways KIA infotainment console.
91300	97820	So here we have the victim in this day is this one, okay?
98280	101920	So who has a KIA car?
103000	103960	Nice.
103960	106980	Do you recognize this time of infotainment console?
106980	110860	Maybe it could be the you, so it's vulnerable.
110860	120600	So this is the model, the high unit model, the high unit FCCID you want to check, the software version, the firmware version, okay?
121240	134560	When you disassemble, here we have many components, but principal we have to focus in the system of a chip that is an unknown system of a chip, TMM9200, no data chip, no information about that.
134620	148780	After that we have the microcontroller, the microcontroller is very old, so this board is a trash, it's a shit because it's like built with very many cheapest components.
148780	165060	So after that we have the EEPROM, the safe configuration information, we have also the flash SPI WB25Q128JB that have the firmware, all the firmware, after that we have another flash SPI that have another binary.
165060	169020	But principal these are the principal components.
169020	181200	So the system of a chip communicate with the SPI and also with the EEPROM and the SPI 2 megabytes of 2 megabytes have the factory binary, okay?
182500	188360	In the backside we have the power connector, CAN connector, USB, the antenna and the parking lights.
188680	203160	In the backside also we have a two touch screen controller, the ATMXT449 that is capacitive touch controller, like very similar to the red fingerprints, okay?
203160	208680	Another touch screen controller is the AK4183.
208800	215820	So this infotainment console is supplied to Kyiv by Motrix, okay?
216080	219520	This is the unique information that we have about this system of a chip.
219520	221260	No more information, okay?
221260	225920	I asked for the data sheet to the manufacturer, but now I need responses.
226200	235580	So here we have the system of a chip, manufacturer, the supplier, the old, the head unit and the end, it's Kyiv, it's the vendor.
237160	247400	When we dump the EEPROM we have the software information, universal, unique, identified number, also is printed in the board.
248080	259800	And when we need the communication between the EEPROM and the system of a chip in the boot process we have this kind of information, so there is information in the boot process with the EEPROM about the configuration, software and so on.
260180	270640	After that we dump the SPI WB25 16 and we see that in the boot process we don't have information, okay?
270640	278460	So from the block, a black box we are executing a hardware engineering process to understand what is going on in the boot process.
278680	285820	After that we have the dumping of the firmware because in this flash is the firmware.
286200	288420	All the magic is in this flash.
288580	289220	Okay?
289220	303640	After that we see that in the boot process there are communications, so that means that after the root boot, after the root boot, we have the second stage that is in this flash.
303640	308820	So we are going to check that in a few slides.
309920	313480	So we have communication through SPI.
313480	317220	Remember in AEPROM we have communication I2C.
317220	322420	In the SPI, in this firmware we have communication through SPI communication, okay?
322420	329440	And after that I realize that in the back side of the URL we have a UART access, okay?
329440	338820	So I proceed to soldering and this was very useful for execute a reverse engineering process through the UART locks.
339200	340080	Okay?
340120	342980	Next to that we have the binary parsing.
342980	357040	So this is very interesting because Bingwall lies us in this case because Bingwall told me that this binary is a Q and X boot block and so on.
357040	360520	And also the PNG files are not rendered well.
360520	368800	So Bingwall show me many false positives, 100% false positives.
368800	379500	So the solution was execute a manual extraction looking for the real magic bytes of the PNG, the JPEG files and so on.
379500	385060	So this file is like my SQL copyright is ‑‑ doesn't exist.
385720	392460	So also I realize that the Bluetooth information is saved in this raw binary in plain text.
392460	393420	Very dangerous.
393420	397120	Here we can see the Bluetooth password in plain text.
397120	399340	Also the connections, the contents and so on.
399340	401800	So very dangerous.
401800	407000	So Bingwall told me that, hey, this is a Q and X boot block.
407000	408960	But this is not true.
409760	421240	If you search the code, the source code of the Bingwall you can see that the magic byte of the Q and X is EB109000.
421240	423340	But this is not official information.
423340	424560	This is wrong.
424660	427380	And anyone, everyone choose Bingwall.
427380	434100	But if you search about this issue, it is still open, it is still not verified.
434100	438220	So Bingwall ‑‑ don't use Bingwall.
439120	440480	Okay.
441340	444360	So at this moment Bingwall is in version 3.
444360	447080	It's better than the version 2.
447120	449620	So it's less false positives.
450020	463380	So I reject that because when I disassemble this architecture is ARM thumb in big endian we have the magic byte is not a Q and X.
463380	471680	In this case the magic byte is a part of the branch link exchange instruction in the thumb architecture.
471800	472320	Okay.
472320	474380	So this is a call function.
474380	475160	Okay.
475400	480860	And we can verify that in the same address, 2D6572.
480860	481340	Okay.
482540	489040	So after many reversing process we have here the parts of the Bingwall.
489040	493360	So first of all we have a RAR file that have the recovery, you know, the factory reset.
493360	497440	After that we have another big RAR file that is the premain.
497440	498840	What is the meaning of the premain?
498840	501200	It is the second stage boot loader.
501220	513360	In this case we have the one image that appears in the boot loader process when you power on the unit, you are able to see a key image.
513440	520420	After that you have two key images that are not user, the boot loader binary and more information.
520740	524440	The third part is the 3D RAR file.
524480	525000	Okay.
525000	540140	So in this case we have the kernel, the file system and also here we have the certificates, the boot loader , the private key, the public key, one PNG file and three more RAR files as you can see.
540140	542840	That is part of this big binary.
543220	549560	After that you have the Bingwall and software information in a very short part of the Bingwall.
549560	552260	And after that, very dangerous, the Bluetooth data in plain text.
552260	554760	Bluetooth connection, Bluetooth password, Bluetooth name.
554840	559680	And after that if you pay attention here we have 882 PNG files.
559820	560360	Okay.
560360	573640	So all the displays, all the images that you see in the display, all these images are PNG files that are loaded from the firmware in the boot process.
573640	575680	All these images.
575680	578520	The home, the seats, everyone.
578520	592660	They are all ‑‑ so after I get all the images as you can see, okay, so let's start to analyze this real‑time operating system.
592840	600400	As you can see here we have 110 tasks identified at the moment, identified at the moment as you can see.
600560	616440	So remember the main real‑time operating system is the function that run a loop, you know, so after the boot process, after the system and application init, initialization application and system in for hardware verification process integrity and so on,
616440	623140	we enter in a main application task that is the brain of this real‑time operating system, okay?
623600	635300	So yeah, as you can see, we have here set application state, initialization hardware drivers, initialization of the services systems and so on.
635300	652960	And here we have the loop that manage, you know, the log status, the process events, the handlers and create the event, dispatch, the state transition, ensuring the system remains operational and responsible to events or commands.
654120	663020	We have here many PNG functions, a lot of PNG functions live, around 100 functions just with PNG functions.
663020	675020	Anyway, all these functions are renamed by me because in the thing where we don't have variable names, function names, so I invented these names of the functions also.
675020	680260	So it's interesting here because many functions are regarding to the live PNG library detection.
680260	701280	Remember, live PNG library is the library that allow us execute the PNG process to the verification, the checksum verification in the each header, you know, the header, the data, the chunk data and the EN all have CRC verification process, okay?
701280	707300	So here we have many, many, many functions regarding to this library.
708340	710260	More functions about PNG.
710360	719760	So after that, if you visit the page of the manufacturer of the system or chip, you can see.
719940	722420	Remember, here I have two options.
722420	731840	Android Automotive OS, Linux Automotive OS and the tier that it is right now is show it is IRTOS.
732100	743840	So here you can verify the name IRTOS because in the binary there are strings about the path or where is the, you know, the files.
743840	747260	So here we have IRTOS, IRTOS solution, IRTOS.
747260	751020	So the name of this real time operating system is IRTOS.
751400	759920	This is all the technical information about that, you know, ARM, Cortex A9 is developing in C, libraries.
760180	766420	At the moment there are vulnerabilities like the Bluetooth is implanting things in the URL loads.
766420	768720	There are two private keys recovered from the firmware.
770000	776680	Many things because we have like our own three private keys and four public keys.
777400	789060	The real time operating system use vulnerabilities like metric SSL that has CBEs, also like PNG version have more CBEs.
789060	792560	So let's start test the boot loader process, okay?
792560	796700	So to do that remember that in the firmware we have many RAR files.
796700	801400	In this case the RAR files are compressed with version 4.
801400	804260	So that's the reason that I don't change anything.
804260	826180	I just take the binary of the second boot stage process, see, second boot loader stage, and I just compress with RAR version 4 and I patch the firmware with this new compress to check if there are integrity process in the boot load process, okay?
826720	830780	So as you can see, the system don't boot.
831560	836280	It appears a white image, okay?
836280	837360	But don't give up.
837360	839020	Let's continue testing more.
839120	841520	So, you know, remember, power die.
841520	842840	I don't want to die.
843320	846100	So at this moment the room board is okay.
846100	852440	As you can see, the first stage boot loader, the signature, the crypto key is perfect as I was testing.
852560	855700	So let's test the second stage boot loader, okay?
855780	866000	Because remember, the pre‑main binary is the second stage boot loader that loads the entire main binary that is the real time operating system.
866000	870060	And after that you can use the hard unit.
870300	901760	So as you can see, I realize that there are no integrity in the 882 PNG files because we have a secure boot loader in the room board, the second boot loader also has integrity check process also in the main real time operating system and the beginning of the main function of the real time operating system also there are integrity verification.
901760	913240	But when the PNG functions are loaded from the firmware to the ROM in the system of the chip, there is no integrity verification process.
913240	923880	So it's like we have here a bridge, a secure boot loader and after that the 882 PNG files without verification integrity.
923880	930100	So you can verify this in the pre‑main and also in the main function, okay?
930100	940640	So here we have the init system and boot loader, the initialization boot loader system function, the flash detection function loop, the detect flash device as you can see.
942670	952220	So here we have the second stage boot loader and here we have the part where the ‑‑ okay?
952340	959900	So also in the ‑‑ remember in the main function of the real time operating system we have here.
959900	977760	Our information through your logs, flash detection, memory uses logs and here we have also the plane of the main task of the real time operating system where the file system is mounted and in this part is where all the PNG files are loaded, okay?
977760	986280	And basically after that we have more functions, more talks, but this is the main.
986280	988540	The main application task.
988540	990680	So let's go to check.
990680	1000000	So this is ‑‑ in here we have the vulnerability because in this line it appears the file system mounting process, okay?
1000000	1001900	But what is going on here?
1001900	1012060	The application, you know, the UI daemon execute a file open cause to the operating system.
1012060	1026520	So basically the operating system reads the raw PNG bytes from flash into the main memory via the system which is memory controller and boot fabric and after that this is ‑‑ passes to the leaf PNG function, okay?
1026520	1041400	So basically the leaf PNG library just pass the headers, execute verification process into the image, they compress the EDAT channels and produce a compressor RGBA buffer in RAM.
1041400	1043640	But what is going here?
1043640	1059480	Leaf PNG checks don't are useful if you don't ‑‑ if you don't ‑‑ if you don't execute integrity verification process of the hash of the entire image, basically leaf PNG checks don't are useful, okay?
1059480	1079960	So that's the reason that right now we have here the most elaborated QR phishing in the automotive world because basically I infected this was the hello world for this vulnerability so I changed this with this image with the world hack and here we have hack world.
1079960	1086180	When I realized that was, hey, this is danger and the boot process don't detect this change.
1086180	1092600	So I can change whatever image that I want, defacement, execute defacement and so on.
1092600	1095100	So you are thinking that it's possible.
1095640	1097180	Absolutely, yes.
1097180	1100900	But at the moment I am going to show the QR.
1100900	1104560	So QR phishing attack through parking tickets, no.
1104560	1108540	Let's go to execute a very sophisticated QR attack.
1108540	1123920	So in this case, after many attempts and after many reversing process I realized that to execute these back door requirements we need that the fake image would be the same size as the original image.
1123920	1138560	If the fake image is smaller than the original, the image will not render if it is compressed so the image has to be all the metadata, all the PNG headers because it is verified by the, remember, leaf PNG library.
1138820	1143480	So it is possible to replace any image as long the same offset is maintained in the firmware.
1143480	1151120	So you achieve this retype, you are able to execute, inject whatever image.
1151120	1158200	In this case, this is the official QR that redirects to the KIA web user manual as you can see.
1158360	1169960	But I created the image with Inkscape that completes all the requirements, you know, the same size, the same pixels and so on.
1169980	1176920	And after that I create this tool that I will publish right now after I finish my conference I will publish this.
1178020	1183820	So I create a phishing web page.
1183960	1184260	Okay.
1184260	1186180	As you can see, it's very similar.
1186280	1194300	I just added the download button to download a malware application for the Android phones.
1194300	1200840	So you can see in this case the malware is an official KIA app infected with a bug there with our Android detection.
1200840	1204920	So as you can see, my KIA app installed it was correctly.
1204940	1209120	So when you open, basically I have access to the phone.
1209300	1218660	What are the ways to infect that is through USB and also with hardware hacking, executing a flash, flashing the malicious firmware.
1218660	1219340	Okay.
1219580	1225400	For finish, let me show you the demo.
1228780	1233300	I need to scan the QR because in the QR I have the manual.
1233300	1234880	I have everything about the car.
1234880	1235700	This is a new car.
1235700	1237980	So I'm going to scan the QR.
1238140	1239000	Where's the QR?
1239000	1244440	It's in the hard unit in the setup system and manual.
1244460	1246600	As you can see, here we have the QR.
1246600	1250780	I'm going to scan but what is going on?
1250780	1260020	As you can see, this redirects to a new official KIA web page because this is not a manual KIA web page.
1260020	1262860	As you can see, the domain is driversout.com.
1262860	1266220	This is set up in my own web page.
1266480	1273160	But as you can see, it's very real KIA.
1274240	1275420	I don't know.
1275760	1278640	Maybe here, start and so on.
1279100	1281120	Setup and so on.
1281360	1284300	So hey, what I have here?
1284300	1287720	I have here download KIA official app.
1287720	1289200	Let's go to download.
1289780	1292180	I already downloaded it previously.
1298140	1304100	So here is .99 megabytes and so on.
1304100	1308760	But anyway, I'm going to stop because the application is this one, kia.apk.
1308760	1319200	This is a malicious application that if I install more details, it started scanning.
1320080	1321900	App is started.
1322040	1322800	Okay?
1323340	1334300	So before open, at this moment, I'm going to this is the big thing here.
1334300	1336200	I have the interpreter.
1336200	1343120	So this is the C2 where I am able to get the connection on the Android cell phone.
1344040	1345200	Okay.
1346280	1348720	Let's go.
1349000	1351760	I'm going to open the application
1355250	1360250	and immediately I have drivers out.
1360590	1363450	As you can see, I have access to the form.
1363450	1364850	So let me show you.
1365590	1368690	Android 14.
1368990	1372470	And I'm going to put, for example, get your ID.
1372530	1376910	I'm going to dump the SMS, for example.
1379210	1383490	So basically I have access to the cell phone.
1383490	1386670	I will show the results.
1386810	1389130	So here we have.
1391350	1402970	So I was able to get access to the cell phone to, you know, have a location, contacts and CMS is down, recording the microphone.
1402970	1405010	This is very dangerous.
1405290	1405970	Yeah.
1405970	1410870	At the moment, this is, kia will create a CBE about that.
1412790	1413830	Yeah.
1414470	1416670	But it's the moment, it's a zero day.
1416670	1420330	Because kia will not patch that.
1420330	1420970	Okay?
1420970	1423830	So that's the reason that I decided to show it in this conference.
1423830	1424810	Thank you so much.
