WEBVTT

00:00.000 --> 00:01.220
Welcome, everyone.

00:01.620 --> 00:04.380
Unfortunately, the screen will not be working.

00:04.400 --> 00:06.860
So some things might be hard to follow.

00:06.860 --> 00:10.540
But just know that if you don't understand something, it's not you.

00:10.540 --> 00:11.600
It's the screen.

00:12.660 --> 00:15.860
So anyway, my name is Aleksandr Lazar.

00:15.880 --> 00:21.220
I'm a security researcher at Bdefender and today we'll talk about cameras.

00:21.440 --> 00:23.860
Specifically, Dahua devices.

00:23.860 --> 00:30.100
How to get their firmware and two vulnerabilities that can be turned into code execution.

00:31.420 --> 00:33.360
But first, why cameras?

00:33.420 --> 00:40.080
Well, in the year 2025, people still expose their webcams to the Internet.

00:40.900 --> 00:46.080
Most of those devices have simple exploits that are also reliable for multiple versions.

00:46.080 --> 00:49.060
So it makes them the perfect targets for a botnet.

00:49.500 --> 00:58.380
Then there were recent military reports that these security cameras are being hacked in order to follow logistic movements.

00:59.420 --> 01:05.200
And another case where a ransomware gang used a camera to pivot inside the target network.

01:05.600 --> 01:09.560
So maybe we should pay a little bit of attention to these security cameras.

01:10.300 --> 01:11.680
But how do we do that?

01:12.320 --> 01:16.320
Well, to check if a camera is secure, we need to know what runs on it.

01:16.320 --> 01:18.040
And this means getting its firmware.

01:19.020 --> 01:20.680
There are a couple of ways to do this.

01:20.680 --> 01:28.900
We have the easy way by downloading it from the website or getting it through a UART shell or simply intercepting an update.

01:29.440 --> 01:31.600
Then we have the hardware way.

01:31.600 --> 01:32.600
Telepathy.

01:32.880 --> 01:33.300
A.K.A.

01:33.300 --> 01:34.480
memory reading.

01:35.240 --> 01:40.800
So for Dahua we had multiple devices, three cameras and an XVR.

01:41.300 --> 01:44.180
Two of the cameras and the XVR, it was okay.

01:44.180 --> 01:47.220
They had their firmware online, we just got it from their website.

01:47.620 --> 01:50.500
For the other camera, we had to read the flash ROM.

01:50.500 --> 01:57.520
And to do that, first you search for the data sheet of the chip to find the pin out.

01:58.200 --> 02:00.500
Then you have to connect the reader.

02:00.500 --> 02:03.680
In this case we used a bus pirate, but anything should work.

02:04.680 --> 02:09.160
And of course you have to desolder the chip first before connecting the reader because there might be interference.

02:10.880 --> 02:18.660
Flash ROM didn't work for this particular brand of chips, so we wrote a Python script using the commands that we found in the data sheet.

02:19.060 --> 02:25.560
But okay, we got the firmware from the chip, we have the firmware from the websites, what do we do now?

02:25.740 --> 02:30.160
Well, we don't want the firmware per se, we want the file system.

02:30.440 --> 02:32.280
So we need to extract it.

02:32.640 --> 02:40.620
Two of the cameras, we had an easy way with it because simply you extract the archive and use bin lock on the files.

02:41.160 --> 02:43.280
The problem was with the other two devices.

02:44.920 --> 02:52.160
The archive still contained files that had suggestive names like web.squashfs.

02:52.360 --> 02:56.760
But when we used bin lock on them we only found U image headers.

02:57.900 --> 03:04.040
The files were high entropy, so this means they are usually either compressed or encrypted.

03:04.900 --> 03:09.360
There were also Zlib signatures when you used bin lock on them.

03:09.480 --> 03:18.180
And these usually are false alarms, but when we extracted those we found strings, we found file names, even code.

03:18.180 --> 03:20.530
It was JavaScript but still code.

03:21.160 --> 03:23.760
So maybe not encrypted.

