So, next. I'm going to make the same joke I did earlier. Don't care. How many people here use antivirus at work? How many people think that antivirus is worth a shit? Oh, man. CISSP over here. How many people have said, well, I'll solve this problem. I'll get an EDR. Yeah? How many people think that EDRs are worth a shit? Ah, sucker. Time to learn about how EDRs may not be as effective as you think they are. Let's give Nomad a big round of applause. You had a great time, man. Thank you. Appreciate it. Hello, DEF CON. And today we're going to, well, my name is Dimitri Snashkov. And a couple words about what I do. I'm a developer. I'm a developer. I'm a developer. I'm the CEO of RavTeam and who I am just because it is applicable to our talk. RavTeam operator. Help my team execute the testing efforts. Um, sometimes create tools, sometimes release them. And so because this talk is going to be from the perspective of RavTeam operator. Um, I want to set some stage before we go dive into details. Um, I think that Linux matters. I think that it runs a lot of payloads on the cloud and elsewhere. I And I do think that attack and offense actually tries to get there as fast as they can, bypassing office networks, dropping there through applications. And I do think that the defense follows the attack. And as such, we start seeing as operators, we start seeing a lot of presence of EDR on Linux. And so what is EDR? It's End Point Detection Response, right? And we as operators are supposed to kind of respond to that by stress testing them and seeing what they can do. So, it's a story, right? It's a story of us getting onto the Linux box time and time again and being caught. 15 minutes, 10 minutes. What happened? Two, three years ago it wasn't the case. We knew exactly what we were doing there. Now there's this fancy thing called EDR, but we can't do anything about it. So, we have to do something about it. And that's really define what it is. Is it a pure play EDR product? Is it a side gig for whitelisting applications? Is it a DLP? Perhaps it's maybe some homegrown scripts, right, that catch us or some form of other manual or tool assisted threat hunting. And so, when we drop through the box, we do not know what it is. On top of that, we have to address initial foothold. Let's say our exploit worked. We got there, but so what do we do? How do we maintain presence there? Our activities may be logged, supervised, right? We need to stay there for a while. It's not a 15 minute job to establish a foothold and basically compromise anything else in that network. We have to persist. While we're doing it, we're supposed to evade automation that is definitely watching over our actions. And maybe even deflect the network from the network. And we're supposed to evade the artifacts that we brought in, into that environment. On top of that, we may be in a position that we are in quiet boxes and defense actually knows what they run. Whitelisted binaries, processes are quiet, right? So we are the anomaly. There are two sort of ways of, uh, taking, tackling our issue strategically, right? It's an operational evasion where we shut down the EDR, blind it in a way. You know maybe we're confusing it from that operational perspective and you guys really need to check out the talk that Tiemensen and Rutkeler has done this morning for that. Here we're going to take a look at the behavioral evasion, right? So what does that mean? We are going to try to take the execution of our programs and we're of uh of our uh cradle payload bootstrap whatever the case may be that we're going to talk about. And then we're also going to try to deflect that artifact discovery that we've been talking about. Alright so what are the objectives strategically? Well we know we need to uh we need to evade detection at run time that's that's a given right? Somehow we need to serve their payload our payloads in such a way that they're either undetectable or maybe easily sort of um you know they're they're created in such a way that EDR doesn't know what to do with it. Strategically there are three choices. We can drop our uh our tools right on the box but that may not work because they may detect our our our programs our our malicious payloads right there. We can start developing offensive tools right on the box but then we have to make sure that we have the development facilities we have to have compilers maybe we can have some tools on the box themselves to to compile all that. Also not ideal. And the third choice is fully living off the land utilization right? We take what we're given and try to work with it but then again we do not know where we are how quiet the box is what is white listed are we going to find what we can rely on to extend and maintain our foothold. And so maybe there is a way to do an assemble attack, right? It's a blended approach that has a couple of ideas. The first idea maybe we can bring in small malware cradles that are not malicious in nature, they're just bootstrap code that gets loaded with malicious code at run time as it runs and then we can so EDRs, they're building the story of consistent execution of a program is not going to be able to do that. Or maybe we can interject into that story. And then build the iterative capabilities by loading our cradle with the malware. The second idea is probably more powerful, depends on where you are, is to take the white listed binaries and essentially turn them into Trojan horses, turn them into decoys of our own actions. And then the second idea is to turn them into either the user or the computer. The reason why it's powerful is because the white listed binaries are there, there's supposed to be- they're trusted. So the story that EDR builds, we're attacking the trust, right? And that's more powerful. And in this thought we're gonna talk about both of these ideas, how they can actually progress in parallel. So in the first stage we're gonna see how we can actually work with what ingre-ingredients do we have to build that cake, you know, to cook it, to bake it rather. Um, and we're going to heavily rely on preloader in Linux operating system for that. We're going to see how we can chain our preloading and then maybe hide some things from the EDR. And last but not least we're going to talk about the concept of rapid prototyping which is really important because of the constraints that we cannot bring our own tools and we have to somehow try to build them on site. Rapid tooling prototype is really important for us. In the second stage we're going to try to weaponize and operationalize the offensive capabilities that we've built. We're going to look at mimicry and decoys in operating system for our own actions and benefit. And we're going to see some other things that will help us persist. So stage number one, let's take a quick trip, you know, down the memory lane into the dynamic linking and loading. Just like in other operating systems, your linker is a tool, set of tools, a framework that allows you to com- to, to basically assemble your executable with dynamic libraries, static libraries, whatever the case may be, essentially present a, uh, consistent view of that binary, right? The loader and linker, they see two different execution views. They have, uh, or two different, uh, memory footprint views, right? There is a linker view and there is an execution view. Segments versus, uh, sections. And linker basically says, okay, well I'm going to find your dynamic library if you are looking for it at the run time and I'm going to patch it into the executable. I'm going to run relocation of the memory and I'm going to hand it off to the, to the actual execution. So, In practice, if you're the operator or any user of the Linux system, it looks very simple. When your executable is compiled with dependencies on a dynamic library, if it runs and it doesn't find the dependency, it bombs out, and you're given an error pointing to the actual library that is missing. Once the dependency is found, and you can do that by various tools available on a Linux machine, you can actually launch it back, and everything is going to be fine. If your library path is set up right, and your dependency is found. And also the other concept is, um, is elf hooking, right? Used everywhere for malicious and non-malicious purposes to introspect binaries, to change its behavior, to hot patch a binary. Essentially what it does is, you can use in the, you can use the preloader to actually find a library that is supposed to be loaded into the memory space of the executable, and you can actually interact with it. You can take a binary, you can basically detect it, and you can physically log it with the feature and functionality that you can introduce into it. That is foreign to the execution of that binary itself. And so you can basically say, ok well I can take a functionality, I can re-route it. We're breaking the API contract here, by re-routing our execution to the libraries that we bring in. But, uh, there is a problem with that. The problem is that you need to know the API. library is C library is known very well, there are mempages for it, the contracts are known, the APIs are known. For example, for F open case, F open API you know exactly what it returns, what it takes and how that works and so when you're preloading the binary with a known F open API you know how to interject it, right? You can reroute it and interject it, but unfortunately in the black box scenario that we're working in, when we're dropping in the box and we do not know what we are trying to preload, that presents a problem. We first need to understand what that binary does, we need to trace it, maybe reverse engineer it a little bit, we cannot do it most of the time on the box itself. So what if we are going to be a little bit more agnostic as to the specifics of the API we're trying to hook? What if we are not going to the actual subversion of the target, we're not going to be able to get the standard or I'm going to rewrite functionality in a library that we're preloading? We're still going to compel it to execute our code, how do we do this? Let's look at the relationship that the processes have on Linux, parent and child process. If you are the parent of a process you likely let's just say own the bootstrap process of it. You can introspect it and you can have some form of relationship between the two. And so we can try and deliver it to the payload generically in a known way by abusing this relationship and trust. And then, you know, the world is your oyster. You can do other things with it. Let's see how that works. But first is just the viability check. Why do we need to do this? Well, if we're taking the two paths, the clean preload cradles, right, and the second path is using the binaries that you find on a disk, you can time the loading of the modules and you can actually work towards, towards blinding EDRs that way. The EDRs may not be able to fully trace your execution if you're taking care of splitting your payload into different libraries using the preloads. And you can abuse the parent-child relationship on Linux and attain your, your goals that way. And what we want is we want to take a target process and turn it into this monstrosity instrumented whether with our payload, our malicious payload, and also trigger that payload or parts of it when we want to. So let's walk through that process. In order for us to do this, uh, let's turn our attention to, back into the ELF format. But in this case, we're going to look at it from the offensive standpoint. So let's look at it from the offensive standpoint. Let's look at it from the noqt line. We're going to take the sections of the ELF and we're going to try to introduce malicious code in it. Well, in the case of uh, a cradle we're bringing in it's really easy because we can compile things into those sections. And our compiler, our friendly compiler, is helping us with that. By using sections like, init array, or fnit, or maybe even as, as a pre-init array. Essentially we can supersede the understanding of the execution by injecting code into the sections that will be executed before your main, right? And so the one curious thing or side effect of loading and linking I guess in this case is that control is given to that shared object that you're introducing through loading before transferring control to the main. Do you see what we're doing here? We're basically trying to preload the executable and interject and control its execution before it even starts. Parent child relationship? Maybe. The other thing is we can take a look at things past ELF format. We can look at the library, libc library in Linux operating system. We can actually hook libc start main. The reason why that's useful is because libc start main is everywhere. It sets up the memory, um you know, uh it hooks up uh the memory of the memory of the memory of the memory of the memory of the memory of the memory, uh different things, sets up execution context for executables on Linux, um at least in many cases. And we can do that, right? By basically hooking libc start main and then looking for a dynamic um next function that goes into into the the original main by using the dl sim and dl uh dl open. But that's not optimal. Why is this not optimal? Well, let's go back actually. The reason why it's not optimal is because EDRs can actually look for DLSim and DLOpen and basically deny your execution. It's very easy to trace and see what DLSim is being used and just say no you guys cannot load any libraries into this process. Okay, well if you, if you the EDR do not like us that way what we're going to, what we're going to do, we're going to use a facility called weak symbols. What weak symbols mean is that if you are trying to load a binary with, um, with a li- a binary with a library of your choosing and you define a, um, function, maybe a global function or some variable that you're exporting from that library. Normally as we've seen before when you cannot find a, you know, feature or function that you're looking for, your destination is going to be a library. So what we're going to do is we're going to use a function called load. So, um, we're going to So we will basically, we're going to say no, I can't continue. I can't find that code. Well what weak symbols are doing for you is it says okay well if it's not present just skip it. Maybe it's loaded down the line but we don't care about that. So if we are dropping in the sandbox and we're seeing okay well can, do we, do we have a library sitting next to our, to our executable or otherwise for example, incident response has taken our library, but not, uh, has taken our binary cradle, but not the library, then, uh, we're not going to launch it. And so this story unravels, right? Uh, you can chain, um, preloads and libraries through the weak, weak symbols. You can say if it's present, launch it into memory, it's not, then skip it. That's called, uh, controlled weak refs. There's also foreign weak refs. Did you know that ev- almost every binary on Linux contains weak symbols? And did you know that you ca- you can actually hook them from the library preloading them? CXA finalize and gmon start is a good example. There are others, especially in the, uh, in, um, in solutions that deal with, for example, Java virtual machine. So essentially what that gives us is if we're not able to bring our cradles, we can find weak symbols in libraries or executables on the box itself because they're given to us and we're going to take advantage of that. And also I talked about the chain weak refs. You can actually split the execution of your payload or the payload itself across a chain of dynamic libraries. So when the EDR gets one library, it doesn't see the full picture. That's what we want. Next up is the construction, right? The constructors, uh, are very useful when you're coding, um, C or C plus plus application. You have a way of saying, okay, well that's my constructor. You know, it sets up virtual memory for dependencies and all that good stuff. We can take advantage of that. How do we, how do we do this? Well, what we do is we preload a binary with a library that defends, that defines a constructor for that execution. So essentially before it gets to the main, we're saying, oops, that's an object. Don't do execution of a main. Instead, we're saying, oops, that's an object. Don't do execution of a main. Instead, run the constructor before you hand it off to main. And the same thing with destructor. Before the, uh, binary is, uh, you know, ends its execution, just execute whatever we're giving in the destructor. Destructors are powerful that way because you can time the execution of your malware. Nothing tells you to, if you're, uh, preloading slash bin slash ls, bin slash, your malware has to run at the outset of that execution. You can run for hours and then when, the, well, bin ls is not a good idea, but maybe some, some long running, uh, process, right? And when you kill it, maybe sending a signal to it or whatever the case may be, this is where you trigger the execution of your malware. Right? So now with the constructors, we can do it in a target agnostic manner. We can take any executable on Linux and basically start preloading it in a generic way. And if EDR technology actually knows about that trick and they say, okay, well, we'll interject and we'll just give you a constructor, default constructor. Turns out there are priorities on the constructors and so if they load at a default priority of 200, what we can do is we basically, uh, uh, load it at, uh, at a priority higher than that at 101. Right? And the same thing with destructor. We will basically patch a different priority to constructor to override the defense. The other thing that we can, we can do to break that story that EDR kind of, uh, builds by saying, okay, well, indicators of compromise are there. You know, are they building a story? Is it a malicious executable? Is it not? Am I going to kill it? Am I not going to kill it? Is to trigger that malware loading through out of bed signals. Not only regular signals, but even exception handling. Right? Nothing tells us that we cannot instrument our cradle or preload the, uh, the decoy library, decoy, decoy binary on a system that is not working. Um, and then basically divide by zero. That's not a, a recoverable event in most cases, but we can implement a handler. So what EDR sees as a completely disastrous event and it stops looking, we recover from it and we continue running. Right? Tips, tips and tricks like that. So you can self-trigger your own execution there. And we're actually going to see, uh, that coupled with other things later on. And then it, obviously if you're bringing in your libraries, you can start building user land rootkits on it. You can clean your LD preload from your own environment. So if EDRs are looking at your memory space and says, hey, where is the payload? And if they're relying on environmental variables, they're not going to be able to find it. All that good stuff can go in there, obfuscation of your loaders, right? Runtime situational checks. Um, possibly even foregoing the main itself. Maybe you're doing some assembly tricks to basically set up a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a. N example is if what is saying, okay, if EDR is looking for main I'm not going to have it. Or I can rename main to something else, something innocuous. And you can even substitute the actual loader, ld .so, on Linux to have your own into the interpreter section. So if EDRs are instrumenting in such a, in some way the ld .so, they're not going to see it executing. Okay, so now we have some uh primitives to work with, some recipes, some tips. How do we progress um further? How do we expand and scale our our presence there? Right? That's important because we have to have almost a la carte set of tools and primitives in order to bypass different versions of ADRs because we do not know what it is, right? It could be whitelisting technology that we know about, it could be something else. Okay, well we mentioned LD.SO as a default linker and loader for the um Linux operating system. What about system libraries and binaries that run other binaries on systems? Well LD.SO not only runs programs that you know that it finds or ellipse start patches it in, but it can also run directly your payloads, right? And if your ADRs are watching over the regular expressions like what is your process name, right? I'm not going to allow some things that I do not like and I can only do things that I don't like. I can only do things that I can, um, not like and I can do, and I can, um, that way. Let's say I have a loader and I want to go to place.com and I want to kind of do a seeding task. So that's a very VI launching into the memory, switching TTYs and basically executing your code. Are you doing all that EDR? If you're not doing all of that, then obviously you're going to miss that. But from our perspective, from the operating perspective, that's too chatty, right? Because that assumes that the defense can analyze our command line, right? And so it's also all of that, you know, it may be really easily defeated. Okay, well, we need to devise some other things. Maybe we can up our anti-innovation capabilities. Maybe we can bring in, interpret the languages into the mix, right? So we can prototype easily once we drop in the box. And so, before we actually get to interpret languages, we can even talk about highly reflected pieces of code that are, you know, you know, you know, you know, you know, you know, you encoded into the, um, low uh, shared libraries. Nothing to say that you have to create your shared libraries out of C, or C plus plus, right? You can actually use form function interface and run things out of python, or maybe compile things with cgo, and by the way, what does the it give us? It gives us, as an attacker, a privilege of 256 functions, highly reflective before the defense can actually find our main and figure out how we are executing. So just by shimming, shimming out of the consistent execution of C language into some other stacks, for example, interpret language or VMs or other things that are very highly reflective, the EDR loses our trail and therefore it cannot build a consistent story to be able to determine if we are malicious or not. And the same thing with interpreted languages. You can actually run some things in it. For example, you can preload things with Lua. That's a completely different execution and it gives you different memory footprint if EDRs are not watching for it. And you can, with chaining you can mix and match all these things. So see how many, it's a death by a thousand cuts in many respects as far as EDR building that story. That's what we're after. We're basically trying to abstract it to the, to the point where we're persistent, you know, if, if it's not a known good and if it's not a known bad, because EDRs are running on, you know, most EDRs run on performance and they cannot consume too much CPU time or, or analysis time, they will say, okay, fine, I'll let you go. And so, right now we know that those primitives that we're trying to build are not that primitive, right? But, stage two is not that primitive. Stage two is how do we package this whole thing? How do we make this rapid prototyping actionable? How do we make it maybe even more defensible for us? So start thinking about, uh, preloader, pre, preloaders. And let's start thinking how do we expand the functionality and make them more, uh, flexible I should say. In this example if we're taking slash bin slash LS and we're preloading it with our malware execution chain, right, that's in this example, we have a preloader. In this example, any arguments that we're passing in into the preloader are not going to end up being used because they're eaten by the ALS. Well, you know, what can we do with this? How can we make our loader even more expanded? We can start moving back on the command line with environmental variables that are being consumed by the preloader, right? And mind you, in this case the preloader is only a dynamic library, it's not an executable, it is loaded as a constructor into slash bin slash ALS. And so in this case we are saying, hey, you know, take that bin ALS, preload it with libctx.so, by the way go into the background, by the way rename itself in the process table as SMTP process, by the way have a chain of shims that load into, you know, you dynamically unravel that chain and load it back into the memory, and then you can actually, and by the way pass arguments to those chains, to the chain or to those libraries that we're preloading. That's one way of doing it. And those chains can use all the things that we talked about, they can be highly reflective, they can escape into, into interpretive languages. They can even switch on different IPCs, right? They can run over pipes or they can source their payloads over various ways. So, that's one way of doing it. But, you know, if you um, facilities that the operating system has. Now, and obviously they can clean up after themselves, right? They can remove all the things that they've loaded, LD preload, uh, all the environmental variables. So, um, if you're there first, you'll probably see that. If you're not, you won't. One small little problem, the loader that we're trying to do, the preloader, uh, chain that we're trying to launch, at least one of them is a file, right? A file, ld.so tries to load first. And as such, it's on disk, it's scannable, admins can find it, whatever the case may be. But yes, we know about EDR identity crisis. Yes, I, yes we know not everything is being watched, but there is a chance. So we want flexibility. Can we work with memory? Can we load things over memory? Well, loading modules into the memory is, is really interesting thing. It's, it's very, it's very, it's, it's, it's, it's, it's very, it's common, right? Mapping, uh, memory and stuff like that. So your operating system is going to love you for that. There are facilities. But as soon as you start trying to execute something from memory, your operating system will not like it at all. So, historically it's been, there have been, uh, many different, uh, ways of operating shared memory on Linux. Dev SHM, right? You can stuff some things in there, but again, EDRs may know about that, they watch it. Uh, so, uh, naked memory mapping of files is also something that is being watched by EDRs because you can put permissions on it, you can change permissions, you can create, uh, read, write, execute, um, sections in there and then, you know, obviously that's detectable. And most of the, most of the time you can't really, uh, obtain execution from memory location because of that. Because you cannot mark your, um, memory executable at some time, you know, sometimes you just can't do that. As kernel 3, uh, 3.17 rolls in, um, we, we're gaining a specific separate system call, which is memfd create. That's not a new technique to load things into memory from, uh, memfd create. But, if you want to do this, here's the API to do this, memfd create, you allocate memory and then you basically pass it to fexecve or maybe you emulate execution, but the point that it, it works. You basically have a way to, to execute things over memory, right? Uh, essentially, it is the relaxed, um, the, the operating system relaxes rules on execution when when you use that specific, uh, system call. But, that's not what we're after. It is going to hold, but we're not after that. A curious side effect of running memfd create is that it exposes a file descriptor like like any other Linux process in a proc, right? And that memfd creates a proc fd in this case, uh, you know, two, descriptor number two, for example, or three, whatever the case may be. That's what we're after and let's review what we can do with this. Well, if we're breaking the story of EDR and we're splitting payloads across libraries, we can split payloads across memory spaces of processes. We can say, we can have line, we can line up ten cradles, launch them up into the memory and those ten cradles are going to be separate processes that may host a part of the payload. How do we reach out to those, um, processes and ask them, hey, give me your part, give me one tenth of a payload so I can execute it. This is what we can do with memfd create. Instead of, um, if we're taking the preloader and, um, we're taking the memory and instead of executing and loading the module from, um, a disk, we can ask a different process to give us a descriptor that maintains or contains the library or a payload in such a way that we can execute it. So we're gaining, we're reaching out to a process ID 564117 and saying, hey, give me an exposed, um, uh, proc file descriptor. Okay? The process ID 564117 is the only problem here is while we're actually doing execution and loading from memory, what is 564117? And if we're not in a relationship with that process, if we're not the parent-child relationship or we're not super user, then we're not going to be able to see that, you know, that process descriptor because of the Linux security model. So let's work on 564117. And before we do that, we have to look at the nature, which is really brutal at allocating resources and very efficient. And there are things in nature that you can learn from, right? We can learn from. One of these things is a phenomenon of a virus that infects a specific, um, ant colony, right? And once, uh, the ant is infected, the virus doesn't kill the ant. What it does, it basically turns it into a zombie by, uh, saying, okay, ant, I'm going to control your muscles instead of nervous system. And as such, you're going to climb up the tree, bite on the leaf, and you're going to stay there until I tell you to release yourself or die or whatever the case may be. At this point, the spores mature and then they rain down on other ants and the story continues, the cycle of life, right? The interesting part from this is the fact that we're controlling the muscle system of an ant without killing it. And so Zombie Ant Farm is designed to do exactly that. It is an out-of-target process store of payloads. It's a broker and a dealer of the payload that is somewhere in the memory that the preloaders that we're looking at can ask it to, to release payloads for its, you know, for their consumption. So it is a broker that reaches over the cross-process memory for a payload. Without go, going into details on how it actually does that in terms of what features it has, defensive capabilities and what not, let's first think how it works conceptually. Conceptually, there's a lot of work that needs to be done. And that's when you have this ZEV, essentially it loads things into the memory, it asks the operator to load uh, payloads directly from the URL into its memory and then expose the, um, the payload that was loaded from the URL, into the memories into the operating system uh, into the file system, through the proc, right? And then your Uber payload basically goes out and says, retrieve it. And because I can, I can actually launch my parent and child relationship with the payload, then I gain access to the payloader's memory space. This is how that looks, right? Your payload chain, because we're operating on the same user ID so we can introspect processes. We're saying, go get me a payload out of somebody else's memory space. And by the way, do it in the proc, and by the way, do it from the memory, and by the way, I don't care about your EDR, right? Um, and so in this case, 56.4.1.17 that we've seen before, it acts as a broker and a dealer for the payloads for us. Conceptually, you know, the big picture is how that works, right? That you have facilities and primitives where you create this monster target process that you can instrument with different, uh, you know, uh, code running through sections or compilers or loaders or whatever the case may be. Your loader asks ZAF to basically give them the payload or features or functionality and it loads the target executable with them. So what EDR sees, now it needs to connect the dots and see the full story across memory processes of the entire, you know, maybe 10 or 20 different mechanisms. The IPC, the sockets, the URL retrieval, um, you know, two different processes that are involved or three different processes that are involved. And if you're looking at the tree, you know, if it gets the real cradle or a clean executable it's not going to see any of that. So that's what we're after. So the pipeline is getting stronger here. Okay, well, one other problem that ZAF itself is, a, is, is, is an executable, how do we, it's a Catch-22, right? Like how do we get executable that doesn't drop on disk? So we can get the library payload that doesn't drop on disk by using some sort of, you know, a, a, um, autosuggest activity. Yeah, so we can get the library payload that doesn't drop on disk by using a in Zev, but how does Zev get there? Right? And so we're returning our attention back into memfd create but only doing this from the interpreted um language for example Python. Right? Through common function interface you can call up the Linux operating system sys, sys calls right? You can say hey memfd create from Linux or from from Python execute itself and give me whatever you're going to give me. Well Python is just a string of text right? You're not dropping executables on a disk anymore. What you're doing is just running a script in a Python so now you're extending that story for EDR all the way out into just a string of text that loads that executes the the URL retrieval of Zev itself and launches it in the memory um through the interpretation, through interpreted language. Py preload is what I called it right? It reaches out to the um URL end point to a web server, fetches it out to the web server, fetches things and launches them into the memory by using decoys. So for example when uh EDR or your threat hunters are looking at the process table what they see is a bash for example that launches bin ls but they do not see the relationship of the Python code basically getting things out from elsewhere and and unraveling that chain. So again we're trying to blind the EDR from the behavioral standpoint so it doesn't build, doesn't have a chance to build that story. And along the way it's not going to be able to do that. It's not going to be able to do that. And along the way we're basically trying to to prevent uh EDR from having to latch on any kind of trust that we're doing. Okay and so you know conceptually it's really easy now right? Like a Python script that is very small, it's a text, you drop it in, it gets a Zev, Zev launches into the memory. Zev itself has facilities to interface with so we're having a shell script go out to its socket and say hey load you all of your payloads from all these um all these other locations be it file system or you know external network interface or URL whatever the case may be. Store it in your own memory space and delve it out as needed as asked. In a whole you know if we were to have a visual of this whole thing it looks like this right? Number one is your pipe reload driver that gets the Zev out of the external um location. In memory execution of a process for Zev, Zev presents um a driver sort of uh socket that says okay well here's your you know uh json go get me something from external, expose me some some payloads and I'm going to use the uber preloader pipeline to go get the payloads from it and I'm going to instrument the process that I want slash bin slash ls whatever the case may be to do the bidding on our end. So all that is we're going to we're going to go into a demo. And this demo is going to show, see if we can do that. Okay so that's zombie on farm right? First we're going to fetch a remote binary and execute it from memory as we talked. And so we have a we watched the file system just to make sure we're not dropping anything on disk right? And then we're launching a http server to serve the payloads and in this case there's going to be a malicious ls command for example that comes out of that url. And pi preloader is a python script that says okay that's a binary go fetch it. Execute it and load it from a specific file descriptor if we have um a way to do this and yet we're seeing that nothing has been dumped on disk right? Nothing is there. The second thing that we're we're doing is we're actually um you know fetching um the preloader library if we want to. Exactly the same thing executing it, without preloader seeing that it works right? Then we're watching the file system making sure it's not dropping anything on disk starting the http server. And then essentially uh telling the preloader that what we're loading is a shared object out of somewhere in the url executing it in the bin ls and by the way you know that bin ls is innocuous it's going to describe uh describe something on a box. So both bin ls and the preloader are going to be running on a run in memory with you know loaded um malicious code here. Okay? Then let's fetch ZAF. Let's do exactly the same thing to it as we did previously to the ls. So let's basically break that story even more. Um same thing watching the uh file system launching ZAF saying that it's running as bash. Um let's do exactly the same thing to it as we did previously to the ls. So let's see if I can figure this out. Okay. First we just come out of here. And then we actually see that the uh file system is running. Here's the structure for loading the ls. It's running exactly the same thing. Um so we're gonna start the uh uh a um a sql file system. Right now we see that it's running on a uh uh on a uh a sql file system or a browser. I'll show you a little bit more in a second. Um so basically it's running on the uh a sql file system and the uh a sql file system is doing a rather intense loading and then it's a loading the uh application of a uh a sql file system on a sql file system. So there's a sql file system running. There are two 4 is the last one. Let's see where it loaded. Right. So memfd is a ephemeral descriptor that is executed in a ZEF memory space. And then we can just go directly for execution of that LS. Instead of doing a path on disk, we're doing a path in the memory catching a file descriptor 6 from ZEF. Right? And that's a regular executable that we fetched. Pretty powerful. And then, you know, we basically just keep doing this. We can, you know, create preloader chains and those things. Doing exactly the same thing here. Right. We have our previous module that we have loaded. But instead of loading executable, we're going to load a library for preloading. And it should end up in a ZEF memory space. So we're going to end up being on, I did, file descriptor 7, which is true. And then instead of executing out of PROC, we preload LS with exploit that comes out of its, you know, ZEF's memory. Right? The module's still there. You can destage it however you want. But but the point here is that we're now splitting execution of payloads and delivery into two memory processes. Okay. Other things, other research to break that story that is going on right now, it's not fully complete but I kind of wanted to talk about that a little bit, is if we are owning our code crave, or code cave, essentially we can randomize the, we can remove ASLR from the process by creating a personality trick, right? We're basically forking executable, we're changing the personality and we're executing it without the memory space, with memory space that is not randomized anymore. And then we write or read into the memory process, into the process memory, our exploit. So our exploit no longer needs to come from a library that you preload, it can come from a text, right? How do we do this? Well, we have a process called we essentially, like I was saying, we fork, then address the randomized, put a flag on the personality adjustment of a process that we're launching because we're parent and child relationship, we're able to do that, and we're releasing it for execution. And then if we have a destination process that has a code cave that we can stuff our exploit in, we're able to do that in an address, in a user to user address space by writing process VM write a V. So we're working on this. Summary, preloading is really, really a viable path to evasion. Grab the executable from Linux, preload it, do it in memory. Out of process payload delivery works, and it, I in my view is going to continue um to to extend into more attacks and we're going to do more research on it. From the red team perspective, do not use, you know, all of that on one engagement at the same time because it's going to burn your payloads and mechanisms of delivery, choose things wider than the other ways, and this is very important, today. Let's go to some of our wisely. See foreign function interface is important to interface and to escape from EDR story by basically switching the, uh, the stacks, the technical stacks. And then use those source of, uh, assembler attack, uh, splitting, scattering, and then assembling things on a box as you choose to, um, it depends on which EDR you're going against and what the consequences may be. The code for both zombie and all these examples is released. You guys can download it, play with it, send bugs, add to it, it's open. Defense, optics into proc, optics into IPC, optics into process loader, optics in memfd create, must. Clearly define what EDRs do for you in the scope of your, uh, threat model. What it can and cannot do. And start implementing Linux capabilities. There's no reason why binls should run a socket code. Right? And obviously last but not least is start thinking about the protective context. Quiescing your boxes, making sure you know what runs and how you're protecting your stuff. Thank you. Thank you.