So, first off, thank you for coming. I know almost everyone wants to be either napping in a coma or in some kind of stupor around here at this point. So I do appreciate that. We are going to be talking about decision making and adversarial automation. I do have to give you a quick warning. This does contain math. I understand that some people have a very fraught relationship with math. And to quote my mother-in-law, math isn't supposed to have symbols or letters. So we'll try to keep that to the minimum. I'm Bobby. I'm a dad , husband, nerd. I chase rockets when I'm not breaking things. Michael O'Dell, or I go by Moke sometimes. I'm just a nerd that happens to work with him . He thought I'd be good for this talk. Pleasure to meet you. He's also making it a project to bonsai that, whatever that is. All right. So I know we've got a couple of blackjack players, statistically speaking here in the audience. You're probably basic system kind of folks, right? You know, you actually follow the rules and you're responding in a deterministic fashion to what happens. And then you have some random who sits down and starts, you know, hitting on an 18 or something equally insane. Randomness, chaos agents, floky worshipers, whatever you want to call that. So we're going to go through a couple of things here. We're going to talk about determinism versus probabilistic things, how that factors into decision making. And then we're going to show you a little demo that puts these principles into practice. So our friend, the stochastic parrot, the term comes from a paper on the dangers of stochastic parrots by Mary Bender and crew. Stochastic is probabilistic, random. Parrot, it doesn't, it isn't able to do anything new or novel. It is only able to regurgitate what it has been trained with, what it knows. On the flip side, and stealing from predator-prey dynamics, we have deterministic predators. So these are things that are going to be following a fairly robust sort of processes and are predictable to an extent. You know, you put meat down in front of a carnivore that hasn't eaten in a while, it's probably going to go after it, assuming it doesn't find you tastier. When we are making decisions, decisions are all about observing trade-offs. We can look at, do we learn more about an environment or do we do things to that environment? In particularly in adversarial work, do we go for stealth and linger for a long time or do we go for speed and get that knockout blow? For those of us who are trying to emulate the various classes of adversarial behavior, are we going for a smash and grab like a typical ransomware operation or are we trying to siphon out large quantities of data undetected for extensive periods of time? So when you are working in an adversarial situation with decision making, you're not the only decision maker that matters in this. The enemy gets a vote. So going back in time a ways, we've got this delightful concept, the OODA, observe, orient, decide and act. So make this a colleague has stepped to the other side of the stage. He's off to my right. I'm deciding to fling this bottle of water at him and at that action he now has to do the thing. The moment I choose to act, I screw up his loop. His decision making process has to reset. He now has to have observed that behavior. He has to decide what to do with it and so on and so forth. What this comes down to when we're talking about these decision making loops and who here has dealt with or runs a SOC? A couple of you. What's your average latency for event to alert? Anyone want to volunteer something? It's okay. This is a safe space. It's only recorded for the entire internet. Would anywhere between five minutes and I don't even want to know be a fair way of putting that? Well, that's the decision loop. The SOC has to observe, go through the whole process and decide what to do. Meanwhile, an attacker learning things as they go can make those choices and can move through the environment with a degree of rapidity. And every time the attacker has gone and done something, SOC moves to contain it, the attacker may already be on 17 other boxes and have compromised a dozen or more accounts depending on the speed of that. So there's a couple of different models that have emerged in decision making. Quick and dirty, let's say that we are able to know everything about an environment in order to make decisions. Markov decision process. We have a state, the existence of the universe. We have our set of actions that are allowed. We have the probability of using each one of those actions. We have some kind of reward and then there's a another fudge factor called a discount factor in there. Who remembers when Google DeepMind had an AI that it taught itself how to play Atari games? Okay, a couple of you. So you think an Atari game, you've got what gets displayed on the screen, that's the state, that's the universe. An Atari has four buttons, those are the actions that you can potentially exercise with that. And most of those games have a scoring function, there's a numerical integer based score for that. So it's really easy to have a model learn how to make decisions and predict what's going to be able to predict what actions at any given state are going to result in what it wants, which is the score to go up. But when you're working with an environment that you don't necessarily have full, complete and utter knowledge on, that's a whole different problem set. That's where we get into what's called a partially observable Markov decision process. There's a lot more letters, some of them look kind of funky here. But for every possible observation and the potentiality of the unobserved things, the unknown unknowns, have to be factored into this model. You don't know what you're going to find on that next subnet over after you've landed on a box. You don't know what services or what users with what access you're going to enumerate when you start. You can think of a straightforward MDP as the white boxiest white box assessment that you've ever conducted. Whereas a partially observable MDP is your black box. We're exploring as we go. We have to weigh actions. We have to weigh whether or not doing a thing that is going to give us more information about the environment is the best step versus actually taking action off of what we already know. So within those spaces, we've got a couple of ways of looking at this. Stochastic methodologies. Anytime that you are talking about decision planning, you can mentally substitute pi for probability. That's your spare math tip. A is always going to be action. S is going to be the state of the system. So if I've got four potential actions here that are valid for a state, there's an equal probability. We're just rolling the dice here. Random walk, no different than if we're letting a kid go and pick which block we land on for what we do. Whereas if we want predictability around these things, we go for a more deterministic process. So probability for a particular state, we're looking at the maximum quality action. So if we want to always pick the best thing that we could possibly do. If you've got admin credentials, you're going to want to do admin things. You're you've got predictability. You can explain why. You're not having to explain that there's some randomness in here. Now, where we get into some interesting elements is there's other risk factors that we can apply to the decision making process. It's not just a straightforward reward function. We can look at detectability. Is a particular action likely to trigger some kind of response? Is that going to, how is that impacted by where we are and what we're doing? There's a lot of gray area in this that's really challenging to model. I'm sure most of you have preferred detective controls. The things that if you are a tester, you hate going up against because they're reasonably good. So this is something that we can dial around. We can move it from zero to 100. If we're going straight with the math, it's more zero to one. But that's neither here nor there. We look at what's the worst thing that could happen versus what is the best that we can get out of this. That all gets weighed. And we can leverage that in a couple of different fashions. Worst thing that could happen, you had a foothold, now you don't. Ranging all the way up to you had a foothold and now you have some nice men from a federal agency banging on your door because someone didn't read their scope document. What's the best thing that we can get out of it? Is this going to allow us access to additional information? Is this going to allow us to move on to other systems? Is this going to allow us to perform actions that we couldn't perform before? Is this going to allow us to repurpose conference room equipment as an audio bug? There's all kinds of situations here. So when we're talking about building the adversarial decision making systems, you're going to want some kind of automation in place. Nothing should be done 100% by hand. But there's always a question of is this really the best thing that we can choose to do at this point in time given what we know and the state that we're in. And it turns out, like most challenging things, evaluation is really, really hard. How do you know without rerunning the scenario thousands of times through all the permutations that this is the best thing? A lot of really good adversary simulation folks, they don't really think about the environment. They feel the environment that they're operating in. There's an aspect of intuition that's really hard to codify. And the fact of the matter is, it's very, very hard to build scenarios where you can test this in a repeatable fashion. So we have a continuous debate between emulation versus simulation. With emulation on these models, you have a system that behaves like the real environment, but things happen in real life. Things happen on actual networks. They're not all perfectly deployed cookie cutter boxes, no matter what the DevOps people tell us. So emulation only gets you part of the way. Sometimes you just have to do it in real life. We just have to fire it off in actual environments. So that is a thing that we have to do. But what's nice is there are some delightful pieces of technology that have popped up in the last short bit that make this a lot easier for us. Who here has heard of or worked with LUDIS? Okay. You all have some nice take home bits. LUDIS is a tool for scanning up repeatable cyber ranges programmatically. Specter ops just dropped a tool that can take a blood hound export and reproduce it inside a LUDIS range, which is really sexy. So I'm going to skip along. We have different mechanisms for performing this decision making. If you were to imagine the optimum decision outcomes as a three dimensional surface, that's what policy gradients are. We have a probability, we have a set of actions, we have a set of states. That function can be represented any number of ways. It's more commonly found in environments where there's a degree of continuous behavior in terms of the actions. Are we turning the steering wheel 10 degrees or 12 degrees? But it is equally applicable to discrete actions where I'm going to run a particular command with a certain set of parameters. I'm going to press a certain button. I'm going to slam on the brakes because this guy keeps tailgating me. In the middle set of this, we've got another fun thing, Boltzmann exploration. This relies on a much more interesting set of elements. Anytime you see a cue with the state action, it's the quality of the state and action. So we're taking the probability of any particular action is represented as the overall relative quality against all of the things that are potentially there. Again, this is a somewhat more decidable model. And who here has worked with run books or checklists in their day-to-day? A couple. So decision trees are essentially checklists. What do we do at any particular time? These can be encoded algorithmically. The problem with this is it is a state machine. You can only have a finite number of things that you do. You have a finite number of conditions. You run through each of those. So if you are trying to avoid detection or other elements around that, it's challenging because you're following your rules and you're enemy, which may be the defender, may know what those rules are. They may have CTI from other organizations that have been impacted and they know what playbook you're using. Or maybe your company playbook got leaked and everyone is wondering about all of that fun training that you have going on. But with this, we can point at that chart and say, you know, we can go, when someone comes back and asks, why did you do thing X at time Y, we can point at the chart and go, see, that's why. We did it because we were domain admin. Now, there's one big problem with this. This is easy to deal with in toy scenarios where we're dealing with a very limited number of machines and environment, potential tools. When you look at the growth of a state space and the growth of the action space, that starts increasing on one of those fun curves that the computer scientists don't like. When you start getting into real world network environments where you have tens or hundreds of thousands of systems and similar numbers of services, huge numbers of users, you end up with a huge space that you have to chop through. And that's deeply problematic. Because it doesn't scale. And we don't necessarily have infinite processing capability around all of these fun things. So we make do. So we're going to want to borrow some techniques. And we know that environments and their connections can be represented in graphs. Everybody has learned from the bloodhound folks that attackers thinking graphs, that structure works for representing networks. But when you're deciding what to do, you can look at patterns within the graphs to filter that down. So we have this delightful technique called sub graph matching. Basically if we can define a pattern of prerequisites in a environment, in a graph, we can go through that graph looking for instances of that. And there's a lot of prior art on speeding up this technique on doing these fun things. Because social media networks have billions of nodes and you might want to query that in a relatively short time. Or let's say that you're a bank and you're looking for money laundering or potential tax evasion. You're looking at transaction pairs and amounts and who is moving money to whom and who are they moving money to. Those patterns are repeatable and distinct and can be relatively easy represented with this. So we've got a toy example that we've got a quick demo to show leveraging this. We use a property graph to represent the state of a environment. We have a, and we're releasing this bit, a domain specific language that's based on top of YAML for helping to define preconditions and what they look like in the graph to a particular tool use and what you expect to get out of it. And because Neo4j sucks in so many ways, it's not a good graph system for this. We've stumbled across an open source embedded graph database that runs in process, single file, doesn't require you standing up a server called Kuzu. It's good stuff, spun out of University of Toronto. I highly recommend you check it out if you're doing anything graphy that requires Cypher. So we're not directly taunting the demo gods. I went and had a recording. So I'm going to talk through this a little bit. But we're priming the system. I was just going to say that you can see here on the right side, basically the export of all this stuff, as we're going through the left side and capturing input from our user and going through the pen test days, you'll see we're starting to collect information on the right side here as it's being pulled in. Let's go through this a little bit. Simply say that as you can see as we're having inputs being brought in, the graph is starting to update. You'll see before long as we go through this, it will actually start to present some of the actual outputs and some of the stuff we can run in the system, actually showing the next step, essentially. So we've built a solution inside of our testing architecture where we're collecting console data from all of our operators' systems and we're able to use this to reconstruct their performance. So this is derived off of that. We're priming the pump here with some manual exploration commands simply to get things going. We're going to fast forward in just a second because nmap takes forever to run and I did not want to sit here. Everyone should be hearing the voice at this point. So nmap finishes, we'll abort out of that, it'll process that and go on start giving us commands to run in the environment. I am resisting using this so much. Come on. I can fast forward more if I need to. There we go. All right. So we're pulling out from the clipboard, pasting in, starting with some basic Linux. Eventually the model is going to get annoyed. Because it's running out of things that it can try. We only primed this example with 14 different tool usages just for the sake of quickness. Helps if I pay attention when I'm recording this stuff. You can see we're taking in new inputs every time and the next Now it's angry and wants to respond. We backed it into a corner. And we're going to skip ahead just a minute when it intercepts things. The test environment that we used for this was gated directory. Again, excellent work. Love it to death. It's great for sending out things like this and tools and all the other various things. So we've got a hash. We'll pop out of that so that it'll process that hash. And now that we've got a hash, we can decide to do some cracking. Which will happen in a moment. Crack and skip. Yay. We will get to that in just a second. But so we'll just finalize this out. We'll do a secret stamp on that because now that we've got a credential that we can run that, boom, we go. This is a toy example. We're working toward building similar systems for production use around this. Domain dumped. Yay. All right. Let me chuck forward. If you want to check out the DSL and use that to build things off of, that's awesome. We appreciate it. Thanks for adversary village for letting us come and bug you guys. Feel free to hit us up, reach out, all that fun stuff. And I will take questions out in the hall so that our next crew can come in and get set up. Thank you very much for your time, everyone.