AgentLens: Graph-Guided Safety Auditing for LLM AgentsAgentLens: Graph-guided Security Auditing for LLM-based Agents
AGENT L ENS uses an audit knowledge graph to audit five software engineering agents, verifying 44 vulnerabilities, 12 of which obtained CVE numbers.
Pre-deployment auditing: the auditor is a trusted maintainer or internal security engineer, the auditing environment is not compromised, and the auditor can access source code, configuration, prompts, tool definitions, API bindings, permissions, and defense mechanisms, and can execute and observe the agent through legitimate external entry points in a controlled environment that preserves the original workflow and defenses.
- Static auditing can find suspicious weaknesses in agent implementations, but cannot confirm whether they are reachable and triggerable under the original workflow and built-in defenses. Pre-deployment auditing needs to link component interactions, weaknesses, and defenses, and obtain evidence of violations during execution.
- AGENT L ENS builds an Agent Profile Graph from source code and configuration, adds threat intelligence, automatically discovered weaknesses, and defense constraints to form an Audit Knowledge Graph; it then derives audit paths, generates path-specific payloads and multi-turn scenarios, checks execution results against predefined conditions, and has security experts review them.
- Across five agents, a total of 70 audit paths were retained and 44 vulnerabilities were validated, with 12 issues assigned CVE numbers. On Langflow, AGENT L ENS, AgentFuzz, and Agent Audit validated 11, 3, and 0 respectively; the recall rate on the OpenClaw known-vulnerability benchmark is 75%.
- The authors note that incomplete runtime signals may cause misjudgment, baseline configuration may affect comparisons, and results may not generalize to non-code agents; the five-agent evaluation has no independent ground truth. OpenClaw covers only selected public CVEs, and the underlying LLM may have seen this information during training.
- Evaluated models
- Claude Opus 4.6GLM-5.2
- Benchmarks
- OpenClaw BenchmarkLangflowAider
- Metrics
- Validated Vulnerabilities (VV)Weakness Nodes (WN)Auditing Paths (AP)Avg. WNPTotal Time Cost (TTC)Avg. Time-to-Exposure (Avg. TTE)TPFPFNrecall
The researchers propose AgentLens, a systematic security auditing framework for LLM agents, and find 44 vulnerabilities in five widely used agent applications, all with more than 24,000 GitHub stars, each vulnerability verified by being triggered during execution, of which 12 reported issues received CVE identifiers. The framework analyzes the target agent's implementation, component interactions, and built-in defenses, organizing them into an audit knowledge graph, on which basis it derives candidate attack paths, generates path-specific verification payloads, and constructs multi-turn audit scenarios that place the payloads in task-relevant contexts to verify whether a suspected risk manifests as safety-violating behavior during execution. The paper states that agent implementation weaknesses and unsafe interactions with external resources can lead to remote code execution, arbitrary file access, SQL injection, and data leakage; compared with the state-of-the-art method AgentFuzz, AgentLens detects 3.67 times as many vulnerabilities.
Related events and news
1 events · 0 news mentions
- This event's paper
AgentLens框架审计LLM智能体发现44个漏洞
Paper analysis
What problem does this paper attempt to solve?
The core is to turn statically suspicious weaknesses into executable, reviewable evidence of security violations within the agent's original workflow.
Core question: how to systematically audit LLM agents before deployment and validate whether implementation weaknesses can cause security violations under real workflows and existing defenses.
- Scenario and importance: software engineering agents can call tools, operate on files and APIs, and change the execution environment; the authors believe their implementation flaws and unsafe interactions may lead to remote code execution, arbitrary file access, SQL injection, and data leakage.
- Shortcomings of existing methods: the authors state that LLM red-teaming tools mainly check unsafe responses, AgentFuzz targets taint-style vulnerabilities, and Agent Audit's static candidates are not guaranteed to be triggerable at runtime; semantically harmless LLM outputs may also become unsafe operations through surrounding implementations.
- Core observation: risk often comes from the relationships among prompts, tools, files, configuration, and defenses rather than isolated flaws; only when reachable from an external entry, propagated along the workflow, and passing through or bypassing defenses does it form a verifiable risk.
- Proposed approach: AGENT L ENS builds an Audit Knowledge Graph, derives audit paths, generates path-specific validation payloads and multi-turn audit scenarios, and then checks execution results; the paper reports 44 validated vulnerabilities on five agents.
- Threat model:
- Goal: discover implementation-level weaknesses and validate whether they can produce violations such as tool misuse, unintended code execution, and privilege abuse through normal workflows.
- Knowledge and capabilities: a trusted auditor can read source code, configuration, prompts, tool definitions, API bindings, permissions, and defenses, and can use threat intelligence and weakness discovery tools.
- Victim system and entry points: the agent before deployment; the auditor can interact through legitimate external entry points in a controlled environment that preserves the original workflow and defenses, and observe outputs, tool calls, logs, and state changes.
- External risk sources: both direct interaction and untrusted external input can trigger sensitive actions; in multi-user deployments, a malicious user may affect other users through shared resources or workflows.
What related research exists?
Related work is divided into agent risks, agent security analysis, traditional software and graph analysis, and LLM red-teaming tools.
Agent security risks
- Agent Security Bench, MemMorph, AgentPoison, etc.: The paper links prompt injection, tool hijacking, and unsafe data handling with tool misuse, information leakage, unsafe execution, and task deviation; Les Dissonances studies cross-tool collection and contamination in tool pools.
- OWASP Top 10 for Agentic Applications and NIST AI RMF: Summarize risks such as agent goal hijacking, tool misuse and exploitation, and identity and permission abuse; the authors use OWASP categories to organize audit risks.
- Asleep at the Keyboard? (2025): Evaluates the security of GitHub Copilot code contributions; the paper uses this to illustrate that interactions with code repositories, terminals, and project files may bring code tampering, credential exposure, and system compromise.
Agent security analysis
- AgentFuzz (2025): A greybox fuzzing framework that extracts call chains to sinks and uses LLM-guided mutation to detect taint-style vulnerabilities. The authors criticize it for focusing on taint flows triggered by a single prompt, which may miss cases that require connecting multiple weaknesses along an execution path.
- Agent Audit (2026): Statically analyzes agent code and configuration and reports potential risks. The authors argue that static analysis may report risks that are unreachable or untriggerable under the actual workflow and defenses, producing false positives.
- ORL-Auditor, SpecOps, KV-cache sharing research: Concern training trajectory security, GUI behavior monitoring, and cache-sharing privacy, respectively; the authors state that they do not target systematic agent auditing.
Traditional software vulnerabilities and graph security analysis
- Inspectron (2024) and smart contract storage collision detection (2025): Represent traditional software vulnerability detection. The authors argue that agents also rely on natural language instructions, LLM planning, tool calls, and multi-turn context, making traditional methods difficult to apply directly.
- PROGRAPHER, MAGIC, Trec, Slot: Build provenance graphs from system audit logs for runtime anomaly detection, APT identification, or post-attack investigation; the authors state that agent auditing requires different abstractions oriented toward components, workflows, weaknesses, and built-in defenses.
LLM red teaming and baselines in this paper
- HarmBench, garak, PyRIT: Evaluate whether adversarial prompts can induce unsafe or policy-violating responses from a target LLM; the authors argue that checking responses alone is insufficient to cover how the surrounding implementation interprets outputs and changes the environment.
- Comparison baselines and benchmarks: The experimental baselines are AgentFuzz and Agent Audit, compared on VV on Langflow and Aider; additionally, 20 selected public OpenClaw CVEs form a known-vulnerability benchmark.
The authors position AGENT L ENS as path-based auditing for pre-deployment agents: rather than only finding a certain type of weakness, it uses reachability, multiple weaknesses, workflow context, and defense constraints together for runtime validation.
How does the paper address this problem?
AGENT L ENS organizes components, weaknesses, and defenses with a graph, then generates payloads and multi-turn scenarios along paths and validates execution.
The overall idea is to turn agent auditing into path analysis on an Audit Knowledge Graph: first statically reconstruct the workflow and annotate risks and defenses, then have the LLM generate test content based on path context, and finally collect violation evidence in the original execution flow.
Audit Graph Construction
- Agent Profile Graph: Gp=(Np,Ep), where nodes represent components such as classes, functions, LLM interfaces, external tools, and memory modules, and edges represent call, data-flow, and control-flow dependencies; nodes also store component type, code location, and parameter lists.
- Static extraction: Python ast is used to parse the source code into an abstract syntax tree, and components and dependencies are extracted in combination with inheritance relationships, tool registration bindings, and external API calls.
- Weakness annotation: forms Ga=(Np,Ep)∪(W,G); each item in W contains a target component, a weakness category referencing CWE, and a risk description, and each item in G contains a protected component, a defense mechanism, and specific constraint rules.
- Two sources of weaknesses: public threat intelligence such as NVD and the GitHub Advisory Database is retrieved by component entity and type; in addition, 10 automatically discovered skills are instantiated based on the OWASP Top 10 for Agentic Applications, and Claude Code is used to scan the target source code. Intelligence collection excludes vulnerability reports related to the version of the agent under test.
- Defense extraction: mechanisms and constraints such as input validation, commit validation, and error handling are extracted from prompts, configuration, tool wrappers, permission checks, and human approval logic, and attached to the corresponding nodes.
Audit Paths and Prioritization
- Path generation: depth-first traversal is performed from attacker-controllable external entry nodes to security-critical nodes such as code interpreters, system commands, file operations, database queries, external APIs, or privileged tools.
- Redundancy removal: subpaths fully contained in other paths are first removed, then paths with identical entries, critical nodes, and weaknesses are grouped, and only one is retained per group.
- Ranking basis: priority consists of a weighted positive term from the normalized total path weakness severity score V(p) and a weighted negative term from the normalized path length Len(p); the authors treat length as an execution difficulty term, with α=0.7 and β=0.3 in the implementation.
- Actual budget: the paper states that prioritization can be ignored when the budget is sufficient; to discover risks as much as possible, the experiment tests all retained paths rather than only a high-priority subset.
Payload and Multi-Turn Scenario Generation
- Payload inputs: the underlying LLM receives risk category R, security impact I, path information p, and defenses G; categories reference OWASP and CWE, impacts reference MITRE ATLAS, and paths include intermediate components, weaknesses, and defenses.
- Generation goal: keep the payload as the test objective and place it in a task context consistent with the agent's workflow, while accounting for known defenses; the appendix-style prompt box is listed directly in Sec. III-C and contains the complete generation instructions and JSON output format.
- Scenario definition: an interaction sequence S=(M1,…,Mk), where the content of each round can be delivered through agent-accessible channels such as chat text, uploaded RAG documents, code repositories, tool return values, or configuration files.
- Context progression: the LLM first generates the first-round content according to the entry, then establishes task state round by round along the path, embeds the payload in one of the rounds, and if necessary continues to observe subsequent operations after delivery; each scenario has at most five rounds in the experiment.
Execution Validation and Judgment
- Controlled execution: scenario content is submitted in order in a test environment that preserves the agent's original workflow and defenses, and execution outputs, tool calls, logs, and state changes are observed.
- Violation judgment: validation conditions are defined for each vulnerability type before the audit, and execution is checked against them for specific security violations, with findings finally manually reviewed by security experts.
- Role of the graph in the case: Figure 4 connects Aider's URL handling, web scraping, and subsequent code commit nodes into a path and marks CWE-20, CWE-918, CWE-200, CWE-693, and defenses such as URL confirmation; the authors use this to organize a four-round scenario and check the metadata request.
What experiments did the paper conduct?
The experiments cover the main audit of five agents, OpenClaw known vulnerabilities, comparison with two baselines, ablation and repeated runs, and an SSRF case.
Experimental Setup
- Agents under test: Aider v0.86.3, MetaGPT source version 1.0.0, Goose v1.29.1, Cline v3.51.0, Roo-Code v3.51.1; the comparison experiment additionally includes Langflow, and the known-vulnerability experiment includes OpenClaw v2026.3.8.
- Implementation and environment: Ubuntu 22.04, 64-core Intel CPU, 251 GB RAM; AGENT L ENS is implemented with the Claude Agent SDK, the default underlying LLM is Claude Opus 4.6, and the model comparison uses GLM-5.2 instead.
- Main evaluation metrics: WN is the number of nodes annotated with potential weaknesses, AP is the number of audit paths after filtering, Avg. WNP is the average number of weakness nodes per path, and VV is the number of validated vulnerabilities; TTC is the number of seconds for the complete pipeline, and Avg. TTE=TTC/VV.
- Judgment and review: execution is checked against the validation conditions for each vulnerability type defined before the audit, and then security experts manually review it; each multi-turn scenario allows at most five interactions, and the main experiment tests all retained paths.
- OpenClaw benchmark: public CVEs that affect v2026.3.8, can be reproduced on Linux, and have clear consequences are selected; after deduplication by root cause, 20 are retained, and TP, FP, FN, and recall are reported; an independent Claude Opus 4.6 control is run three times.
- Baseline comparison: on Langflow and Aider, the evaluation protocol of AgentFuzz is followed, findings from the three parties are aggregated, manually checked, and VV is reported; the paper does not report the number of independent repetitions for the main five-agent experiment.
Main Results
The five agents total 70 APs and 44 VVs, with a total TTC of 11,982.21 seconds; the following are the complete results of Table I.
Swipe horizontally to read the table
Agent WN AP Avg. WNP VV TTC (s) Avg. TTE (s) Aider 60 19 2.53 8 3054.56 381.82 MetaGPT 83 12 1 6 1450.02 241.67 Goose 303 12 3.83 12 3124.99 260.42 Cline 58 16 1.06 8 2256.25 282.03 Roo-Code 31 11 1.82 10 2096.39 209.64 - Overall efficiency: the main text reports an average of 14 paths, 8.8 VVs, and 2,396.44 seconds TTC per agent, a VV/AP of 62.86%, and an average Avg. TTE of 275.12 seconds.
- Weakness count is not equal to path count: Goose has the most WNs but an AP of 12, fewer than Aider's 19 and Cline's 16; the authors attribute this to Goose's tools broadly accepting external parameters with insufficient input validation, and emphasize that path generation also removes redundancy.
- Public vulnerability types: among the 12 CVEs in Table II, there are 6 Code Injection, 2 Path Traversal, and 1 each of Protection Mechanism Failure, SQL Injection, SSRF, and Cleartext Transmission of Sensitive Information; undisclosed vulnerabilities are not detailed.
OpenClaw Known Vulnerabilities and Independent LLM Control
- Detection results: AGENT L ENS obtains 15 TP, 0 FP, and 5 FN on the 20 ground-truth vulnerabilities, with a recall of 75%.
- Independent model control: standalone Claude Opus 4.6 identifies 0, 2, and 2 known vulnerabilities in three runs respectively; the authors believe the complete audit workflow helps discover more known vulnerabilities than a standalone LLM.
- Evidence boundary: the authors also note that these public CVEs may already be in the underlying LLM's training data, so this experiment cannot rule out the influence of prior knowledge.
Comparison with AgentFuzz and Agent Audit
Swipe horizontally to read the table
Agent AgentFuzz VV Agent Audit VV AGENT L ENS VV Langflow 3 0 11 Aider 0 3 8 According to Table III; the abstract also states that the number of detected vulnerabilities is 3.67× that of AgentFuzz.
- Langflow: the authors state that AgentFuzz's single-prompt taint-style focus misses vulnerabilities that require connecting multiple weaknesses; Agent Audit validates no vulnerabilities and flags dummy keys in test files as hardcoded credentials, whereas the authors' execution validation considers them harmless.
- Aider: AgentFuzz produces 171 call chains to 44 sinks; after excluding chains outside normal workflows and chains without a meaningful attack surface, the authors generate 30 seed messages, but none reaches a sink.
- Manual review: the authors report that many of Agent Audit's findings are false positives upon manual inspection; the authors attribute AGENT L ENS's greater VV to path-guided multi-turn testing and runtime validation.
Ablation, Repeated Runs, and Underlying Model
- Ablation settings: NoWA removes weakness annotations, NoGuard removes defense information, NoGraph removes graph/path construction, and NoMultiTurn removes multi-turn scenarios; the trends across the five agents are similar, and the paper reports only Aider in Figure 3(a).
- Values in the figure: the complete system has VV=8; NoWA=3, NoGuard=4, NoGraph=4, NoMultiTurn=4. The authors state that neither the four variants nor the complete system produced unconfirmed findings.
- Authors' explanation: NoWA's paths and payloads lack risk relevance; NoGuard does not account for Aider's character filtering and filesystem constraints; NoGraph requires the LLM to infer execution steps on its own; NoMultiTurn may fail to establish prerequisite task state.
- Repetition and model swap: with the audit graph fixed, payloads and scenarios are independently generated five times using only Claude Opus 4.6, and the VVs on Aider are 8, 8, 7, 7, and 7, with a mean of 7.2 (Figure 3(b)); GLM-5.2 gives 7, and the authors state that it still works effectively after switching to a different underlying model.
Other Ablations and Analyses
- Path prioritization: the main experiment tests all retained paths and does not give prioritization ablation numbers under different audit budgets.
- Five-round cap: the authors explain that this cap is for efficiency under a limited budget and can be increased to support longer interactions, but they do not report results for other round counts.
- SSRF case: Figure 4 shows CWE-20 and CWE-918 in Aider connected along URL handling and fetching nodes; the authors report that a metadata request is made through the built-in scraper, and the issue received CVE-2026-10177.
- Case defense conditions: the authors state that URL confirmation only requires user consent and does not check the destination address, so SSRF can still occur after confirmation; this case also involves a CWE-693 weakness where subsequent commits skip validation.
What are some points that can be further explored?
The authors discuss validity threats such as misjudgment, baseline configuration, generalization, and ground truth; the experiments also have explicit coverage boundaries.
Limitations and Future Directions Noted by the Authors
- Runtime judgment may be wrong: Sec. V notes that when observable signals are incomplete or ambiguous, runtime behavior checks may misjudge exploitation results; the mitigation is manual inspection of the audit paths and exploitation evidence for validated vulnerabilities.
- Baseline configuration affects comparison: Sec. V notes that comparisons with baselines may be affected by their configuration; the authors follow the baseline papers' experimental settings and evaluation metrics where applicable.
- May not generalize to all agents: Sec. V notes that the evaluation mainly targets code agents, and non-code agents may have different tool interfaces, execution environments, and security risks.
- Cannot estimate the number missed: Sec. V notes that the five-agent evaluation lacks independent ground truth, so it cannot determine how many vulnerabilities remain undiscovered.
- Known-vulnerability benchmark coverage and training contamination: Sec. V notes that the OpenClaw benchmark covers only selected public CVEs, and the underlying LLM may have seen this information during training.
- Code release is still planned: Data Availability states that the artifact will be made public upon acceptance; currently, code, scripts, reproduction instructions, and PoC results are provided in an anonymous repository.
Experimental Coverage
- Main evaluation targets: five open-source software engineering agents, namely Aider, MetaGPT, Goose, Cline, and Roo-Code, with versions and code sizes listed in Sec. IV-A and Table I.
- Comparison scope: the VV comparison with AgentFuzz and Agent Audit is conducted only on Langflow and Aider (Table III), and the two baselines are not extended to all five agents in the main table.
- Known-vulnerability scope: the OpenClaw benchmark consists of 20 public CVEs deduplicated by root cause and reproducible on Linux; AGENT L ENS obtains 15 TP, 0 FP, and 5 FN.
- Ablation and repetition: the numerical results in Figure 3 use Aider as the representative; the repeated experiments fix the audit graph and repeat only payload and scenario generation five times, and the GLM-5.2 control is also on Aider.
- Interactions and disclosure: each scenario has at most five rounds, and the main experiment traverses all retained paths; the paper does not report the number of independent repetitions of the full five-agent pipeline, nor does it discuss undisclosed vulnerabilities in detail.
Summarize the main content of the paper
AGENT L ENS combines graph-guided path analysis with execution validation, reporting 44 validated vulnerabilities and 12 CVEs.
AGENT L ENS is a pre-deployment security auditing framework for LLM software engineering agents; its focus is not merely listing static suspicious points, but validating whether they can cause concrete violations under the original workflow and built-in defenses.
- Problem: Agent risks are distributed across component interactions, external inputs, tool calls, and defense constraints; the authors argue that existing LLM red teaming, single-category vulnerability detection, and static analysis are insufficient to answer "whether it is reachable and whether it is triggerable."
- Method: Build an Agent Profile Graph from source code and configuration, fuse public threat intelligence, weaknesses discovered by Claude Code skills, and defense constraints into an Audit Knowledge Graph; traverse and deduplicate to obtain paths from entry points to security-critical operations.
- Validation: The underlying LLM generates payloads according to risk category, security impact, and path context, then constructs task scenarios of up to five rounds; execution evidence is checked against predefined conditions, with manual review by security experts.
- Main results: Table I retains a total of 70 paths and validates 44 vulnerabilities across Aider, MetaGPT, Goose, Cline, and Roo-Code, with an average of 2,396.44 seconds per agent; Table II lists 12 CVEs that have been assigned numbers.
- Comparison and generalization: In Table III, the VV of AGENT L ENS, AgentFuzz, and Agent Audit on Langflow are 11, 3, and 0 respectively, and on Aider are 8, 0, and 3 respectively; the recall rate on 20 public CVEs of OpenClaw is 75%.
- Stability and boundaries: In the Aider ablation, the full system has VV=8, and the four variants have 3 or 4; Claude Opus 4.6 has an average VV=7.2 over five generations, and GLM-5.2 has 7. The authors also acknowledge validity threats such as runtime misjudgment, baseline configuration, generalization beyond code agents, lack of independent ground truth, and training contamination from public CVEs.