03:24.640 --> 03:30.820
At first we thought it might be a custom compression scheme that you usually find on those devices.

03:31.400 --> 03:41.900
But this was partially confirmed by the fact that the zip file signature which is PK was replaced by DH, presumably from Dahua.

03:42.220 --> 03:52.180
Also we had U image headers on the file system files which is not at all common and especially on a web cam.

03:52.760 --> 03:58.100
So the kernel wasn't readable either, so we had to go to the beginning, the boot loader.

03:59.120 --> 04:06.020
It was in the same archive, it wasn't encrypted and it was a U boot variant so time to load it in Ghidra.

04:07.120 --> 04:11.540
To do that you can use bin lock to see the layout of the file.

04:11.640 --> 04:17.200
And in this case just ignore the U image header and go for the LZMA compressed data.

04:18.300 --> 04:22.820
You then carve the file out with DD and extract it.

04:23.020 --> 04:32.260
The LZMA utilities might complain about some corrupt data on these specific devices, but you can use the Python modules, they don't complain, just do their job.

04:33.340 --> 04:39.500
Okay, so extraction looked good, we had strings, we had constants, so we had something valid.

04:41.000 --> 04:48.140
Load the binary in Ghidra with the R64 architecture on Little India and this is specifically for XVRs of Dahua.

04:48.580 --> 04:53.200
A base address of zero will work so time to have some fun.

04:55.060 --> 04:57.940
Where do you start when you load the boot loader?

04:57.940 --> 05:06.920
Well, you go for the constants, either strings or in this case because we suspected encryption we went for the AES substitution box.

05:07.300 --> 05:12.580
So check its references and go up the call tree until something starts to make sense.

05:13.100 --> 05:20.660
Here we found some strings like uboot encrypt file or firmware get key, so obviously we were on the right path.

05:22.340 --> 05:28.180
Judging by those strings and the nested if structure of the function, the decoding was happening in four steps.

05:28.180 --> 05:35.980
First we had the firmware, getting the firmware key, then setting key factors, then setting flags, then uboot encrypt file or so they call it.

05:36.760 --> 05:37.520
Okay.

05:38.100 --> 05:40.640
The first step is getting the firmware key.

05:41.100 --> 05:51.060
And I will show you the function but what basically happens there is that we have hard coded bytes that are copied inside a buffer.

05:51.480 --> 06:00.040
Those hard coded bytes appear to be the same on multiple devices but the first six bytes will be replaced with the processor name.

06:00.220 --> 06:04.600
So this firmware key will be different for different device types.

06:05.100 --> 06:07.340
Then we had three functions.

06:07.480 --> 06:12.180
And you can deduce they are hashing functions by looking at the constants in them.

06:12.600 --> 06:14.360
You need to find the algorithm still.

06:14.620 --> 06:20.520
Well to do that you can get those constants, plug them into chat GPT and get the wrong answer.

06:21.000 --> 06:26.060
And then with one option removed you will deduce it's shot to 56.

06:26.760 --> 06:34.940
Okay so they got a 32 bytes hash, they wanted a firmware key that's 16 bytes so they just store the first byte with the last one and so on and so forth.

06:36.780 --> 06:41.680
So we have the 16 bytes buffer which is the firmware key and it's time for the key factors.

06:42.280 --> 06:47.700
This step is different for the kernel and the file system but we'll focus on the file system.

06:49.480 --> 06:54.200
So they just set an empty buffer and use it as a parameter to the next function.

06:54.860 --> 07:01.280
The firmware key that we got from the first step will not be used here so we expect some other hard coded stuff.

07:01.940 --> 07:02.900
Let's go deeper.

07:04.080 --> 07:16.820
Here we will see, I mean you don't see but you see a nice little function with some bit wise operations, buffers that are hard coded and it can be a bit daunting at first when you see such a function.

07:16.820 --> 07:19.640
But it gets better if you take it step by step.

07:20.080 --> 07:23.940
First you need to find what those many function calls actually do.

07:24.260 --> 07:25.840
And in this case it was pretty simple.

