Retrospecting Security Incidents in Agent ApplicationsBacktracking Agent Applications Security Incidents
The authors propose Origin, a tool for retrospective analysis of agent application security incidents; the authors claim that on 5 applications and 8 incidents it correctly located the CEP using only 2–4 queries each time.
- After an agent application is attacked by IPI or MC-Poison, analysts need to retrospectively locate the CEP (the function call that first introduces malicious content), but the trajectory log is at the agent functional layer and the CEP is at the code execution layer; the semantic gap makes manual code inspection take hours.
- Proposes Origin: using CLDG (cross-layer dependency graph) as an intermediate abstraction, it infers regions divided by information source type (Per/PA/RR/PK/UNK) onto the function and variable planes, together with a query language; region inference uses 3 label propagation rules plus 9 condition-action rules, requiring only a small number of EXT/INT labels from the developer.
- On 5 open-source agent applications and 8 incidents, the authors report that Origin correctly identifies all CEPs with 1 candidate each time (2–4 queries per incident); region-level queries reduce the inspection scope to 6.49%–35.76% of the variable plane; Joern and CodeQL all fail on the 8 incidents, and Pysa succeeds on only 1.
- The authors note: indirect calls introduced by frameworks (such as LangChain tool dispatch) cannot be resolved; C2-type LLM-driven agentic loop agents and agent library frameworks are out of scope. The experiments cover only 5 open-source Python applications and 8 incidents, and the human experiment had only 4 participants.
- Threat model
- An attacker can launch two types of agent-specific attacks, IPI and MC-Poison (including composite attacks); malicious data enters the application through the return value of a legitimate API call and causes harm along the data flow; the analyst has the trajectory log and the application source code and needs to locate the CEP (the function call that first introduces malicious content). The scope is limited to C1 (predefined workflow) applications.
- Evaluated models
- GPT-ResearcherQuivraiderMetaGPTSWE-agent
- Benchmarks
- 8 起攻击事件(IPI、MC-Poison (M)、MC-Poison (KB)、IPI + MC-Poison (KB)),分布于 GPT-Researcher、Quivr、aider、MetaGPT、SWE-agent
- Metrics
- CEP 识别成功率region inference 的 precision/recall|Vq|/|Vvar|(检查范围缩减比)执行时间与峰值内存标注速度与准确率变化(ΔSpeed、ΔAcc.)
Origin is a tool for backtracking security incidents in agent applications, letting analysts use a small number of queries to locate the intrusion entry point (CEP) that existing tools cannot identify. After an agent application suffers a security incident, organizations need to backtrack to locate the intrusion entry point in order to remediate damage and prevent recurrence; the available material is mainly trace logs and source code that record agent functionality, and application-specific function call logs are often limited. Trace logs sit at the agent functionality abstraction layer, whereas intrusion entry point candidates are function calls at the application code execution layer, so analysts must manually inspect the code for each candidate to infer the corresponding functionality. Origin connects functions inferred at the functionality layer with variables in the underlying taint propagation subgraph through a cross-layer dependency graph (CLDG), together with a query language and a region inference algorithm. In a case study of five popular agent applications and eight attack incidents, analysts using Origin correctly identified all intrusion entry points.
Related events and news
1 events · 1 news mentions
News that mentions this paper
大模型安全周报:单步合规检查挡不住智能体跨步骤组合危害
- 公众号 大模型安全研究cites the paper's id or link大模型安全周报:每一步都合规,拼起来就是一次入侵
Backtracking Agent Applications Security Incidents(https://arxiv.org/abs/2611.26525)
Paper analysis
What problem does this paper attempt to solve?
Address the semantic gap between agent functional-layer logs and code execution-layer CEPs in retrospective analysis of agent application security incidents.
Core problem: after a security incident occurs in an agent application, analysts find it difficult to locate the CEP (compromise entry point, the function call that first introduces malicious content) at the code execution layer from the trajectory log at the agent functional layer.
- Scenario and importance: IPI and MC-Poison are the two most prevalent of the OWASP Top 10 threats for agent applications, and multiple CVEs and red-team reports have appeared; after an incident, organizations need to retrospectively locate the CEP, remediate the damage, and prevent recurrence.
- Inadequacy of existing methods: the authors state that trajectory-log fault diagnosis, detection-based fault attribution, and preventive information flow control cannot give the CEP, only the faulty execution state, the faulty agent, or the LLM tool call; in the GPT-Researcher case, 1,518 candidates remain after log pruning, and manual inspection takes hours.
- Core observation: agent functions can be grouped into a small number of regions by the type of information source they interact with (e.g., Per, PA, RR, PK); a region is the set of program variables that implement functions in the same group, and analysts can directly exclude irrelevant candidates at the region level.
- Proposed in the paper: the retrospective tool Origin — using a CLDG (cross-layer dependency graph) plus a query language as the intermediate abstraction, together with rule-guided region inference, to propagate a small number of developer labels into region membership of functions.
- Threat model:
- Attacker capability: launch two types of attacks, IPI and MC-Poison (including composite attacks); malicious data enters the application through the return value of a legitimate API call and propagates along the data flow.
- Victim system: C1-type (predefined workflow, where source code determines control flow) agent applications; C2-type (where the LLM runtime decides functional calls) and agent library frameworks are out of scope.
- What the analyst has: the trajectory log and the application source code; application-level function call logs are usually missing.
- Success criterion: locate the CEP (API call name, file name, line number) and the taint propagation path from the CEP to the attack effect.
What related research exists?
Related work falls into four groups: software root cause analysis, APT causal analysis, agent attacks and defenses, and agent fault diagnosis; the authors state that none of them can locate the CEP.
Software system root cause analysis
- Root cause localization work based on backtracking, reconstruction, or statistical analysis (e.g., REPT, ARCUS, AURORA, etc.) — diagnosing the location of defective code that triggers memory safety violations and data races.
- The paper points out the difference: in agent security incidents, the application code itself has no bug; the problem is the lack of validation of the boundaries of external untrusted information sources, and attack data enters through legitimate APIs and propagates without obstruction.
APT attack causal analysis
- Work that constructs attack provenance graphs from OS-level audit logs (e.g., BackTracker, HOLMES, AIQL), as well as follow-up work that refines log granularity and fuses application-layer logs.
- The paper points out the difference: in agent applications, analysts only have trajectory logs and static analysis; the former lacks function call records, and the latter lacks agent functional semantics, and a semantic gap exists between the two.
Agent application attacks and defenses
- Attacks: IPI (e.g., Greshake et al. 2023, AgentDojo, InjecAgent) and MC-Poison (e.g., AgentPoison, BadAgent, PoisonedRAG), as well as composite attacks combining stages.
- Defenses: data-instruction separation and prompt hardening (StruQ, SecAlign, Spotlighting), filtering at the memory read/write stage, application-layer taint tracking and runtime policy enforcement (e.g., CaMeL-style information flow control, Progent, IsolateGPT).
- The paper points out that these defenses are preventive and can still be bypassed; detection work for IPI/MC-Poison and retrospective diagnosis are two different problems.
Agent fault diagnosis and attribution
- Trajectory-log fault diagnosis and multi-agent fault attribution work (e.g., Which Agent Causes Task Failures and When?, AgentSentry, etc.).
- The paper points out that they give the faulty execution state, the faulty agent, or the LLM tool call, rather than the source-code-level CEP function call.
Comparison baselines and positioning: the experimental baselines are the static taint analyzers Joern, CodeQL, and Pysa (Table 4), compared on the same 8 incidents; the authors position this paper as an intermediate abstraction connecting the agent functional layer and the program variable layer, and its implementation tool.
How does the paper address this problem?
Origin uses the CLDG two-layer graph plus a query language as its intermediate abstraction, and uses rule-guided region inference to establish the mapping from regions to variables.
Overall approach: introduce an intermediate abstraction so that analysts can replace manual code inspection one by one with a small number of region-level and variable-level queries. Origin takes application source code and a small number of developer labels as input and outputs a queryable CLDG.
Problem setting and intermediate abstraction
- CEP definition: malicious data enters the application through the return value of some API call and causes harm along the data flow; the CEP is identified by the API call name, the program file name, and the line number of the call site, together with the taint propagation path from the CEP to the attack effect (variable-level and function-level).
- Four elements of the intermediate abstraction: the set of regions, the mapping from regions to variables, the region-level query interface, and the translation from region-level to variable-level queries.
- The configured region set (Appendix A): Per (Perceiving), PA (Planning & Acting), RR (Recalling & Reflecting), PK (Prompt Kitchen), UNK (Unknown); the design applies to any analyst-defined region set.
CLDG (cross-layer dependency graph)
- Definition 5.1: G = (R, Vfn, λ, Ecross, Vvar, Evar), i.e., the function plane (function nodes after region inference), the variable plane (taint nodes and edges), and the cross-plane edges connecting the two; the meaning is to overlay region semantics on the taint graph.
- The variable plane is built by context-, flow-, and field-sensitive forward taint propagation, starting from the return value of each API call; the same variable in different statements is treated as different nodes.
- The function plane and cross-plane edges are derived from the variable plane: a function that contains variables in the variable plane enters the plane and is connected to the variables it defines/uses.
Developer knowledge collection
- Developers provide a one-time function-to-information-source mapping table (EXT/INT labels), reused across incidents; only functions that directly call built-in or library APIs need to be inspected (e.g., 353 of the 607 functions in GPT-Researcher).
- LLM assistance is used: the prompt contains the function's API calls, relevant source code, and decision rules, and produces a structured report for developer review (Appendix F.1 gives the full prompt), turning the labeling work from "labeling" to "reviewing".
Region inference
- 3 label propagation rules: API calls that read an information source propagate the label forward; writes to an information source propagate backward; the special label of prompt assembly functions propagates only within the function (the authors state this is because prompt assembly is a local function).
- 9 condition-action rules (Table 1): the region is determined by combining four questions — whether it interacts with an information source, read/write, the main information source type, and whether it mainly assembles prompts; for example, a function that receives user requests and has no prompt assembly label is assigned to Per.
- The authors state that the rules are intended to be practical rather than exhaustive; Rule 9 was added after the case study to cover the situation of "starting to assemble the prompt right after reading an information source".
Query language and query processing
- A query starts with CHECK and consists of DEPENDS_ON atomic formulas connected by AND/OR; terms can be region names or variable identifiers; the → chaining operator continues evaluation on the subgraph of the previous query result.
- Region-level query: use λ and cross-plane edges to obtain the variables of the source/sink regions, perform forward and backward reachability and intersect them, and return the function-level dependency graph.
- Variable-level query: use the call graph and control flow graph to enumerate only control-flow-feasible taint paths, avoiding infeasible paths.
Implementation
- About 16 KLoC of Python, based on Joern (v4.0.360), using Pyrefly (v0.45.0) to enhance type inference; patches three Joern limitations that cause missed reports: not resolving generator expressions, not tracking instance variable taint across functions, and incomplete call graphs under dynamic dispatch (indirect call resolution follows Xia et al. and Liu et al. with two enhancements).
What experiments did the paper conduct?
Evaluated on 5 open-source applications and 8 incidents: CEP identification, region inference precision, inspection scope reduction, performance, label volume, and LLM report utility.
Experimental setup
- Tested applications (Table 2): GPT-Researcher v3.3.3 (9,317 LoC), Quivr v0.0.33 (2,615 LoC), aider v0.86.0 (25,945 LoC), MetaGPT v0.8.2 (43,284 LoC), SWE-agent v1.1.0 (8,995 LoC), all open-source Python agent applications.
- Incidents: 8, covering IPI, MC-Poison (M), MC-Poison (KB), and the IPI + MC-Poison (KB) composite attack; Table 3 notes that MC-Poison does not apply to aider/MetaGPT/SWE-agent, and IPI alone does not apply to Quivr.
- Baselines: the static taint analyzers Joern 4.0.360, CodeQL CLI 2.27.0, and Pysa 0.9.25; given ground-truth sources and sinks, test whether they can verify the CEP.
- Metrics and criteria: RQ1 success = identifying the ground truth CEP and a taint path matching the actual attack execution; RQ2 is the precision/recall of region inference; RQ3 is |Vq|/|Vvar|; RQ4 is time and memory; RQ5 is the label proportion; RQ6 is the change in annotation speed and accuracy.
- Human experiment: 4 participants, two groups of 200 functions each, each person takes two 10-minute tests (manual annotation M and reviewing LLM reports L), with order counterbalanced.
- Environment: Intel Core Ultra 9 285, 128 GB RAM, Ubuntu 24.04; all RQs use a manually verified mapping table.
Main results
According to Table 3 and Table 4:
Swipe horizontally to read the table
Application Attack category Number of queries Origin result Joern/CodeQL Pysa GPT-Researcher IPI 2 1 candidate, success Fail/Fail Fail GPT-Researcher MC-Poison (KB) 2 1 candidate, success Fail/Fail Fail Quivr MC-Poison (M) 2+2 (two stages) 1 candidate, success Fail/Fail Fail Quivr MC-Poison (KB) 2+2 1 candidate, success Fail/Fail Fail Quivr IPI + MC-Poison (KB) 2+2 1 candidate, success Fail/Fail Fail aider IPI 2 1 candidate, success Fail/Fail Fail MetaGPT IPI 2 1 candidate, success Fail/Fail Success SWE-agent IPI 2 1 candidate, success Fail/Fail Fail - The authors state that analysts using Origin correctly identified the CEP on all 8 incidents, with only 1 candidate per incident; 5 used 2 queries, and 3 two-stage incidents used 4.
- For the baselines, the authors report that Joern and CodeQL all fail on the 8 incidents, and Pysa succeeds only on MetaGPT IPI; failure reasons include unresolved indirect call targets, missing data dependencies for language constructs and API calls, and untracked stored data written before being read (Appendix E).
- Of the 4 function calls reported by Pysa on MetaGPT IPI, only 1 is on the correct path; the authors state that analysts still need additional analysis to locate the CEP.
Region inference precision (RQ2)
- According to Table 6: the precision of the 5 applications is 0.6960–0.8750, and recall is 0.7068–0.8798; aider is the lowest (precision 0.6960, recall 0.7068), and SWE-agent is the highest (both 0.8750).
- The authors' explanation: aider is used in an interactive command manner, taint paths are short and disconnected from one another, and labels cannot propagate across commands.
Inspection scope reduction (RQ3)
- According to Table 5: 11 region-level queries reduce the variable plane to 6.49%–35.76%; the lowest is 6.49% for two Quivr queries, and the highest is 35.76% for GPT-Researcher IPI.
- The authors state that PK is the key factor in the reduction (appearing in 9 of the 11 queries), because PK functions are few (Quivr 1, aider 2, SWE-agent 3); the same IPI query has different reduction ratios across applications, which the authors attribute to differences in the PA region size of each application.
Other ablations and analyses
- Performance (RQ4, Table 7): CLDG construction accounts for more than 95% of the total time (6.38–109.09 s) and is a one-time offline cost; queries per incident average under 90 ms; peak memory is under 7 GB.
- Developer labeling effort (RQ5, Table 8): only 2.4%–8.9% of application functions require EXT/INT labels (SWE-agent 17/713, Quivr 22/246).
- Utility of LLM reports (RQ6, Table 9): the 4 participants reviewing reports improved annotation speed by 15.4–75.0% over manual annotation, and accuracy by 8.3–50.4 percentage points, reaching 88.9–100%.
- Quality of LLM automatic labeling (Appendix F.2, Table 12): of 2,719 candidate functions, 81.46% were decided and 18.54% undecided; EXT labels have FNR 0.00 and FPR 4.19, INT labels have FNR 0.00 and FPR 0.78 (counting only decided functions).
- Case observations (Section 9.3): the agentic loop does not hinder CEP localization (when the CEP and the attack effect are outside the loop); when generic file read/write functions serve as sources/sinks, intermediate variables can be used as waypoints to constrain paths; the MetaGPT incident shows that IPI across agent boundaries can occur through normal coordination mechanisms (shared files).
What are some points that can be further explored?
The authors list two limitations: framework-introduced indirect calls and C2 agents; the experiments cover 5 Python applications, 8 incidents, and a 4-participant human experiment.
Limitations and future directions noted by the authors
- Framework-introduced indirect calls (Section 11 Discussion): static analysis cannot resolve indirect call targets introduced by frameworks (e.g., LangChain tool dispatch), causing the corresponding taint paths to be missing; the authors state that solving this requires framework-specific modeling or dynamic analysis, and list it as future work.
- Agents driven by an LLM agentic loop (Section 11): for agents such as OpenClaw and Hermes where the LLM runtime decides functional calls, static analysis cannot determine CEP function calls (except in the situation described in Section 9.3 Finding (b)); the authors state this is left for future research.
- Scope limitation (Section 4.1): the method directly targets C1 (predefined workflow) applications; C2 and agent library frameworks (e.g., LangChain, SmolAgents, AutoGen) are out of scope, and the authors state this is left for future research.
- Rules are not exhaustive (Section 6.3): the authors state that the condition-action rules are intended to be practical rather than exhaustive, and Rule 9 was added after the case study.
- Code release (Section 1): the authors plan to release the Origin source code on GitHub.
Experimental coverage
- The tested applications are 5 open-source Python agent applications (GPT-Researcher, Quivr, aider, MetaGPT, SWE-agent), covering four domains: deep research, conversational assistant, coding copilot, and software development (Table 2).
- The incidents cover IPI, MC-Poison (M), MC-Poison (KB), and composite attacks, 8 in total; Table 3 notes that MC-Poison does not apply to aider/MetaGPT/SWE-agent, and IPI alone does not apply to Quivr.
- The baseline comparison is with three static taint analyzers, Joern, CodeQL, and Pysa, and tests whether they can verify the CEP given ground-truth sources and sinks (Section 10.3).
- The human experiment has 4 participants, two groups of 200 functions each, and 10 minutes per session (Section 10.8); the paper does not report inter-participant agreement metrics.
- All RQ evaluations use a manually verified function-to-information-source mapping table (Section 10.2).
Summarize the main content of the paper
Origin uses the CLDG intermediate abstraction to connect the agent functionality layer with the code layer; the authors state that all 8 incidents located the CEP with 1 candidate.
A systems security paper on a tool for tracing security incidents in agent applications.
- Problem: After IPI and MC-Poison incidents occur, analysts need to locate the CEP (the function call that first introduces malicious content), but the trajectory log is at the agent functionality layer while the CEP is at the code execution layer; in the GPT-Researcher case, even after log pruning there were still 1,518 candidates, and manual inspection takes hours.
- Method: Origin uses CLDG (function plane + variable plane + cross-plane edges) and a query language as its intermediate abstraction; region inference uses 3 label propagation rules and 9 condition-action rules to propagate a small number of EXT/INT labels provided once by the developer (only 2.4%–8.9% of functions) into function region assignments; the implementation is based on Joern and patches three of its missed-detection limitations.
- Main results: On 5 open-source applications and 8 incidents, the authors report that analysts using Origin correctly identified all CEPs with 1 candidate each time, using 2 queries for single-stage incidents and 4 for two-stage incidents (Table 3).
- Comparison: On the same incidents, Joern and CodeQL all failed, and Pysa succeeded only on MetaGPT IPI (Table 4); region-level queries reduced the inspection scope to 6.49%–35.76% of the variable plane (Table 5).
- Other data: region inference precision/recall is 0.70–0.88 (Table 6); queries take under 90 ms on average with peak memory under 7 GB (Table 7); in the 4-participant experiment, the LLM report increased annotation speed by 15.4–75.0% and accuracy by 8.3–50.4 percentage points (Table 9).
- Authors' conclusions and boundaries: The authors believe the intermediate abstraction lets analysts trace incidents across different applications through a unified interface; they also acknowledge that indirect calls introduced by frameworks cannot be resolved, and that C2-type LLM-driven agents and agent library frameworks are out of scope, left for future research.