Backtracking Agent Applications Security Incidents
Organizations: Pennsylvania State University, University Park, PA, USA
Abstract
Agent applications are increasingly deployed, yet agent-specific attacks pose real threats to them. Upon a security incident, organizations backtrack to identify the CEP (compromise entry point), remediate the damage, and prevent its recurrence. The main artifacts available for backtracking are trajectory logs, which record agent functionalities, and source code; app(lication)-specific function call logs are often fairly limited. However, trajectory logs are at the agent functionality abstraction layer, while the CEP candidates are function calls at the app code execution layer. Due to this semantic gap, the analyst needs to manually inspect the relevant code for each CEP candidate to infer its corresponding agent functionality. In this work, we present Origin, a backtracking tool for the analyst to submit a small number of queries to identify CEPs that existing tools cannot provide. Our approach poses two challenges: (1) define the intermediate abstraction that captures the mapping relationships between the two semantic layers; (2) determine the region-to-variable mapping for constructing the cross-layer graph defined in the intermediate abstraction. Each region is a specific group of agent functionalities. Origin addresses the challenges by (1) the cross-layer dependency graph (CLDG) that connects region-inferred functions at the semantic level to the variables in the low-level taint propagation subgraph, plus the associated query language, and (2) the region inference algorithm. Case studies on five popular agent applications across eight attack incidents show that an analyst using Origin correctly identifies all the CEPs.
Figures & tables
| Rule | IS? | R/W | Main IS | Asm.? | Region |
|---|---|---|---|---|---|
| 1 | No | – | – | No | UNK |
| 2 | Yes | R | Ext | No | Per |
| 3 | Yes | W | Ext | No | PA |
| 4 | Yes | R+W | Ext | No | PA |
| 5 | Yes | R | Int | No | RR |
| 6 | Yes | W | Int | No | RR |
| Application | Domain | Stars | LoC | Version | Type |
|---|---|---|---|---|---|
| GPT-Researcher ( GPT, 2025 ) | DR | 24,027 | 9,317 | v3.3.3 | MAA |
| Quivr ( Qui, 2025 ) | CA | 38,575 | 2,615 | v0.0.33 | SAA |
| aider ( Aid, 2026 ) | CC | 38,237 | 25,945 | v0.86.0 | SAA |
| MetaGPT ( Met, 2026 ) | SD | 59,192 | 43,284 | v0.8.2 | MAA |
| SWE-agent ( SWE, 2026 ) | SD | 17,716 | 8,995 | v1.1.0 | MAA |
| Attack Description | Diagnosis Detail | Diagnosis Result | |||||||
| Application | Attack Class | UI | Phase | #Queries | #Paths | #Func | #Cand. | Succ. | CEP Description |
| GPT-Researcher | IPI | No | A | 2 | 3 | 13 | 1 | ✓ | Obtaining web search result |
| MC-Poison (KB) | No | A | 2 | 4 | 19 | 1 | ✓ | Loading knowledge document | |
| Quivr | MC-Poison (M) | Yes | A | 2 | 1 | 6 | 1 | ✓ | Receiving chat message |
| B | 2 | 2 | 8 | ||||||
| MC-Poison (KB) | Yes | A | 2 | 2 | 9 | 1 | ✓ | Receiving file upload | |
| Application | Attack | Joern | CodeQL | Pysa |
|---|---|---|---|---|
| GPT-Researcher | IPI | Fail | Fail | Fail |
| MC-Poison (KB) | Fail | Fail | Fail | |
| Quivr | MC-Poison (M) | Fail | Fail | Fail |
| MC-Poison (KB) | Fail | Fail | Fail | |
| IPI + MC-Poison (KB) | Fail | Fail | Fail | |
| aider | IPI | Fail | Fail | Fail |
| Application | Attack Class [(Subclass)] | Region-level Query | |||
| GPT-Researcher | IPI | CHECK (PK DEPENDS_ON PA) AND (PA DEPENDS_ON PK) | 2,605 | 7,284 | 35.76% |
| MC-Poison (KB) | CHECK (PK DEPENDS_ON RR) AND (PA DEPENDS_ON PK) | 2,213 | 7,284 | 30.38% | |
| Quivr | MC-Poison (M) | CHECK (PK DEPENDS_ON Per) AND (RR DEPENDS_ON PK) | 157 | 2,018 | 7.78% |
| CHECK (PK DEPENDS_ON RR) AND (Per DEPENDS_ON PK) | 131 | 2,018 | 6.49% | ||
| MC-Poison (KB) | CHECK RR DEPENDS_ON RR | 321 | 2,018 | 15.91% | |
| CHECK (PK DEPENDS_ON RR) AND (PA DEPENDS_ON PK) | 224 | 2,018 | 11.10% |
| Application | TP | FP | FN | Precision | Recall |
|---|---|---|---|---|---|
| GPT-Researcher | 196 | 48 | 42 | 0.8033 | 0.8235 |
| Quivr | 50 | 12 | 9 | 0.8065 | 0.8475 |
| aider | 229 | 100 | 95 | 0.6960 | 0.7068 |
| MetaGPT | 571 | 101 | 78 | 0.8497 | 0.8798 |
| SWE-agent | 140 | 20 | 20 | 0.8750 | 0.8750 |
| Application | CLDG (s) | Infer. (s) | (ms) | Mem. (GB) |
|---|---|---|---|---|
| GPT-Researcher | 19.20 | 0.29 | 36.00 | 2.51 |
| Quivr | 6.38 | 0.03 | 5.63 | 2.56 |
| aider | 109.09 | 1.97 | 89.38 | 5.57 |
| MetaGPT | 72.15 | 0.77 | 67.50 | 7.00 |
| SWE-agent | 18.74 | 0.14 | 9.38 | 4.27 |
| Application | App. funcs | EXT | INT | Total | % |
|---|---|---|---|---|---|
| GPT-Researcher | 607 | 35 | 6 | 41 | 6.8 |
| Quivr | 246 | 7 | 15 | 22 | 8.9 |
| aider | 837 | 51 | 3 | 54 | 6.5 |
| MetaGPT | 2,872 | 84 | 35 | 119 | 4.1 |
| SWE-agent | 713 | 17 | 0 | 17 | 2.4 |
| ID | First | Agent | Python | Speed | Acc. L | Acc.(pp) |
|---|---|---|---|---|---|---|
| P1 | Low | Med. | ||||
| P2 | Med. | Low | ||||
| P3 | High | High | ||||
| P4 | Low | High |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Application | Per | PA | RR | PK | UNK | A | M:S | |
|---|---|---|---|---|---|---|---|---|
| GPT-Researcher | 244 | 3 | 133 | 17 | 18 | 69 | 4 | 2.34% |
| Quivr | 62 | 4 | 14 | 31 | 1 | 9 | 3 | 6.00% |
| aider | 329 | 2 | 156 | 0 | 2 | 168 | 1 | 0.63% |
| MetaGPT | 672 | 6 | 359 | 40 | 20 | 225 | 22 | 5.18% |
| SWE-agent | 160 | 1 | 64 | 0 | 3 | 92 | 0 | 0.00% |
| Incident / phase | Joern | CodeQL | Pysa |
|---|---|---|---|
| GPT-Researcher IPI | C Scraper, research and report targets. L Conditional logging interrupts content flow. Argument binding at repaired calls. A Page-preservation effects of wait/scroll helpers. S Research context passed into report generation. | C Browser/scraper, coroutine extraction, browser-manager, URL-context and selected prompt targets. L Container contents lost across three selected awaits; document-field reads. A Page/HTML/text extraction, gathered results, retrieval/compression/thread invocation, streaming request and chunk content. S Stored context passed into report generation. | C Source-bearing returns at scrape_async and browse_urls ; both targets are needed for the reconstructed PDF report. |
| GPT-Researcher MC-Poison (KB) | C Document-loader, context, research, and report targets. L Conditional logging interrupts context/report flow. Argument binding at repaired calls. S Research context passed to report generation. | C Context-manager target; explicit join binding restores its required function waypoint. L Awaited document-collection contents; document-field reads. The retained research-comprehension rewrite changes capture and target inference together, so its cause is not isolated. A Both gathers, retrieval/compression/thread invocation, streaming request, and chunk content. S Stored report context. | C Unresolved manager.start_streaming prevents the document source from reaching the PDF-generation report. Supplying the manager type restores the qualifying call under reconstructed declarations. |
| Quivr MC-Poison (M) Exploitation | L Named answer argument does not bind to the history-update function’s formal parameter. Initialized ChatHistory content does not reach the constructed object returned to the caller. | L History-object source does not taint selected message fields; tainted assistant field does not satisfy the whole-record sink. An explicit constructor-content rule satisfies that endpoint. A Missing chain request-to-response and database insertion-to-readback summaries. | C The handler’s inferred receiver includes a class without generate_answer , hiding the source-bearing return. |
| Quivr MC-Poison (M) Poisoning | L Named model/history-update arguments, omitted **kwargs input, and nested response indexing. Initialized OpenAiAnswer content does not reach its constructed result. | A Missing completion request-to-response summary. Native question-storage paths remain positive but omit the generated assistant response. | C Unresolved generate_answer hides the question-to-assistant sink summary. |
| Quivr MC-Poison (KB) Exploitation | C Unresolved vector-store retrieval. L Named model/history-update arguments, omitted **kwargs , nested response indexing. OpenAiAnswer and ChatHistory constructed content. | C Unresolved vector-store retrieval. L Constructed content requires a whole-record rule for the configured object endpoint. A Completion request-to-response and database insertion-to-readback summaries. | C The handler cannot import the retrieved-document return through unresolved generate_answer . |
| Quivr MC-Poison (KB) Poisoning | C Existing-file linking and brain-record insertion targets. L Named File constructor input. Argument binding at repaired calls. Caller-visible constructed File content. | C HTML-parser dispatch on the specified new-file route. L Document fields and constructed document content. A Pydantic file initialization, upload reads, loading/splitting, and document-to-vector-ID association. S Temporary-file write to later load. | — |
| EXT | INT | ||||||
|---|---|---|---|---|---|---|---|
| Application | Functions | Decided (%) | Unresolved (%) | N | FNR/FPR | N | FNR/FPR |
| GPT- Researcher | 353 | 303 (85.84) | 50 (14.16) | 36 | 0.00/3.97 | 0 | –/0.00 |
| Quivr | 127 | 89 (70.08) | 38 (29.92) | 5 | 0.00/4.55 | 13 | 0.00/5.00 |
| aider | 640 | 536 (83.75) | 104 (16.25) | 83 | 0.00/9.04 | 8 | 0.00/0.94 |
| MetaGPT | 1,164 | 925 (79.47) | 239 (20.53) | 55 | 0.00/1.92 | 12 | 0.00/0.44 |
| SWE-agent | 435 | 362 (83.22) | 73 (16.78) | 21 | 0.00/3.12 | 4 | –/1.10 |
AI Agent Security
Artificial intelligence agent security studies attacks and safeguards for tool-using, persistent, and collaborative systems across digital and physical settings.
See all 563 papers