Skip to content

AgentSecGraph: A Security-Aware Dependency Analysis Framework for LLM Agents and the AgentSecBench CorpusBeyond Predefined Sinks: Security-Aware Dependency Analysis for LLM Agents

Paper Tracker· arXiv:2610.03014· Hang Cui·Indexed by this site · 2026-10-05· Originally publishedDefenses

Quick read

Analysis and theory

Based on the paper PDF (AI-generated); refer to the original

AgentSecGraph achieves 91.1% context completeness on 9 held-out cases, while sink-only is 20.0%.

Questions
In agents, model output can trigger command, file, network, or browser operations, not just remain in text. The identity of a predefined sensitive operation cannot tell whether a dependency is still present, has been cut off, or whether a guard exists.
Methods
AgentSecGraph treats sensitive operations as anchors rather than vulnerability verdicts, builds a Security-ADG for each candidate, and records sources, dependencies, trust boundaries, guards, and external effects. Python uses local AST backward tracking; TypeScript/JavaScript uses more conservative lexical tracking.
Experiments and results
Among the 23,866 full-corpus candidates, dependency evidence is 41.15% and potential guards 12.88%. Among the 22 reproduced behaviors, 1 vulnerability is confirmed. On 9 held-out cases, Security-ADG context completeness is 91.1% (guards 5/5), while sink-only is 20.0% (0/5).
Limitations and future work
The authors state that the analysis is local static evidence, does not establish reachability, exploitability, or guard sufficiency, and that 67 repositories cannot statistically represent the entire ecosystem. Timing comes from a single run; 22 reproduced behaviors and 9 representation cases do not support general vulnerability detection claims. Independent adjudication of the 344-item checklist remains future work.
Experimental setupAgentSecBench · Context Completeness、Guard Visibility et al.
Benchmarks
AgentSecBench
Metrics
Context CompletenessGuard Visibilitysource-to-operation dependency evidence ratepotential guard evidence rate
AI summaryThe researchers propose AgentSecGraph, a candidate-operation-centric security-aware static analysis framework that builds a Security-Aware Agent Dependency Graph (Security-ADG) for each security-sensitive operation, adding agent relevance, source and dependency evidence, trust-boundary context, guardrail evidence, and external-effect semantics beyond operation identity. The accompanying AgentSecBench covers 11 ecosystems, 67 real LLM agent repositories, and 37,542 source files; the current analyzer identifies 23,866 static security-sensitive operation candidates across 65 repositories and generates one Security-ADG artifact per candidate, completing full-corpus analysis in 50.8 minutes, recovering source-to-operation dependency evidence for 9,821 candidates (41.15%) and potential guardrail evidence for 3,075 (12.88%).