07:25.840 --> 07:27.940
We had mem set and mem move.

07:28.380 --> 07:33.120
And for basic functions like this you can pretty much deduce them from context.

07:33.200 --> 07:40.100
For example, if you have two buffers as a parameter and a size you can probably guess it's a mem copy or a mem move.

07:40.300 --> 07:45.380
If you have a buffer and a size again you can guess it's a mem set .

07:45.800 --> 07:54.220
You can pretty much guess and then check for those guesses and it makes this whole reversing process a whole lot quicker.

07:54.860 --> 07:59.380
Okay, we have two functions left besides those mem copies and mem sets.

08:00.380 --> 08:04.060
And the first one had bit wise operations.

08:04.080 --> 08:06.840
Which and hard coded buffers.

08:07.080 --> 08:12.560
You can look those buffers up and in this case we found a match with the AST tables.

08:13.320 --> 08:19.220
Usually you might not find an exact match especially on AES because there are multiple implementations.

08:19.220 --> 08:23.200
You have hardware accelerated or fast implementations.

08:23.200 --> 08:29.840
But if some bytes match you can probably assume it's AES unless they modify some constants which happened before.

08:30.020 --> 08:31.940
But I digress.

08:32.080 --> 08:37.460
Okay, besides these T tables we had a loop that could go 10, 12 or 14 iterations.

08:37.520 --> 08:43.180
So if you are familiar with the algorithm you will probably guess it's the AES key expansion part.

08:43.640 --> 08:51.120
Okay, we have AES key expansion then the next function is probably some AES mode of operation.

08:51.120 --> 08:52.680
But we need to find it.

08:53.460 --> 08:55.900
This function had five parameters.

08:55.900 --> 09:00.400
It had probably the key, size, input and output.

09:01.000 --> 09:08.280
The fifth one could either be a flag for encryption or decryption but in this case we had a buffer so it's probably an IV.

09:08.740 --> 09:14.520
Still, AES has multiple modes that work with an IV like CBC, CFB, OFB.

09:14.560 --> 09:17.860
But you can again make assumptions.

09:18.040 --> 09:22.440
You take the most common mode of operation which is CBC and then check for it.

09:23.820 --> 09:29.180
Here we found something that looked like a high level AES CBC operation.

09:29.180 --> 09:37.820
So first you store the IV with the plain text then you call the block function and then the resulting cipher text will be the new IV.

09:38.460 --> 09:43.780
We found something similar so we just said okay, it's AES 256 CBC.

09:44.860 --> 09:51.700
Still, you need to find the parameters and you just go at the bottom, take each parameter one by one and see where it's modified.

09:52.400 --> 09:59.040
The IV was created in one wild loop and it consisted of six unique characters.

09:59.740 --> 10:07.080
The key was created in two loops and this time the bytes were incremented from 20 to 30 and 23 to 33.

10:08.280 --> 10:14.300
You still need the plain text and here we had two hard coded buffers, 32 ints and 32 bytes.

10:14.300 --> 10:19.200
These are the buffers that will be different for the kernel decryption and file system decryption.

10:19.500 --> 10:27.240
So those two buffers were added together, summed to 600 and divided again, cast to a byte and some other operations.

10:27.320 --> 10:29.620
But we obtained the plain text.

10:30.900 --> 10:34.740
Okay, 32 bytes plain text, we get a 32 byte cipher text.

10:34.740 --> 10:40.980
The last 16 bytes of this cipher text will be concatenated with the firmware key that we got in the first step.

10:40.980 --> 10:50.180
So at the end we have 32 bytes which from what we've already seen, it looks a lot like an AES key.

10:51.860 --> 10:57.520
Okay, we have two steps left, the setting flag step and the U-boot decrypt file step.

10:57.560 --> 11:04.000
And we take them together because it's easier to understand them and this setting flag step is not present on all devices.

11:06.060 --> 11:13.360
So we have a function with either seven parameters or five parameters if the setting flag step is not present.

11:13.360 --> 11:16.820
We'll go the XVR route which is with the seven parameters.

