---
title: "How we built Datadog’s agentic vulnerability hunting system"
description: "We developed threat packs that give our agents the context they need to run efficient, repeatable hunts. Learn how we did it. "
author: "Bianca Lankford, Matt Meen, Adrien Peronnet"
date: 2026-11-18
tags: ["security", "threat detection", "ai"]
blog_type_id: the-monitor
locale: en
---

With today’s closed- and open-weight AI models, you can find potential vulnerabilities through skills, tools, or prompting. The harder part is checking whether those issues are exploitable once you account for a service’s business logic and existing security controls. At Datadog’s scale, that quickly became a sticking point for us. A production service can depend on frameworks, infrastructure, and other services that dozens of teams maintain. An agent reviewing one repository may not see the authentication checks or network restrictions that those teams provide, or know which security requirements the service must uphold. 

That’s why we built an orchestration pipeline that gives agents the security context they need to hunt for vulnerabilities. The pipeline also lets us repeat hunts against known vulnerabilities, so we can check whether agents still find them consistently after we change a model or harness. The workflow centers on **threat packs**, compact, human-reviewed documents that turn subject matter experts’ security knowledge into context that agents can use during a hunt. Each pack includes a system summary and explicit security requirements to help agents focus on weaknesses in that system. 

We’ve already seen these packs reduce noise and improve report quality, which helps us prioritize findings more efficiently. Hunts using these packs have also uncovered guest-to-host escapes in open source components, including [one through virtio-fs](https://github.com/kata-containers/kata-containers/security/advisories/GHSA-2gv2-cffp-j227) in Kata Containers' Rust runtime and [another caused by missing length validation](https://github.com/kata-containers/kata-containers/security/advisories/GHSA-fgm4-mv68-h344) in Dragonball's virtio-blk implementation.

In this post, we'll walk through how we build threat packs and turn findings into reproducible reports. 

## Defining the security requirements in a threat pack

Our threat packs borrow from threat modeling and policy-as-code best practices, with security requirements kept in a standalone, versioned file. Our hunt orchestration pipeline loads the threat pack’s security context and clones the repositories required by the hunt’s scope. It breaks down vulnerability, discovery, and reproduction into separate tasks and routes each task to the most cost-effective model capable of completing it. The pipeline keeps the workflow consistent across model providers and agent harnesses, which run the agents and connect them to appropriate tools.

![Diagram showing the individual components of a threat pack](https://web-assets.dd-static.net/42588/1795015403-01-building-a-threat-pack.png)
*A threat pack combines the system’s scope, security invariants, and architectural context with review priorities and compensating controls.*

Each threat pack pairs a **threat-pack.md** with a **metadata.yaml** file. The Markdown file has four sections that covers the system summary, security invariants, review priorities, and known compensating controls. The YAML metadata identifies the pack's scope, maintainer, and code locations. We version both files so we can reconstruct the security context that we provided for a particular hunt and compare it with later versions.

We keep packs concise, usually around 300 lines, to give hunting agents the security context they need while using only a small share of their context window.

### Capturing security requirements as invariants

An agent can trace a request parameter through a code function without knowing that the service must derive tenant identity from an authenticated session or that a downstream component already checks permissions. Those requirements and protections often live in architecture decisions, past security reviews, and engineers' knowledge of the system. Without those details, the agent may report a missing check that another component performs, overstate a finding's impact, or miss code that violates an organization boundary.

Consider an isolated code execution service with the following security requirement:

`Code inside the guest host must never reach the Kubernetes node, host filesystem, container runtime, or cloud metadata service.`

A reviewer can manually search for calls that touch a file system or network socket, but deciding whether those calls violate the rule requires more details. For this scenario, the reviewer needs to also know that root access inside the guest is expected and that a Kata microVM provides the trusted boundary between the guest and host. They also need to account for the Kubernetes and Cilium policies that constrain the workload and the egress proxy that provides the only approved path to an external network. Source code may reveal some of those protections without explaining all the access the service is intended to allow or prevent.

We record that security requirement as an **invariant**, which is a property the system must always preserve. The threat pack pairs it with the service's trust assumptions and known compensating controls, such as restrictions on outbound connections. With that context, the agent has a clear goal and can look for a reachable path that breaks the requirement and account for protections that could prevent an attacker from using it. 

### Building and reviewing packs with service owners

Each pack covers a service or trust boundary, which may span several repositories or cover only part of one. For example, if authentication happens in a separate service, the pack needs to explain how the service under review receives and trusts the authenticated identity. The code locations in the pack give the agent a starting point for following relevant call chains and examining the protections that affect a possible vulnerability.

We’ve created hundreds of threat packs, prioritizing systems by risk. For each pack, agents draft the initial version from code, penetration test reports, risk reviews, and design documents. Our interview skill then guides agents to ask subject matter experts security questions the code can’t answer, challenge assumptions, and clarify details that could affect the hunt. 

As a final step, each pack goes through human review before it’s used in a hunt. That review determines the system's intended behavior and the assumptions agents should use when testing it. When the code and pack disagree, reviewers determine whether the implementation violates a requirement or the pack needs an update. Service owners also provide review priorities and known compensating controls.

## Requiring findings to explain the violated security property

Hunts can produce many findings, particularly with new threat packs or a more capable model. Before passing those reports to triage, we need to check whether the issues are exploitable and whether they violate the security requirements in the pack.

![Diagram showing how candidate findings are qualified](https://web-assets.dd-static.net/42588/1795011968-02-how-candidate-findings-are-qualified.png)
*Candidate findings must connect a reachable entry point to a violated invariant before proceeding to a proof-of-concept attempt.*

A **candidate finding** is the agent's initial report, before filtering and validation. A second agent, acting as a judge, reviews each candidate against the threat pack. The report must name a declared invariant, identify an entry point an attacker can reach, and explain how that path could violate the invariant. Candidates that meet those requirements become **qualified findings**.

Candidates that can't connect a reachable entry point to a violated invariant become **disqualified findings**. They stop before reproduction and don't proceed through automated triage or remediation. We retain their reports so reviewers can identify missing context in the pack or evidence that the harness overlooked and use that information to refine the pack or improve our pipeline.

We also benchmark the qualification step to check whether it filters out legitimate findings. That helps us evaluate the quality of the filtering so we don’t treat a drop in the number of reports as our only measure of success. We keep candidate reports, reproduction results, and triage decisions together so reviewers can see what was tested and why a finding's status changed.

Before a qualified finding goes to triage, the agent attempts a proof of concept in a staging environment or by testing the relevant code locally. That attempt can reveal that the proposed attack path doesn't work or that the issue is less serious than first reported. It also gives reviewers reproduction details to use when deciding what to investigate or fix. If the agent can't complete the test in the available environment, we record that limitation and leave the finding unverified.

### Using a finding to search for a broader bug class

The same bug class can affect services covered by different threat packs, so a finding in one service can prompt us to look for the same vulnerability pattern in others. We saw this with a finding from a static application security testing (SAST) scan of an AI-assisted feature. The feature displayed model output through a Markdown renderer that allowed external images, which breaks the [Agents Rule of Two](https://ai.meta.com/blog/practical-ai-agent-security/). A prompt injection that puts sensitive information in an image URL could cause the browser to send that information to an attacker when it requested the image.

We replaced the renderer with a component that omits Markdown images and sanitizes or validates links to prevent unexpected external requests. The team then checked other features, including parts of the codebase that didn't yet have threat packs, and found the same rendering pattern in multiple places. That review showed that the problem extended beyond the original call site.

We captured the rendering requirement in a threat pack for our application's user interface as a **universal security invariant** that applies to all components. Whenever untrusted input can influence content from an AI workflow, every component that displays that content must use the hardened renderer, which omits Markdown images and checks links.

With that requirement in the pack, the agent let us extend the team's initial review across the user interface codebase, checking features with different implementations. It could also use the pack's compensating controls to rule out attack paths that those protections blocked. Within a few days of recording the invariant, the hunt had produced several similar findings that we confirmed were vulnerabilities.

## Repeating controlled hunts to evaluate changes

To prevent regressions when we change model, prompt, or part of the harness, we need to check whether the updated configuration still finds vulnerabilities that an earlier version detected for the same threat pack. Large language model (LLM) agents can return different findings even when the configuration and inputs stay the same, so we repeat hunts to measure how consistently each configuration finds known vulnerabilities.

![Diagram showing how repeated hunts are scored](https://web-assets.dd-static.net/42588/1795012024-03-how-repeated-hunts-are-scored.png)
*Known reference findings enter only at the scoring stage, where the judge compares them with the results of repeated independent hunts.*

### Keeping benchmark inputs fixed

These repeated hunts use a benchmark of known vulnerabilities to test how reliably the agents can rediscover them. Our initial benchmark in August 2026 included 43 validated vulnerabilities across systems covered by nine threat packs. The reference findings came from open source repositories, customer-facing products, and internal systems. 

Before a benchmark hunt begins, we freeze the threat pack, repository snapshots, run configuration, and reference findings. Fixing the pack version keeps the security requirements unchanged, while fixing the source version keeps the code that's under review unchanged. The selected snapshots contain the known vulnerabilities before remediation, and the hunting agent receives the code and pack without access to the reference findings. We repeat each configuration independently so we can compare a proposed change with an earlier version and see how much the results vary between runs.

After each benchmark hunt, a separate evaluator, which we call the **semantic judge**, compares the results with the hidden reference findings. This evaluator has a different job from the agent that qualifies candidates before triage. It checks whether a hunt rediscovered a known vulnerability by comparing the attacker capability, violated boundary, root cause, and exploitable path in both reports.

For example, suppose the reference finding describes how a prompt injection could make a feature put sensitive information in a Markdown image URL. A new hunt might focus on that feature's "unsafe renderer," which lets the browser request the image and send the information to an attacker. If both reports identify the same renderer and attack path, the judge counts the known vulnerability as rediscovered despite the difference in wording.

### Measuring consistency across repeated runs

Once the semantic judge has matched each run's findings to the reference set, we need to assess which known vulnerabilities the configuration found and how consistently it found them. A vulnerability that appears in one run but is missed in several others gives us less confidence that it will resurface in a later hunt. We use two measures, **union detection** and **stable detection**, to track that difference when evaluating changes to a pack, model, or harness.

Union detection tells us whether the agent found a known vulnerability at least once across all valid repetitions. Stable detection means the agent finds the same vulnerability in most independent runs. Our current criterion is detection in at least 7 of 10 runs, which is a working threshold that we expect to adjust as we collect more results. Establishing that baseline helps us recognize when a later configuration finds the vulnerability less consistently.

We compare how often the old and new configurations find the same vulnerability across repeated hunts to investigate a possible regression. For example, if the old configuration found it in 8 of 10 runs and the new one found it in 2, we'd investigate whether the change made detection less likely. We'd compare that drop with the variation between hunts that use the same configuration to help determine whether the change caused it.

## What’s next for our hunts and how to start yours

Our early findings give us reason to keep developing this approach, and [work seen elsewhere in the industry](https://www.figma.com/blog/how-figma-stays-ahead-of-vulnerabilities-with-agents/) shows that teams are combining written security context with evaluations against known vulnerabilities. We expect that combination to remain useful as models and agent frameworks change. 

The requirements we record in a threat pack can guide a new model, and repeated hunts give us a way to test whether the change helps it find vulnerabilities more consistently. Our next phase will focus on moving from findings to fixes. We need to test proposed fixes against the same security requirements and determine how to deploy them reliably across services, including environments with strict security and compliance requirements. That includes the constraints of our [FedRAMP® High environment](https://www.datadoghq.com/blog/datadog-achieves-fedramp-high-certification.md).

If you're starting with agentic vulnerability hunting, you can choose a service boundary that your team understands well and document its security requirements with the service owners. You can then repeat hunts against known vulnerabilities, keeping the reference findings out of the agent's inputs, to examine what it finds, what it misses, and how consistently it detects each issue.

You can explore more of our work on the [Datadog engineering blog](https://www.datadoghq.com/blog/engineering.md), read about our [AI research](https://www.datadoghq.com/blog/ai.md), or find our latest [security research](https://securitylabs.datadoghq.com/).

If you’d like to explore how Datadog can help your security organization mitigate vulnerabilities in your environment, you can <!-- Sign-up trigger (sign up for a free 14-day trial today) omitted -->.