Dual-Agent Verification and False Positive Management in AI Penetration Testing
As AI agents increasingly handle penetration testing, their tendency to misinterpret anomalies as vulnerabilities can lead to high false positive rates and erode trust in automated security tools. This article explores a dual-agent architecture that separates discovery from verification, establishing strict evidence criteria, code-based state constraints, and robust scope control to ensure reliable, auditable, and secure AI-driven security testing.
Why AI Penetration Testing Requires Independent Verification
AI agents can understand page structures, invoke security testing tools, analyze responses, and complete tasks from asset discovery to report generation. Compared to traditional rule-based scanning, this approach offers stronger contextual understanding but introduces new risks: the model might misjudge anomalies as vulnerabilities or prematurely conclude “confirmed” findings with insufficient evidence.
In security testing, false positives affect more than just report readability. They increase manual review costs, disrupt vulnerability prioritization, and can cause development teams to lose trust in automated security tools. Therefore, an AI security testing system must not only focus on “how many issues are found” but also answer the following questions:
- Can findings be repeatedly verified?
- Is the verification process using an independent context?
- Are conclusions supported by sufficient evidence?
- Can the system remain cautious when confirmation is not possible?
- Are testing actions always confined to the authorized scope?
Based on these requirements, a more robust design splits “discovery” and “verification” into two independent agent roles. The former seeks potential leads, while the latter conducts reviews based on restricted permissions and clear criteria.
How the Dual-Agent Architecture Works
In the dual-agent model, the primary agent handles information gathering, page analysis, API identification, input vector localization, and preliminary risk assessment. It can invoke browsers, terminals, and authorized security testing components to form an evidence package containing requests, responses, context, and initial judgments.
When the primary agent submits a potential vulnerability, the system does not directly generate a confirmed conclusion. Instead, it initiates a completely new verification agent. The verification agent does not inherit the primary agent’s full reasoning process, nor does it take its conclusions for granted. It treats the content provided by the primary agent as material to be inspected.
A complete verification object typically includes:
- Target assets and authorized scope;
- Type of potential issue;
- Trigger conditions and reproduction steps;
- Relevant request and response summaries;
- Anomalies observed by the primary agent;
- Test actions already executed;
- Remaining uncertainties.
The verification agent must re-check key facts and complete the review within a limited number of interactions and a set timeframe. This design mitigates the risk of the “same model continuously reinforcing its own judgments” and helps identify errors the primary agent made in context understanding, causal inference, or response interpretation.
Verification Conclusions: Beyond Simple “Yes” or “No”
In actual security testing, information is often incomplete, permissions insufficient, or environments invisible. Therefore, verification results should not be simply categorized as “vulnerability” or “non-vulnerability.” A more reasonable result model includes at least three categories:
- Confirmed: The verification agent can repeatedly trigger the issue according to predefined standards and obtain evidence matching the nature of the vulnerability.
- Excluded: Verification shows that the anomalous behavior is due to normal business logic, expected configuration, front-end display differences, or artifacts caused by the testing method.
- Undetermined: The verification process lacks sufficient evidence to prove the vulnerability exists, nor can it reasonably rule out the risk. For instance, the issue might require additional accounts, specific business states, internal network conditions, or callback results unobservable by the verification agent. In such cases, no forced conclusion should be drawn; instead, it should be routed to a manual review queue.
“Undetermined” does not mean “no issue.” It represents the evidence boundary of the current automated process, helping security personnel accurately identify which items still require human intervention.
Setting Specific Criteria for Different Vulnerability Types
A model’s natural language judgment cannot replace executable verification criteria. For different types of issues, minimum evidence thresholds must be predefined.
Take script injection issues, for example. Simply seeing input echoed back verbatim does not prove an exploitable risk. The system must also confirm whether the content enters an executable context, whether it actually triggers expected behavior, and whether the relevant output originates from the target application rather than the testing environment itself. If it is merely text display, security-encoded, or blocked by browser policies, it should not be directly classified as a confirmed vulnerability.
For server-side request forgery (SSRF) issues, verification standards should be even stricter. The system needs to confirm that the request was indeed initiated by the target service and reached a temporarily generated, unpredictable test address generated by the verification process. During testing, reliance on automatic redirects, cached results, or callback signals generated by the scanner itself should be minimized. Only when the callback source, time relationship, and request characteristics form a complete evidence chain is it appropriate to elevate the finding to a confirmed result.
For access control issues, judgments cannot be based solely on whether the page returns content. It is also necessary to compare response differences across different identities, permission levels, or resource identifiers, and confirm whether the access result exceeds the current subject’s authorized scope.
For injection issues, distinguish between error messages, response delays, result changes, and controllable impacts. A single anomaly might stem from network fluctuations, caching, backend load, or business parameter validation; repeat testing and control samples must be used to reduce false positives.
Using Code Rules to Constrain Model Conclusions
In automated security systems, models are well-suited for understanding complex contexts but should not have unrestricted final adjudication power. Critical state transitions should be controlled by deterministic code.
For example, the verification agent can only submit “Confirmed” after completing required actions, obtaining necessary evidence, and meeting judgment criteria. If the model directly outputs a confirmation conclusion without executing a successful retest, the state machine should automatically downgrade the result to “Undetermined” rather than accepting the model’s linguistic expression.
A state design similar to the following can be adopted:
Discover Lead↓Generate Evidence Package↓Independent Verification├─ Meets Criteria → Confirmed├─ Clearly Invalid → Excluded└─ Insufficient Evidence → Pending Manual Review
The code layer should also verify the following:
- Were required verification steps executed?
- Were authorized targets used?
- Were complete request and response summaries recorded?
- Was there repeat or comparative testing?
- Were time, count, or permission limits exceeded?
- Is the model’s conclusion consistent with actual evidence?
This division of labor—“code constrains, model analyzes”—is more suitable for high-risk security scenarios than relying entirely on natural language judgments.
Scope Control as a Prerequisite for Automated Testing
Once AI agents possess autonomous planning capabilities, the risk of unauthorized scanning increases significantly. A seemingly reasonable redirect or external resource reference could induce the testing process to access unauthorized hosts. Therefore, the system must enforce scope control at the tool invocation layer, rather than merely reminding the model in the prompt not to “cross the line.”
Scope control should at least cover:
- Initial authorized targets;
- Explicitly allowed subdomains or address ranges;
- Allowed protocols and ports;
- Whether following redirects is allowed;
- Whether accessing third-party resources is allowed;
- Whether sending high-risk test requests is allowed.
Before each tool invocation, the system should normalize and verify the target, including hostname resolution, address ownership, port checks, and redirect chain inspection. If the target is outside the authorized set, the call should be blocked before execution, rather than logging an alert after the request completes.
Additionally, the scope policy must be auditable. The system needs to log invocation time, target, invoked component, request type, block reason, and associated task, allowing the complete process to be reconstructed in case of disputes or anomalous behavior.
Permission Isolation and Verification Environment Design
The verification agent should ideally use read-only permissions and a minimized toolset. The primary agent can handle exploration tasks, but the verification agent’s goal is to confirm facts and should not possess unrestricted attack capabilities.
Safer isolation methods include:
- Creating independent sessions for verification tasks;
- Not inheriting the primary agent’s conversation history;
- Passing only structured evidence, not raw unprocessed instructions;
- Restricting callable tools and their parameters;
- Setting maximum interaction counts and execution durations;
- Defaulting to prohibiting write, delete, and bulk modification actions;
- Storing sensitive credentials separately from verification logic.
Furthermore, text from web pages, API responses, and file contents may contain content designed to induce the model to alter its behavior. The system should treat this data as untrusted input, preventing it from overriding system-level security policies. The verification agent’s instruction priority, tool permissions, and target scope should be centrally managed by an external controller.
Reports Should Present Both Conclusions and Evidence
A high-quality report should not just provide the vulnerability name and risk level; it should also explain how the conclusion was reached. It is recommended to retain the following information for each finding:
- Affected assets;
- Risk type and impact scope;
- Reproduction conditions;
- Key request and response summaries;
- Actions executed by the verification agent;
- Pass or fail criteria;
- Whether environmental limitations exist;
- Automated conclusion and its confidence state;
- Recommended manual review items.
For “Pending Manual Review” results, missing conditions should be explicitly noted, such as needing a second test account, requiring business personnel to confirm expected behavior, or needing to observe callbacks within the target network. This prevents manual reviewers from wading through irrelevant logs and allows them to focus on issues that genuinely cannot be closed by the automated process.
Evaluating the Effectiveness of False Positive Governance
Without public benchmark data, users should not judge system quality solely based on feature lists. A more reasonable evaluation approach is to build an internal test set covering real vulnerabilities, normal behaviors, boundary conditions, and easily confused anomaly scenarios.
It is recommended to focus at least on the following metrics:
- False positive rate;
- False negative rate;
- Repeat success rate of confirmed results;
- Proportion of results pending manual review;
- Average verification cost per finding;
- Unauthorized invocation block rate;
- Report evidence completeness;
- Conclusion modification rate after manual review.
The test set should include different business processes, permission models, response formats, and network conditions, distinguishing between “discovery capability” and “verification capability.” Only in this way can one determine whether the dual-agent mechanism actually reduced false positives or merely shifted more results to the manual queue.
Caution in Implementation
Dual-agent verification can improve the reliability of AI penetration testing, but it cannot replace professionals, authorization processes, and human judgment. Automated systems remain susceptible to incomplete testing environments, insufficient identity permissions, complex business semantics, and model reasoning biases.
When deploying in production environments, the following principles should be adhered to:
- All tests must obtain explicit authorization;
- Conduct low-risk, low-concurrency verification first;
- Require manual approval for high-impact actions;
- Default to least privilege;
- Audit all tool invocations;
- Strictly distinguish uncertain results from confirmed results;
- Regularly evaluate false positives and false negatives using internal samples;
- Fully disclose automation boundaries in reports.
Overall, the key to AI penetration testing is not having a single agent perform more actions, but establishing a security process that is restrictable, reviewable, explainable, and accountable. By separating discovery and verification roles, defining clear vulnerability criteria, using code to constrain model states, enforcing strict scope control, and preserving manual entry points for uncertain situations, enterprises can improve testing efficiency while reducing the risks of false positives, unauthorized access, and incorrect remediation.