11:16.820 --> 11:18.620
Two of those from flags.

11:18.620 --> 11:24.000
Then we have the input address and its size and the output address and its size.

11:24.140 --> 11:26.220
Those two addresses are the same.

11:26.220 --> 11:28.820
So we will have in place decryption.

11:29.120 --> 11:31.680
Then a flag for either encryption or decryption.

11:33.440 --> 11:34.160
Okay.

11:34.160 --> 11:35.860
So we have the function.

11:36.060 --> 11:36.580
Yeah.

11:38.360 --> 11:43.260
And because we already named some other functions, this time it will be much faster.

11:43.260 --> 11:54.600
We have the buffer up there, we have the AES key expansion function and then in an if else statement we have the AESCBC encrypt function that we have already seen.

11:54.700 --> 11:56.820
So I wonder what could be in the else.

11:57.580 --> 11:58.500
Okay.

11:58.860 --> 12:02.660
We found a function for decryption but again we need parameters.

12:03.100 --> 12:08.340
We have a size of 200 X so it means we decrypt 32 blocks at a time.

12:09.280 --> 12:12.680
The IV will start at zero and it will be incremented.

12:12.760 --> 12:16.240
They cast the first four bytes to an int and increment those.

12:17.860 --> 12:18.280
Okay.

12:18.280 --> 12:22.400
We also have the input pointer and the offset that is added to it.

12:22.400 --> 12:28.560
So you decrypt 32 blocks, you increment the offset with 200 X and so on and so forth.

12:28.900 --> 12:35.360
The problem was that at some point this offset will be incremented by more than 200 X.

12:35.720 --> 12:39.640
So this means that some blocks will be skipped and not decrypted.

12:39.720 --> 12:43.960
And because we have in place decryption, they will remain in the output unchanged.

12:44.500 --> 12:55.940
So this basically solves the mystery of how we managed to find strings and file names and code inside the supposed encrypted block.

12:56.640 --> 12:59.300
Those blocks were never encrypted, just partially.

13:00.660 --> 13:01.420
Okay.

13:01.680 --> 13:12.680
To recap, we have the key from the first two steps, we have the IV, we have the algorithm which is AS to 56 CBC and we just need to find the input.

13:14.080 --> 13:20.420
If you remember earlier we have file system images with an image header which is 64 bytes in size.

13:20.600 --> 13:26.700
This header has a size field and the value of this field matched the number of bytes following the header.

13:27.100 --> 13:35.360
So again we carved those bytes out with DD, we plugged them into the decryption algorithm and great success.

13:35.540 --> 13:40.260
We have the file system, we have the files, now what?

13:40.700 --> 13:41.320
Okay.

13:41.320 --> 13:42.800
Now we go ham.

13:43.140 --> 13:45.440
First we map the attack surface.

13:45.900 --> 13:50.700
The binary that does everything will be called either Sonya or challenge depending on the device.

13:50.840 --> 13:52.860
This is where the listeners will be.

13:53.200 --> 14:04.160
If you only check the open ports with N map for example, you will only find three open ports for HTTP, RTSP and DHAP which is a custom protocol for Dahua.

14:04.400 --> 14:11.460
If you actually look at the listeners in the binary, you see that they cram protocols on the same port.

14:11.760 --> 14:19.020
So they use the reg X to parse the incoming packet and then select the correct handler for the respective protocol.

14:19.960 --> 14:30.980
So after seeing that, we discovered about 10 to 16 protocols depending on the device like UPNP, web socket handlers, RTSP over HTTP from 10 to 16.

14:31.760 --> 14:36.120
The problem was that not all were enabled on all devices.

14:36.280 --> 14:39.360
And most of them actually used authentication.

14:40.340 --> 14:48.540
Still as always there are handlers that don't use authentication and one of them was of course found on HTTP.

14:49.740 --> 14:59.080
On HTTP a client can use cookies, sessions, authorization headers with all kinds of hashes and most of them were pretty well implemented I might say.

14:59.300 --> 15:07.260
But there were a few handlers without authorization and one of them was called RPC2 upload file with name.

