[00:00.000 --> 00:04.960] We're going to get started this morning with what looks to be a very exciting talk with a [00:04.960 --> 00:09.660] couple of recorded demos, because these guys are smart and they don't do live demos at [00:09.660 --> 00:18.920] DEF CON. Well, you're allowed, but it's just a really, really terrible idea. So if this is [00:18.920 --> 00:25.320] your first time in track four, which we are calling fancy track, here in fancy track, you [00:25.320 --> 00:31.200] cannot vape, you cannot smoke anything of any kind. You are not supposed to be having any [00:31.200 --> 00:36.700] kind of outside beverages other than water. There you go. Like I said, if you want to kind [00:36.700 --> 00:41.520] of move towards the center so that people can get in and out, that will help because we're [00:41.520 --> 00:46.740] going to have a lot of people coming to a lot of really good talks today. With that said, let's [00:46.740 --> 00:51.700] get Topher and Michael up here. How many people use antivirus at work? How many people [00:51.700 --> 00:57.440] believe it does anything? There we go. How many people use EDR at work? Yeah? How many [00:57.440 --> 01:07.020] people believe it does something? Aha! Suckers! Let's give Michael and Topher a big round of [01:07.020 --> 01:23.910] applause. Thank you for coming on an early Saturday morning. EDR is coming, hide your shit. [01:24.510 --> 01:31.410] I'm really happy to be here this year. This sort of came about as a hallway conversation at [01:31.410 --> 01:37.290] DEF CON last year. We had some ideas, we talked it over, it turned into some research and here [01:37.290 --> 01:42.330] we are. And that's pretty exciting. So go out there and talk to all the people and have all [01:42.330 --> 01:51.290] the ideas and submit something next year. Alright, so who are we? Well, first of all, we don't [01:51.290 --> 01:56.330] speak for our employer. These are speaking all on behalf of ourselves and nothing that we [01:56.330 --> 02:03.210] are saying is to be construed as, you know, from our employer. I'm Michael Liebowitz. I like [02:03.210 --> 02:10.090] to, in my free time, write or make hardware implants, re-implementing NSA hardware [02:10.090 --> 02:17.150] implants and I'm a principal troublemaker. Anne? And I'm Topher Timson. I like doing like [02:17.150 --> 02:20.370] C sharp malware stuff. So hilariously enough, some of the things you are going to see in this [02:20.370 --> 02:26.410] talk, I've talked about previously at DEF CON 23. So it's kind of like the old is still new. I'm [02:26.510 --> 02:30.370] a principal vulnerability enthusiast. We both work on red teams and as you can see by our [02:30.370 --> 02:40.490] matching attire, we just want to drink coffee and write malware. Alright, so here's what we're [02:40.490 --> 02:44.830] going to go through and we have a lot to cover. So we're going to go through it pretty fast. [02:44.830 --> 02:51.570] Basically, what EDR is, why we care. UEFI and the thing to note about UEFI is UEFI is [02:51.570 --> 02:56.910] cross-platform which is why we're doing a Windows and a Linux demo and why we have a [02:56.910 --> 03:01.070] Windows and Linux payload. Of course, you know, what everyone's wondering, what does this all [03:01.070 --> 03:05.170] mean? And then, you know, some mitigation or whatever and then future work and then [03:05.170 --> 03:11.550] conclusions. So we're going to kind of start off with talking about EDR. So a lot of you [03:11.550 --> 03:15.190] raised your hands that you use this and think it works. So we're about to, you know, kind of [03:15.190 --> 03:22.230] ruin that for you. So kind of a, so it's 10 o'clock, the slides are a little bit hung over. [03:22.230 --> 03:26.910] So EDR is end point detection and response, not enterprise. Thanks slides for being up early [03:26.910 --> 03:32.230] with us. The biggest thing about EDR is that it's really just defensive tooling that focuses [03:32.230 --> 03:36.630] on like detecting, investigating and mitigating suspicious activities going on within an [03:36.630 --> 03:42.030] environment. The big thing that it really provides blue teams is a hunt capability. So this [03:42.030 --> 03:49.010] is how and a lot of organizations, they're making like large scale like correlations for hunt [03:49.010 --> 03:53.030] stages. So like, oh, this machine over here is doing these sorts of things. That's not [03:53.030 --> 03:58.590] really typical. This alert fired on our scene. Let's go investigate. Typically, it really [03:58.590 --> 04:02.590] just means that like for us on red teams that blue team is going to find you and we don't [04:02.590 --> 04:08.630] want to be found. Uh, so we're going to sort of look at how we avoid that. Um, and then like [04:09.290 --> 04:14.670] the one big thing with EDR is that typically everything is mapped to uh, like MITRE attack. [04:14.670 --> 04:18.150] And if you're not familiar with MITRE attack, that's essentially just like this huge [04:18.150 --> 04:22.650] knowledge, knowledge base of uh, of things that attackers tend to do based off of real world [04:22.650 --> 04:28.050] observation. So like you probably hear the term like TTPs thrown around everywhere. Um, in [04:28.050 --> 04:33.330] essence, it's really just this huge table that lists things that attackers like to do. So you [04:33.330 --> 04:36.850] kind of like think back to previous life when you were in kindergarten and you get like a [04:36.850 --> 04:41.750] gold star for like turning in your homework on time and like being polite. It's essentially [04:41.750 --> 04:46.010] like that but for like us as bad guys. So we get gold stars when we do like persistence. We [04:46.110 --> 04:50.150] get a gold star for privilege escalation. Uh, so like we want to fill out all the things but [04:50.150 --> 04:56.450] not have anybody know so we don't actually get the gold stars. Uh, we just want to do it. Um, [04:56.450 --> 05:01.710] so like I'm saying like EDR is really just tuned like in actuality for like processes, [05:01.710 --> 05:07.230] commands and API calls. So if you're like running say like uh, CMD.XE or PowerShell or [05:07.230 --> 05:11.450] doing like some registry stuff or trying to set up persistence. Because those are like [05:11.450 --> 05:17.410] TTPs in the MITRE attack framework, those tend to be flagged and mapped and then alerted on [05:17.410 --> 05:22.350] for the, the blue team. Um, and we want to make sure that none of that actually happens. [05:24.670 --> 05:32.030] So, uh, a lot of people talk about, you know, the risk curve and um, you know, this is the other [05:32.030 --> 05:37.370] side of the risk curve. Basically, you know, no, no attack, no breach lasts forever, right? [05:37.370 --> 05:42.010] You can see from the right side of the graph that eventually you're going to get busted. And [05:42.010 --> 05:46.830] you, you land your shell, you know, that's kind of the highest risk time. You move around a [05:46.830 --> 05:50.930] little bit and eventually you sort of settle into persistence. And like the longer you hold [05:50.930 --> 05:55.910] on, the more chance it is that someone's going to roll you up. And really what we want to do [05:55.910 --> 06:03.610] is, you know, make this curve flatten a little bit. And, you know, what, what does it mean [06:03.610 --> 06:08.130] when, you know, the breach gets detected? Like no one's sleeping well tonight. This is, this [06:08.130 --> 06:14.410] is terrible. You know, your lovingly crafted payload becomes the analyst's sample. You're [06:14.410 --> 06:20.230] like very upset because all these months of work and crafting that super awesome payload are [06:20.230 --> 06:27.070] just down the drain. And the analyst is like, oh shit, there goes my Friday night. Nobody's [06:27.070 --> 06:35.070] happy. So what we want to do is we want to modify this risk curve. We want to make it such [06:35.070 --> 06:40.970] that, you know, we're not going to flatten that initial shell pop kind of, kind of part, like [06:40.970 --> 06:44.830] that's kind of the same. But we just want to, we just want to hang on to the good stuff for [06:44.830 --> 06:49.830] longer. Eventually, eventually you're going to get rolled up. But we just, just hang out and [06:49.830 --> 06:58.590] chill out for a little bit longer. So as we were investigating ways that we can hide from a UEF or [06:58.590 --> 07:04.690] from a EDR, Mike and I had some pre-existing platform experience, a particular UEFI platform [07:04.690 --> 07:10.390] experience, so like platform firmware. So in sort of this research, it's like, we were [07:10.390 --> 07:14.550] thinking that we can utilize this sort of functionality to evade all of these detections and [07:14.550 --> 07:19.810] make that risk curve and the dwell time for us last a little bit longer. So if you're not [07:19.810 --> 07:25.210] familiar with UEFI, I have to include this awesome diagram of it because John Lucchetti has [07:25.210 --> 07:30.570] told everybody ever talking about UEFI that they have to. Essentially, if you're not [07:30.570 --> 07:35.530] familiar with UEFI, it's essentially what modern BIOS is now. So it does all of the things [07:35.530 --> 07:40.730] that you don't really care about, like CPU in it, trains your memory, it loads a bunch of [07:40.730 --> 07:46.530] option ROMs from like your PCI devices. There's other talks that go over what this actually [07:46.530 --> 07:51.050] means. Uh, but what we're concerned about is if you look at the bottom, there's this notion [07:51.050 --> 07:57.410] of runtime services and after the OS boots, those are exposed at the operating system level. [07:57.450 --> 08:02.190] Some of the things that get exposed within the runtime services stage of UEFI are, uh, [08:02.190 --> 08:07.210] UEFI firmware variables. So these are persistent variables that actually live within your [08:07.210 --> 08:12.910] NVRAM on your, on, on your platform, uh, that are accessible both to UEFI applications, [08:12.910 --> 08:17.090] like, if you're familiar with secure boot, all of your secure boot like variables and stuff [08:17.090 --> 08:23.110] live there. So like boot order, like your, uh, the keys that secure boot utilizes, things of [08:23.110 --> 08:27.470] that, uh, nature. So we're going to take advantage of the fact that we can persist within [08:27.470 --> 08:33.910] NVRAM, within the UEFI platform that we can then access at operating system runtime. Um, [08:33.910 --> 08:37.770] so, sort of like, you're probably thinking at this point, well, why UEFI firmware [08:37.770 --> 08:42.670] variables? Well, like I was saying, it, it's a way that you can hide your payloads from all [08:42.670 --> 08:46.710] of these detective capabilities because it's, it's a blind spot for all of them. Nobody [08:47.230 --> 08:52.550] looks here, like really at all, especially within AV and EDR platforms. Um, if you're not [08:52.550 --> 08:56.550] familiar really with what UEFI firmware variables are either, it essentially consists of [08:56.550 --> 09:02.430] like a name and a GWID, so it's like this tuple. And if you are able to set or get that, uh, [09:02.430 --> 09:06.890] that tuple, you can pull the contents of what that variable is out of NVRAM. And we're [09:06.890 --> 09:11.630] going to kind of showcase that we can execute those live on the system to both stash our [09:11.630 --> 09:20.430] stuff and to sort of have like this persistence, uh, mechanism. So, really quickly, uh, like [09:20.430 --> 09:23.930] UEFI firmware variables have a couple of types. There's authenticated and [09:23.930 --> 09:28.250] unauthenticated. This isn't so much important, but we kind of just wanted to briefly touch [09:28.250 --> 09:32.770] on it, uh, just in case you're concerned at all with the specification or what we're doing. [09:32.770 --> 09:36.790] Like, um, if you've heard of like authenticated variables, these are signed like X509 [09:36.790 --> 09:41.050] certs that, uh, perform like a certificate check when writing. Uh, we're not going to worry [09:41.050 --> 09:45.970] about those. There are unauthenticated variables that are also, um, present, uh, at that [09:45.970 --> 09:51.270] runtime stage. These have no verification on write. The majority of variables on a platform, [09:51.270 --> 09:55.810] as we'll show you in a demo, are unauthenticated. Uh, so it's not really abnormal for these to [09:55.810 --> 10:00.810] be there and it's not atypical for things to necessarily be writing or reading from there. Um, [10:00.810 --> 10:05.690] if you're like a platform researcher or something, you know about this. Uh, there's a couple [10:05.690 --> 10:10.630] of attributes as well to UEFI firmware variables, uh, within the specification. We're going to [10:10.630 --> 10:16.030] really just focus on 3 out of the 6 because as I'll showcase in the Windows 10 API, uh, you [10:16.030 --> 10:22.050] have to have non-volatile boot service access and runtime access in order to have, uh, UEFI [10:22.050 --> 10:28.270] variables that persist within the Windows runtime after boot on your NVRAM. Um, so just note [10:28.270 --> 10:32.570] that those 3 are going to be utilized and that'll be shown in the demo as well. Sort of the [10:32.570 --> 10:38.430] hilarious little thing here too with, uh, why we sort of started thinking about UEFI as a [10:38.430 --> 10:43.950] way to hide from EDR is, uh, in an old, old life, we're walking, you know, with some blue team, [10:43.950 --> 10:47.830] uh, folks and we're talking about ways that we've been being tricky on engagements and [10:47.830 --> 10:53.850] sharing some techniques. And we're kind of talking about, like, uh, IOT devices and how it'd [10:53.850 --> 10:57.770] be cool to hide, like, an IOT firmware. And they're like, yeah, that'd be cool, but, like, [10:57.770 --> 11:01.010] please don't ever hide, like, in platform firmware. And, you know, Mike and I kind of [11:01.010 --> 11:08.410] stopped and we're like, oh, shit. Uh, so we're going to do Windows and Linux, uh, and we're [11:08.430 --> 11:11.490] going to do, uh, Windows and Linux. Like Mike said, uh, UEFI is platform agnostic, so it [11:11.490 --> 11:15.430] doesn't matter what it's running on. It's, it's part of your platform. It helps boot Intel, [11:15.430 --> 11:21.410] like, processors. It also works, like, on AMD. Uh, it's kind of different there. It's, it's a [11:21.410 --> 11:30.870] specification, whatever. Um, so UEFI and Windows, basically, um, I was re-looking at the MSDN [11:30.870 --> 11:35.270] articles for Windows 10 and I recognized, so they had taken this off and then they [11:35.270 --> 11:42.330] re-introduced the ability to do UEFI platform stuff within 1803. Um, so I was kind of, like, [11:42.330 --> 11:46.290] reading the documents. They, they listed all of these requirements for actually being able to [11:46.290 --> 11:51.490] use this, these API function, this API functionality within Windows now. So it was kind of [11:51.490 --> 11:54.790] concerning because there, there's a lot there that they say you need this, otherwise it [11:54.790 --> 11:58.690] won't work. Such as, you need to declare firmware read and write in your application [11:58.690 --> 12:02.890] manifest. You need to have it be a protected app, so, like, a signed app that the Microsoft [12:02.890 --> 12:07.910] store signs. Needs to be signed. You need to be an admin that has access to this special [12:07.910 --> 12:13.690] privilege SE system environment name, uh, like privilege token in your process space. So [12:13.690 --> 12:17.730] looking at it, it was kind of daunting because it's, it's such a long list of requirements, [12:17.730 --> 12:25.030] but, you know, we're hackers, that doesn't mean anything. Uh, so we started looking at ways to [12:25.030 --> 12:29.510] bypass this, like Specter Ops puts out a lot of, like, WDAC bypasses, which is a way to [12:29.510 --> 12:33.750] execute signed Windows binaries with that, well, unsigned Windows binaries, so, like, [12:33.750 --> 12:38.410] unsigned Windows binaries you can still execute. Um, obviously on red teams we sometimes [12:38.410 --> 12:45.090] jump to conclusions or we make, uh, some leaps forward to speed up engagement time with, [12:45.090 --> 12:50.350] like, assume breach type, um, scenarios or sort of the methodology and thinking that we're [12:50.350 --> 12:55.950] gonna wind up being admin, why don't we just become admin now. Um, so, like, that sort of [12:55.950 --> 12:59.410] stuff for our purposes of doing this sort of thing on red team engagements wasn't [12:59.410 --> 13:03.610] necessarily impactful, so we just kind of went with it with the assumption that we're [13:03.610 --> 13:07.270] gonna be, we can be an admin on a box and we're not gonna need it to be a signed, uh, [13:07.270 --> 13:13.010] Windows application. So, like, uh, just to showcase what the read and white firmware [13:13.010 --> 13:18.810] variable API looks like from the MSDN articles, you can do set and get firmware variables [13:18.810 --> 13:23.490] from NVRAM, uh, really the key thing here is you just have, like, the name and GWT tuple [13:23.490 --> 13:29.890] that I was mentioning earlier, um, and for set, all you do is you point, uh, the buffer you [13:29.890 --> 13:33.790] want to write into the variable, you give it the size and the attributes that you want to [13:33.790 --> 13:38.230] have it be declared as, and it just sets it in NVRAM for you. And then for get, it's the [13:38.230 --> 13:42.790] same sort of idea, you give it a name and a GWT tuple and then you give it the buffer you [13:42.790 --> 13:47.270] want to read into and then it reads the NVRAM out into some memory buffer that you control [13:47.270 --> 13:51.350] as the attacker and, of course, you'll wind up executing that once you get the variable out [13:51.350 --> 13:56.050] of NVRAM. Uh, these are the attributes, not really important, it's on the slide more for [13:56.050 --> 14:01.270] reference, but this is from the MSDN article, note that for variable, uh, attribute runtime [14:01.270 --> 14:06.070] services, it says if you want this to be accessible during RT, it needs to also be [14:06.070 --> 14:09.730] accessible to boot services, so that's kind of why we're going to have to set all three in [14:09.730 --> 14:17.670] Windows, so NVBS and RT variables. So when I was initially implementing this, uh, it was sort [14:17.670 --> 14:22.850] of the decision between if I wanted it to be in C++ or in C sharp, so I initially [14:22.850 --> 14:28.510] implemented all of this in C++ just because it was, it was easy, because the MSDN articles [14:28.510 --> 14:32.850] basically just give you the code you need, but as I was kind of doing the research, it [14:32.850 --> 14:38.270] occurred to me that C++ wasn't a viable option because AV flags it very easily, um, like one [14:38.270 --> 14:42.370] thing that you have to do obviously if we're getting a firmware variable is you need RWX [14:42.370 --> 14:47.350] memory, so doing a lot of calls to like virtual alloc, virtual protect, uh, it's kind of a red [14:47.350 --> 14:52.190] flag right now, especially for EDR products as they start querying all these APIs, um, like [14:52.190 --> 14:56.170] most applications aren't like making an RWX memory buffer and then executing it like it was [14:56.170 --> 15:01.950] shellcode, so we're not going to do that. Um, C sharp can basically do everything C++ can [15:01.950 --> 15:06.730] either with P invoke or reflection, and having C sharp malware experience in the past was [15:06.730 --> 15:11.130] like, yeah, let's just do it in C sharp. Furthermore, most of the C sharp bypasses, or [15:11.130 --> 15:15.270] some of the, most of the WDAC bypasses are in C sharp anyway, so that kind of like checked [15:15.270 --> 15:19.710] that flag off for us. And then in order to make things kind of easier for all of our red team [15:19.710 --> 15:23.110] friends to use, particularly on Windows environments, we wanted to make sure that they [15:23.110 --> 15:27.850] could, that they could use it in C sharp as like kind of the direction that, uh, malware [15:27.850 --> 15:33.590] authors in Windows are kind of going for red team engagements these days, or, or going. Um, [15:33.590 --> 15:38.430] but there's reference code for both on the repo which we'll showcase later after the talk. So [15:38.430 --> 15:43.250] essentially the steps for writing a UEFI variable in Windows is really easy once you have that [15:43.250 --> 15:47.550] admin privilege. Uh, you essentially just need to obtain the SE system environment name with [15:47.550 --> 15:52.450] set priv. Uh, this is the only case of like P invoke that we're going to be using. Um, [15:52.450 --> 15:55.690] furthermore, like I was saying, like in the manifest where you needed read and write [15:55.690 --> 16:00.570] capabilities, the MSDN article is weird in that it lists all of those things for C plus plus [16:00.570 --> 16:05.470] applications. It makes no notion of ever doing this stuff in C sharp, so I've never had to [16:05.470 --> 16:09.590] declare those things and I don't really know what Microsoft is stating in that, so just ignore [16:09.590 --> 16:13.930] that completely. You don't need it for C sharp. Uh, you can then get the address of your pin [16:13.930 --> 16:18.410] buffer, so that's our payload, and then we just write the UEFI variable to NVRAM and now [16:18.410 --> 16:25.010] it's persistent storage. So here's some code really quickly to set the privilege. Um, it's [16:25.010 --> 16:29.730] just P invokes, you get process, you say that you want the new, the new token privilege, you [16:29.730 --> 16:35.150] set it, boom, we're good. Then you can get the address of your, uh, pin buffer in C sharp, [16:35.150 --> 16:40.410] like I said, this was your payload. So you initialize an end pointer, you call, uh, [16:40.410 --> 16:45.830] interop services to get a pinned array of your, of your buffer that you want to write. You pin [16:45.830 --> 16:50.430] it so the garbage collector and nothing can, can touch it as you're working with it. And then [16:50.430 --> 16:55.190] you just simply write that UEFI variable with the set firmware variable call with, uh, the [16:55.190 --> 17:00.390] tuple, and in this case it's going to be C sharp UEFI. And then I have a super secret, uh, [17:00.390 --> 17:07.390] super secret GWT, uh, super secret GWT, say that five times fast, um, that you can Google and [17:07.390 --> 17:12.590] figure out what it is. Uh, so the steps for executing UEFI variable are pretty much [17:12.590 --> 17:17.470] similar. You still need that token. And the first thing I did in C sharp was I did P invoke [17:17.470 --> 17:22.050] with virtual alloc to obtain an RWX memory pointer that I can execute. And then I was just [17:22.050 --> 17:27.250] obtaining that UEFI variable back into that buffer so I can execute it. Uh, so the first [17:27.250 --> 17:32.590] step, same idea, you need that privilege. The second step is I start P invoking some memory [17:32.590 --> 17:39.550] so I have RWX. Uh, but you can't actually really do that in C sharp because it's abnormal to [17:39.550 --> 17:44.790] bring things into your import address table that aren't actually C sharp specific. Um, so [17:44.790 --> 17:49.930] like all of the virtual calls are more suspicious than getting a new process token. Cause, [17:49.930 --> 17:53.270] uh, within like C sharp there's no real way to do like process token stuff. You have to [17:53.270 --> 17:59.330] pretty much P invoke so it's not suspicious. It is suspicious for EDR products that you're [17:59.330 --> 18:04.570] doing virtual alloc, virtual free and virtual protect within C sharp. It's like, whoa, stop [18:04.570 --> 18:07.970] right there. We're going to tell the blue team about this and they're going to hunt you down. [18:08.050 --> 18:14.650] So we can't do that. Hilariously enough as we were going through this research, um, OJ is [18:14.650 --> 18:20.490] working on like a, a C sharp C alarm interpreter and he was dealing with some stuff and he [18:20.490 --> 18:24.970] also says the same thing like don't P invoke your dot net apps. Like EDR is going to find [18:24.970 --> 18:29.950] you. Like as he says, it's the proverbial solution for them hunting you down. Uh, so we're, [18:29.950 --> 18:35.030] we're not going to have, we're going to lose the ability to P invoke to get RWX memory. Uh, [18:35.030 --> 18:42.470] which is kind of a problem. So we can't do step 2 anymore, but fear not, uh, the CLR and C [18:42.470 --> 18:46.930] sharp is fantastic for malware. So we're going to actually just now instead of doing any [18:46.930 --> 18:52.530] virtual calls, we're going to use reflection within C sharp to obtain RWX JIT memory, which [18:52.530 --> 18:58.050] just in time compilation leaves RWX memory pages if you're not familiar with it, to read the [18:58.050 --> 19:02.850] UEFI variable into that. Then we're going to write the UEFI variable into a method table [19:02.850 --> 19:08.990] pointer and then we're going to execute the method as if nothing actually ever happened. Uh, [19:08.990 --> 19:11.750] so those are the steps. I'm going to actually go through that in detail because that was [19:11.750 --> 19:18.430] probably a little bit jarring. Basically, in C sharp, if you're not familiar with it, [19:18.430 --> 19:24.050] because it's an intermediate level, uh, language representation of code, it has to get just in [19:24.050 --> 19:29.690] time compiled to assembly code before it gets executed by the processor. So within C sharp [19:29.690 --> 19:33.650] there's this huge method table that contains all of the methods that the C sharp application [19:33.650 --> 19:39.450] knows about and all of those contain a JIT stub for those classes methods. So essentially [19:39.450 --> 19:43.610] what that means is at the time of just in time compilation, the method table gets [19:43.610 --> 19:49.110] referenced, you then get a function pointer to the executable assembly code that the [19:49.110 --> 19:54.130] processor will run, which is RWX due to the notion of JIT. You can grab that method [19:54.130 --> 19:58.430] pointer, dereference the function pointer that the assembly code lives to, which is, uh, [19:58.430 --> 20:02.770] just the location of the method that you're clobbering and overwrite it. So this [20:02.770 --> 20:07.210] essentially means we can declare a method that we don't care about, force it to just in time [20:07.210 --> 20:12.530] compile, get the pointer to it and then overwrite it. Uh, so it's basically like red [20:12.530 --> 20:20.390] tulip C but in C sharp and it's like more fucky. So the steps for that look like this. We're [20:20.390 --> 20:25.210] essentially going to now obtain an RWX JIT memory page to read the variable into. That's [20:25.210 --> 20:30.710] going to consist of defining a method, uh, to overwrite, JITing the method, obtaining the [20:30.710 --> 20:35.430] pointer to the method and then overwriting it and calling it. So we'll define a method to [20:35.430 --> 20:40.110] overwrite. This is in the code that I'm going to be releasing. It's just called overwrite me. It [20:40.110 --> 20:46.610] does nothing. We'll JIT the method. So here you can see in reflection I'm doing a type of the [20:46.610 --> 20:51.910] program I'm in. Get method overwrite me. I call compile service run time helpers prepare [20:51.910 --> 20:55.770] method which is essentially just going to JIT that with the method handle. So I have my [20:55.770 --> 20:59.850] method dot method handle. That's dereferencing one of the pointers. And then I obtain the [20:59.850 --> 21:04.470] pointer to the method which is just get function pointer once I've JITed it. So now I have the [21:04.470 --> 21:11.390] location of the raw assembly code after JIT and that RWX memory location. So now I write the [21:11.390 --> 21:17.250] UEFI variable payload that's stored in NVRAM into the pointer to method. So I just call get [21:17.250 --> 21:22.130] firmware variable EX. Uh, you can see the third argument there after the tuple is pointer to [21:22.130 --> 21:27.350] method with then the fourth argument being buffer length. That's going to take the NVRAM out, [21:27.350 --> 21:31.590] plop it in and then I can just execute the method called overwrite me as if it was actual C [21:31.590 --> 21:37.330] sharp code and I hadn't done anything malice. So we're going to do a quick demo of what that [21:37.330 --> 21:42.410] looks like to kind of tie it all together in Windows. Um, step one, you obtain your, you [21:42.410 --> 21:46.810] obtain your shell on target. Uh, we've already done that so step one's kind of skipped. We're [21:46.810 --> 21:51.790] then going to run write UEFI C sharp. You'll see this with a, with a writer binary that I've [21:51.790 --> 21:55.770] written. Uh, in an actual like red team engagement or in a campaign you'd probably do this [21:55.770 --> 21:59.730] with like whatever C2 framework you were using. So you can use the C sharp code say like in [21:59.730 --> 22:03.730] cobalt strike with some of the functionality there and do it on Windows boxes. Um, you'll [22:03.730 --> 22:08.030] then do some sort of persistence mechanism for the reader binary which is going to go through [22:08.030 --> 22:13.070] and do the steps I just demonstrated with reflection. Um, it's like a 4 kilobyte binary [22:13.070 --> 22:16.050] you'll use for persistence. You can, you know, we're not giving you a persistent [22:16.050 --> 22:19.690] mechanism. I'm sure all of you have lots in your bag. Uh, you just need to throw this [22:19.690 --> 22:24.430] binary somewhere and, and run it. And then we'll uh, we'll run it to showcase what it looks [22:24.430 --> 22:38.930] like. So, the Windows demo is this one. Computers are hard. So here I am on Windows. Um, I'm [22:38.930 --> 22:43.090] going to first go through and run a really quick chipsec module. Uh, if you're not familiar [22:43.090 --> 22:48.070] with chipsec, it's a UEFI platform security tool that helps security researchers analyze [22:48.070 --> 22:53.730] platform firmware. Uh, it does a lot of cool things for UEFI, particularly variables. So what [22:53.730 --> 22:58.390] I did here is I just ran a module to dump and list what all the UEFI variables currently on my [22:58.390 --> 23:03.430] system are. You can see that there's a lot of them. Do note that most of these are NVBS plus [23:03.430 --> 23:09.030] RT. Uh, so most of them are accessible, uh, at run time services to the operating system. [23:09.030 --> 23:14.350] And they're, of course, because they're persistent, they're persistent in NVRAM. So [23:14.350 --> 23:18.530] there they are. You didn't see mine. Here I'm going to dump really quickly the variable list [23:18.530 --> 23:22.970] to show you that there's contents of all of these variables. Like this one is kind of funny, [23:22.970 --> 23:28.750] like test zero, this is a test. Um, so there's lots of variables here. Nobody really ever [23:28.750 --> 23:33.050] audits them. Like I said, AV and EDR doesn't look here. So now what I'm going to do is I'm [23:33.050 --> 23:38.070] going to run write UEFI or UEFI write C sharp. That's going to write a UEFI variable to [23:38.070 --> 23:44.490] NVRAM. I ran chipsec again to show you that it's now there. There it is. Uh, C sharp dash UEFI. [23:46.550 --> 23:52.090] So now that that's there on box, I can execute what the payload is. Um, but first I'm going to [23:52.090 --> 23:57.410] show you what that, uh, there's actual like, uh, shellcode there. So I'll go into the UEFI [23:57.410 --> 24:01.370] variables directory with chipsec. I'll dump it out. And there you can see that I have some [24:01.370 --> 24:05.690] shellcode there that I'm going to execute out of NVRAM with a, with a, the, the reader [24:05.690 --> 24:10.630] binary. Uh, that payload for demo purposes is going to be our, our favorite demo, uh, [24:10.630 --> 24:14.710] Metasploit. So it's just a meterpreter shell that I'm going to spin up. I'm going to go [24:14.710 --> 24:19.950] through, run UEFI read C sharp. And then as you can see from that, uh, I successfully just [24:19.950 --> 24:28.750] executed a payload out of NVRAM with like a four kilobyte binary using reflection. Thank [24:28.750 --> 24:34.890] you. So the fun doesn't actually end there. So because this is a persistence mechanism and [24:34.890 --> 24:39.770] it's persistent, uh, in NVRAM, this means it's going to survive reboots. It's going to [24:39.770 --> 24:43.790] survive reinstalling your operating system. The only way to clear this out is to like [24:43.790 --> 24:48.830] clobber over that variable or, uh, pull NVRAM with like a deady prog and re, uh, like [24:48.830 --> 24:54.810] rewrite your UEFI, um, variable space. So I'm going to shut down the box, reboot it, go back [24:54.810 --> 25:01.530] to my Metasploit shell, uh, rerun the console. And then it's a cooking show. It takes a long [25:01.530 --> 25:06.010] time for Windows to boot. So speed it up. Uh, you know, I just put the payload in the oven. [25:06.130 --> 25:13.350] It's going to be done pretty quickly. The machine's booting. Still booting. It's a [25:13.350 --> 25:18.810] cooking show. Wait a minute. There it is. Let's see. And there we go. I just executed my [25:18.810 --> 25:23.910] payload out of NVRAM again, uh, with a persistence mechanism out of a UEFI variable. [25:27.800 --> 25:35.400] Yay, cookies. And shells. It, uh, it baked some shells. Awesome. Um, so we kind of like have [25:35.400 --> 25:38.520] hand-waved the persistence thing. We're going to leave that as an exercise up to the [25:38.520 --> 25:43.620] reader. Like I said, WDAC bypasses are a great way to do this. Uh, in actuality, uh, your [25:43.620 --> 25:47.720] payload's a UEFI variable. Like, good luck, have fun. Analysts, uh, we love you still [25:47.720 --> 25:52.580] though. Like, we're going to help you, but this is fun. Um, so like what about Windows EDR [25:52.580 --> 25:56.160] products? We haven't necessarily touched on that. Like, obviously this is a way to, to [25:56.160 --> 26:01.520] mitigate detection. Um, so we looked at a couple of, uh, EDR vendors and we found no [26:01.520 --> 26:06.500] relevant information pertaining to the usage of either these API calls, executing out of [26:06.500 --> 26:10.960] UEFI variable or anything of that nature. The only thing they're really going to see is [26:10.960 --> 26:15.460] that you're executing this binary. Uh, but like there's binaries executed on systems all [26:15.460 --> 26:19.100] the time. That's not really something too relevant, too relevant that's going to trigger [26:19.100 --> 26:26.160] hunt. Um, furthermore, uh, there's a lot of ways currently to sinkhole or to tamper with [26:26.160 --> 26:30.100] EDR products. So here's like a five line PowerShell script that you can use to like [26:30.100 --> 26:35.820] sinkhole EDR products. This works on a lot of them. Uh, like EDR products are things of [26:35.820 --> 26:41.280] software running on a box. Software have configs. Configs can be tampered with. So just [26:41.280 --> 26:44.520] tamper with configs a lot of the times and you can get away with anything on a box on [26:44.520 --> 26:48.860] Windows. Um, there's a lot of other ways to go about it. We can chat like after the talk [26:48.860 --> 26:52.340] about it. Uh, this isn't really a talk about this. So it's a talk about hiding your shit and [26:52.340 --> 26:58.020] that's how you hide your shit in Windows. Um, some WDAC bypasses just for references. Uh, [26:58.020 --> 27:01.420] now that I've talked about hiding your shit in Windows, uh, Mike's going to talk about some [27:01.420 --> 27:09.620] Linux stuff. Boy, Windows is silly. Let's, let's, let's talk about Linux. Linux is, you [27:09.620 --> 27:16.740] know, everyone knows that's where the real loot is. So, let's talk about the problem space. [27:16.740 --> 27:21.660] Uh, basically, let's introduce our players here. We have, you know, the kernel. We have the [27:21.660 --> 27:27.940] EDR. And we have, on the right, we have your sample. And, you know, EDR is looking at your [27:27.940 --> 27:34.300] sample and that's, that's bad. That's what makes it your sample and not your payload. Um, and, [27:34.300 --> 27:38.400] you know, the EDR and your sample are actually kind of peers, right? We're both running as [27:38.400 --> 27:44.840] privileged processes and the EDR has some hooks into kernel space to help it do, help it do [27:44.840 --> 27:50.780] its job. And so that's what that sort of rectangle just above the eyeballs is. Eyeballs are [27:50.780 --> 27:59.800] obviously EDR. And so, like, what does our solution space look like? Well, you know, what we [27:59.800 --> 28:04.840] really want is just to make, you know, just to sucker punch the EDR a little bit, you know, [28:04.840 --> 28:09.000] while it's not looking and make sure that it just doesn't look at us at all. And then, then [28:09.000 --> 28:16.100] it's back to being our payload. So, you know, how are we going to do that? We, we need to, [28:16.100 --> 28:22.680] like, we need to show up early to the fight, right? So that it never sees us coming. So we [28:22.680 --> 28:27.340] need to infect something. So, you know, how does your computer, how does your computer [28:27.340 --> 28:33.160] boot? And what can we infect? Well, the first thing that boots is platform firmware. And [28:33.160 --> 28:38.740] that's signed by the OEM. You can't really infect that easily. Boo. The next thing, that's [28:38.740 --> 28:42.680] signed by Microsoft, the shim, that's signed by Microsoft and it pivots the key over to the [28:42.680 --> 28:50.640] distro. That's a little bit harder to infect. Uh, grub, you know, signed by the distro, no [28:50.640 --> 28:57.200] good. Kernel signed by the distro, no good. But the RAM disk is generated on system and not [28:57.200 --> 29:03.660] signed. This sounds like a good time. And then sometime later, some shit happens and the [29:03.660 --> 29:08.600] EDR is, is started. So obviously what we need to infect is the RAM disk. So how are we [29:08.600 --> 29:12.860] gonna, what capabilities do we have, what, what, what, what tools do we have at our disposal [29:12.860 --> 29:16.920] in the Linux environment to, to make things happen and, and, and make the EDR not look at us. [29:16.920 --> 29:24.040] So, uh, the first sort of, uh, wonderful syscall to, uh, introduce is ptrace, right? And this is, [29:24.040 --> 29:28.220] you know, why we say the 90s are back again. Like ptrace, uh, exploitation of processes has [29:28.220 --> 29:34.940] been like, uh, as, as old as time itself. But, you know, and, and it's, it's tapered off in [29:34.940 --> 29:39.940] the, in the modern era because we have policies that prevent you from doing it. We have like [29:39.940 --> 29:44.980] Yama and SE Linux and AppArmor and silly stuff like Smack and Tomoyo and whatever. But the [29:44.980 --> 29:50.020] best part about all this stuff is the policy is implied in, is applied in user space. [29:50.540 --> 30:00.100] Alrighty. So let's, let's, let's go through this, um, let's go through this in flow chart sort [30:00.100 --> 30:08.700] of land. So we have, um, the RAM disk is actually the original PID 1. That's actually where, uh, [30:08.700 --> 30:15.320] init starts from. And then it finds your file system, you know, draws some pretty stuff on [30:15.320 --> 30:21.860] screen, like make sure you have the right fonts, whatever. And then it does, it actually [30:22.380 --> 30:26.900] deletes everything out of the, out of the root file system except for target directory. And [30:26.900 --> 30:36.620] then it moves the mount from the target to root. And then it execs systemd. And that will [30:36.620 --> 30:41.500] come up again, this sort of deleting everything. And then like systemd starts and like, you [30:41.500 --> 30:45.460] know, the thumbs down is the policy being loaded that prevents you from attacking the EDR. [30:45.460 --> 30:49.380] And then of course our eyeballs here are the EDR. So let's, let's talk about some other [30:49.380 --> 30:56.020] things. We have FANotify. FANotify is kind of a obscure API, but like it's designed for AV. I [30:56.020 --> 31:01.800] don't think any AV actually uses it, but, you know, who cares? Exploiting, or using security [31:01.800 --> 31:08.260] APIs for unintended things is like one of my favorite things. So basically what this lets [31:08.260 --> 31:15.340] you do is this lets you, you know, do the AV thing, right? Like a file is accessed, you get to [31:15.340 --> 31:21.680] stop that process from accessing that file, decide whether it's okay, and then you can say, [31:21.680 --> 31:28.660] if it is, to go ahead, which effectively allows us to inhibit startup of other processes. [31:30.400 --> 31:38.240] Another fantastic utility is memfd create. This has been talked about a lot in, in, in [31:38.260 --> 31:46.520] the hacker scene, but essentially, like, you can create an anonymous file, and this works [31:46.520 --> 31:53.220] like a file, get a file descriptor, and then you can actually access it through, you know, [31:53.220 --> 32:01.080] PROC PID, FD, even from other processes. This is fantastic. And, you know, the best part is, [32:01.080 --> 32:08.240] like everyone says, never touch disk, kids. And then another API that we can use is [32:08.260 --> 32:15.020] and this is also somewhat obscure and not really security relevant, is a PRCTL, PR set [32:15.020 --> 32:26.580] timer. So we need some marker for our process to say to the EDR, don't look at this. And so we [32:26.580 --> 32:31.280] need something that's inheritable, right? So, you know, you can, you can have your [32:31.280 --> 32:37.740] malicious shell, you can catch shadow, and when cat does, cat also inherits the marker. So we [32:37.740 --> 32:43.580] do the set timer slack, this basically controls how often you wake up the CPU, it's designed [32:43.580 --> 32:50.200] to save power, but I don't care about that. And then lastly, like, config EFI virus, this is [32:50.200 --> 32:53.820] the kernel config to make the EFI virus file system, you saw what a pain in the ass it was [32:53.820 --> 32:58.920] to do stuff with UEFI on Windows, Windows is dumb, it's just a file system, you just read [32:58.920 --> 33:05.800] and write files, it's super easy, you can do it from a shell script. And then I talked [33:05.800 --> 33:11.680] previously about MS move, like, basically, this, if you look in the code, this is labeled [33:11.680 --> 33:17.620] as black magic fuckery. I can go through these steps, but it's really convoluted, but [33:17.620 --> 33:24.880] essentially, if you want to have a malicious process that survives pivoting the root file [33:24.880 --> 33:30.120] system out from under you, there's a whole lot of really weird stuff involving containers [33:30.120 --> 33:37.180] and cheroots and namespaces and weird stuff to do so that your malicious process sees the [33:37.180 --> 33:41.780] real root file system as opposed to seeing the init root file system, which has nothing in [33:41.780 --> 33:48.200] it. Funny story, like, even though you can never have two root file systems in Linux, if you [33:48.200 --> 33:53.400] don't do this, you have two root file systems in that process, and the real one and the init [33:53.400 --> 33:59.160] one, and nothing is there, it's, like, really messed up. So, anyway, let's go through how [33:59.160 --> 34:07.460] this works in practice. So, our little devil emoji here, I like emojis, is our malicious [34:07.460 --> 34:16.780] demon. This is effectively stage one. We, in the init script, in the ramfs, forks and execs [34:16.780 --> 34:25.020] that. We open the EFI vars, we actually mount the EFI vars file system and mount proc and all [34:25.020 --> 34:34.320] that. And we fetch it out of the, we fetch stage 2 and 3 out of UEFI land. And then we just [34:34.320 --> 34:40.680] kind of stay there and we cross that boundary between init ramfs land and, you know, the [34:40.680 --> 34:46.560] real system land. And that execs, you know, our friend system D, which then spawns all kinds [34:46.560 --> 34:52.920] of other garbage. And when it spawns the policy load, which we detect through FA notify, we [34:52.920 --> 34:59.440] give a stop signal to sysctl. Sysctl is going to apply the policy that says you cannot [34:59.440 --> 35:06.640] p-trace. And there's our EDR over there. I think you can figure out the next step. We're [35:06.640 --> 35:15.740] going to p-trace the EDR and then, like, have our way with it. So, what p-trace allows us to [35:15.740 --> 35:22.900] do is, basically, we stop the process. You can see we probably end up stopping it right [35:23.460 --> 35:32.460] after or before a syscall. And we can just back up, we can just back up to the syscall. We can [35:32.460 --> 35:39.020] control the IP and back up to the syscall. And then we can just set EAX and set what syscalls [35:39.020 --> 35:44.280] we'd like to make. So, we're effectively coercing syscalls into the process. So, we can call [35:44.280 --> 35:51.080] memfd create. Then in our other process, because we can access proc FD, proc paid FD, we can [35:51.080 --> 35:59.880] shove stage 3 in there, which is embedded in stage 2, which, by the way, never touched disk. [36:00.420 --> 36:09.220] And then we can do an mmap. Fortunately, unlike in Windows, mmapping rewrite execute pages is [36:09.220 --> 36:14.000] like totally normal. Lib C does it all the time. And then we can just put our shellcode in [36:14.000 --> 36:21.060] there. And then we set, oop, I went too fast. Then we set our EIP to the slash of the [36:21.080 --> 36:30.100] slide there. And we actually just jump over. And then we effectively return to DL open as [36:33.820 --> 36:40.060] we learned yesterday. And as I kind of already knew, like, I'm sorry, I forgot the speaker's [36:40.060 --> 36:51.060] name. We talked about it yesterday. It's on my note card. I'm out of sync. Anyway. So, Lib C [36:51.080 --> 36:56.400] has an internal DL open. We can do the old school LD preload trick except for without LD [36:56.400 --> 37:02.340] preloading. We can call the internal DL open and then we can have our malicious SO. And that [37:02.340 --> 37:09.260] malicious SO can clobber whatever we need to clobber. And then we return. All right. So now, [37:09.260 --> 37:16.560] we can send the continue to our policy load and load the actual policy that prevents us for [37:16.560 --> 37:24.080] doing this. And our EDR is actually now looking the other way. So, basically, if you look at [37:24.080 --> 37:32.780] the code and you see our payload, and this is sort of a point that also touched on, that you [37:32.780 --> 37:37.240] don't want to, there's two options here about clobbering the EDR, either the input stage or [37:37.240 --> 37:40.700] the output stage. And the input stage is complicated. You have to understand how it [37:40.700 --> 37:44.580] processes information from the kernel. The output stage is super simple. You've already [37:44.580 --> 37:48.380] looked at the logs. You know what they say. You just want to, you know, compromise its [37:48.380 --> 37:53.540] ability to write things to the output log or things you don't want to the output log. And [37:53.540 --> 37:57.780] then there's our malicious process and everybody's happy. The EDR is looking away and we can [37:57.780 --> 38:06.640] plunder away. So, let's do a little demo. What I'm going to do is we're going to tune up [38:06.640 --> 38:12.640] AuditD. AuditD is our example EDR. You know, I know that AuditD is not a commercial EDR [38:12.640 --> 38:20.040] vendor and you're wondering, does this work on commercial EDR vendors? Yeah, probably. And [38:20.640 --> 38:26.640] we'll install our implant. We'll reboot. We'll set the marker. We'll do the exploit again and [38:26.640 --> 38:32.340] we'll show that we're invisible. All right, let's do the demo. Okay. Oh, God, how do you do [38:32.340 --> 38:47.060] this? Windows is hard. Oh, God. Do it. Okay. Oh, God, what did I do? Oh, God! Oh, God! [38:49.760 --> 38:57.820] I know how to use Windows. This Windows shit is complicated. All right, here we go. We got [38:57.820 --> 39:05.520] the analyst on the right. We got the hacker on the left. And what we're going to do is the [39:05.520 --> 39:11.120] analyst is going to turn on the audit rules. He's going to tune up audit so that it just has [39:11.120 --> 39:15.800] every exec. Then we're going to tailor the audit log. We're going to exploit the enterprise [39:15.800 --> 39:19.880] tool. You can see we're root. We're making all this noise. It's terrible. You know, they're [39:19.880 --> 39:25.780] going to roll this up. You can see it on the right, all that noise. Then we're going to run [39:25.780 --> 39:30.420] our infector binary. Our infector binary is going to make a whole lot of noise. But this [39:30.420 --> 39:36.160] noise is actually really normal because systems generate initram fs's all the time. So it's [39:36.160 --> 39:45.780] fine. So it's going to make basically all the noise that it makes on an initram fs update. [39:45.800 --> 39:52.700] This is kind of a lot of reused harness from my horse pill talk from a few years ago. But, you [39:52.700 --> 39:59.180] know, it's as true today as it was there. Everything's infected. Have a nice day. And then [39:59.180 --> 40:05.980] we're going to reboot. Let's do some cooking show time. Let's see if I edited this video well [40:05.980 --> 40:15.780] enough. Here we are. Okay. I'll edit it tighter next time. Okay. And we're going to reboot. [40:15.800 --> 40:24.580] Again, we've tuned up audit. And you can see we're displaying the audit log there. Let's see. [40:24.580 --> 40:33.460] Make a little space there. Okay. And then we're going to do the same thing. Actually, we're [40:33.460 --> 40:37.340] going to set our marker first. And that's going to make a little bit of noise. But once you [40:37.340 --> 40:43.160] set the timer slack, that's what the PRCTL call is. You can see the marker is set. And you can [40:43.160 --> 40:50.320] also see that there's no noise in the audit log. And then I game root again. And you can see, [40:50.320 --> 40:59.580] again, no noise. We're invisible. We can do all those nasty things we did before. Invisible. It's [40:59.580 --> 41:10.680] awesome. Ta-da! And then we can show the policy as applied. You can see YAML mode 3 [41:10.680 --> 41:15.060] means P trace is completely disabled in the system. And that is true. P trace is now [41:15.060 --> 41:19.440] completely disabled in the system. But we inhibited the policy load that prevented us from [41:19.440 --> 41:25.820] doing that. And then, like I said, everything is a file system. Or everything is a file in [41:25.820 --> 41:33.460] Linux. If you look somewhere in there, there should be a lol key. Yeah, there it is. Yeah, [41:33.460 --> 41:39.840] right around there. Because hacking is funny. And then, ta-da! We did it. How do we get back [41:39.840 --> 41:52.480] to the slides? Okay. Thank you. And, you know, everyone on a Saturday morning at DEF CON is [41:52.480 --> 41:59.380] always thinking to themselves, what does this all mean? You know, we just want to bring [41:59.380 --> 42:05.740] happiness to everyone. Everyone is going to sleep well tonight. This is the net happiness [42:05.740 --> 42:11.600] increase. You're happy. The analyst is happy. That payload that you spent months working on [42:11.600 --> 42:16.240] is still your payload and not their sample. Everything is good. That's what we're all [42:16.240 --> 42:22.480] about. Bringing happiness to the world. All right. I don't really care about mitigation, so [42:22.480 --> 42:26.040] I'm going to have Topher talk about that. I mean, I don't really care either, but we felt it [42:26.040 --> 42:30.720] necessary. There's a couple of things that you can do to mitigate this. Like, the one biggest [42:30.720 --> 42:35.560] thing is, because we're utilizing UEFI variables, is to actually monitor and audit those [42:35.560 --> 42:39.640] against your organization's fleet. That would be like the first step to sort of mitigating [42:39.640 --> 42:44.000] these risks that we've presented. Um, furthermore, EDR vendors, if any of you are out [42:44.000 --> 42:48.840] there, you should be detecting UEFI APIs and this functionality in Windows and in Linux [42:48.840 --> 42:53.080] spaces if you happen to be doing, like, Linux EDR. Um, it's not really common for [42:53.080 --> 42:57.580] applications to set and get firmware variables. Um, and furthermore, like, after the [42:57.580 --> 43:04.020] installation of a platform, uh, NVBS and RT variables being set is pretty weird. Uh, I've [43:04.020 --> 43:07.680] never actually seen that in practice. If you have seen that in practice, come talk to me [43:07.680 --> 43:13.540] about it, because I'd like to know where, because I want to abuse it. Um, furthermore, as we [43:13.540 --> 43:18.260] kind of showcase, EDR tamper resistance is not at all effective. Uh, it's very easy to, like, [43:18.260 --> 43:23.940] sinkhole, uh, the sensor, kill the sensor. As Mike showed, it's very easy to p-trace the [43:23.940 --> 43:28.840] sensor. Um, so vendors really just need to work on securing their, uh, agents and their [43:28.840 --> 43:33.100] processes a little bit better. Um, furthermore, uh, Mike kind of said this in his horse [43:33.100 --> 43:37.960] talk at Black Hat a few years ago, but assembling RAM disks on systems is just silly. Stop [43:37.960 --> 43:43.900] doing that if you're a Linux distro. Um, so, like, as far as closing the rest goes, we have [43:43.900 --> 43:51.020] some future work. So, you know, the system firmware is, uh, a great, a great place to hide [43:51.020 --> 43:56.620] and there's all kinds of goodies in there and we are just touching the surface of it. And it's [43:56.620 --> 44:01.340] interesting, like, as we were doing this research, a lot of companies started announcing [44:01.340 --> 44:08.480] that they are going to start looking at the firmware space as a place to hunt. But, you [44:08.480 --> 44:13.220] know, this is a cat and mouse game and, uh, as far as I can tell, the, uh, are we the mouse or [44:13.220 --> 44:21.620] are we the cat? Anyway, one of us is already ahead. And I think it's us. I'm not sure if we're [44:21.620 --> 44:27.820] the cat or the mouse. Alright. So, like, in closing, we're bringing net happiness to [44:27.820 --> 44:31.980] everybody. We're going to have ourselves a UEFI dot party. We're plundering away our loot. [44:31.980 --> 44:37.080] We're sucker punching that pesky EDR. Um, and all of our code is located on this GitHub [44:37.080 --> 44:44.660] link, uh, perturbed platypus or, you know, as we like to call ourselves, APTPP. Uh, we, we [44:44.660 --> 44:49.300] just pushed the code. We just confirmed it. We had a, we had a timer on a box that pushed it [44:49.300 --> 44:55.380] exactly 1045. Uh, it's live. So, go, go have at it. Plunder away. Uh, here's some references [44:55.380 --> 44:58.480] that you can look at. Uh, that, that's all we got for you.