← All AI Engineer talks

AI Engineer World's Fair 2026

Using LLMs to Secure Source Code

About this talk

Anthropic's Eugene Yan explains how security teams can use LLMs and agentic harnesses to find, verify, prioritize, and patch real source-code vulnerabilities. Using Mozilla's Firefox work with Claude Mythos Preview and a Python SQL-injection example, he outlines a six-step workflow built around threat modeling, isolated sandboxes, discovery, verification, triage, and patching. He emphasizes system context, reproducible exploit testing, scarce engineering attention, and feedback loops that improve patch quality.

Chapters

  1. 0:00Introduction and emerging AI security capabilities
  2. 1:58Firefox results, open-source vulnerabilities, and agentic harnesses
  3. 4:56Six-step workflow and threat modeling
  4. 7:42Isolated sandboxes and SQL-injection discovery
  5. 16:03Patch validation and generative verifier loops
  6. 21:03Customizable security harness and closing

Talk transcript

  1. 0:00

    [upbeat music] Hi, I'm Eugene, a member of technical staff at Anthropic.

  2. 0:15

    Um, I've spent the last several months with working with security teams and Claude to find and fix vulnerabilities in codes and systems. So I want to share with you what we've learned as much as we can.

  3. 0:24

    Before I get started, quick show of hands, how many of you here, here are security engineers in your day job?

  4. 0:31

    Okay. Okay. How many of you here are engineers in your day job? Oh, sweet. Okay, great. I have a better understanding of how to give this talk now. Um, security engineers in the room, please don't boo me if I oversimplify things.

  5. 0:42

    I wanna get this message out to as many people as I can. So first, I wanna share with you three high-level trends that we are seeing, and those are model capabilities, right?

  6. 0:50

    Number of vulnerabilities found, um, and where the bottleneck is shifting to. Then I want to distill the lessons we've learned from working with dozens of, uh, organizations to improve their security posture, as well as the bottleneck that you might encounter and how you can try to address it and prep for it.

  7. 1:04

    And finally, I wanna share how you can get started this week with links to resources.

  8. 1:09

    So why do we care about so much about cybersecurity now? Um, time horizon benchmarks track the length of time an AI model can complete a task measured against an actual human doing the task.

  9. 1:22

    Um, so we all know about the Mita Eval task, you know, how, how much knowledge one agent can do. The UK AI Security Institute has a cybersecurity version of this.

  10. 1:32

    You know, these tasks require identifying, exploiting security weaknesses in target systems, and, you know, testing skills like reverse engineering and web exploitation. So in this chart, we see that models are able to increasingly do longer cybersecurity task.

  11. 1:45

    Um, but what's also interesting is that you kind of see a step jump against the previous regression line. So these models are a step improvement in capability. And what does this step improvement in capability buy us?

  12. 1:58

    Recently, Mozilla Firefox published a number of security bug fixes they made each month. The average in twenty twenty-five was about twenty, twenty-ish. And then you can see in February and March, it kind of three X'd to about sixty and seventy.

  13. 2:13

    And then in April, it seven X'd to four hundred. So what this means is that what's happened in April is twenty X of last year's average.

  14. 2:24

    Um, they attributed about two-thirds of this to Mitos Preview, about two hundred and seventy-one, which shows that frontier models can help defenders like yourself find and fix vulnerabilities at scale.

  15. 2:37

    We also-- What are some notable vulnerabilities? Hands up, who here remembers Log4Shell? Anyone? Anyone was here over the December holidays, like scrambling to patch this stuff, too? So Log4Shell, um, is a bug in a Java logging library.

  16. 2:52

    If an attacker sends a string, you log it, the attacker can run code on your system. The Belgium Defense Ministry was breached within days, and a fintech platform w- uh, leaked two million users data.

  17. 3:03

    And then before that, we had Heartbleed, which is an, a bug in OpenSSL. You know, so much of the li- of the Internet runs on OpenSSL, and we, we all know what impact it had.

  18. 3:14

    This is Anthropic sharing of our own work, scanning more than a thousand open source repos. Um, from twenty-three thousand candidates, uh, sixty-two hundred of them were rated as high or critical.

  19. 3:25

    And at the time of the update, sixteen hundred of them were reported to maintainers and about a hundred patched upstream. We shared our observation that finding vulnerabilities now is quite straightforward.

  20. 3:39

    The bottleneck has now shifted to verification, triage, and patching, and I wanna share with you everything we've learned about that so we can get ahead of it.

  21. 3:48

    So how do we do this in our own systems and code bases? Um, two words: agentic harnesses. I'm citing Mozilla again, and this was even before they worked with Mitos Preview.

  22. 3:58

    I'm gonna read it off the screen here. Early experiments showed that some promise, but the high rates of false positives made it impractical to scale. But the introduction of agentic harnesses that can reliably detect security issues has changed this, right?

  23. 4:15

    These models and harnesses together can find real bugs and dismiss non-reproducible speculation.

  24. 4:23

    So the harness and the model working together can get a lot of work done.

  25. 4:29

    We found that most teams converge in approximately these six steps, and a big chunk of my talk is gonna be about these six steps. Right, the first two steps are set up, right?

  26. 4:38

    You do a bit of upfront investment per code base. How many of you here know what a threat model is?

  27. 4:44

    Amazing. I love that. A threat model is some kind of like, kind of system design, but for your code base or system, what are threat vectors? So this helps you decide what are the vulnerabilities in your system that you care about.

  28. 4:56

    And then also, we also want an isolated sandbox where you let your model run possibly untrusted code, or you let your model deliberately detonate proof of concepts of exploits, I'm gonna call them PoCs, to confirm that they are true positives.

  29. 5:10

    And then the next four are loop, where, you know, we have discovery that identifies vulnerabilities, verification confirms that they are real. We have triage. You know, you can't give a developer a hundred vulnerabilities.

  30. 5:21

    You gotta identify the top ten or twenty critical and high, so they can focus their attention. And then you can patch, patch the box. So now I'm gonna talk about each step.

  31. 5:30

    Now, to make things concrete, I wanna share with you how they apply on a hypothetical system. So this is order service. Order service, you type in an ID, and then you look up an order.

  32. 5:41

    So what kind of vu- vulnerabilities might we find in this? Um, the first step is the threat model. So why does this matter? So several teams, if you look at a code, right, finding-- have found that having a well-documented threat model really increases your true positive rate to ninety percent.

  33. 5:58

    Ninety percent is outstanding, if you ask me. I think anything above seventy-five is, is great. That's where you wanna aim for. Now, to put it another way, one CISO said this, "The model has great context of the code-"

  34. 6:09

    But poor context of the system. And why does this, why does this happen? It's the be- whatever the model can read, the model will understand well. But there's so much information that the model cannot read.

  35. 6:20

    Why did the senior designer design the system this way? What are all the vulnera- vulnerabilities that on-call has been fixing that has not been written down? All of this is now implicit context in your head, but you need to write it down somewhere, maybe in a threat model, to help the model be a better security engineer.

  36. 6:37

    So we can work with models to build these threat models, and the threat model is really just a document, right? First, we can bootstrap a threat model, give the model access to all your documents and code, even pass code mo- comments, pass patches that were made and what CVEs they were patching.

  37. 6:51

    And you can ask the model to infer, hey, what possible... what other CVEs have not been patched, right? So the model can do that. Then after the next step is that you should ask the model to interview the expert on the system, right?

  38. 7:05

    What are some things that could happen that we didn't plan for? Or what are some things that we actually don't need to worry about for vulnerability because maybe this is an internal VPN-only app, or there's a compensating control elsewhere.

  39. 7:17

    A lot of this is not in the code, right? If you look at your code base, it's not there. But it needs to be written down somewhere, so the model can benefit for it.

  40. 7:24

    So here's an example threat model of order service, right? You know, the key asset is the data, you know, con- con- uh, contains customer PII, and the entry point is the orders API.

  41. 7:34

    We can also see that the model has suggested some possible threat vectors, like SQL injection, and that the fact that you could call this API without any form of authentication.

  42. 7:42

    Then the second step is the sandbox. So isolation and reproducibility.

  43. 7:49

    In some cases, we may be running untrusted code. In some cases, we may be asking the model to deliberately create exploits. So we want some isolation, um, to prevent the model from doing bad things.

  44. 8:00

    So this isolation, doing bad things could be data exfiltration or, you know, dropping things in production. And of course, uh, you, you want all of this to be running in a VM without egress and of, of course, without your cloud credentials.

  45. 8:13

    The second thing we want is reproducibility. So a lot of times, uh, you may find that the model may find a s- a bug because you were using a old dependency.

  46. 8:22

    Or you want, you want all of your agents to be starting from the same baseline container so that your agents can very f- can, can, can run everything in a harness in the pipeline.

  47. 8:32

    So now building a reprodu-- uh, representative sandbox of your system is actually quite difficult, but the capability is quite useful. I think, here's one team we worked with. They quoted, "The biggest f- the biggest lever we had is having the model testbeds, essentially sandboxes with live systems and where they can run and detonate the PoCs to confirm

  48. 8:50

    that they are true positives." So how would a sandbox for order service look like? Well, y- this is a simple sandbox. Uh, three Docker images connected together. One for the app, one for the Postgres database, and one for the Redis cache.

  49. 9:05

    And on the right, we have the security agent, uh, which sits outside the target boundary trying to probe the app via HTTP.

  50. 9:13

    Now that we have the setup done, we can now move on to doing the work of discovery, finding the vulnerabilities. So the first is no-- So what are some...

  51. 9:24

    There are three things that matter a lot, and it's no surprises here. The first thing is really context engineering. You're gonna give the model all the context, as much context as you can.

  52. 9:33

    If the, if it's written down and if you share the model, the model can find it, the model will be a better security engineer. You improve your vulnerability coverage.

  53. 9:41

    You reduce your false positive rate. The second is to have simple pro- simpler prompts. Um, how many of you here have found that as models get better, you actually need to remove from your prompts?

  54. 9:54

    That's what I found. With every new model version of Step Jump, I actually have to cut my prompt size by maybe about fifty percent. Right. So as models get better, your prompts need to be less and less specific, prescriptive even.

  55. 10:05

    While, you know, previous, previous models, you might s- ask the model to look out for specific category classes. But for newer models, you can just probably say something like, "Look for where untrusted data hits the trust boundary," and the model is very good at inferring this.

  56. 10:20

    Finally, give the model tools. So one example, we had a pen testing team. They give the model tools to check the response, to, to query the API, check the response, read the logs, read the source code.

  57. 10:32

    Now, this is just like the tools that you give a regular security engineer, right? A lot of times you expect the model just read the code. That doesn't quite work.

  58. 10:40

    Allow the model to be dynamic, to read the tools, uh, to, to run the tools. And when they did this [chuckles], their true positive rate was almost a hundred percent because the model could actually verify in the loop.

  59. 10:51

    So here is the get API for the order service, and it's just five lines of code. Can anyone here spot the vulnerability?

  60. 11:01

    You can shout it out. SQL injection. I-- [chuckles] You guys, exactly. So this is what the discovery agent flag, right? You know, in line four, we build a SQL query via Python string interpolation.

  61. 11:13

    So the user incu- input flows straight to the SQL query, right? And that means that someone can inject a SQL query that exfiltrates data from your database. This is code that I would have written, right?

  62. 11:22

    As me as a non-sec- security engineer, it's just a very... I just write the simplest code possible, and this is how it would look like. Current models are very good at detect-- spotting simple stuff like this.

  63. 11:34

    So after discovery, so we have maybe a thousand, let's say a hundred vulnerabilities, we may have not been able to confirm them. The next step is verification. So if you think about machine learning, discovery optimizes for recall, find as many vulnerabilities as possible.

  64. 11:51

    Verification optimizes for precision. Of the hundred vulnerabilities we found, how many of them are truly optimi- uh, truly exploitable? So we have them both working separately. So we found that it's helpful to have these two steps separately, right?

  65. 12:05

    Because when the discovery agent is trying to verify its own work in the loop, trying to debate against itself in the loop, it may actually self-censor, and this may actually hurt recall.

  66. 12:15

    Um, and when building the verification agent, it's helpful for the verification agent to be independent and adversarial. Independent means that the verification agent doesn't see the reasoning traces, doesn't see all the work that the discovery agent has done.

  67. 12:28

    All the verification agent gets is the vulnerability, and it approaches it from an adversarial point of view. Assume that this vulnerability is false, try to confirm it's false or confirm it's true.

  68. 12:38

    So this sets the-- this sets a very high bar for the vulnerability, which reduces the false positive rate. And also, if you have invested the time in building, building a representative sandbox, um, have the verification agent build the PoC, detonate the PoC to confirm if the verif-- the vulnerability is true.

  69. 12:58

    So in this case, back to order service, our verification agent is confirming the SQL injection, right? In a fresh container, and this is why we have everything in containers, the verification agent is only given line number four.

  70. 13:10

    Here's where SQL injection could happen. And the verification agent actually tries, just runs the curl command, and the verification agent can see all the customer PII that has been ex-exfiltrated.

  71. 13:21

    So now you have confirmation that a SQL injection can work.

  72. 13:26

    So after discovery and verification, we've maximized recall, we've optimized for precision, the next step is triage. So a lot of this may truly fire, but some of these are bug correctness issues.

  73. 13:38

    They have very low business impact. So across multiple teams, they shared that you can lose trust with product engineers by sending them all the vulnerabilities that are true, even those that are medium or low severity, because those engineers can't cope.

  74. 13:53

    And as we've seen so many times, the scarce resource now is engineer attention. So imagine you're a product engineer. What are the kinds of vulnerabilities you want to actually receive and fix?

  75. 14:05

    So as part of this step, we can do deduplication, you know, cheap heuristic checks, or we can get a model to help you with clustering and deduplication. We should also consider the severity ex-- of the exploit, right?

  76. 14:15

    Uh, one thing to consider is the magnitude of the outcome, of the impact. What is the magnitude? Is it a ring zero magnitude or a ring one magnitude? Um, and also the likelihood of it occurring, right?

  77. 14:25

    How many hoops does an attacker have to jump through to actually make that exploit? And this is where the threat model is useful throughout. You can think of the threat model as just synonymous with context.

  78. 14:36

    Just give the model context about your business, right? So, for example, compensating controls. If you have a firewall, something that was initially high severity could actually be low. On the other hand, if you know that your database is mostly customer PII data or healthcare data, a model might have, have set that as medium severity, but it actually

  79. 14:57

    could be high because the, the contents of your data are so sensitive. So in this case, we have on the left

  80. 15:05

    triage that the agent has done. The agent has said that this is high severity for these reasons, right? High impact, high likelihood. Now, on the right, after human review,

  81. 15:16

    the operator has confirmed that, you know, th- has downgraded this to low likelihood. And the reason why it's low likelihood is because we have an application firewall that blocks SQL injections, and also there's the fact that the service is internal only.

  82. 15:28

    It's only for internal i- warehousing or internal logistics. It's not, it's never internet facing. Therefore, the likelihood is low. Now, you can imagine, like, how would the model know this?

  83. 15:37

    This is not written in a code base. It may be in, available in a system design, it may be available in your documentation, it may be available in your confluence, et cetera.

  84. 15:45

    So this is the kind of context you need to provide to the model so that the model can get better at this.

  85. 15:52

    Now, after that, we close the loop: patching. To validate the patch, you know, we can build a patch, and then we wanna validate. There's a ladder of sorts. First, the original PoC has to stop working.

  86. 16:03

    That's basic. Second, the existing test suite should stay green. No regression. And then we can go further, right? We can have a fresh discovery agent try to attack the patch code again.

  87. 16:13

    Is the patch comprehensive enough? And teams have found that by giving the patching agent such feedback, um, you can actually... The patch quality improves greatly, right? And you know, this is a generative verifier loop.

  88. 16:23

    Give your agents context, give your agents feedback, and they, they can do the, do their work. And finally, a human confirms the patch before it's been merged. So here's how the patch will look like.

  89. 16:32

    You know, in the first diff, we update the code. It's a one-line fix where we move the variable out of Python. Uh, and therefore, we reduce the likelihood of SQL injection.

  90. 16:41

    And in the second diff, not only do we update the code, not only do we fix the system, we close the loop. We make sure that the s-- next time we run this loop, we run this scan, these issues don't happen again.

  91. 16:51

    And this is really important when you're building the, building harnesses, right? You're building loops, they're operational expense, but when you close the loop, they now become capital expense. You get better with each iteration you run.

  92. 17:03

    So we make clear the compensating controls we have, the ap-application firewall, and the fact that it's internal only. Okay, so the quick recap. These are the six steps, and each step focuses on one thing.

  93. 17:14

    Threat model provides context. Sandbox provides isolation and reproducibility. This is the baseline fundamentals that you need to have. This will carry throughout every scan you have. Context and reproducibility.

  94. 17:27

    Then after that, the rest is really, if you look at it, it's... If you, if you squint, it actually looks like an ML pipeline. Recall, precision, ranking, and closing the loop.

  95. 17:38

    It's a regular machine learning pipeline. Now, that's the technical challenge we have. There's another technical challenge we have, and as my previous director would say, non-technical problems are an order of magnitude harder than technical problems.

  96. 17:54

    So what are some other bottlenecks you might have? So imagine you have a process. What happens when you have one or two orders of magnitude more input? What is gonna start to break?

  97. 18:06

    In the case of the harness, the scanning harness, you just have more engineering, you spend more compute, you pay more money. Things that can be solved with money are not really problems.

  98. 18:15

    But human attention doesn't scale. Your dev, your product engineers, and your security engineers, what if they don't agree on what high severity or cal- ca- uh, tr- critical severity is?

  99. 18:27

    You need to put them in a room, you need to write down all these rules so that everyone agrees. And, you know, your threat models, they're all stuck in people's heads right now.

  100. 18:35

    Someone needs... They need to be interviewed, maybe by a model or by someone else, and write all their threat model down so that now you can have agents help you.

  101. 18:43

    And finally, you know, patching, patch, patch review. Um, I still don't know of many companies that have gone through fully automated patch review, especially when pi- uh, patching security issues.

  102. 18:55

    So here are some organizational bottlenecks that you might hit and what you can do. The first thing is vulnerability routing. So if you maybe get a, a dozen vulnerabilities a month, you can probably curate them, you know, email them to specific teams, assign Jira tickets.

  103. 19:08

    When you have hundreds, you can't do this. And this can really be as simple as, you know, sending it to the code owner, et cetera, um, or, or the service owner, and it doesn't really need an LLM in the loop.

  104. 19:20

    The next, second thing is severity calibration. The, the one hard thing we found is that product engineers and security engineers, red team, blue team, they may not agree on what high severity is, and all this requires a lot of your business context.

  105. 19:32

    I really think it helps to have everyone discuss and write it all down once and for all, agree upon that, that you can send that to agent. And finally, the patching bandwidth.

  106. 19:42

    Um, I'm sure no one writes... Very few of you here write code by hand now, but it's also very challenging for you to just be given the vulnerability and try to implement a patch, even with LLM assistance.

  107. 19:54

    You definitely wanna be moving towards AI-generated patches, and then have the human in the loop verify it. And, you know, generate the patch, reattack the patch. Okay.

  108. 20:05

    If you only remember one thing, well, here are the three things you want-- I want you to remember. I would like you to start now. Please, start with open source dependencies.

  109. 20:14

    Start with whatever you're comfortable with. Two, I wanna teach you how to climb the learning curve. Don't try to aim for automation immediately, right? Start interactively. Do it hands on the wheel with, uh, Claude Code or your favorite IDE, doesn't matter.

  110. 20:29

    Learn where you get cut. Learn what kind of context you're missing. Learn where precision is low. Then third is don't just aim for scanning. Uh, scanning is not the bottleneck.

  111. 20:41

    Verification, triage, and patching, and then all your organizational processes, those are the bottleneck. Over there, I have a couple of resources. We have Claude Security to scan your code base, validate findings, suggest patches.

  112. 20:51

    We have a blog. We have open source repos for, with, that includes the interactive skills and autonomous harnesses. And all you have to do is to run these few steps to very quickly get hands on the wheel.

  113. 21:03

    And in it, if you look at step five, you have the harness, and you can just customize it.

  114. 21:09

    That's all I had. Thank you. [audience applauding] [outro jingle]