[00:00.000 --> 00:00.600] All right, cool. [00:00.600 --> 00:06.080] So I've got a ton of slides to get through and everyone thinks it's not going to be possible, so we're going to jump straight into it. [00:06.600 --> 00:06.980] All right. [00:06.980 --> 00:09.680] So we're going to run through bare metal reverse engineering. [00:10.200 --> 00:19.420] We're going to talk through some of the arm assembly, bare metal reverse engineering, how to do some firmware dev, and then just some tools that I've used along the way. [00:19.480 --> 00:23.020] I will say, like, again, I'm going to run through this very quickly. [00:23.140 --> 00:27.660] We will make these slides available somehow, probably just post them on Solacek.io. [00:29.060 --> 00:33.680] But I'm also down in the biohacking village, so feel free to swing by the CTF at any point. [00:33.840 --> 00:35.620] I'd be happy to talk about this in more detail. [00:35.620 --> 00:41.980] And we also have an actual hands-on demo that you could do as part of the CTF for the biohacking village this year. [00:42.840 --> 00:43.300] All right. [00:43.300 --> 00:45.760] So me, really quickly, cofounder of Solacek. [00:45.760 --> 00:47.500] My background is electroengineering. [00:47.900 --> 00:51.800] So I was an embedded software developer for a number of years. [00:51.840 --> 00:54.780] That's where I really learned how to do a lot of the firmware dev. [00:54.960 --> 00:58.660] Firmware dev made me effective at firmware reverse engineering. [00:58.660 --> 01:00.280] So that's where a lot of this is coming from. [01:00.520 --> 01:03.440] And you can find me and follow me on Solideo Gloria. [01:04.760 --> 01:06.460] There's my handle there. [01:07.220 --> 01:07.460] All right. [01:07.460 --> 01:08.660] Let's talk about bare metal. [01:08.660 --> 01:15.420] So bare metal, if you're not familiar, is very different than other operating systems you might be used to. [01:15.420 --> 01:21.480] I did a nice flow diagram so you can figure out where I think you stand if you're a bare metal developer. [01:22.180 --> 01:24.180] That's obviously my unbiased opinion. [01:24.340 --> 01:28.340] But obviously different than embedded Linux and Windows and all that kind of fun stuff. [01:28.980 --> 01:29.460] All right. [01:29.460 --> 01:31.560] So just a few things about bare metal. [01:31.900 --> 01:34.620] There's really not the same level of privilege separation. [01:34.620 --> 01:42.900] There is a wide spectrum of bare metal and RTOSs and different, you know, solutions that you can use. [01:42.900 --> 01:47.260] But in general, most of them don't have the same level of privilege separation. [01:47.720 --> 01:49.880] They're also running lightweight scheduling. [01:50.080 --> 01:53.380] It's much different than the kernels that you'd see on Linux, for example. [01:53.940 --> 01:56.740] And there's sometimes minimal abstraction. [01:56.740 --> 02:00.120] We'll talk more about kind of the different layers in a second here. [02:00.120 --> 02:12.300] But the another example is that you typically when you exfill firmware from a board, you're exfilling the raw binary which in some cases is stripped and doesn't have any symbols or anything like that. [02:12.300 --> 02:16.000] So knowing how to do that and deal with that is really the goal of this talk. [02:16.000 --> 02:20.200] And the last thing as we'll see later as well, direct register access is common. [02:20.200 --> 02:21.740] We'll learn more about that in a second. [02:22.520 --> 02:22.860] All right. [02:22.860 --> 02:25.920] First, I want to talk about firmware just a little bit. [02:26.240 --> 02:30.640] Because I think knowing firmware is obviously essential to start reversing firmware. [02:31.020 --> 02:38.020] So I guess just to define what firmware is, you know, it's the low level software runs on the hardware. [02:38.020 --> 02:41.520] I think people have different call firmware different things every once in a while. [02:41.520 --> 02:46.820] But I think anything that's interacting with hardware at a fundamental level I would consider firmware. [02:47.960 --> 02:48.480] All right. [02:48.480 --> 02:49.800] So why learn firmware? [02:49.820 --> 02:51.660] I've already kind of alluded to it a little bit. [02:51.660 --> 02:54.500] But it teaches you a lot about the hardware as we'll see. [02:55.160 --> 02:59.000] Teaches you about memory structures and teaches you different coding patterns. [02:59.000 --> 03:02.600] Those are all critical to understanding obviously how that works. [03:02.600 --> 03:05.260] And then just some other fun side notes. [03:05.440 --> 03:10.220] I do think that if you can do firmware, you're the best programmer. [03:13.120 --> 03:14.820] That's how I've defined that. [03:14.960 --> 03:17.160] It also pays fairly well. [03:17.160 --> 03:18.960] It's actually kind of an untapped market. [03:19.200 --> 03:25.220] So understanding how to do firmware reverse engineering for whatever reason is just not as common as like Intel x86, for example. [03:25.300 --> 03:27.000] And it's just plain fun. [03:27.000 --> 03:28.860] And I mean that with all my heart. [03:29.640 --> 03:30.380] All right. [03:31.240 --> 03:35.300] So again, going through some of the operating systems, I had the flow diagram earlier. [03:35.300 --> 03:38.360] But bare metal, just think low level chips. [03:38.740 --> 03:47.980] And kind of the next level, honestly from a reverse engineering perspective, you can really say that even RTOSs are kind of bare metal. [03:47.980 --> 03:49.220] And I can explain that later. [03:49.220 --> 04:00.360] But tons of RTOSs that are out there that have different levels of scheduling and different complexity and some are much more lower level and closer to the hardware. [04:00.660 --> 04:03.160] QNX, free RTOS, things like that. [04:03.200 --> 04:08.860] And then there's also this whole world of embedded Linux, embedded Windows IoT, things like that as well. [04:08.860 --> 04:13.480] Here we're going to really focus on kind of the RTOS and ARM 32 bit microcontrollers. [04:15.040 --> 04:15.480] All right. [04:15.480 --> 04:16.620] So this is important as well. [04:16.620 --> 04:22.140] I wanted to find kind of the different layers of firmware that you often see. [04:22.540 --> 04:26.800] The board support package, this is typically we'll look at some of this code. [04:27.020 --> 04:32.880] But this is typically, you know, setting a register to enable like a GPIO pin or something like that. [04:32.880 --> 04:36.520] It's the specific low level fundamental calls to the actual hardware. [04:37.200 --> 04:41.260] On top of that, you'll often see hardware abstraction layers. [04:41.320 --> 04:48.820] So, you know, if you're working on a particular part like an STM32, they have HAL abstraction layers which make it much easier. [04:48.860 --> 04:50.840] And I've got some examples that we'll see on that. [04:51.260 --> 04:54.220] And then an RTOS is kind of above that. [04:54.220 --> 04:56.480] In some cases this can change. [04:56.500 --> 05:05.260] But an RTOS is really managing all the scheduling and you can set up threads and queues and semaphores and mailboxes and all that kind of fun stuff as well. [05:06.420 --> 05:06.920] All right. [05:06.920 --> 05:09.160] So let's dig into ARM assembly a little bit. [05:09.160 --> 05:13.840] And I apologize, I'm going to go through this way faster than it probably should be gone through. [05:13.920 --> 05:17.660] But again, feel free to stop me and I'll jump into this a little bit more. [05:17.960 --> 05:19.860] So different CPU architectures, right? [05:19.860 --> 05:22.200] I think everyone's probably familiar with most of these. [05:22.500 --> 05:27.620] I think most of the reverse engineering I've seen has been really focused on Intel X86. [05:28.800 --> 05:32.000] And then I haven't seen a ton of RISC-V and MIPS. [05:32.000 --> 05:33.200] I'm sure it's out there. [05:33.200 --> 05:38.540] But ARM is the area that I'm most familiar with and going to be the emphasis of this talk. [05:38.600 --> 05:42.220] But some quick differences between Intel X86 and ARM. [05:42.800 --> 05:45.060] One is a complex instruction set. [05:45.060 --> 05:47.340] The other one is a reduced instruction set. [05:47.720 --> 05:49.480] They've got dedicated registers . [05:49.480 --> 05:52.720] They've got more simple decoding. [05:52.720 --> 05:59.200] And then some other things that happen just because it's more stripped down on ARM that you'll see. [05:59.200 --> 06:07.760] So understanding the intricacies of ARM assembly is really important when you start reverse engineering firmware on ARM microcontrollers. [06:08.200 --> 06:20.040] So, you know, decompiling firmware, looking through, you know, what ARM turns into from a compiler and what crazy things compilers decide to do sometimes is something I would definitely encourage folks to do. [06:20.680 --> 06:21.260] All right. [06:21.260 --> 06:24.180] Another part of ARM is thumb. [06:25.280 --> 06:28.660] It's I would say one of the most confusing things about ARM. [06:29.380 --> 06:33.360] So thumb is well, I guess ARM is 32 bit all the time. [06:33.360 --> 06:35.760] Thumb is kind of 32 bit, kind of 16 bit. [06:35.760 --> 06:39.580] And then it also swaps back and forth from ARM and thumb on a lot of microprocessors. [06:40.000 --> 06:51.860] And it's very difficult to reverse engineer and understand because you've got different bite offsets and the last bit of the instruction is how it's switching. [06:52.200 --> 06:56.120] So understanding the intricacies of ARM and thumb are also extremely important. [06:57.960 --> 06:58.840] All right. [06:58.840 --> 07:05.140] So going through some of the registers, again, for ARM, we've got some general purpose registers, R0 through R12. [07:05.200 --> 07:07.840] We'll see in some of these examples how those are actually utilized. [07:08.260 --> 07:12.240] And then the specific registers that are important are R13, 14, and 15. [07:12.240 --> 07:15.160] That would be the stack pointer, the link register, and the program counter. [07:15.560 --> 07:16.620] Various data types. [07:16.620 --> 07:21.840] You've got the words that are 32 bit, obviously ARM 32, and you've also got half words and bytes. [07:22.600 --> 07:32.560] When you're actually looking at the disassembly, you can see when these are actually getting called in the actual instruction itself, which I'll get into more in a second. [07:32.920 --> 07:37.580] But you can see, you know, you load word, load half word, load sign byte, for example. [07:37.700 --> 07:40.600] Those are all contained within the actual instruction itself. [07:41.920 --> 07:42.140] All right. [07:42.140 --> 07:45.360] So diving into this, I know this probably looks scary. [07:45.360 --> 07:46.980] It's really not that bad. [07:47.880 --> 07:50.760] But there are a few different things that I want to talk about here. [07:51.240 --> 07:55.120] Loading and storing, just this concept of loading. [07:55.120 --> 08:05.520] So if you think, you know, in a load message, you can kind of see it here, or load instruction, you're actually taking the argument and pulling it into the ‑‑ sorry, the second argument and putting it into the first argument. [08:05.520 --> 08:10.100] So that first example is loading the address from R0 into R2. [08:10.240 --> 08:12.520] And then store basically does the opposite. [08:12.520 --> 08:16.160] So it's taking R2 and storing it into the address of R1 there. [08:16.160 --> 08:19.120] And then we'll talk about relative addressing later on. [08:19.120 --> 08:27.820] But branching, the way the branching works here is that you can branch and you can modify the different registers and flags. [08:28.160 --> 08:31.120] And then you can set it to branch to a specific label. [08:31.120 --> 08:42.740] And you can see there are a few different branch calls, branch equals, branch not equals, branch with link, branch with the BX there is actually switching to thumb, I believe. [08:43.260 --> 08:46.480] But there are a few different branching functions. [08:46.480 --> 08:50.960] These are all just basically if statements, switch cases, that's what they get compiled into. [08:52.100 --> 09:02.540] Relative addressing, this is super common, and we'll see this as well, where when you actually load something, sometimes it might not be calling a specific address. [09:02.840 --> 09:08.400] This is, you know, compiler optimization reasons behind why this is the case. [09:08.520 --> 09:13.940] So you'll see, you know, the best example there is probably the third one where you're loading into R2. [09:14.220 --> 09:26.920] The address of R0 at offset of four, which means that you're going and looking at a specific memory address and you're shifting down actually in the instruction itself instead of just calling the direct address. [09:27.560 --> 09:29.220] And the last one, stack frames. [09:29.240 --> 09:35.520] So, you know, I won't get into this too much, but stack frames build and contain like a function, for example. [09:35.900 --> 09:38.040] So, again, using the [09:41.120 --> 09:55.260] code that I showed earlier or using the unique registers that I saw earlier, you can see how it handles the link register and the stack pointer at the beginning, the prolog and the epilog of a function . [09:55.260 --> 09:58.000] So that's really important to see those distinctions. [09:59.280 --> 09:59.720] All right. [09:59.720 --> 10:04.260] I won't spend too much time on this, but there are a ton of really common instructions that you'll see. [10:04.620 --> 10:08.540] Move, arithmetic, bit shifting, things like that. [10:09.900 --> 10:10.440] All right. [10:10.440 --> 10:11.800] So I'll spend a little bit of time on this. [10:11.800 --> 10:16.340] Hopefully everyone can see this is like the most important part that seems to be blocked. [10:16.600 --> 10:28.680] But so if you imagine, you know, just a quick, you know, easy function that checks the value of A to B and does some returns, you can see how that actually builds out. [10:28.680 --> 10:37.680] So you can see the prolog, the epilog, you can see some of the loading and storing, you can see the relative addressing, you can see all the branching, again, moving to that check function. [10:38.260 --> 10:39.420] This is using Jeff. [10:39.420 --> 10:43.520] I would highly recommend using Jeff, which is built on top of GDB. [10:43.660 --> 10:46.880] It's wonderful for reverse engineering and understanding more about how to do this. [10:46.880 --> 10:56.120] And again, this basic function running on my computer and then stepping through every piece of it is a wonderful way to actually learn how ARM assembly works. [10:56.120 --> 11:06.280] And you can see these, you know, in addition to Jeff, you can see the stack register or the stack kind of changing, the registers changing, and you can really track through what the actual code is doing. [11:07.080 --> 11:07.580] All right. [11:07.580 --> 11:10.140] Now let's go back to firmware development for a second. [11:10.140 --> 11:17.440] I want to quickly run through how to do firmware development, the hard way and the easy way, and then we're going to start talking about how to disassemble everything, right? [11:17.440 --> 11:25.400] Because hopefully we're going to build out some fundamental knowledge of what's actually happening, and then you can see, you know, how we get back to the source code, which is our ultimate goal. [11:26.320 --> 11:33.140] So in order to do firmware development, what we need to do is initialize the different peripherals, right? [11:33.140 --> 11:36.480] This is often, you know, how you start interacting with hardware. [11:36.480 --> 11:43.480] In this case, I'm going to show what it takes to actually initialize a single GPIO the hard way, and then I'll explain it the easy way. [11:43.480 --> 11:48.660] So what we have to do is initialize the peripheral clock, and this is just on an STM32. [11:48.660 --> 11:50.760] Some of these might have some nuanced differences. [11:51.200 --> 11:59.000] You'll initialize the peripheral clock, and you'll set the GPIO as an input, and then in this case, I'm just setting the GPIO as a pull-up resistor, right? [11:59.000 --> 12:02.080] So it's just checking a pin value. [12:02.140 --> 12:05.260] And it sounds super easy, but let's get through how to do that. [12:05.260 --> 12:11.020] So the STM32... I wish I'd known about this podium, because I would have shifted all my slides the opposite direction. [12:11.540 --> 12:16.240] The STM32 has different memory addressing for different peripherals. [12:16.240 --> 12:20.260] So imagine just a giant block of memory that's only peripherals. [12:20.260 --> 12:30.920] So in this case, I think it's like 40 million hex, and all the peripherals under that are in different offsets as well. [12:30.920 --> 12:33.440] So you can kind of see... hopefully everyone can read that. [12:33.600 --> 12:36.100] And this is just a data sheet that you'll get online. [12:36.220 --> 12:40.460] You can see the boundary address, and you can see the offset of all these different peripheral registers. [12:40.540 --> 12:52.140] So in this case, to set the peripheral clock, we're going to set the RCC peripheral boundary address, which would be at the 40,000... or 40,023,800 or whatever. [12:52.340 --> 12:55.100] And you're going to set a specific value. [12:55.280 --> 13:01.580] If anyone can see that, you're basically just going to set one specific bit in this register. [13:02.420 --> 13:09.540] And then this specific bit, this GPIOC because we're setting PC2 in this case, that has to be set. [13:11.780 --> 13:12.780] All right. [13:12.780 --> 13:16.240] And then the next thing after you do that, you have to initialize the GPIO. [13:16.380 --> 13:19.700] So to initialize the GPIO, again, it's got that peripheral offset. [13:19.700 --> 13:25.360] We're going to set the specific mode, which is setting two bits in a... in the register. [13:25.680 --> 13:28.560] And then pull up, pull down is the exact same way. [13:28.920 --> 13:36.200] You'll just see, you know, how these have to be set in the register in order to enable that function. [13:36.560 --> 13:47.520] So one thing on that, you can easily just set it, that register equal to something, but you run into a ton of issues where if you set that register, you could potentially modify the configuration of the other peripherals. [13:48.060 --> 13:57.220] So this is just some of the logic that I use in general to... to make sure that... and force that... that function into the correct state. [13:57.220 --> 14:03.400] So you can see some, you know, bit wise logic or equaling and then... and equaling with the complement, et cetera. [14:03.400 --> 14:07.660] So that'll be... that'll become important later on when we get more into the reverse engineering. [14:09.400 --> 14:11.340] So the input register, same thing. [14:11.580 --> 14:14.660] You're just checking specific registers. [14:14.700 --> 14:17.760] And this is, again, the hard way to do things. [14:18.340 --> 14:18.580] All right. [14:18.580 --> 14:19.800] So let's talk about the easy way. [14:19.800 --> 14:25.140] That was hopefully... I emphasize how... how tedious that would be. [14:25.140 --> 14:26.920] The easy way would be HAL drivers. [14:26.920 --> 14:29.600] So in this case, we're going to set up a UART. [14:29.840 --> 14:33.360] And you can see how much easier it is to do that when you actually use the HAL. [14:34.640 --> 14:35.940] So it's just like this, right? [14:35.940 --> 14:39.180] You just set up an instance and a structure that's prebuilt for you. [14:39.180 --> 14:40.420] This is built by ST. [14:40.480 --> 14:45.540] And you can just literally say in that structure what these specific values are. [14:45.540 --> 14:48.060] And you can run through setting that. [14:48.700 --> 14:50.560] And then using the HAL is very similar. [14:51.140 --> 15:01.080] So now hopefully you understand the... with the HAL and with the BSP, it's very different in terms of how that ends up being reverse engineering, right? [15:01.080 --> 15:07.520] So if you think about what HAL has to do, you have to abstract away a ton of functions. [15:07.520 --> 15:12.560] You have to make sure... when you lose the discrete calls, you inherently... [15:15.120 --> 15:19.720] when you lose the discrete calls, you inherently have more complicated code that you have to reverse engineer at the end of it. [15:19.720 --> 15:25.580] So understanding what that looks like in reverse engineering really helps us get to the solution quicker. [15:26.020 --> 15:26.420] All right. [15:26.420 --> 15:29.240] So really quickly, let's talk through what's not going to work. [15:29.420 --> 15:35.100] Strings might give you some stuff, but it's really not going to give you everything and you don't know how those strings are being used. [15:35.340 --> 15:44.400] File is effectively worthless on raw binary that you pull from a... from a firmware via like JTAG or SWD. [15:44.600 --> 15:46.020] Binwalk is kind of helpful. [15:46.020 --> 15:47.860] You can see if it's encrypted or not. [15:49.400 --> 15:52.880] The AES key find, sometimes you'll find keys, but not really. [15:53.320 --> 15:54.880] So let's go to Ghidra. [15:54.880 --> 15:58.360] So to do Ghidra, I'm just going to run through these very quickly. [15:59.160 --> 16:00.540] Just import a file. [16:00.720 --> 16:03.240] In this case you set the little cortex Indian. [16:04.360 --> 16:06.580] In this case we're also going to add a flash mirror block. [16:06.580 --> 16:08.820] I'll explain that afterwards if anyone is interested. [16:09.580 --> 16:11.600] I don't like to analyze immediately. [16:11.600 --> 16:15.660] What I like to do is actually do the memory map configuration first. [16:16.540 --> 16:21.520] So I'll set up the flash map, the mirror, the RAM, et cetera, all those things you can get from a data sheet. [16:22.140 --> 16:23.520] And then I'll analyze the binary. [16:23.520 --> 16:26.920] Ghidra has this ARM aggressive instruction finder, which is extremely helpful. [16:28.200 --> 16:31.100] And then if anyone's used Ghidra before, it's pretty straightforward. [16:31.340 --> 16:34.760] Well, straightforward if you are a reverse engineer, I guess. [16:35.300 --> 16:40.720] But you've got the disassembly, you've got the listing, and it'll try to recover the source code as much as possible. [16:40.760 --> 16:48.100] You can rename functions, you can retype functions, and you can search for strings, and you can start to look for those string references. [16:49.200 --> 16:59.360] In addition to that, and why I like using Ghidra, I'm sure I'll argue with someone about IDA and Binary Ninja later, you can do your own scripts, which are really nice, and it's just Python-based. [17:00.040 --> 17:09.140] So you can just manage your scripts and you can add certain tool sets to Ghidra to help with the reverse engineering. [17:09.200 --> 17:14.120] One of the ones I love to do with that is the... it's actually called SVD loader by Level Down Security. [17:14.300 --> 17:16.840] Effectively, what this does is takes that entire data sheet. [17:16.840 --> 17:22.400] So that data sheet is often represented in an XML file or a SIMSIS SVD file. [17:22.860 --> 17:31.840] It's effectively just an XML that talks about all the register mapping that I was talking about before, which obviously makes it where you can automate that and parse that data. [17:31.880 --> 17:35.040] And then what this tool does is put it into the memory map. [17:35.040 --> 17:38.300] So after you run that tool, you can select an SVD file. [17:38.300 --> 17:41.200] These can be found online for most microcontrollers. [17:41.200 --> 17:42.720] And then you get this updated memory map. [17:42.720 --> 17:48.520] So what that does now is we've got all those peripherals that were just general addresses with offsets. [17:48.660 --> 17:53.020] Now those are actually peripherals that will be dereferenced in the code effectively. [17:53.020 --> 18:00.780] And you can actually look at where those functions are getting called and find the cross reference and then you can go back to that peripheral, which is extremely helpful when you're reverse engineering firmware. [18:02.140 --> 18:03.680] From there, you can actually type cast. [18:03.680 --> 18:13.080] So if you all remember, you know, what this looked like before, where it's, you know, nonsense, this, you know, pointer to a pointer to this cast three times. [18:13.580 --> 18:27.500] When you actually know what it is and you can kind of detect that this is RCC, if you cast it to the right object or type here, you'll actually see, you know, we're starting to get to exactly what the source code looks like, which is, it's pretty impressive. [18:28.320 --> 18:34.040] And if you do this enough, you can get to literally the exact same, exact same code. [18:35.720 --> 18:41.540] Again, I wrote this code, so it's pretty easy to reverse engineer your own code, but I think this can be applied across the board. [18:42.260 --> 18:42.540] All right. [18:42.540 --> 18:44.580] I also wrote another tool called Type Loader. [18:44.580 --> 18:48.980] What Type Loader does is it parses the actual HAL files. [18:49.440 --> 18:54.600] So like STM32 HAL, it'll parse that and it'll create all the data types for those HAL objects. [18:54.820 --> 18:57.500] And then from there, you can actually start to dereference those types. [18:57.500 --> 19:08.240] So now, instead of just doing it at the low level of the BSP where you're changing the actual peripheral calls, now you step one step up and you can say this code looks like it's actually that UART handle. [19:08.240 --> 19:13.080] I'm going to type cast it to that UART handle from HAL because it has that similar looking signature. [19:13.180 --> 19:16.860] And now I've got the exact same source code on the HAL layer and on the BSP layer. [19:17.220 --> 19:19.820] Last one is bsim. [19:19.900 --> 19:23.160] This is, I think, by the NSA still is part of Ghidra. [19:23.260 --> 19:39.580] What bsim does is it allows you to do binary similarity, I think is what it stands for maybe, where you can basically precompile a project, and then you can analyze that project against a known function data type. [19:39.580 --> 19:42.540] So basically, what you have to do is just enable bsim. [19:42.540 --> 19:44.820] You can create an H2 bsim database. [19:45.100 --> 19:46.700] And then this is the key part here. [19:46.700 --> 19:52.720] You can build a binary dedicated and then reverse engineer that binary and then load that into the database. [19:52.720 --> 19:56.280] So now, imagine if we built, we know it's an STM32. [19:56.280 --> 19:57.280] We know it's using HAL. [19:57.280 --> 19:59.420] We know it's using a free RTOS, for example. [19:59.460 --> 20:01.760] I'm going to build an entire project that's just a sample. [20:01.760 --> 20:03.820] I don't care what the code does. [20:03.820 --> 20:05.560] It doesn't have to have like any application code. [20:05.560 --> 20:18.900] But we built all of those function signatures out and we can then start to use that binary or that database to analyze our functions later on that are also using STM32 and HAL, presumably. [20:19.740 --> 20:24.520] From that, you can add the reverse programs of the H2 bsim database. [20:24.720 --> 20:26.020] And then you can start searching functions. [20:26.020 --> 20:31.180] So when you search a function, you can set the thresholds for the similarity and confidence. [20:31.260 --> 20:33.380] And then you can start to apply the signature data type. [20:33.380 --> 20:45.420] So if you see some random function that does all kinds of crazy stuff, you can see context switching and it's going in and out of these different modes and yielding like in an RTOS or like what that will do. [20:45.840 --> 20:49.880] You can quickly determine that this is an RTOS call. [20:50.260 --> 20:52.900] I probably don't care about reverse engineering the RTOS. [20:52.900 --> 20:53.940] You might in some cases. [20:53.940 --> 21:02.540] But for me, if you're reverse engineering and you're trying to get to the application on embedded firmware, this is a quick way to start weeding out stuff that doesn't really matter like an RTOS. [21:02.540 --> 21:07.180] And what this looks like, you can quickly see this OS thread new. [21:07.400 --> 21:12.020] If I didn't know what that was, I might be reverse engineering that function for days potentially. [21:12.080 --> 21:15.200] Quickly with bsim, I can just say, hey, this is starting a thread. [21:15.200 --> 21:15.940] I don't care. [21:15.940 --> 21:23.060] Or it can help me figure out from there, I want to look at where that actually function is getting called and then I'll start to look into the actual application. [21:23.060 --> 21:42.560] So hopefully, I've gone through extremely fast the method for kind of how firmware works a little bit and ARM assembly and then also some tools to really just work all the way up from the hardware low level BSP to the HAL to the RTOS so we can start reverse engineering the application which is really most important for us. [21:42.560 --> 21:45.080] So I did it. [21:45.140 --> 21:46.460] Any questions? [21:47.060 --> 21:48.000] Thank you. [21:53.300 --> 21:55.540] I've got like two minutes for questions. [21:55.660 --> 21:56.240] One minute? [21:56.240 --> 21:57.380] Or does everyone have to leave? [21:58.360 --> 21:58.960] All right. [21:58.960 --> 22:00.120] I guess everyone has to leave. [22:00.540 --> 22:04.460] Y'all feel free to stop by the biohacking village and I'd be happy to talk to anybody if y'all have questions.