NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Backtracking Agent Applications Security Incidents

Yicheng Cai, Taegyu Kim, Peng LiuarXiv 2026

As Large Language Model (LLM) agents move from experimental toys to enterprise-grade tools, they bring a new class of security headaches. When an agent is compromised via Indirect Prompt Injection (IPI) or Memory Poisoning, security analysts face a daunting task: finding the "Compromise Entry Point" (CEP)—the exact line of code where the malicious data first snuck in.

The paper "Backtracking Agent Applications Security Incidents" introduces Origin, a tool designed to bridge the massive semantic gap between what an agent says it’s doing and what the underlying code is actually executing.

TL;DR

Origin is a backtracking tool that helps security analysts identify the root cause of LLM agent security incidents by bridging the gap between high-level trajectory logs and low-level source code. By organizing code into functional "regions" and using a Cross-Layer Dependency Graph (CLDG), it allows analysts to pinpoint compromise entry points with 100% accuracy across evaluated real-world incidents, reducing manual code inspection by up to 94%.

What Problem Does This Paper Address?

When a security incident occurs, analysts typically have two things: trajectory logs (which record high-level agent actions like "planning" or "retrieving memory") and the source code.

The problem is a "semantic gap." A trajectory log might say the agent retrieved a poisoned document, but the source code might contain thousands of function calls related to data retrieval. Standard static taint analysis tools can track data flow, but they lack the "functional" context to tell an analyst which specific variables belong to the "memory retrieval" phase versus the "prompt assembly" phase. This leaves analysts manually auditing hundreds of potential entry points—a process that can take hours or days.

Methods

The authors propose a new intermediate abstraction called the Cross-Layer Dependency Graph (CLDG). This graph consists of two planes:

  1. The Function Plane: Represents high-level agent functionalities.
  2. The Variable Plane: A low-level data-flow (taint) graph.
Figure 1. Origin overview.

Key Innovations:

  • Region Inference: Origin automatically categorizes code into five functional "regions":
  • Perceiving (Per): Handling external inputs (e.g., user queries).
  • Planning & Acting (PA): LLM-generated responses and tool invocations.
  • Recalling & Reflecting (RR): Internal data retrieval (e.g., knowledge bases).
  • Prompt Kitchen (PK): Where prompts are assembled for the LLM.
  • Unknown (UNK): Utility functions.
  • Rule-Based Mapping: To populate these regions, Origin uses a set of condition-action rules (see below) that propagate labels from a small set of developer-identified "information source" functions across the entire graph.
Table 1. Condition-action rules for region inference.
  • High-Level Query Language: Analysts can use a specialized language to ask questions like: CHECK (PK DEPENDS_ON RR) AND (PA DEPENDS_ON PK). This translates to: "Did data from the knowledge base flow into a prompt, and did that prompt then influence an outgoing action?"

Datasets

The researchers evaluated Origin on five popular, actively maintained open-source agent applications representing different domains:

Table 2. Selected agent applications.

They tested the tool against eight real-world attack incidents, including complex multi-phase memory poisoning and compound attacks (IPI + Knowledge Base poisoning).

Key Insights and Ideas

  • Information Sources Define Functionality: The core "aha" moment is that agent functionalities are defined by the type of data they touch. By identifying where code interacts with external vs. internal sources, you can automatically infer its high-level purpose.
  • Semantic Pruning: By querying at the "region" level first, analysts can ignore 64% to 94% of the variables in a standard taint graph, focusing only on the code paths that are functionally relevant to the attack.
  • LLM-Assisted Labeling: While the system requires some developer knowledge (labeling which functions hit external/internal sources), the authors found that using an LLM to pre-generate these labels increased speed by up to 75% and improved accuracy.

Key Results

  • Perfect Accuracy: Origin correctly identified the CEP for all 8 test incidents, narrowing the search down to a single candidate in every case.
  • Efficiency: In the Quivr memory poisoning case, the analyst only had to examine 8 function names and 2 taint subgraphs, compared to manually auditing over 2,600 lines of code.
  • Performance: Constructing the CLDG is an offline cost (taking seconds to minutes), but the actual security queries are lightning-fast, averaging under 90ms.

Limitations and Future Work

  • Autonomous Agentic Loops: Origin currently focuses on "predefined workflow" agents (C1). It struggles with "OpenClaw-like" agents (C2) where the LLM decides the control flow dynamically at runtime, as static analysis cannot easily predict these transitions.
  • Framework Complexity: Highly dynamic frameworks like LangChain can obscure data flows, leading to missing edges in the graph. The authors suggest that future work could involve framework-specific modeling.
  • Static Analysis Bounds: Like all tools built on static analysis, Origin is limited by Python’s dynamic nature (e.g., resolving indirect calls). While they implemented several enhancements to Joern, some edge cases remain.

Summary updated

BibTeX
@misc{cai2026backtracking,
  author = {Yicheng Cai and Taegyu Kim and Peng Liu},
  title = {{Backtracking Agent Applications Security Incidents}},
  year = {2026},
  eprint = {2611.26525},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.26525},
}
Figure