The researchers propose AgentSecGraph, a candidate-operation-centric security-aware static analysis framework that builds a Security-Aware Agent Dependency Graph (Security-ADG) for each security-sensitive operation, adding agent relevance, source and dependency evidence, trust-boundary context, guardrail evidence, and external-effect semantics beyond operation identity. The accompanying AgentSecBench covers 11 ecosystems, 67 real LLM agent repositories, and 37,542 source files; the current analyzer identifies 23,866 static security-sensitive operation candidates across 65 repositories and generates one Security-ADG artifact per candidate, completing full-corpus analysis in 50.8 minutes, recovering source-to-operation dependency evidence for 9,821 candidates (41.15%) and potential guardrail evidence for 3,075 (12.88%).

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Sensitive operation identity cannot determine security semantics; dependency and security context evidence must be added.

    Operation identity cannot determine the security implications of agent behavior.

    • Scenario: LLM agents connect model decisions to command execution, file systems, networks, browsers, and external tools. The authors state that untrusted information such as user instructions, retrieved documents, memory, model plans, and tool outputs can cross multiple software and trust boundaries before influencing externally visible operations.
    • Existing limitations: The authors state that existing analyses often anchor on predefined sensitive operations, but the same command execution may retain agent input dependencies, be cut off by constant overwriting, or have allowlist guards (Figure 1). Decorators, tool wrappers, workflow nodes, dynamic registration, and remote MCP tools can also hide relevant relationships.
    • Core distinction: The authors divide evidence into sensitive operation candidates, security-critical behaviors, and vulnerabilities. Matching a sensitive operation does not automatically equal a vulnerability; the latter also depends on controllability, protections, deployment exposure, authorization, privileges, impact, and exploitability.
    • This paper's approach: Propose a static framework AgentSecGraph that constructs a candidate-centric Security-ADG for each candidate; and build a frozen corpus AgentSecBench. The goal is auditable dependency and security context, not automatic vulnerability verification.
    • Analysis scope: Input is a frozen program snapshot and a deliberately permissive candidate set. Stronger vulnerability conclusions are made separately through reproduction and security evidence, not by single operation matches.
  2. What related research exists?

    The authors position this paper as static recovery of security context, distinct from attack evaluation, taint detection, and runtime enforcement.

    Agent safety evaluation

    • Injection and tool risks: Greshake et al. (2023), Liu et al. (2024), and Zhan et al. (2024) study indirect prompt injection; Debenedetti et al. (2024)'s AgentDojo evaluates attacks and defenses in environments; Ruan et al. (2024) use sandboxes to identify agent–tool risks.
    • Broader benchmarks and threat surfaces: Zhang et al. (2025)'s Agent Security Bench, Andriushchenko et al. (2025)'s AgentHarm, and Lee et al. (2025)'s SEC-bench cover prompts/tools/memory, multi-step harmful misuse, and real software security tasks. Chen et al. (2024), Evtimov et al. (2025), Luo et al. (2026), and MCP-related work extend the scope to memory poisoning, web agents, resource abuse, and MCP.
    • Ecosystem evidence: Liu et al. (2026) report that third-party agent skills can carry malicious instructions and auxiliary code; Kim et al. (2026) systematize agent system design, attacks, and defenses.

    Program analysis

    • Classical foundations: Ferrante et al. (1987)'s PDG, Yamaguchi et al. (2014)'s Code Property Graph, Avgustinov et al. (2016)'s QL, Enck et al. (2010)'s TaintDroid, Arzt et al. (2014)'s FlowDroid, and Wang et al. (2026)'s YASA provide dependencies, property graphs, queries, and source–sink/taint analysis.
    • LLM-integrated software: Liu et al. (2025)'s AgentFuzz dynamically searches for inputs that trigger sensitive operations; He et al. (2026)'s TaintP2X statically traces LLM-generated values to sensitive sinks; Zhang et al. (2026)'s Agent Audit combines agent dataflow with credential, configuration, and privilege analysis.
    • Authors' contrast: The authors believe predefined source–sink relationships are insufficient to characterize security risk, so they treat sensitive operations as candidate anchors and then add agent semantics, sources, dependencies, trust boundaries, guards, and external effects.

    Runtime enforcement

    • Policy enforcement: Wu et al. (2025)'s IsolateGPT isolates system resources; Debenedetti et al. (2026)'s CaMeL separates trusted control flow from untrusted data; Shi et al. (2025)'s Progent performs programmable least privilege on tool calls; Li et al. (2026)'s ACE separates planning from execution and constrains information flow and capabilities; He et al. (2026)'s AttriGuard performs runtime causal attribution for tool calls.
    • Authors' contrast: The authors state that these systems mainly enforce policies at runtime; AgentSecGraph does not enforce policies, only statically records trust boundaries, guards, available privilege context, and external effects.

    Dependency representations and baselines

    • Graph representations: Wang et al. (2026)'s AgentFlow builds an ADG covering agents, prompts, models, capabilities, memory, and control policies. Li et al. (2026)'s Agent-BOM combines static capabilities with runtime state to reconstruct security-relevant executions and attack chains.
    • Baselines and corpus: The representation comparison uses sink-only, simplified ADG, and full Security-ADG on the same candidates; the corpus is the self-built AgentSecBench. The paper does not run AgentFuzz, TaintP2X, or Agent Audit as experimental baselines. Table 6 is annotated by the authors for setting, whether agent dependencies are present, whether context beyond operation identity is present, and the main focus.
    • Positioning: The authors state that this paper contributes static dependencies and security context on real agent source code; it is complementary to taint paths, AgentFlow's framework dependencies, and Agent-BOM's runtime reconstruction, with granularity at the level of individual sensitive operations.
  3. How does the paper address this problem?

    Construct Security-ADG anchored on sensitive operations, separating operations, dependencies, and security context.

    AgentSecGraph treats matched sensitive operations as analysis anchors, builds a candidate-centric Security-ADG for each candidate, and separates it from vulnerability determination.

    Problem Setting

    • Candidate generation is deliberately permissive: a match only indicates that a security-relevant capability may exist, not that it is controlled by the agent, reachable from untrusted sources, insufficiently guarded, or exploitable.
    • For each candidate, the static security context is written as C(o)=⟨R, S, D, T, P, G, E⟩, respectively agent relevance, source, source-to-operation dependency evidence, trust boundaries, statically available privileges, candidate guards, and external effect categories.
    • These dimensions are evidence, not verdicts. Dependency or trust boundaries do not establish exploitability; the presence of a guard does not establish guard completeness or effectiveness. D(o) being true only indicates that dependency evidence was recovered.
    • The goal is narrower than automatic vulnerability verification: recover how agent-relevant values affect sensitive capabilities and the surrounding security context; stronger conclusions rely on reproduction.

    Candidate Anchoring and Framework Normalization

    • Each candidate is bound to a frozen repository, source location, operation category, detector source, and local code.
    • Framework constructs are mapped to records N, containing framework, semantic role, program symbol, exposed parameters, and match confidence. When identified as agent-oriented tools, exposed parameters can be marked as agent-relevant sources.
    • The current implementation covers representative constructs from MCP/FastMCP, LangChain, CrewAI, AutoGen, OpenAI Agents SDK, Semantic Kernel, and LlamaIndex. Normalization does not assign vulnerability labels. The paper does not provide specific selectors.

    Security-ADG

    • Each candidate's graph is written as Go=(Vo, Eo, Φo): evidence nodes, recovered relationships, and graph-level source and security context attributes. It does not reconstruct the entire program, only preserves the evidence needed to explain this operation (Figure 3).
    • Table 1 types include program symbols, sensitive operations, input sources, trust boundaries, guard candidates, external effects, and contains, may_cause, may_data_depend_on, may_cross, may_guard.
    • may_ indicates static evidence and possible relationships, not proof of end-to-end reachability, attacker control, exploitability, or guard sufficiency.
    • External effects are deterministically assigned abstract categories based on operation category, as pattern attributes, not runtime-confirmed effects.

    Dependencies, Trust Boundaries, and Guards

    • Backward recovery from values consumed by the candidate seeks local chains from sources that are agent-relevant or externally influenced to the operation.
    • Python uses AST to track local parameters, assignments, definitions, and reassignments; when an agent-oriented parameter is overwritten by a constant before reaching the candidate, the corresponding dependency terminates. TypeScript/JavaScript performs syntax-aware lexical backward tracking, more conservative, without full alias, type, or control-flow reasoning.
    • Guard evidence includes allowlists, fixed parameters or command construction with parameter vectors, schema or syntax validation, authentication, path restrictions, sandboxing, and resource limits. may_guard only indicates that defense evidence is visible.
    • Privileges are recorded only when explicit evidence can be recovered from supported source constructs, not inferred from deployment identity, environment permissions, or runtime authorization.

    Implementation Contract and Three Views

    • The pipeline includes language analyzers, framework adapters, and deterministic graph generation. Adapters are independent of the graph schema.
    • Construction success means exactly one graph is emitted linked to the original candidate identifier and source location, measuring one-to-one generation and linking, not semantic correctness or completeness of relationships.
    • The same candidate exports three views: sink-only leaving only the operation; simplified ADG leaving structural operations and external effects; full Security-ADG leaving sources/dependencies, trust boundaries, guards, and external effects.
    • Analysis runs on recorded Git commits and is independent of human annotations, model safety judgments, reproduction results, and vulnerability handling. The authors state the analysis is intentionally local; reflection, dynamic registration, metaprogramming, and deployment-related exposure may make evidence incomplete.
  4. What experiments did the paper conduct?

    Across 9 cases, Security-ADG retains 91.1% context and 5/5 guards, while sink-only is 20.0% and 0/5.

    Experimental setup

    • Corpus: AgentSecBench, 67 public repositories, 11 ecosystems, 37,542 source files, 291.2 MB, frozen at recorded Git commits. Inclusion is independent of analyzer output. Primary language Python 51 (76.1%), TypeScript 7 (10.4%), and the remaining 9 are mainly C#, Rust, Go, PHP, and Shell (Table 7).
    • Three candidate populations: the historical pilot of 531 candidates across 5 repositories; the same 5 snapshots rescanned with the current scanner yield 508, recording only scanner drift; the current full corpus of 23,866 candidates, used for characterization and timing. None of the three are vulnerability counts.
    • Environment: HP ProBook 440, i5-1340P (16 logical processors), 32 GB RAM, Windows 11 Home (build 26200), CPython 3.13.12. Single process, no worker pool. Wall-clock time comes from one complete run; the paper does not report repeated-run distributions or formal peak RSS.
    • Baselines: sink-only, simplified ADG, and full Security-ADG on the same candidates. Differences come from information dropped by the representation, not from different candidate generation.
    • Metrics: Full-corpus ratios use 23,866 as the denominator. Context completeness is the sum of applicable reference elements retained by the representation across cases, divided by the sum of applicable elements; absent or unknown elements are excluded, and no_guard_confirmed remains in the denominator as a supported negative element. Guard visibility is counted only when both the reference and the representation expose concrete guard evidence.
    • Ground truth: The reference set requires behaviors to be bindable to frozen snapshots and supported by controlled reproductions reviewed by the authors. A five-model panel (openai/gpt-5-mini, anthropic/claude-sonnet-4.6, google/gemini-3.5-flash-lite, qwen/qwen3-max, deepseek-v4-pro) independently pre-annotates 150 tasks and 750 valid responses, used only for disagreement triage. Implementation assistance uses OpenAI Codex and GPT-5.6. The paper does not report agreement coefficients with humans.

    Main results

    RepresentationContext CompletenessGuard Visibility
    sink-only20.0% (9/45)0/5
    simplified ADG40.0% (18/45)0/5
    Security-ADG91.1% (41/45)5/5

    Per Table 5 and Appendix Table 12. 9 held-out cases, 5 applicable dimensions per case.

    • The authors state that the increase from 40.0% to 91.1% cannot be attributed solely to structural dependencies; sources, security-relevant dependencies, trust boundaries, and guards provide additional context.
    • The authors state that these numbers measure context retention, not vulnerability detection accuracy; 5/5 does not mean the observed guards are sufficient.
    • Appendix Table 11: on 4 no_guard_confirmed cases, Security-ADG is 4/5, and on 5 guarded cases it is 5/5; sink-only is 1/5 in both, and simplified ADG is 2/5 in both. The authors state that the graph does not emit positive guard nodes for the former, so no guard-retention score is counted.

    Full-corpus coverage and overhead

    • What was measured: The current scanner processes all 67 frozen repositories, then builds a graph for each candidate.
    • Results: 67/67 completed, no skips or failures; 23,866 candidates from 65 repositories and 7,214 source files; one Security-ADG per candidate. Dependency evidence 9,821 (41.15%), framework-specific evidence 749 (3.14%), potential guards 3,075 (12.88%) (Table 3). End-to-end 3,046.6 seconds (50.8 minutes), 7.83 candidates/second; extraction 1,508.5 seconds, graph construction 1,538.2 seconds; median repository time 9.6 seconds, P90/P95 203.0/236.2 seconds (Table 4).
    • Authors' interpretation: The success criterion is one-to-one generation and source linking, not semantic correctness. Source, dependency, and trust-crossing derived counts are identical, so the authors do not triple-count 9,821, nor treat this experiment as an independent trust-boundary accuracy. No explicit privilege context was recovered this time. The authors state that runtime supports offline corpus analysis, with large repositories forming the latency tail.

    Reproduction reference set

    • What was measured: From source inspection to controlled behavior confirmation; using available isolated execution, stubs or monkeypatches of external effects, or paired attack–defense tests. Model judgments are not used as labels.
    • Results: 13 repositories, 22 behaviors; vulnerability ground truth 1, pending-disclosure candidate 1, guarded non-vulnerabilities 20 (Table 2). Among the 9 representation cases, 5 are local monkeypatch proofs and 4 are source-construct proofs of unexecuted external effects (Appendix D). The paper does not report the specific reproduction details of that confirmed vulnerability.
    • Authors' interpretation: Reproducing a sensitive behavior does not by itself establish a vulnerability; after agent-oriented values reach strong capabilities, deployment exposure, authorization, privilege, guards, and impact still matter for the judgment. The authors state that in the reproduced cases, recurring patterns include dependency retention versus removal by constants, guarded versus unguarded, validation paths versus effect paths, and different trust contexts for the same low-level operation; sink-only records only operation identity.

    Other ablations and analyses

    • Table 14 dependency evidence: filesystem_write 84.14% (4,218/5,013), filesystem_read 65.28% (2,730/4,182), external_tool_invocation 11.28% (603/5,344), browser_control 1.87% (11/588).
    • Table 14 guard evidence: filesystem_delete 51.29% (299/583), dynamic_code_execution 41.82% (23/55), external_tool_invocation 1.37% (73/5,344). The authors state these must not be interpreted as differences in vulnerability prevalence across categories.
    • Table 14 categories with the highest candidate counts: external_tool_invocation 5,344, filesystem_write 5,013, filesystem_read 4,182, command_execution 2,722.
    • Full-corpus explicit privilege context evidence is 0 (§4.3); external effect node coverage is a per-category assigned pattern attribute.
    • Scanner drift: on the same 5 pilot snapshots, the historical checklist has 531 candidates, and the current scanner yields 508 (§4.1).
    • The 344-operation checklist (dddabtc/winremote-mcp 148 items, nexu-io/html-anything 196 items) is not fully covered by independent adjudication, so the paper does not report match counts, recall, precision, or F1 (Appendix F).
  5. What are some points that can be further explored?

    The authors state that static evidence is incomplete and the reference set does not support general vulnerability detection conclusions.

    Limitations and future directions noted by the authors

    • Construct and internal validity: The authors state that the abstraction omits some deployment-related factors; context completeness measures represented evidence, not proven reachability or exploitability; guard visibility does not establish guard sufficiency (§5.3).
    • Analysis scope: The authors state that Python recovery is local and AST-based, not sound whole-program, alias, points-to, or symbolic analysis; TypeScript/JavaScript uses weaker syntax-aware lexical tracking. Reflection, dynamic registration, metaprogramming, or deployment-specific exposure and privileges may produce missing or imprecise evidence (§5.3).
    • Privilege and counting: Privileges are recorded only when explicit evidence can be recovered from supported source constructs; none were recovered in this full-corpus extraction. Source, dependency, and trust-crossing corpus counts are identical, so the authors do not treat them as three independent measurements, nor do they claim an independently validated trust-boundary recovery rate (§5.3).
    • External validity: The authors state that 67 repositories and 11 ecosystems are not statistically representative of the entire ecosystem; availability, selection criteria, and open-source access shape the composition. Python dominates, and its dependency analysis is stronger than TypeScript/JavaScript, so the aggregate results are not a language-agnostic performance estimate (§5.3).
    • Conclusion validity: 23,866 and the historical 531 come from different scanner versions and cannot be directly treated as a scale-up experiment. Evidence frequency does not estimate vulnerability prevalence, nor does it establish recall relative to all security-relevant behaviors within repositories. Timing comes from a single run, and the archive does not contain peak memory. Five-model triage may affect which cases are reviewed by humans earlier, so the authors do not treat the reproduction set as an unbiased estimate of corpus behavior prevalence. The 22 behaviors and 9 cases support the reported case-level, representation-level findings, but not exhaustive recall or general vulnerability detection claims. The authors do not use precision, recall, or F1 as primary metrics against the reference set (§5.3).
    • Checklist adjudication: Appendix F.4 states that independent adjudication labels do not cover all 344 items, so the evaluator does not provide aggregate or per-category recovery metrics; completing independent adjudication remains future work.

    Experimental coverage

    • The full-corpus objects are AgentSecBench's 67 frozen repositories, 11 ecosystems, and 37,542 source files; the current scan yields 23,866 candidates, 65 repositories with candidates, and 7,214 files with candidates (Table 2, §4.3).
    • Framework adapters cover representative constructs from MCP/FastMCP, LangChain, CrewAI, AutoGen, OpenAI Agents SDK, Semantic Kernel, and LlamaIndex (§3.2).
    • The reproduction reference set is 22 behaviors across 13 repositories: 1 confirmed vulnerability, 1 pending-disclosure candidate, and 20 guarded non-vulnerabilities (Table 2).
    • The representation comparison is 9 held-out cases and three same-source views; 5 cases have reference guards, 5 are monkeypatch proofs, and 4 are source-construct proofs of unexecuted external effects (§4.6, Appendix D).
    • The paper does not report repeated-run timing distributions and peak memory (§4.1, §5.3); does not report match counts, recall, precision, or F1 for the 344-item checklist (Appendix F.4); does not report agreement coefficients between the reference set and model pre-annotations (§4.1); does not report the specific reproduction details of that 1 confirmed vulnerability.
  6. Summarize the main content of the paper

    AgentSecGraph uses Security-ADG to separate operation detection from security interpretation and quantifies context retention.

    AgentSecGraph performs security-aware static analysis on frozen LLM agent source code: sensitive operations serve only as candidate anchors, and Security-ADG then records its relationships with agent inputs, dependencies, trust boundaries, guards, and external effects.

    • Problem: The same command execution can be connected to agent input, cut off by constant overwriting, or guarded. The authors argue that looking only at operation identity cannot explain these differences, and each match should not be directly treated as a vulnerability.
    • Approach: Python uses AST for local backward dependency analysis, where constant overwriting terminates the corresponding dependency; TypeScript/JavaScript uses more conservative lexical tracking. may_ edges indicate only static evidence. The same candidate can be projected into sink-only, simplified ADG, and full Security-ADG. The corpus AgentSecBench contains 67 repositories, 11 ecosystems, and 37,542 source files.
    • Corpus results: The current analyzer produces 23,866 candidates and the same number of graphs, with no reported construction failures. Dependency evidence 41.15% (9,821), potential guard 12.88% (3,075), end-to-end 50.8 minutes (Table 3, Table 4). Explicit privileged context is 0 this time.
    • Behavior and representation: 22 behaviors reproduced across 13 repositories, confirming 1 vulnerability, 1 pending disclosure, 20 guarded non-vulnerabilities (Table 2). On 9 held-out cases, Security-ADG has context completeness of 91.1% and guard visibility 5/5; sink-only has 20.0% and 0/5, simplified ADG has 40.0% and 0/5 (Table 5).
    • Authors' conclusion: Predefined sensitive operations can still serve as analysis anchors; the authors claim that after adding dependency and security context, superficially similar operations can be explained separately. The above numbers are evidence retention and the current analyzer's distribution on this corpus, not vulnerability detection accuracy or vulnerability prevalence.
Read originalarxiv.org