15:07.260 --> 15:12.100
But despite the name, the problem wasn't that you could upload files.

15:12.200 --> 15:15.740
Those files were just empty freeze that had a fixed path.

15:16.200 --> 15:18.880
The problem was that they parsed the header incorrectly.

15:20.640 --> 15:26.220
So usually you have the classical usage of the N string functions in C.

15:26.540 --> 15:33.960
You copy a string into a buffer but then instead of using the size of the buffer you use the size of the string.

15:34.320 --> 15:41.500
Here the CSEC header will overflow into the BSS section after only 34 hex bytes.

15:42.320 --> 15:44.500
The binary crashes of course.

15:45.560 --> 15:50.220
In BSS you mostly find global variables or static variables.

15:50.540 --> 15:57.760
Here we have overwritten a pointer so I already thought I had to get out the maloc malificarum to exploit it.

15:58.000 --> 16:07.760
But before we go deeper into the arcane magic that is heap exploitation, I wanted to check why the program actually crashed.

16:09.320 --> 16:17.000
The pointer we overwritten turned out to hold some structure related to the sessions, the HTTP sessions.

16:17.380 --> 16:24.540
First I thought I will recreate this structure in memory and give myself a session in order to increase the attack surface.

16:25.280 --> 16:27.360
But the crashing function gave me hope.

16:27.360 --> 16:34.380
So it was checking for the token expiration and if this token will be expired it will delete it.

16:34.380 --> 16:41.100
But this deletion happened with a function pointer that was stored in the same structure I wanted to overwrite.

16:42.380 --> 16:45.160
So the plan should be simple now, right?

16:45.420 --> 16:51.000
Rewrite the structure in memory and replace this cleanup function pointer with a system call maybe.

16:51.780 --> 16:56.380
The problem was that I didn't have a debugger because I didn't have a shell.

16:56.860 --> 17:00.080
Okay, I didn't have a debugger anyway but you will see why later.

17:00.820 --> 17:10.760
We also had another camera that had shell access but that camera didn't have the HTTP service so we couldn't do some parallel reconstruction on it.

17:11.900 --> 17:17.700
So first I tried static analysis but the results, not the best.

17:17.720 --> 17:28.100
We had linked lists, dictionaries, pointers to pointers, some structures had cookies in them that were checked so it was very hard getting it right in one shot.

17:28.380 --> 17:39.280
But thankfully this camera had a TX pin enabled so when it crashed it printed the registers and the registers are usually all you need to make an exploit.

17:39.280 --> 17:44.440
So I started rewriting the structure step-by-step one crash at a time.

17:46.100 --> 17:51.160
Most of the crashes were just null pointer references or illegal memory accesses.

17:51.280 --> 18:02.080
When I met one of those I just looked at the program counter, the register that caused the crash and made that register point inside my structure so it wouldn't crash anymore.

18:02.700 --> 18:07.420
If you do this 15 more times the program will still crash.

18:07.940 --> 18:12.800
But this time it will be with the program counter not in the code section error.

18:13.100 --> 18:15.360
And that is when you know you've made it.

18:16.120 --> 18:16.860
Okay.

18:16.920 --> 18:18.380
Where is the function pointer?

18:18.380 --> 18:19.980
You replace it with system.

18:20.660 --> 18:22.580
But we need a payload to run.

18:23.620 --> 18:30.180
We didn't have reverse cell utilities on the camera like netcat but we had TFTP so we could download files.

18:30.800 --> 18:35.660
The problem was the kernel didn't run unsigned binaries.

18:35.900 --> 18:38.800
So we couldn't run just anything.

18:39.620 --> 18:42.060
Pretty impressive protection for a webcam.

18:42.160 --> 18:47.320
Still we could load libraries using the LD preload privilege escalation trick.

18:48.540 --> 18:55.300
So we needed a shared library that was compiled for that specific architecture and thankfully we had a tool chain.

18:55.600 --> 18:58.640
And if you remember earlier I said I didn't have a debugger.

