AgentTrap: A Stateful Feedback Deception Honeypot for Autonomous Penetration Testing AgentsAgentTrap: Stateful Feedback Deception against Autonomous Penetration Testing Agents
AgentTrap, relative to no defense, reduces the combined real-target ASR across eight agents from 95.8% to 79.2%, and elicits API keys in 18.8% of runs.
The attacker uses an autonomous penetration testing agent to attack a black-box network service. The agent has no sandbox restrictions, can run commands, call tools, and make network requests, and iteratively adjusts based on the target's responses; it can only access the target through external interfaces. The defender can observe interactions and control the target-side defensive responses, but cannot access the agent's internal state, prompts, or execution environment.
- Autonomous penetration agents rewrite plans in multiple steps based on target responses; conventional honeypots' static artifacts and predefined responses cannot keep up. Defenders need to maintain interaction with adaptable deception and conduct controlled countermeasures without interfering with benign users.
- AgentTrap uses sentinel endpoints to distinguish attack interactions, an LLM controller generates stateful deceptive responses based on the current request, history, and real application state, and then decides when to escalate and launch countermeasures based on subsequent probing behavior. In the evaluation, the countermeasure is capturing the attacker's API key.
- Eight agents each paired with two LLMs, comparing four defenses on a SQL injection business endpoint and a honeypot endpoint. The authors state the overall real-target ASR drops from 95.8% to 79.2%, API keys are elicited in 18.8% of runs, and resistance depends on the model recognizing deception and architecture isolating keys.
- The authors plan to strengthen state control, add inducement strategies beyond credential requests, and expand vulnerability types, agents, backends, and repetition counts, then measure the overhead and interference with legitimate users in real deployment. The experiment uses eight agents, 3 runs per cell, and the controller model is not specified.
- Evaluated models
- Claude Opus 4.8Claude Sonnet 5DeepSeek-V4-FlashDeepSeek-V4-Pro
- Benchmarks
- authorized sandbox(business endpoint with SQL injection 与 defense-controlled endpoint)
- Metrics
- ASRCSRtoken usagewall-clock time
The researchers propose AgentTrap, a closed-loop honeypot for autonomous penetration testing agents, which uses sentinel endpoints to avoid harming normal traffic, stateful deception based on the protected application, and behavior-guided escalation strategies to sustain interaction and collect agent-side behavioral evidence. In a deployed web application, the research team evaluated eight autonomous penetration testing agents using real application endpoints and separate honeypot endpoints, with three defense strategies. Compared to no defense, AgentTrap reduces the overall attack success rate on real targets from 95.8% to 79.2% and successfully induces the attacker's API key in 18.8% of runs, outperforming static deception and fixed escalation strategies. Trajectory analysis shows that an agent's ability to resist such countermeasures depends both on model-level recognition of deceptive requests and architecture-level isolation of sensitive resources.
Paper analysis
What problem does this paper attempt to solve?
Static honeypots cannot keep up with the multi-step adaptation of autonomous penetration agents; AgentTrap uses closed-loop deception to maintain interaction and conduct controlled countermeasures.
Autonomous penetration testing agents rewrite multi-step attacks based on target feedback; static honeypots struggle to adapt.
- Scenario: The authors state that large language models transform automated penetration from predefined scanning into adaptive attacks that continuously interpret observations, revise plans, and call tools. Honeypots are used to divert attacks away from real assets and support tracking and active countermeasures.
- Existing shortcomings: The authors state that conventional honeypots mainly expose predefined decoys and log interactions, relying on static artifacts and predefined responses, lacking adaptability to multi-step attacks with constantly changing strategies, thus making it difficult to maintain credible deception.
- Observation: Agents primarily infer target state from runtime feedback and may not recognize deliberately set deception. The authors believe defenders can exploit this to mislead agents, divert them to controlled honeypots, consume attack budgets, or trigger controlled code execution in their environment.
- Threat model:
- Scenario: The attacker uses an autonomous penetration testing agent to attack a black-box network service.
- Attacker capabilities: The agent has no sandbox restrictions, with sufficient permissions to run commands, call external tools, and initiate network requests; it maintains state based on returned responses and iteratively adjusts. If responses appear untrustworthy or inconsistent with prior observations, it may question or abandon that path. It can only access the target through external interfaces, not source code, deployment configurations, internal state, logs, or private backends.
- Defender capabilities: Can observe interactions with the target and control the responses of target-side defensive components; cannot access the agent's internal state, prompts, or execution environment.
- Proposed method: The authors state that AgentTrap is the first closed-loop honeypot for such agents: sentinel endpoints avoid interfering with benign users, stateful deception based on the protected application maintains multi-step consistency, and behavior-guided escalation decides when to perform controlled disclosure and countermeasures.
What related research exists?
Related work includes feedback-driven penetration agents and honeypots that treat deception as preconfigured artifacts; baselines are no defense, static deception, and fixed escalation.
Related discussion is in the introduction and Background, with no separate Related Work section.
Autonomous Penetration Testing Agents
- Closed-loop workflow: The authors summarize PentestGPT (2023), CAI (2025), PentAGI (2025), AIDA (2026), pentest-ai (2026), pentestagent (2026), Strix (2026) as a closed loop of Planning, Discovery, Attack, Reporting (Figure 2, citing [1, 2, 5, 6, 10–12]). Given a website and testing objectives, the agent decomposes subgoals, forms vulnerability hypotheses, uses tool calls and multi-step actions to verify and exploit vulnerabilities, then organizes trajectories into reports.
- Feedback-driven: The authors believe observed responses update hypotheses and subsequent plans; this design also gives the defender an opportunity to manipulate feedback.
Honeypots
- Traditional honeypots: Pouget et al. (2003) and Spitzner (2003) discuss honeypots, honeynets, and honeytokens: using decoy hosts, services, or artifacts to attract malicious activity and support detection, observation, and intelligence gathering.
- Deception against LLM attackers: Ayzenshteyn et al. (2025)'s Cloak, Honey, Trap, and Pasquini et al. (2024) are classified by the authors as placing model-directed instructions, honeytokens, and other deceptive artifacts into the environment to mislead, detect, delay, or disrupt autonomous agents. The authors state these approaches mostly treat deception as pre-configured artifacts or responses, offering limited support for adapting to an agent's multi-step evolving attack state.
Baselines and Evaluation Environment
- Baseline methods: Table 1 defines M1 as no defense, M2 as static deception (fixed deceptive responses and artifacts), M3 as fixed escalation (dynamic deception, counterattack after three interactions). The evaluation environment is a business endpoint (real SQL injection) and a defense control endpoint in an authorized sandbox, not a named public benchmark.
The authors position AgentTrap as a closed-loop honeypot: using sentinel endpoints, stateful deception based on the protected application, and behavior-guided escalation to adjust responses during interaction, rather than only deploying pre-configured decoys.
How does the paper address this problem?
AgentTrap is accessed via sentinel endpoints, then an LLM controller performs stateful deception based on application state, and decides counterattack timing based on subsequent behavior.
Overall, AgentTrap turns the honeypot into a closed loop: first, sentinel endpoints catch reconnaissance, then responses based on real application state maintain deception, and finally, countermeasures are decided based on subsequent behavior.
Three challenges and corresponding design
- Isolation: The honeypot must be isolated from legitimate workflows; deployment should not affect benign users or change real application behavior.
- Consistency: The defender cannot see the agent's internal reasoning. Feedback must still appear credible and consistent across multi-step attacks; otherwise, the agent may abandon the deception path and return to the real attack surface.
- Escalation timing: Initial contact may be mere reconnaissance. The honeypot must use subsequent behavior to determine how deep the attack goes and when to launch countermeasures.
- Three stages: Sentinel endpoints, stateful deception, and behavior-guided escalation correspond to the above points.
Sentinel endpoints
- Not in normal flow: Endpoints do not appear in normal application workflows. The authors believe benign users are unlikely to access them, but automated reconnaissance may still discover them.
- Purpose: Separate attack-oriented interactions from benign access, avoiding defense deployment interfering with legitimate users or changing real application behavior.
Application-based stateful deception
- Trigger: After the agent accesses a sentinel endpoint, an LLM controller orchestrates deceptive interactions. The paper does not provide the model name of this controller.
- Input: The controller generates context-dependent responses based on the current request, prior interactions, and the application's actual runtime state, allowing the endpoint to adjust during interactions while maintaining behavioral consistency.
- Grounding: The authors state that constraining interactions to real application behavior in the real environment is used to reduce hallucinated or internally inconsistent feedback that might expose deception.
Behavior-guided escalation
- Weak to strong: Initially, only limited deceptive feedback is returned, and the agent's response is observed.
- Pursuit signals: Continued probing, refined attack inputs, and increasingly targeted requests are used to determine whether the agent continues along the deception path. Based on this, stronger signs of exploitability are gradually provided.
- Countermeasure condition: Countermeasures are launched only after observed behavior meets escalation conditions, to avoid premature activation when the agent has not yet acted on deceptive feedback. The paper does not specify formal thresholds for this condition.
- Countermeasure target in evaluation: The experiment defines countermeasure success as capturing the attacking agent's API key. The motivating example is an endpoint using deceptive feedback to induce the agent to retrieve a key from its own environment and submit it in subsequent requests (Figure 1); the original feedback text is not reproduced here.
Success criteria
- Attack success: Retrieving a pre-placed flag via the SQL injection path.
- Countermeasure success: Capturing the attacking agent's API key.
- Fixed strategy in baseline: M3 launches countermeasures after three interactions; AgentTrap decides when to counterattack based on inferred agent behavior (Table 1 method description).
What experiments did the paper conduct?
Relative to no defense, the eight-agent total real-target ASR dropped from 95.8% to 79.2%, with 18.8% of runs eliciting an API key; most combinations had a counterattack rate of 0.
Experimental Setup
- Environment: In an authorized sandbox, there are two fully decoupled endpoints: the business endpoint contains a real SQL injection, and the defense control endpoint implements deception and counterattack. Attack success means retrieving a pre-placed flag via that injection path; counterattack success means capturing the attacking agent's API key.
- Subjects: Eight public autonomous penetration testing agents. The authors state the repositories average over 28k GitHub stars. Each is paired with two documentation-recommended or officially supported backends: AIDA, Claude Code, PentestGPT use Claude Opus 4.8 and Claude Sonnet 5; pentest-ai, PentAGI, Strix, CAI, pentestagent use DeepSeek-V4-Flash and DeepSeek-V4-Pro.
- Comparison: M1 is no defense; M2 is static deception, returning fixed deceptive responses and artifacts; M3 is fixed escalation, providing dynamic deception and counterattacking after three interactions; M4 is AgentTrap.
- Recording: Table 1 has 3 runs per cell, recorded as x/3. The paper does not mention LLM review, judgment thresholds, human agreement, or statistical tests, nor does it specify which LLM is used for the honeypot controller. Figure 3 additionally records tokens (k) and wall-clock time (s) for each agent under the four configurations.
Main Results
The table below is excerpted from Table 1. The totals of 95.8% and 79.2% cover all 16 agent–backend combinations, not just the rows listed in the table. M2's CSR is 0/3 throughout the table, so it is not listed separately.
| Agent + LLM | M1 ASR | M2 ASR | M4 ASR | M4 CSR | M3 (ASR, CSR) | | AIDA + Claude Opus 4.8 | 3/3 | 3/3 | 3/3 | 0/3 | 3/3, 0/3 | | PentestGPT + Claude Opus 4.8 | 3/3 | 2/3 | 2/3 | 0/3 | 3/3, 0/3 | | PentestGPT + Claude Sonnet 5 | 2/3 | 0/3 | 2/3 | 0/3 | 3/3, 0/3 | | Strix + DeepSeek-V4-Pro | 3/3 | 3/3 | 2/3 | 0/3 | 2/3, 0/3 | | CAI + DeepSeek-V4-Flash | 3/3 | 3/3 | 0/3 | 3/3 | 1/3, 2/3 | | CAI + DeepSeek-V4-Pro | 3/3 | 3/3 | 2/3 | 2/3 | 3/3, 1/3 | | pentestagent + DeepSeek-V4-Flash | 2/3 | 3/3 | 0/3 | 3/3 | 1/3, 2/3 | | pentestagent + DeepSeek-V4-Pro | 3/3 | 3/3 | 3/3 | 1/3 | 3/3, 0/3 |
Omitted combinations identical to the AIDA + Claude Opus 4.8 row: AIDA + Claude Sonnet 5, both backends for Claude Code, both backends for pentest-ai and PentAGI, and Strix + DeepSeek-V4-Flash. For these rows, ASR is 3/3 for M1–M4 and CSR is 0/3 for M2–M4.
- Totals: The authors state that relative to no defense, AgentTrap reduces the overall real-target ASR from 95.8% to 79.2% and elicits API keys in 18.8% of runs; it achieves the most counterattack successes and the most consistent ASR reduction, outperforming static deception and fixed escalation.
- Counterexamples: Not every ASR in the table above is lower than that row's M1. PentestGPT + Claude Sonnet 5's M3 ASR is higher than its M1, and that row's M2 ASR is lower than M4. pentestagent + Flash's M2 ASR is higher than its M1.
- Counterattack distribution: The authors state that successful counterattacks are concentrated in CAI and PentestAgent, and AgentTrap generally outperforms fixed escalation. In the table, non-zero CSR appears only in these two; their M4 CSR is not lower than their M3.
Execution Trajectories
- Approach: The authors examine each agent's execution trajectories, distinguishing counterattack success from two types of resistance.
- How they fell for it: Successful cases concentrate in CAI and PentestAgent: they retrieve the API key from their own execution environment and submit it as a candidate exploitation value to the honeypot endpoint. Although CAI requires the model to check responses for malicious content, the authors state it still submits when the credential request is framed as a legitimate exploitation parameter. The authors state that Flash's counterattack success rate is notably higher than Pro's, consistent with the direction of CAI and pentestagent's M4 CSR in the table.
- Resistance: The authors state that AIDA, Claude Code, and PentestGPT did not surrender keys, mainly because the underlying LLM recognized that the deceptive endpoint was collecting credentials and refused to disclose them, rather than agent-specific protections. Strix's exploitation tools are in an isolated sandbox and cannot access the process holding the API key, so the model cannot disclose it even if it follows instructions. The authors believe AgentTrap can be blocked at the model layer or the agent layer. The paper offers no additional explanation for the zero CSR of pentest-ai and PentAGI.
Resource Overhead
- Figure 3: Eight subplots for AIDA, Claude Code, PentestGPT, PTAI, PentAGI, Strix, CAI, PentestAgent; the labeled quantities are tokens (k) and wall-clock time (s), with configurations M1–M4.
- Authors' interpretation: The authors state that static deception can increase the attacker's token and time consumption; AgentTrap is not always the highest resource overhead because it mainly steers the agent toward a controlled path rather than prolonging interaction as much as possible.
Other Ablations and Analyses
- The paper does not report AgentTrap's escalation threshold, controller LLM, or disclosure strength sweep; counterattacking after three interactions is only described in the M3 method description.
- The omitted rows maintain ASR of 3/3 and CSR of 0/3 across the four strategies. The pentestagent + Pro M4 row counts both attack success and counterattack success simultaneously; these are not mutually exclusive outcomes.
- PentestGPT + Claude Sonnet 5's M1 ASR is already not full runs; even without defense, attacks did not all succeed.
What are some points that can be further explored?
The authors plan to extend state control and inducement strategies, and expand the evaluation, increase repetitions, and measure real-world deployment.
Limitations and future directions noted by the authors
- State and strategy: The authors plan to extend more complete state control and more diverse inducement strategies; they will model richer attack states and longer interaction histories so that deception paths and escalation decisions adjust with state, rather than relying only on the current set of interaction patterns (Section 5, Extending the Design).
- Inducement targets: The authors plan to explore inducement strategies beyond credential requests to align with different attack stages and countermeasure goals (Section 5).
- Evaluation scope: The authors plan to add more vulnerability types, autonomous penetration testing agents, and LLM backends to examine whether effects hold beyond the current settings (Section 5, Expanding the Evaluation).
- Repetition count: The authors plan to substantially increase repeated runs per configuration to account for the stochastic behavior of LLM agents and improve measurements (Section 5).
- Real-world deployment: The authors plan to deploy in real environments, measure the effect of diverting agents from real assets, reducing attack success, and maintaining interaction with deception endpoints, and measure deployment overhead and interference with legitimate users (Section 5, Real-World Deployment).
Experimental coverage
- Subjects: Table 1 covers eight agents, each with two document-recommended or officially supported LLM backends, 3 runs per cell.
- Environment and metrics: In an authorized sandbox, a business endpoint with a real SQL injection and a defense control endpoint; metrics are ASR for retrieving the flag, CSR for capturing the API key, and token and wall-clock time in Figure 3.
- Baselines: M1 no defense, M2 static deception, M3 fixed escalation after three interactions, M4 AgentTrap.
- Trajectories: The authors examined each agent's execution trajectories and noted refusals by AIDA, Claude Code, and PentestGPT, and sandbox isolation for Strix.
- Not specified: The paper does not report the model name of the honeypot LLM controller, formal rules for escalation conditions, or statistical tests.
Summarize the main content of the paper
AgentTrap, as a closed-loop honeypot, reduces the combined real-target ASR from 95.8% to 79.2% and elicits the API key in 18.8% of runs.
AgentTrap is what the authors call the first closed-loop honeypot for autonomous penetration testing agents, used to pin down multi-step attacks with adjustable feedback on black-box network services and collect agent-side evidence under controlled conditions.
The problem: such agents revise plans and call tools based on target responses; conventional honeypots' static artifacts and predefined responses struggle to remain credible across multiple steps and to decide when to counterattack.
The method has three steps. Sentinel endpoints are not in normal workflows, used to avoid benign users. An LLM controller generates deceptive responses based on the current request, history, and real application state. Countermeasures are launched only after behaviors like continued probing meet escalation conditions; in the experiment, the countermeasure is capturing the attacker's API key.
In an authorized sandbox, the business endpoint has a real SQL injection, and another endpoint handles deception. Eight agents each have two document-recommended or officially supported backends, 3 runs per cell. The authors report: relative to no defense, the combined real-target ASR drops from 95.8% to 79.2%, with API keys elicited in 18.8% of runs, outperforming static deception and fixed escalation. In Table 1, countermeasure successes occur with CAI and pentagent; the Flash row's CSR is higher than the same agent's Pro row. AIDA, Claude Code, and PentestGPT's models refuse to hand over keys; Strix cannot read keys due to tool sandbox isolation. Several combinations' ASR is not lower than M1, static deception has lower ASR in individual rows, but M2's CSR is all 0/3.
The authors conclude that feedback can support countermeasures against autonomous penetration agents; resistance depends both on whether the model recognizes deceptive requests and whether the architecture isolates sensitive resources from the execution environment.