We were sitting down with Shellfish, who were in the final 10 for the AI Cyber Challenge, which ultimately was, we talked about in this before, which is, you have to create an autonomous system driven by some sort of AI to find bugs in real software or software where they had them injected, so there was at least something to find there, which you guys ended up finding O-Days, which is a whole other thing, but automatically find bugs through an orchestration system that used AI, and then automatically patch those bugs, and they would submit for points and things like that. So when this first happened, like when you first heard of this concept, what was your initial knee-jerk? Like, I'm up for more pain, I need to do this. Yeah, initially we were thinking that this won't work, that we're traditional binary analysis people, right? We've been through thick and thin with trying to make all sorts of crazy architectures and whatnot work, and we're like, AI can't do this, right? When this competition was announced, it was GPT 3.5, right? And if you've ever played around with it, you know that it just was not good, right? And so we're like, okay, fuck this AI shit, we're gonna make a system built on analysis that we know works, and we're gonna crush the competition, right? Two years later, it's maybe a little bit of a different story now. The models have improved, we've improved, it really changed the landscape of how we thought about security as these models got better, as more techniques came out, and as we got to play with them more. But I think one thing to mention there that is also interesting is we were like, we did start out with the, oh, this is not going to work at all, we know that it can't do these tasks, and we're just like, but we very quickly realized that, for example, for the part of the competition where you have to provide patches and fix software, we looked at the state of the art of things of like, how do you automatically do patches? There was no such thing at the time, really. There was a lot of research, but most of it ended up boiling down to, oh, let me mess up these conditions a little bit, change a less than or equal to a less than, and like those kinds of things. But very quickly realized that, yeah, while we can't rely on these LLMs, there's parts that we can't do without them either. Well, and so previously, did you guys compete in the prior Cyber Grand Challenge? So our successors or predecessors had. Gotcha . Yeah. Because I know during that time, I don't know if that required patches as well, or if it was just exploitation. It did require patches. And so, and in that case, it was pure binary. So you were doing stuff that was basically monkey patching, just like pop some new assembly in, call it a day. In this case, you have the binaries to run and test them, but they want code patches for the original source code, which I don't, yeah, I've never, I've been in the industry a long time. I've never heard of anything doing that. Yeah. And even in that competition, like the patching ended up boiling down to mostly like these more like mitigation type fixes, where it's like, oh, we're going to jumble the stack frame and rearrange the variables, or we're going to add stack canaries into the binary afterwards. Right ? So really, these more like, they don't prevent the bug from being triggered. They don't remove the bug. They just make it unexploitable or harder to exploit. That was what was so interesting with this contest, is you were allowed to use, or you had the choice to use commercial static code analysis to help identify bugs, or you, heck, you'd use binary code, like the barcode or something like that. You were allowed commercial licenses. You would use almost an orchestration platform to kick these things off, detect them, run it, check your own uptime and all of that. Did you guys end up using any commercial tools? So I think the only truly commercial tool that we used was CodeQL for static analysis. But beyond that, it's very funny that you mentioned orchestration framework. Because normally, when you have such a huge challenge and all of these components interacting, you would want to use something that's stable, well-tested, like maybe Apache Airflow or something. But instead, you can write entirely from scratch your own orchestration framework, built entirely upon YAML files. Go on! YAML files that end up templating bash into the root process of Docker containers. Go on! Hackery in the purest sense. Yeah, I mean, like, this is a hacker competition, so you may as well have hacks. It was literally whatever we could do to make it work. And it ended up being a very cool and portable system. We can run the entire cyber reasoning system on just a workstation. Or we can scale it up to hundreds of machines in Azure. So obviously, you wrote that over the course of, I guess, the pre-qualifiers before the finals, or at least round one, whatever that was. How did that evolve into the finals? Because I know during the pre or the first round, you had to provide a proof of vulnerability. But it sounded like in the finals, you didn't. That was one, I guess, twist that we had heard about. Were there any other twists in terms of your orchestration that you're like, oh, we spent all this time and now we don't have to do that anymore? Or, oh, crap, now there's a new thing. And how are we going to deal with that? Yeah, I think the biggest thing that comes to mind is like the the budgets just massively increased in terms of both compute and LLM costs that we had available. So for semifinals, for each challenge, you had about $100 of LLM credits. And so at the time, you know, all of the LLM prototypes we built, all of the techniques had to fit within that $100 bill budget. And so that really limited what we could do. Now we had, I think, for 60 challenges, we had like 50K LLM budget. Yeah. And so that boiled down to like $900 per challenge. And all of a sudden, you have a lot more freedom to experiment. How many within Static Code Analysis, like the tool, did you ever find true vulnerabilities using only the LLM? Oh, using only the LLM? Yes. Yeah, yeah. Really? Yes. So like feeding in parts of the Static Code to identify a bug here? So part of our whole CRS framework, we can break it down into several different phases. But the initial phase, run a bunch of Static Analysis tools, gather the results. And then because we have full code bases to work on of hundreds of thousands, if not millions of lines of code, we need to boil this down to something that the LLMs can ingest. So we use the Static Analysis tools to figure out where they should look at first, rank these in some order, and then say, hey, can you reach this location? Or, hey, is there a bug here? And if there's a bug here, can you just crash it for me? And as it turns out, it can, in fact, just crash it for you. So wait, you mentioned that it really sucked in the beginning, and then it got better over time. Was it capable at like the GPT 3.5 era to just do it? Or did that not come until later models? Or did you find yourself using something other than GPT? So I think it kind of started for us where we were like, hey, we can start to do something more of the now more popular approach of like the agentic thing where you let the LLM kind of run by itself. We started noticing that that worked. I think the first with CLAWD 3.5 Sonnet, I think we have pretty heavy uses of various types of models in our thing, but a lot of it is CLAWD 4 now. And CLAWD 3.5 Sonnet was the first prototype where we were like, hey, this is actually really cool. It's able to use tools we give it. It can use a debugger. It can write Python scripts to interact with stuff. And I think that was also one of the first models where we found that ability to write Python scripts that produce inputs that we then feed to the program really helped a lot because all of a sudden, instead of having your fuzzer have to break compression or like break some checksum, it can just import Zlib, zlib.compress, boom, you're there, right? And so I think that was the first step where we're like, oh, wow, that's really cool. So gosh, there's so much to unpack here. So let's, I want to bring back to when you were interacting with the LLMs, were you interacting like directly with, oh, I'm going to open AI's API, or were you using a higher level like a lane chain or something like that to actually, so it would pick, okay, this problem is best solved by this model? No, we were not that sophisticated. It was pretty much, it starts off of us just in like the console of GPT or Anthropic building kind of test cases of, okay, I have this input, if I, let's see if I can actually manually massage this into place. And then once we've confirmed that that works, we then try and turn that into some sort of prompt and automated system so that we're able to do this over and over again and verify that. And we had like our own system built on top of that, one of the people on our team built called AgentLib that built on top of lane chain, but made a bunch of like super nice wrappers around it to be tool calling and like have agents with history that automatically prune and like all of those like common techniques were a little bit like abstracted away. So you could focus a little bit more on the prompting and the component writing. Yeah, I've used, I've used lane chain before. It's really, I'm sorry if the developers, it's really janky, it's really clunky. Yeah. And at a certain point, you're like, I can just maybe just do this over here somewhere. I think one of the important things to note, too, is that like we evolved as AI also evolved at the same time. So when we started, tool calls didn't exist as a concept. We had to figure out how to get it to execute like arbitrary Python code, which was very scary because we're just like, hey, I just made this thing where if you give me Python code, I'll just run it on my system. Yeah, right. Full access to pull down any libraries you need. Yeah, sure. Just go for it. Right. It's probably okay. I'm sure. But no, then, you know, we slowly built our own agentic framework and then like agents and stuff also became a thing. But our system was already so hard set in the stuff that we had done. We just continued to build upon that. So now that you've gotten through the competition, you guys did very well. Who do you see actually deploying these types of systems? Obviously, every not obviously, but every team is required as part of the competition to open source their work or some amount of it. I don't know what the actual stipulations are. I imagine you're very interested to see what everyone else did. Yes . Who do you think is going to take this and run with it after it? Do you guys have plans to do something with it afterwards? Are you already starting your own company? Oh, yeah. It's you want to go Lucas? Sure. Yeah. I mean, I think the answer kind of. I mean, for us, we've built and spent like the last two years building the system. Obviously we want to keep it going, right? And so yeah, we're thinking of exactly this kind of thing of like, how can we make a company that then can actually provide stuff to people, right? Like that can actually make people's code safer. And I think that answer is of like, who's going to use it and how is different depending on the use case. I mean, if you're someone like Google that has just infinite money, basically, to throw at the problem, right? Then you can do a lot more of the techniques that I think this competition finals incentivize where you're just like, have a lot more resources available. I think for smaller companies, there is parts though, of these systems that generally don't cost that much money. One of the settings of the challenge was you're given a target repository, plus a set of changes. And then you're instructed to find bugs that are introduced by those changes. Now it turns out that that problem all of a sudden is a lot cheaper to solve, right? You can by just limiting it to those functions plus what they impact. So for example, if they make new functions reachable that weren't reachable before, that is all of a sudden that something you can maybe do for $5, maybe $20, right? Depending on how big your changes are, that's all of a sudden a lot more approachable for a lot of folks. So one of the biggest problems I've seen in static code analysis is you find, oh, there's an injection point right here, but there's no way of reaching it. So it's kind of like, oh, I don't want to submit this because it's just creating noise for the developers. How did you guys solve that problem? Yeah. So I mean, I think this comes back to the LLM being able to generate reaching seats, right? So we found that in a lot of cases, if you give the LLM a point and you give it like a good start, like let's say some PDF parser, you give it like a good starting grammar maybe for the fuzzer to create a PDF out of. It's actually very good at manipulating that to reach that location. And maybe it doesn't necessarily instantly crash it, but it can get very close. And maybe within a few minutes or hours, it's able to actually mutate whatever your sheet is to crash the program. So you had, just to recap what you just said, you had LLMs essentially writing fuzzers as part of your framework. So not just like we were talking previously about concolic execution, where you have a stack analysis that hits a state space explosion, so you just go run a fuzzer, and then you figure out where the state space shrinks a little bit more, then you go back and forth. In this case, you actually had the LLM or whatever model mutating your fuzzer to that's dope. Yeah, that's just cool. Yeah, we had a this was one of the cooler things where I think we built a lot of stuff around that we want to see the logs to see how well that did. I think there's obviously stuff that could have gone better. But I think there's probably also a lot of very cool stuff in there where the LLM is very good at recognizing patterns. Right. It looks at a function. Oh, I know what this this is like, oh, this is clearly trying to parse a PDF. And so then because we had the LLM write these input grammars that describe the structure of the input, we could detect, hey, this part of this input structure that the LLM is trying to describe looks like a PDF. And then what we would do is we can take these corpuses of entire known PDFs, but also handwritten grammars for PDFs and splice them in at that point to really supercharge the exploration of that LLM where it's like, OK, well, it got there and it kind of has an idea of where it's trying to go. We'll help it along so it can focus on like reaching other stuff that's custom to this application instead of having to worry about the PDF format structure itself. So we're talking about PDFs really quick, but I have a somewhat leading question. Did the competition give you not necessarily all of the not file formats, but input formats that it would be exposed to? Or was your system expected to be able to look at a new code base, decide how to exercise it? So it had to not just reason about how to mutate a fuzzer, it had to reason about what to generate, what fuzzer to generate. This is all I'll tell you. That's wild. I didn't realize the input to these to our system is cURL. So they will send us a cURL request that contains a JSON body that just tells us here's the link to the repo. And here's like the very base metadata of this is a C project. Here's where you can find the Docker file. Here's where you can find like the supported fuzzers. And then that's it. Yeah. So let's let's talk about stages, because there's probably some breakdown and we'll call it your orchestration, which is a stage. The first stage is discovery or identification, probably recon, whatever you want to call it. Can you walk us through the stages of your approach? Sure . Yeah, absolutely. Yeah. So we break it down into I think it's about five stages. One is just the input, right? This is this is what we ingest. And in the case of this competition, it's OSS fuzz projects, right, which have a relatively set format and is somewhat easy to parse. Then we have our static analysis stage where we run tools like CodeQL, Semgrep, and then if they give us any sort of diffs, if it's that type of challenge, we figure out, OK, what are the functions that were touched that were changed? Then we feed this information into our dynamic analysis phase, which includes the LLMs trying to generate reaching input. Yes. I want to pause you on the static code analysis, where you're running Semgrep and things like that. The outputs of those files, were you running them through some sort of report parser that you wrote or were you handing those straight over to an LLM and say, make sense of that? So kind of a little bit of both. So we have a component that we called CodeSwipe that basically just aggregates rankings from different tools. But one of those tools or specifically two of those tools that feed into that ranking would use LLMs to try to rank it. So, for example, we had a component called DiffGuy that would take the diff, it would analyze, it would try to find what's reachable. And then for each of those functions, it would hand them off to LLMs in combinations of like, hey, do you think there's a bug of type of a buffer overflow here or just do you think there's a bug here? The other thing we had was this like custom model that one of the people on our team trained that was trying to do the same thing where you just give it all of the functions and it tells you, I think this is more likely vulnerable than this other function over here. So a little bit of both. But everything kind of culminated in this ranking, this numerical ranking, where honestly, that's just like heuristics where we're just like, hey, four times this score plus two times this score, just to give us a numerical ranking that we can then rate the functions by and hand off to the LLM C generator. So I'd grab that. So I'd grab those outputs then and move those into the dynamic analysis portion. Yeah. So then we know kind of where we need to start, at least for the LLM portion. Where do you need to start looking to try and exploit or find crashes or bugs? And then on the flip side of that is you had our suite of fuzzers, right, where we identify first, OK, what type of input does this thing take? Are we talking SQL queries? Are we talking PDFs? And then as we fuzz, we generate coverage reports. We figure out how far did this grammar that we've generated actually reach into the program and then feed that back into the LLM grammar generation that says, hey, you reached this far. This is what's in your immediate vicinity. This is what you've done so far. Can you go even further? Well, what's cool about this, too, is that, like, I was I think we were all a little bit hesitant to do this initially. But when we talk about this, like, oh, the LLM has to reach certain functions and it has to it has to hit a certain piece of code with a certain vulnerability in it. One of the main components actually just lets the LLM choose what it wants to reach. And so that's kind of cool where it's like, it's like, oh, you've reached these functions. It has a list of goals of like, hey, I'm trying to reach these things. And it can itself decide, I want to add this as a goal function. I want to add this as a goal function. And then it gets it in the status report with a nice little green checkmark when it finally does. So like, wait, so dynamic analysis back here, so many questions I want to ask. Go after dynamic analysis. Where did it run off to? Yes. So then we had root causing, right? Because ultimately, we need to patch these vulnerabilities that we find. And in order to patch them, you do have to understand them. We found that a good portion of vulnerabilities, once you're given the crash, you're patching or LLM can understand it based on the crash report and just give you something that's pretty good, right? But when you have things that are like use after free or heap buffer overflows, where maybe the actual user or vulnerability location happened way earlier than the actual crash location. And so in that case, we had two separate triaging systems that attempted to find the root cause. So , yeah, I was going to say, well, how did your system deal with detecting the victim rather than the perpetrator of, you know, use after free or race condition? Or did you did you get there? Yeah, I mean, I think there's kind of like two pretty different approaches. We've tried to have a little bit of a mix there. One can be kind of boiled down to you hook up the LLM to a debugger and say, tell me what's up. And that one is actually surprisingly effective if you constrain it enough and give it good enough input. Will was working on that one for a while. Yeah. One of the biggest challenges with that is that if you just tell the LLM, hey, you can access GDB, here's where we crashed. Can you tell me like a little bit about what happened is it starts trying to examine every single pointer that it can see and then every single value that that pointer points to. And then it started looking at the stack values and then it just does it just freaks out. Right. So you have to put it in a little bit of a box first. But if you do, it's actually quite effective. And then the other approach was a little bit more of like the traditional, more statistical approaches of trying to do call traces, seeing which parts light up more in crashing inputs versus non-crashing inputs and that kind of thing. And then both of those approaches produce their own reports and their own ranking of like, this is where I think the patch should happen. I'm guessing at this point, after this point, it was probably pretty easy because you now can hand an LLM saying like, here is the exact crash location. Here is the piece of code causing this. Here's the type of bug. Go patch it. So is that correct? You would think. You would think. I would think. You would think. So it actually turns out... And it's also what we thought, too, by the way. Yes. So that it is true. It is somewhat easy to get to a patch that ends up then actually fixing that specific crashing input. But what it turns out is a lot harder is making sure that you submit a patch that fixes all crashing inputs. So, for example, we had a case in one of the... So DARPA ran a couple of exhibition rounds before to let us test the systems. In one of the exhibition rounds, they had a target where we found a bypass to the organizer written patch. And so there was a lot of logic that we had we added that was like, OK, make sure that there's definitely no more crashes. Right. So we would take the patches. We would fuzz them for a little bit. We would give them to our vulnerability hunter agent again and say, like, now try to bypass this patch. And it turns out that there was actually a decent amount of patches that without those stages were bypassable. Whereas it was like, oh, let me just double the size of the buffer or something. Right. Like patching is even like even in these we were we had exhibition rounds leading up to the finals where the organizers would give us a set of pre challenges that they had done. And then after the round was over, they'd release, oh, here's the vulnerabilities and here's the diffs for some of them. And in the diffs were supposed to be the patches that they applied. And we were able to bypass some of those patches as well. So even for humans, writing patches is difficult. It's interesting. It's like we both agreed. You're like, we thought that was going to be easy, but it wasn't. What was what are other like what is the most surprising thing you hit where you're like, I was expecting this and it totally was not that. I mean, I think the first one was the the that the surprising fact that these LLMs can even just do this like one shot seed writing where you're just like, oh, here's a bunch of functions along a path you want to hit. And these functions are really hard sometimes for fuzzers to hit. And the LLM does it for like 50 cents. It's like, yeah, it's just wild. I mean , honestly, the first time we we were all in like a room together and I know I knew people were working on this component and they say, oh, I hit the bug. And I was like, bullshit, you over tuned like, you know, you told it where you needed to go. And then they showed me they do it a second time on like something totally like fuck. So a couple of years ago, I pivoted away from vulnerability research and doing Linux development now. And one of the reasons for that is I got a little burnt out and I realized that the problem is, in some senses, like if you want to go do embedded systems work, it's never been easier. In other ways, it's only beginning harder and harder and harder to make a living in this space, at least compared to even 10 years ago, five years ago. What you're describing is like, oh, we just found a way to make it significantly easier. Great. Oh, shit. Oh, crap, is my response to that. That's fascinating. So so the cool thing about it, though, is that I think one thing that I've taken away from a lot of this is that traditionally, I've not been a super big believer in the idea of like directed fuzzing and all of that. I think it's mostly had at best marginal effects. But now if this is remains true, which is what seems to be true, which is like you can just tell the LM, hey, I think there's a bug here. Go try hit it. Now, all of a sudden, you can do a lot more research into what do bugs look like and how can I find the pattern of a bug and how do I identify bad looking code, like that code smell idea. And all of a sudden, all of that research, now you have an actionable thing that can take that and say, oh, you're right, that is bad. So I think for me, this seems like the obvious step, because we look at most code analysis tools and they're pretty stupid, like SEMGRAP, like we are looking for patterns which we have created. What we're now doing, though, with large language models, which are great at grabbing unstructured data and adding structure to them and looking patterns, I think the only thing which is going to be like a significant gotcha with it is that the generic training we're doing is including so many stupid patterns. So really, so an interesting part about the grammar fuzzing thing is we actually had to tune it a little bit differently because the LM was too good at generating structured code. It would generate code that was that would be within the bounds of what a normal programmer would think to do, but didn't actually test maybe the max or min. And so on top of that, grammar had to add an extra layer that was like, oh, it's trying to set an integer here. Let's actually extend that a little bit so it can be a hacker domain LLM that is just like, no, we're going to keep this one private because it would be too dangerous to release. No, code smell would be a good name for that tool. So if it's not already trademarked, I recommend we're not going to publish this video right away. Feel free to run off. We'll get on it right after. So you hit the point, you've done triage, you identified a bug, you're now ready to do a PR . What's the next step? Do you build unit tests? Like , I'm assuming now you want to build a unit test almost. I guess you've identified a bug, you've done a PR somewhere along the line. I'm guessing you're building a unit test. We'll check. Have I properly patched it? I'm guessing that's the part you were kind of talking about. Yeah. So the way it works in the setting of the competition is basically the unit tests are given to us by the organizers. Not ahead of time, right? We don't ever see them, but the system sees them. And so when we produce a patch, we have to run all of the unit tests and they run them all before the submission. And our patches are only considered valid if all of the functionality tests remain passing. What we have done is a little bit more of what we talked about earlier, where our version of unit testing is basically taking the aggregated set of all crashing inputs we've ever found, making sure that all of the ones that we've clustered together in that same bucket that we believe belong to the same vulnerability, making sure that they patch as many of those as possible. And then with the patches we end up submitting to the organizers are only the ones that are either perfect and patching their entire cluster, or after some amount of time, we'll be like, OK, we've tried, we're clearly not able to make a perfect patch, maybe we'll submit the imperfect one. So that's a little bit more of the testing of the patches that we do. So before we let you go, there's two questions, there's two ones I have to ask. One, in early days of LLMs, there was little stupid tweaks you could do, like take a breath and then answer, or you are a penetration tester trying to do this. Did you find weird tweaks like that along the way where if we said this, this massively improved it? So I'll say initially, yes, we had crazy ideas, we would yell at it, we would threaten it, right? We came up, we never really used this, but the Russian roulette expert approach in which you ask, you know, the three expert approach, right? Where instead, you have 100 experts, and each time it doesn't give you the answer you want, you say, I killed expert 86, do you want to try that again? But and then ultimately, as models got better, these things phase out as they're better understanding like human language and intention, it phased out into just have well structured prompts, define things like this is the instruction in like XML tags, this is the input I'm giving you and yada yada. I did have to laugh early days. It was like this is life or death. If you do not get this right, you are going to kill me. And if he gets it wrong, you're like, you killed me, please. And now the LLM is turning it around on us and Claude is going to phone the FBI when we threaten it. That was the first question. The second question is hindsight 2020. You're now at the end. If you could say something to yourself at the beginning of the competition. What would you tell yourself? Say it was worth it. Yeah, yeah, I think I go for it. I think that I learned so much along this way. I mean, traditional binary analysis knew nothing about AI or LLM when I started. I did not actually even like the field at all. But I thought, hey, these things are kind of popping up. It would be cool to get experience doing this. And I think I learned how to use these. And I think I know what makes them tick a little bit. And I know how I can integrate it in my own projects to make them better and maybe hopefully, you know, make the world a better place. Open source tools, you know. I think my answer would be a little bit of like the don't be afraid to experiment just because I think, you know, this is a pretty big effort to build a fully autonomous system that has to be full hands off, right? Like you're in the real world. You might have people that can fix stuff when it breaks. But in our case, we had to do a lot of engineering to make that happen. And so for me, it was really nice between semifinals and finals to have that breathing room where you're like, OK, we made it past that boundary. Now we can start exploring the space again. And then we rapidly tried out a bunch of stuff. And I think encouraging that more and like earlier and realizing that, you know, the system is going to run whatever it's you have to make it work. But in the approaches, you can be a little bit more experimental. I think that could have been very, very cool just to see what else is out there. I think there's so much stuff we haven't tried yet that we want to try still. And it really is amazing how much it's changed even in two years. And it's I'm curious, especially with the sheer amount of open source tools. Yeah, I'm curious how long before or if there was an approach which was like, go find another open source tool to do this thing. It's just like creating its own, you know, creating tools or finding new tools. Perfect. We've now that we've solved the world problems. I mean, what do we do now? Thank you so much for joining us. Thanks for sharing kind of the secrets. I cannot wait for it to be open source and take a look at what you guys did. And we'll keep an eye on what was it? Codesmell? Codesmell, yeah. Thank you. Thank you for watching. Thank you so much. Thanks for having us. And hack on!