18:58.640 --> 19:00.580
But that's not for lack of trying.

19:00.880 --> 19:07.780
Turns out it's much more difficult than it sounds to cross compile GDB server as a library that runs when it's loaded.

19:08.260 --> 19:09.040
Still.

19:09.660 --> 19:17.120
With that effort left me with a good tool chain and I will show you the command but I can't and I won't spell it because it's very long.

19:17.420 --> 19:22.020
So just be careful when you use build root to use a hard floating point.

19:24.220 --> 19:24.880
Okay.

19:24.880 --> 19:31.860
We compiled a bind shell, made a payload to download it with TFTP and we got root.

19:31.860 --> 19:33.520
You can't see it but we had root.

19:33.520 --> 19:34.460
Just trust me.

19:37.130 --> 19:37.870
Okay.

19:40.980 --> 19:42.520
We had one root.

19:42.860 --> 19:44.160
Time for a second one.

19:45.520 --> 19:48.460
The previous exploit was on the HTTP service.

19:48.980 --> 19:55.260
And this one will be on ONVIF which is specific to IP cameras.

19:55.340 --> 19:59.180
It's still HTTP but it uses some different parsers.

19:59.900 --> 20:05.840
You have the classical ONVIF end points but everything interesting is usually behind authentication.

20:06.380 --> 20:12.280
We had access to getter functions but as the name says they don't parse parameters.

20:13.420 --> 20:23.460
We had the get capabilities and get service capabilities and those would take the host header and use it to display the end points to a client.

20:23.660 --> 20:25.140
The available end points.

20:25.480 --> 20:27.360
So we only control the host header.

20:27.360 --> 20:32.260
This was the only thing that these end points parsed and guess what?

20:32.260 --> 20:34.060
They did so incorrectly.

20:34.940 --> 20:40.240
If this header didn't have a square bracket in it everything was good.

20:40.480 --> 20:44.400
My header would be copied on the stack but the size was checked.

20:44.400 --> 20:45.840
Only 64 bytes.

20:46.060 --> 20:57.880
If we imitated an IPV6 and put a square bracket in our host header the size checking would be skipped and everything copied on the stack.

20:58.120 --> 21:00.880
So we had a classical stack based buffer overflow.

21:01.220 --> 21:03.560
But we need to set some conditions for it.

21:04.000 --> 21:07.280
We control seven registers from R4 to R11.

21:07.480 --> 21:11.160
Then the function that causes the problem is string and copy.

21:11.160 --> 21:17.440
So in our payload we only have access to one null byte and it must be the last null byte.

21:18.280 --> 21:19.960
Why is that a problem?

21:20.260 --> 21:24.180
The code of the camera is not position independent.

21:24.180 --> 21:27.760
So on every run it will be loaded at the same address.

21:28.020 --> 21:31.600
The problem is it's a low address so it contains a null byte in it.

21:31.800 --> 21:36.300
This means our rope chain that we want to create can only contain one gadget.

21:36.820 --> 21:47.340
And usually when you only have one gadget at your disposal you go for a system gadget because it's just easier and you have the greatest chances of getting code execution.

21:48.040 --> 21:50.700
So we had a system gadget.

21:50.700 --> 21:55.340
We could put an address to a payload in R6 which we control.

21:55.500 --> 21:58.160
But still we don't have a payload.

21:58.420 --> 22:03.820
You won't find some bind shell or reverse shell string on a camera.

22:04.640 --> 22:08.440
So we need a way to store the payload and a place to store it.

22:08.700 --> 22:10.380
The place should be easy.

22:10.500 --> 22:12.460
We write into the BSS section.

22:12.860 --> 22:14.120
It is writable.

22:14.280 --> 22:17.340
No null bytes in its address because it sits higher up.

22:17.900 --> 22:19.300
But how do we do it?

22:19.560 --> 22:29.120
Well, maybe instead of going for the system gadget which would be useless, we can find a gadget that actually writes our payload into memory.

22:31.560 --> 22:32.060
Okay.

22:32.060 --> 22:33.500
But where do we go?

