So I'm going to be talking about how we can use automated planning for kind of automated red teaming. My name's Andy. I am a researcher at MITRE. Are you guys familiar with MITRE? I see a lot of head nods and I like that. I also work in ATT&CK and Caldera, which is kind of a lot of where this talk came from. And the way I like to kind of bring this up and talk about this problem is that as a defender, it's really hard to assess what we're missing in our networks. It's easy to fall into this like castle mentality where our networks are castles, adversaries are never going to break in. And well, they are going to break in. They're going to find ways to get around your walls. And as defenders, if we're not really like assessing our own networks, we're not going to know where those holes might be and where we should actually be looking to improve our defenses. So to try to solve this problem, we can run offensive assessments. And that's a catch-all term. And I'm going to go into it, you know, a little more specifics in a bit. But the idea is to stress test your network by executing a real attack and seeing what actually happens. You know, did you detect the attack? Can you see how far they got? Did they make it, you know, into the walls? Did they go to the treasure? What do they actually do? And then try to understand how you can improve your detection and your prevention. And so offensive testing is great. You know, penetration testing is great. All these things are wonderful. However, they're hard. They cost a lot of money to run. They require a very significant time investment. Results are dependent on the capabilities of the personnel who are executing the attack. If you run two different, you know, red teams at different times with different personnel, you're going to get very different results. Exercises can also be hard to repeat. This is a problem because you're going to want to see how your environment has changed over time, how your security has changed, what defenses have changed. If you can't repeat your exercises. You're going to have a problem. And then designing red team exercises is also a kind of like time-consuming and heavily invested process. And, well, automation can solve a lot of these things. If you can automate your offensive tests, you will lower the cost to run an exercise. You just need a tool to run it. They're less time-intensive. You just push a button and it goes and it does its thing. And now you're dependent on an attacker model as opposed to the actual personnel so things are more consistent. And you can repeat the test at the push of a button. And best of all, designs can be saved. And you just, again, hit a button, run the same test you ran before. And, indeed, a lot of people in the community have realized that automation is good. And this is kind of a snapshot of only a small slice of some of the kind of open source projects out there that do automated offensive testing at various degrees. I come from the MITRE side. That's Caldera at the top. Caldera is open source. You have the link there. But there's also Atomic Red Team, which aligns to ATT&CK. There's Meta. I think it's by Uber. Red Team Automation, I think is the name, by Endgame. Infection Monkey, that's by GuardiCore. And then on the right, those are a lot of tools that kind of circle around Bloodhound, which does automated ATT&CK path generation, kind of, you know, pluming active directory to figure out, like, what the trust relationships are. And then a couple of projects that can kind of build off that automation. So, anyway, automation is fantastic. And I keep saying offensive testing. But what do I actually mean by that? I'm going to kind of talk about three different categories. The first is pen testing. That's kind of what we talk about a lot. You know, penetration tests, they're helpful to determine the state of our vulnerability. You test methods of gaining access. You look for weaknesses. You know, this is really, this really tends to be, like, exploit heavy. And from a CASL analogy, this is, you know, really kind of, you know, going at the walls of a network. Red teaming is a little more expansive. Now, red teams actually simulate the goals of an adversary. You know, this is much more end to end. You're going to gain your network access. You're going to move about the network. And you're going to pursue an objective. And here's the thing. Here, as opposed to just kind of targeting the walls, now a lot more is in scope. You have kind of the holes and even the catapults off to the side, which might be, you know, the red team's custom set of techniques that they like to use. Then over here, this is adversary emulation. And here, this is like red teaming, but you want to simulate the actions of a specific adversary. You can call this kind of threat-based red teaming. And unlike red teaming, this is a lot more constrained. We're going to talk about one specific path and one specific threat actor. And so I'm going to talk mainly throughout this talk about adversary. I think adversary emulation is cool. I'd say that a lot of the concepts here in adversary emulation and red teaming, those generalize to pen testing or kind of they all generalize around. I'd argue maybe that some of the ideas for pen testing don't necessarily generalize to adversary emulation, but that's a different argument. So if we want to kind of do successful automated adversary emulation, we need to kind of have a set of goals. And the first is to make it real. You don't want to just kind of run a notional, like hypothetical adversary emulation exercise. You want to actually use the same. Techniques, the same tools and the methods and goals of a real attacker. You also want to do this end to end. You don't want to look for one offs. You want to actually compose attacks because that's what real adversaries do. They do a, they do B, they do C. They don't just do a, and they stop. Like they go throughout your network. Repeatability is important. I mentioned that at the beginning, and then this last one is extensible. We don't necessarily just want to come up with a model where everything is hard coded. It's going to do the same thing over and over again. You want some variability. You want to extend the TTPs that are, that are in your tool. You want to kind of grow as, as needed. And if we really want to realize these goals, we're going to need some form of advanced decision-making to kind of chain things together and figure out what we should be doing. So I'm going to talk about the adversary model that I use throughout this talk. It's the MITRE ATT&CK framework. Out of curiosity, how many people here are familiar with ATT&CK? Yes, this is awesome. Um, a good amount of people. So, so ATT&CK is an awesome framework that kind of talks about what adversaries tend to do after they compromise networks. It breaks things down into the adversaries tactical goals. These are the things like, you know, persistence, privilege, escalation, lateral movement, exfiltration, and then the techniques as to how the adversary achieves those goals. This is more focused on kind of enumerating adversary behaviors as opposed to a specific like attack patterns or IOCs. If you're familiar with the pyramid of pain, this is really targeting that top of the pain, the TTP style, um, you know, enumeration of what adversaries do. And in the ATT&CK framework, we not just enumerate them as a nice little picture in a matrix. We have a description of what the technique is, as well as a list of examples of adversary usage of each technique, as well as software that executes that technique. And I'm going to try not to spend too much time talking about ATT&CK. Apparently orange is a bad color here. Um, some of the nice things about ATT&CK are that it's grounded in real data from, from cyber incidents. All the TTPs we have in ATT&CK, all the techniques are backed up by real publicly available threat intelligence. And my favorite is probably the third one. ATT&CK decouples the problem of understanding what adversaries really do when they attack networks from the defensive solution you want to deploy. So we can use ATT&CK in any way we want to. This is just an enumeration, you know, from the attack networks. And this gives us a lot of flexibility. So to just give an example, this is a slide I stole from a colleague where he just went through and he analyzed a threat report and he found kind of some of the, the strings in a, a piece of malware. And you'll, you'll note here that a lot of these things are, they all map to ATT&CK and that's the enumeration on the left. But a lot of these things are, are really just like, you know, normal Windows things. There's IP config, net local group administrators, net local group administrators domain, net stat, ping. Um, MBT stat is in there as well. DER, all these things that are really kind of these normally benign things that adversaries use when they actually compromise networks. So I bring this up to say, you know, mainly when we talk about adversary emulation, we don't talk about things from a pure exploit driven perspective. This is more the end to end thing where we're talking about also like living off the land and that's going to play an important role kind of later in the talk. I'm going to pivot a little bit and talk about automated planning. I think I have to, it's in the title. Automated planning is kind of old school. Um, it, it's relatively simple to describe basically given the state of the world, an end goal and a set of actions, how do you compose those actions together to achieve your end goal? And here's just an example that's totally contrived of waking up and I want to eat breakfast. So I'm going to get my bowl, get my milk, get my cereal, then eat my breakfast. I'm not going to go get the leash and then walk the dog if I want to go eat breakfast. I've tried that. It doesn't work. Um, as I said, automated planning is kind of old school. Um, one of the biggest kind of sol, solvers, the most well known in the planning field is strips. The Stanford research Institute problem solver, and that's from 1971. So again, old school, um, these are relatively straightforward representation. You have basically a set of Adams and Boolean variables, a set of actions, an initial situation and a goal situation. And the challenge is to figure out, you know, what sequence of action starting from the, um, the initial condition achieves the goal situation. This is, this is pretty straightforward. And the thing about kind of the strips formulation. Is that for each action, we define the name, the preconditions that must be true for us to execute that technique. The atoms are the kind of the, the post conditions that will be true after we execute the technique. And then the atoms are things that will be false when we, after we, um, execute the, or excuse me, not the technique, the action jumping ahead. Here's a simple example that a lot of people talk about in the planning community. It's the blocks world. Um, the colors aren't showing well, but the basic idea is, you know, we have a bunch of blocks on a table. You know, B is on a. C is on spot. Number two is on spot. Number three. We want to achieve this end state where a is on one B is on two C is on three, relatively straightforward. We have an action that moves one to the other. We have some kind of logic description of, you know, how we can move blocks between different locations and a plan just kind of says, okay, B is going to go on. C is going to go on one B on a C on three B on two, relatively straightforward. And, you know, at, at its core, you know, really planning is really just a pathfinding problem over a graph. And the states are no. And the actions are the edges in it that this is a very like horrible oversimplification, but this is a big part of what planning is, is really trying to figure out how you navigate that, that graph. And there's a lot of research on doing this more efficiently. Uh, some kind of three buckets down here. One of them is heuristics, trying to analyze a node in this graph and figuring out, okay, should I actually keep exploring this branch landmarks, trying to find those landmark actions that, oh, I know I need to execute this action at some point. So I'm going to throw it into my plan and then helpful actions, which kind of help you along, along the way. And there's a ton more stuff here. I have, I have a reference down there that is probably illegible. Um, so classical planning is fun, but it doesn't handle uncertainty at all. So the planning field has really exploded. There's like lots and lots of research on planning. This is just only a snapshot of that at, at one level you had conformant planning. This is a little bit more in depth than classical planning here. Your initial state is unknown. Instead, you're giving kind of a set of possible initial states. Contingent planning is another kind of more advanced form of dealing with uncertainty. Now you have. Okay. Actions that can have non-deterministic outcomes. This is like probabilistic planning. Even more confusing is partially observable Markov decision processes. PMDPs here, actions yield observations, which inform our belief about the resultant state. And then we always kind of maintain a belief distribution of, of what state we think we're in. And then the last one I'll put down there is offline versus replanning and continuous planning in part of the planning field. You kind of come up with an operative plan, you figure it out, and then you just go execute a, B, C, D, and E. And you kind of keep going and many applications. You find that you're not going to come up with an operative plan, you know, from the get-go. You're actually going to execute a few, a few actions, reevaluate, execute some more actions, and then reevaluate some more, and then lose your slides. Green's a good color. So, yeah, that's illegible. But, so planning and security has kind of a, or, you know, again, an old school approach. Really traces it back to kind of attack graphs. You can't see the graph, but the basic idea is we can use planning to figure out, like, how to chain vulnerabilities together and move about your network. It's relatively straightforward. It's older. There's a lot of logical models, a lot of research in, you know, kind of the late 90s and early mid-2000s, which talk about how you can construct attack graphs, how you can optimize them. They tend to be kind of exploit-heavy, and there's a lot of utility, but it's hard to see when you're just looking at that. More interesting approaches to using planning and security are kind of automated pen testing using POMDPs. There's a line of papers that took about this approach, which was pretty interesting. And the reason is that, you know, assuming an attacker has full network knowledge, that's kind of unreasonable. If I'm an attacker, and even if I'm a red teamer and I'm going at a network, I'm not always going to know exactly what the network map looks like or what, you know, vulnerabilities exist, who's admin where, you know, the whole AD structure. I don't really know that. So, instead, you know, they take this POMDP approach where, you know, it's relatively, you know, straightforward, where they have sensing actions and then acting actions. You know, the sensing action is something like running NMAP and scanning for vulnerabilities. Acting actions, you know, launching an exploit. Relatively straightforward, but this has resulted in a much more robust solution that's actually able to work in the presence of uncertainty, or attack graph approaches weren't able to shine. And then, probably can't read this either. It's just a taxonomy from a researcher in the planning community who's been working on using planning for kind of pen testing. And he kind of bases it based on what the action is. What the action model is. So, do you even have actions? Are you just kind of drawing a network graph? Do you have monotonic actions where each action increases your knowledge base? You know, delete free. Or you have general actions, which is a normal planning thing. And then you can balance that versus uncertainty where you have, you know, no uncertainty. You have uncertainty in your action outcomes. You have uncertainty in whether or not something might succeed. And then you have uncertainty regarding your state distribution and what state you're even in. And depending on the specific model you're going for, there's a few things in the literature where you might use, you know, just a graph or classical planning. Or an MDP or a PUMDP. And so, this is a great paper. I'd highly recommend it if you're interested in this area. It's called, if you can't read it, Simulated Penetration Testing from Dijkstra Editorium Test. Jorg Hoffman is the author. It's a great paper. All right. So, I'm going to pivot back. It's kind of talking less about kind of, you know, planning and more about adversary emulation. And so, here's an example to motivate it. Let's say you've got this host one and you have a foothold there. And you've seen this host two. And you want to copy a file. And you want to copy a file from host one over to host two. You might say, okay, what do I need to do to copy a RAT file over? I need a working RAT on the source host on host one. I need the mounted file share access from the target onto the source. And then I need write access to that file share. Well, these look a lot like preconditions. And then you can say, oh, what happens after copying a RAT file over? Well, there will be a new file on the target host. That file will contain the RAT. And those are the consequences or post conditions. And what you can do is you can say, okay, if I want to make a plan to copy a file, I need to get that file on the target. Well, to run that copy file action, I need a mounted share. Okay. I'm going to run the mount share command. I'm going to get the mounted share, but I need credentials. Okay. I'm going to dump credentials. Get those credentials. And as long as I start with an elevated RAT, I can go about and do this. And this looks a lot like planning. So this, oh, I get a fun graphic, too. So, yeah. This looks a lot like planning. And just to give you a few examples. You know, suppose you want to go from host one to host two and exfiltrate this. I'm going to take data from host two. One potential plan is I'm going to dump credentials. I'm going to mount the share, copy a file, remotely execute that file, and then exfiltrate the data. Another plan might be exploiting a vulnerability and then exfiltrating the data. Then another plan might be dumping credentials using RDP and then exfiltrating the data. So relatively simple examples, but, again, you can see how we chain these actions together. One of the questions we might want to ask is, you know, suppose we're doing this chaining and we're coming up with these plans. Well, how do I select the right plan? And if you have an explicit goal you've enumerated beforehand, that's straightforward. You kind of enumerate all the plans and go towards a goal. But if you're trying to do address or emulation, you're trying to kind of show these repeat behaviors, you know, what's the right plan to execute? Or even if you have a goal and you have multiple plans, how do you choose the right one? And something that we've done or the line of research that we've taken about is to basically just kind of assign each action or assign each plan a score based on kind of a heuristic function we have. Basically just a decreased weighted sum over each action. It's very straightforward. But the idea is, you know, if we assign each action a reward function or an individual reward and then sum up the rewards kind of decreasing as it, you know, executes further in the plan, then we're going to execute that plan. And it's straightforward. And here I'm not going through the example in detail. But, you know, if you follow what's on the lower right-hand corner, then plan number three is the best plan. So that seems really easy, and it's not that easy. There's a lot of uncertainty that comes about when you're doing adversary emulation. And so let's consider kind of, you know, to kind of walk through that, let's consider two plans. The first is, you know, that dumping credentials plan. And the second is exploiting a vulnerability. When we consider the uncertainty for exploiting a vulnerability, it's relatively straightforward. First, is the target susceptible to the exploit? That's a binary. That's yes or no. And that's something you can scan beforehand. And then the second one is, well, was the exploit technique executed successfully? That's also a binary, yes or no. And you can scan for that after the fact. And it's relatively straightforward how you do that. And this is straightforward, but it still leads to very interesting, interesting scenarios for planners, but it's kind of straightforward from our perspective. Now, consider dumping credentials. This is really easy to describe. When I dump credentials, I need a rat with elevated access. That's straightforward. After dumping credentials, I'm going to get credentials for all accounts that have active sessions on the host I just dumped credentials on. Again, that's also straightforward. However, in practice, while the description is easy, what we're going to get back, our consequences here, the post conditions for this action, are kind of complex. Realistically, running credentials might fail entirely. That's one way it can work. I might not get any credentials. That's certainly possible. I might get credentials for accounts that I've never even heard of. So I can't do any reasoning over them. I've never heard of them. I might get credentials for accounts that I've heard of, but I just can't use. And then if I'm lucky, I'm going to get credentials that I can use. And the problem here is that while these scenarios are somewhat innumerable to an extent, they lead to non-deterministic outcomes that explode in difficulty as we try to kind of chain forward and plan for the future. And this is totally illegible. So a lot of the stuff in the literature, the planning problems that we see, they tend to have bounded uncertainty where at kind of the biggest oversimplification possible, they explore heuristically and they optimize it, but they explore all possible states for each unknown. And this is a snapshot of a paper where they use partially observable contingent planning as an alternative to solving a fully described POMDP. And what they do is that in their problem description, they actually enumerate and say, hey, you know, host zero, that can either be WinNT, you know, the server edition or WinNT, the enterprise edition. And if I'm enumerating that beforehand, then I can use all these techniques, but if I don't have that enumeration beforehand, it makes it a lot more difficult. So, you know, in our case, a lot of the actions we deal with, kind of, you know, using attack as this threat model, trying to do full adversary emulation, these actions have unbounded uncertainty. And it's really not possible to plan over all of this in the world states. We just can't enumerate that. And instead, you know, we've kind of driven us to this conclusion that, you know, continuous automated offensive testing, you know, adversary emulation, it's not just planning. There's also a big acting component. So, one of the things we did is came up with kind of a planning algorithm. It's relatively straightforward. We want to update the world state, and then after we do that, we figure out what valid actions there are that I can execute right now. And that's just looking at my preconditions. It's straightforward. I'm going to construct all plans that lead off with those actions, chain the actions together by leveraging the model, run the heuristic over those plans. Once I have that set, I can just use the heuristic, execute the first action in the best plan, and then repeat. Relatively straightforward, but the problem here is really, well, how do I construct plans if I can't enumerate all the outcomes of the actions that I have in my model? And so we've taken a few approaches. One of them that we did kind of on a more research perspective, we just kind of ran this in a little simulation environment. We basically kind of just guessed what the world looked like, and we used deterministic techniques to identify plans. Very straightforward. It worked well in the simulation space, but even there, it was computationally sluggish and very heuristic heavy. We have a paper there too, intelligent automated red team emulation that walks through some of the stuff we did there. We extended that by using kind of a small world extension idea. This is, I call it the light planner. We basically would guess small extensions about the unknowns we have in our environment. So if I see a host, and I've never probed the admins on that host, I might guess, okay, this account's an admin and this account isn't an admin. Then we can use a rule-based approach to kind of tune what the probabilities are that we're going to guess like. I'm going to guess there's an admin there that I have creds for, or an admin there that I don't have creds for. This works well in simulation, but again, it's hard to implement in practice, and it's hard to come up with a good rule set that you actually want to leverage in a real environment. What we ended up doing is, I'm calling optimistic best guess. This is basically just guessing. This is a simple approach where for each action we have in our model, we're going to encode specific hints that talk about what the kind of best case scenario is. So if I'm dumping credentials, my hint is going to be, I'm going to get credentials for an account that's an admin somewhere. And so this works reasonably well in practice. There's a lot of room for improvement here. It's something we're working on and I want to invite everybody to work on. Caldera's open source. But it works well enough in practice. So I'm going to talk a little bit about Caldera. It's written in Python 3. The rat is in C sharp. We use MongoDB, have all sorts of fun stuff. But there's three main components. We have an admin web UI that you can use to kind of control operations, control what it's doing. We have the server that kind of controls everything. You know, the human interfaces with the HTTP server. And then the server has a database of all the things that are true. An execution engine that talks about how you actually do things. And then the planner, which leverages the attacker model and the world state to forward train and kind of use the algorithms I've been talking about. For each host that you're testing in the environment, you need to have a kind of shim agent. This just facilitates communications between the HTTP server and the agent. This kind of just facilitates that communication. There's also a rat component that actually does kind of move around the network. So there is a real rat. It isn't really executing stuff. The agent is there to just kind of delineate which hosts are in scope or out of scope. Conducting an assessment is very straightforward and easy. This is one of the nice things about using planning. You load the Caldera shim onto the network hosts. You create an adversary. You identify which hosts are actually in scope for your assessment. And then you just launch the operation. It's really nice because it's very kind of low overhead for an operator or someone wanting to run an exercise. During the operation, Caldera will report its activities, any artifacts it creates, anything it does. And then it will automatically stop if it can't do anything further. After the operation, we get a report of everything that it did. You can kind of go in detail and kind of scope it out. And then it will automatically reset the infected host from moving any artifacts it created. And you can kind of control that. And so this will stop it from dropping racks all over your network and modifying registry keys and doing all sorts of other stuff. And I am not going to try to run the demo because this is not working well. So I'm just going to jump ahead to some closing thoughts. Using an automated adversary emulation is fun. There's a lot of cool things you can do with it. Testing analytics and sensors, that can help you see, okay, do my defenses actually work? I'm going to go, you know, I think I'm going to detect credential dumping. I'm going to go throw an analytic into my Splunk instance and run Caldera. And I can see, okay, did that analytic fire correctly or not? Data generation is also good. I don't know if we can produce at this point enough varied data to train models off of. But that's one of the use cases we want to do is to be able to kind of generate data to kind of train people and train anything. Number three, red and blue team training. You know, you can tell your red teamers, hey, here's Caldera. Go learn its TTPs. Go follow what it's doing. It can be like a first step. It's a nice introduction to some potential attack paths. It can also teach your blue team, you know, hey, here's what an adversary did. Continuous testing, straightforward. And then easy structure and replication is another big use case. Some notes for the future. Automation is a hard problem. We've encoded some straightforward techniques, but we're getting to the point where I think we have, like, 30 or 40 different attack techniques encoded in Caldera. And managing the complexity, if you want to use each one of those techniques, that gets kind of hard because you have all these different atomic things that you can do and chaining them together is more and more difficult. And some techniques are hard to execute. RDP is a common one for red teamers, but finding, like, a way to automate RDP sessions is not particularly straightforward because we don't have good APIs for that. Key logging is another one where now we have to do, like, asynchronous operations because we're just waiting for someone to enter in a password. Right now, a lot of the stuff we do is just we can do it and just go execute it and go forth. But we want to kind of get to the point where we can do that kind of thing. So that's kind of, you know, interactive operation. A big question is how we can do this more intelligently. We're kind of working on that stuff on our own. But there's a big machine learning story here. Again, Caldera is open source. You know, optimistic best guess is fun to say, but that's just kind of guessing. There's a lot of cool things that you could potentially do. A lot of things we've looked into. A lot of things we've heard. You know, there's a huge and awesome story here. And then the last point I want to make is that we aren't automating offense in a vacuum. There's a lot of things we've looked into. You know, there's Caldera. We have a rat and semantic now picks it up. We're not automating offense in a vacuum. If you want to be involved with Caldera or anything we're doing, there's a few things. You know, we have the GitHub. We accept pull requests. Anything you want to do. My favorite, and I pulled some of these slides out because I was going to do the demo, is that you can actually create your own techniques and put them into Caldera. And there was actually some guys who, they were on a blog post of how they wrote their own techniques. And they put in the logic. They put in the execution. And they threw it into Caldera. And it was able to string it together as part of a larger attack path. So that was really cool. But anyway, you can get involved there. We have a Slack channel. Please reach out to us if you're interested. You know, we've got MITRE people everywhere. And we have e-mails everywhere too. And then on the AI side, if anyone's interested in automated planning, we just released a, or we were involved in the international planning competition. And that, you know, kind of got rid of some of the uncertainty in a way for the deterministic track. But it standardizes some of the actions in kind of the PDDL format, which is what a lot of automated planners do. Lots of links, lots of context if anyone's interested. I'm Andy. I mentioned ATT&CK. One thing I'll mention is we're running ATT&CKon. We're running a conference dedicated specifically to ATT&CK. The CFP is open right now. It closes on August 15th. Submit stuff. Anything involving ATT&CK, please let us know. We have something called a cyberanalytic repository that has some analytics. Adversary emulation plans is a new one that we've recently released. This is kind of an in-depth look at kind of how you can go about emulating an adversary. And it's basically done anyways. Yeah, I'll leave the links up here.