Beyond Predefined Sinks: Security-Aware Dependency Analysis for LLM Agents
Abstract
Large language model (LLM)-based agents increasingly connect model-generated decisions to security-sensitive software capabilities such as command execution, filesystem access, network communication, browser control, and external tools. Existing analyses often use predefined sensitive operations as anchors, but operation identity alone is insufficient to determine security implications. We present AgentSecGraph, a security-aware static analysis framework that constructs a candidate-centered Security-Aware Agent Dependency Graph (Security-ADG) for each security-sensitive operation. It augments operation identity with agent relevance, source and dependency evidence, trust-boundary context, guard evidence, and external-effect semantics. We further introduce AgentSecBench, a corpus of 67 real-world LLM-agent repositories spanning 11 ecosystems and 37,542 source files. The current analyzer identifies 23,866 static security-sensitive operation candidates across 65 repositories and emits one Security-ADG artifact per candidate. Corpus-wide analysis recovers source-to-operation dependency evidence for 9,821 candidates (41.15%) and potential guard evidence for 3,075 (12.88%), completing in 50.8 minutes. Using a separate reproduction-backed evaluation layer, we establish 22 security-sensitive behaviors across 13 repositories: one confirmed vulnerability, one pending disclosure candidate, and 20 guarded behaviors. In nine held-out cases, Security-ADG preserves 91.1% of the reference context and all five observed guards, compared with 20.0% for a sink-only view and 40.0% for a simplified ADG. These results show that security-aware dependency and contextual evidence enable distinctions that cannot be recovered from sensitive-operation identity alone.
Figures & tables
| Type | Meaning |
|---|---|
| Agent/program symbol | Agent-facing or enclosing program construct associated with the candidate. |
| Sensitive operation | Candidate operation that performs or prepares a security-relevant effect. |
| Input source | Value originating from an agent-facing or external context. |
| Trust boundary | A crossing from a less-trusted or external context to a local capability. |
| Guard candidate | Validation, authorization, sandboxing, argument restriction, or related defensive evidence. |
| External effect | An abstract effect involving a process, filesystem, network, browser, or external service, deterministically assigned from the operation category. |
| Corpus-Wide Analysis | Reproduction Evidence | ||
|---|---|---|---|
| Statistic | Value | Outcome | Count |
| Frozen repositories | 67 | Reproduction-confirmed behaviors | 22 |
| Agent ecosystems | 11 | Repositories represented | 13 |
| Source files | 37,542 | Vulnerability ground truth | 1 |
| Source size | 291.2 MB | Pending disclosure candidate | 1 |
| Candidate-bearing repositories | 65 | Guarded non-vulnerability | 20 |
| Evidence or artifact | Count | Rate |
|---|---|---|
| Framework-specific evidence | 749 | 3.14% |
| Source-to-operation dependency evidence | 9,821 | 41.15% |
| Potential guard evidence | 3,075 | 12.88% |
| Generated Security-ADG artifacts | 23,866 | 100.0% |
| Metric | Observed result |
|---|---|
| Repositories completed | 67/67 |
| Candidates / generated graphs | 23,866 / 23,866 |
| Candidate extraction | 1,508.5 s |
| Security-ADG construction | 1,538.2 s |
| End-to-end wall time | 3,046.6 s (50.8 min) |
| Throughput | 7.83 candidates/s |
| Representation | Context Completeness | Guard Visibility |
|---|---|---|
| Sink-only | 20.0% | 0/5 |
| Simplified ADG | 40.0% | 0/5 |
| Security-ADG | 91.1% | 5/5 |
| Approach | Setting | Agent Dep. | Context | Primary Focus |
|---|---|---|---|---|
| AgentFuzz ( Liu et al., 2025 ) | Grey-box | No | Partial | Vulnerability triggering |
| TaintP2X ( He et al., 2026a ) | Static | Partial | Partial | Prompt-to-sink detection |
| Agent Audit ( Zhang et al., 2026 ) | Static | Partial | Yes | Agent security auditing |
| AgentFlow ( Wang et al., 2026a ) | Static | Yes | Partial | Dependency recovery |
| Agent-BOM ( Li et al., 2026a ) | Runtime | Yes | Yes | Runtime reconstruction |
| AgentSecGraph | Static | Yes | Yes | Contextual behavior evidence |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Corpus property | Value |
|---|---|
| Frozen repositories | 67 |
| Agent ecosystems | 11 |
| Source files | 37,542 |
| Source size | 291.2 MB |
| Primarily Python repositories | 51 |
| Primarily TypeScript repositories | 7 |
| Framework family | Construct family | Normalized interpretation |
|---|---|---|
| MCP / FastMCP | Tool decorators and server-side tool registration | Agent-facing callable and exposed parameters |
| LangChain | Tool decorators, callable wrappers, and toolkit exports | Tool capability associated with its callable |
| CrewAI | Tool declarations and tool collections attached to agents or tasks | Agent-available capability |
| AutoGen | Function or tool registration between conversational agents and executors | Registered callable capability |
| OpenAI Agents SDK | Function-tool wrappers and tools attached to an agent | Agent-facing callable capability |
| Semantic Kernel | Kernel-function declarations and plugin methods | Kernel-exposed callable capability |
| Rater | Exact identifier and interface | Inference and output settings |
|---|---|---|
| M1 | openai/gpt-5-mini ; OpenRouter | Medium reasoning; reasoning excluded; JSON Schema |
| M2 | anthropic/claude-sonnet-4.6 ; OpenRouter | Medium reasoning; reasoning excluded; JSON Schema |
| M3 | google/gemini-3.5-flash-lite ; OpenRouter | Medium reasoning; reasoning excluded; JSON Schema |
| M4 | qwen/qwen3-max ; OpenRouter | Provider-default reasoning; JSON Schema |
| M5 | deepseek-v4-pro ; DeepSeek official API | Thinking enabled, high; reasoning not stored; JSON object with local schema validation |
| Case | Repository | Behavior | Evidence mode | Guard posture |
|---|---|---|---|---|
| HSQ-0014 | dddabtc/winremote-mcp | shell command execution | local monkeypatch proof | no_guard_confirmed |
| HSQ-0087 | dddabtc/winremote-mcp | application launch | local monkeypatch proof | no_guard_confirmed |
| HSQ-0089 | dddabtc/winremote-mcp | desktop notification script | local monkeypatch proof | guarded |
| HSQ-0091 | dddabtc/winremote-mcp | network diagnostic process | local monkeypatch proof | no_guard_confirmed |
| HSQ-0103 | dddabtc/winremote-mcp | service control | local monkeypatch proof | guarded |
| HSQ-0211 | nexu-io/html-anything | agent CLI discovery process | source-level construction proof | no_guard_confirmed |
| Case | Guard posture | Applicable | Sink-only | Simplified ADG | Security-ADG |
|---|---|---|---|---|---|
| HSQ-0014 | no_guard_confirmed | 5 | 1/5 | 2/5 | 4/5 |
| HSQ-0087 | no_guard_confirmed | 5 | 1/5 | 2/5 | 4/5 |
| HSQ-0089 | guarded | 5 | 1/5 | 2/5 | 5/5 |
| HSQ-0091 | no_guard_confirmed | 5 | 1/5 | 2/5 | 4/5 |
| HSQ-0103 | guarded | 5 | 1/5 | 2/5 | 5/5 |
| HSQ-0211 | no_guard_confirmed | 5 | 1/5 | 2/5 | 4/5 |
| Representation | Retained | Completeness | Guard visibility |
|---|---|---|---|
| Sink-only | 9/45 | 20.0% | 0/5 |
| Simplified ADG | 18/45 | 40.0% | 0/5 |
| Security-ADG | 41/45 | 91.1% | 5/5 |
| Evidence or artifact | Count | Rate |
|---|---|---|
| Framework-specific evidence | 749 | 3.14% |
| Source-to-operation dependency evidence | 9,821 | 41.15% |
| Potential guard evidence | 3,075 | 12.88% |
| Generated Security-ADG artifacts | 23,866 | 100.00% |
| Category | Candidates | Dependency | Guard | Trust-crossing |
|---|---|---|---|---|
| browser_control | 588 | 11 (1.87%) | 13 (2.21%) | 11 (1.87%) |
| command_execution | 2,722 | 933 (34.28%) | 315 (11.57%) | 933 (34.28%) |
| credential_access | 2,548 | 251 (9.85%) | 454 (17.82%) | 251 (9.85%) |
| database_access | 1,304 | 106 (8.13%) | 36 (2.76%) | 106 (8.13%) |
| dynamic_code_execution | 55 | 24 (43.64%) | 23 (41.82%) | 24 (43.64%) |
| external_tool_invocation | 5,344 | 603 (11.28%) | 73 (1.37%) | 603 (11.28%) |
| Metric | Observed result |
|---|---|
| Frozen repositories processed | 67 / 67 |
| Repositories with candidates | 65 |
| Candidate-bearing source files | 7,214 |
| Static candidates | 23,866 |
| Generated Security-ADG artifacts | 23,866 |
| Candidate extraction time | 1,508.456 s |
| Category | Count |
|---|---|
| Command execution | 76 |
| Filesystem write | 62 |
| External tool invocation | 58 |
| Network access | 46 |
| Filesystem read | 43 |
| Browser control | 27 |
LLM Agent Security
Large language model agent security studies attacks and safeguards for systems that plan, use tools, retain memory, and act across applications.
See all 330 papers