22:33.940 --> 22:42.220
In a stack overflow where you don't have a null byte, you usually need some kind of memory leak to find the addresses of libraries.

22:42.220 --> 22:45.120
So we can make a rob gadget using them.

22:45.800 --> 22:47.560
We didn't have a memory leak.

22:47.760 --> 22:51.160
So we were calling one gadget.

22:51.160 --> 22:55.180
Hopefully it would write four bytes, two bytes in memory.

22:55.180 --> 23:03.320
But then it would crash because its epilogue would be different from the epilogue of the caller function.

23:03.320 --> 23:10.760
So you have the caller function which calls the vulnerable function where you overwrite the return address and then go to the gadget.

23:10.760 --> 23:16.800
The gadget does its stuff but then the stack pointer will be left in some random place.

23:17.320 --> 23:22.320
So the program crashes, our memory is emptied, no more payload.

23:23.220 --> 23:32.060
But if you understand this problem, you understand the solution because we need a gadget that has the same epilogue as the caller function.

23:32.220 --> 23:41.080
So when we jump to our gadget, our gadget writes something on the stack and then the stack pointer will be left in its proper place.

23:41.500 --> 23:51.840
So the call execution flow will go back to the function above the caller function and our payload remains in memory.

23:52.740 --> 23:53.400
Okay.

23:53.400 --> 23:56.400
Such a gadget sounds hard to find.

23:56.540 --> 23:58.640
But we had a 20 megabytes binary.

23:58.640 --> 24:01.460
So we had plenty to choose from.

24:01.860 --> 24:08.960
We used the instruction search window to find matching epilogues with the caller function.

24:08.960 --> 24:12.360
And we found about 15, 60 functions.

24:12.520 --> 24:14.360
So pretty good.

24:15.280 --> 24:23.120
We chose one where a store instruction was as close as possible to the return instruction.

24:23.220 --> 24:26.880
So we have the store instruction from R7 to R5.

24:26.880 --> 24:28.480
We control both of those.

24:28.480 --> 24:32.960
So this means we can write four bytes at a time in the BSS section.

24:34.460 --> 24:35.300
Okay.

24:36.500 --> 24:38.760
What payload do we use for system?

24:38.760 --> 24:42.700
Well, the same payload we used for the other exploit.

24:43.840 --> 24:46.620
With using LD preload we can load the library.

24:47.800 --> 24:49.580
We have the payload here.

24:49.580 --> 24:51.220
R4, R5, R7.

24:51.240 --> 24:52.360
Controlled.

24:52.520 --> 24:54.060
Then the gadget address.

24:54.680 --> 25:03.040
And then after we write this payload in memory, after about 10 to 15 requests, we can jump to the system gadget.

25:03.300 --> 25:07.800
And because we control the address of the payload, we put it in R6.

25:08.360 --> 25:10.760
And again, root.

25:11.180 --> 25:12.460
The second one.

25:13.140 --> 25:13.960
Okay.

25:14.860 --> 25:16.540
We have a timeline.

25:16.960 --> 25:19.020
The team was great to work with.

25:19.020 --> 25:20.840
They used PGP key.

25:20.880 --> 25:22.480
They answer fast.

25:22.480 --> 25:24.400
They actually fixed the problem.

25:24.760 --> 25:33.580
And they even gave us a list of devices affected which I don't think I've actually seen other IOT vendors do when we report something to them.

25:33.900 --> 25:35.560
So, yeah, kudos to them.

25:37.860 --> 25:38.660
Okay.

25:38.940 --> 25:39.800
This was it.

25:39.800 --> 25:40.860
Thank you for coming.

25:40.860 --> 25:42.840
I hope you learned something.

25:43.320 --> 25:44.740
Sorry for the screen.

25:50.700 --> 25:56.200
And if you have questions, there might be questions, but go ahead.

25:59.000 --> 26:02.760
If not, you can maybe find me at the IOT village sometimes.

26:02.760 --> 26:04.840
But I won't guarantee it.

26:04.840 --> 26:06.120
Thank you.

