Can AI Vulnerability Discovery Work in Production? A Practical Evaluation
This article evaluates whether AI-driven vulnerability discovery is ready for production use by testing two representative open-source approaches: a project-level deep audit framework and a lightweight command-line scanner. Using a real 20,000-line project and a set of deliberately flawed samples, it compares detection rates, verifiability, execution time, token consumption, and cost. The findings show that AI is production-ready as a supplementary layer rather than a replacement for human auditors, especially for cross-file business logic flaws and configuration issues. The article also breaks down the underlying architecture, including multi-agent collaboration and sandbox-based verification, and offers guidance on layered deployment, result triage, cost control, and risk awareness.
1. Background: Why “Can AI Find Vulnerabilities?” Deserves a Real Test
Over the past two years, AI coding assistants and code analysis platforms have proliferated, with marketing claims often centered on sweeping conclusions such as “fully automated vulnerability discovery” or “replacing manual audits.” For enterprise engineering teams, however, the real question is not whether AI can read code, but three more practical ones:
- Detection stability: How much do results vary across projects of different sizes, frameworks, and coding styles?
- Verifiability: Are the reported issues genuinely exploitable defects, or merely suspicious guesses that cannot be reproduced?
- Affordability: Do token consumption, execution time, and human review costs remain proportional?
To address these questions, this article tests two representative open-source technical approaches: a project-level deep audit framework (referred to as Approach A) and a lightweight command-line scanner (referred to as Approach B). Neither approach is recommended over any specific product. Instead, both are treated as engineering paradigms, and their capability boundaries and deployment patterns are discussed.
2. Test Design: Two Paradigms, Two Sample Sets
To make the results comparable, the evaluation deliberately uses a dual-track design of “real project + constructed samples.”
Sample 1: A real open-source project. A medium-sized server-side project of roughly 20,000 lines of code and more than 400 files was selected. It covers typical attack surfaces such as routing entry points, the data access layer, configuration loading, and external calls. This type of project has a well-structured layout and cross-file context, making it suitable for testing a tool’s global understanding.
Sample 2: Constructed vulnerable samples. A small web service file was written manually to contain four typical defect types: command concatenation and execution, path traversal, dynamic code evaluation, and a debug switch enabled in production. The value of constructed samples lies in the “known answers,” which allow direct calculation of detection rates and severity classification accuracy.
Both sample sets use the same underlying large language model to avoid model differences contaminating the conclusions.
3. Results: Detection Capability Diverges from Verifiability
3.1 Performance of the Project-Level Deep Audit
On the real project, the quantitative results for Approach A were roughly as follows:
| Metric | Measured Value |
|---|---|
| Code size | ~20,000 lines / 448 files |
| Execution time | ~10 minutes |
| Token consumption | ~550,000 |
| Total findings | 10 |
| With reproducible verification | 2 |
| Suspected, pending manual confirmation | 8 |
| Estimated cost | Very low (priced by a Flash-class model, only a few cents) |
The most notable aspect of this data is not the “10 findings” but the 2:8 structure. Two items were real defects for which the tool wrote its own attack scripts and successfully executed them in an isolated sandbox. The remaining eight were explicitly labeled as “unverified” rather than being mixed into the conclusions to inflate the count.
3.2 Performance of the Lightweight Scanner
On the constructed samples, Approach B achieved full detection of 4/4, with both CWE identifiers and severity ratings correct:
| Defect Type | Associated Weakness | Severity | Confidence | Result |
|---|---|---|---|---|
| OS command concatenation | CWE-78 | Critical | 1.0 | Detected |
| Path traversal | CWE-22 | High | 1.0 | Detected |
| Dynamic code evaluation | CWE-94 | Critical | 1.0 | Detected |
| Debug mode enabled in production | CWE-215 | Medium | 0.7 | Detected |
The last item is particularly noteworthy. A debug switch is a configuration defect, which traditional rule-based and taint-analysis scanners often fail to cover. A semantic-understanding model recognizes it relatively well, and the slightly lower confidence is consistent with its limited harm boundary.
3.3 Conclusion: Trustworthy, with Preconditions
Taken together, the two rounds of testing support a relatively measured judgment: AI vulnerability discovery is production-usable at the current stage, but it must be positioned as a “supplementary layer” rather than a “replacement layer.” Its incremental value is concentrated in two areas where traditional tools are weak: cross-file business logic defects and configuration or best-practice issues. Its main cost lies in manually adjudicating “suspected” items.
4. Where the Capability Comes From: More Than “Letting the Model Read the Code”
The difference in effectiveness between the two paradigms stems from their implementation architecture, not the model itself.
4.1 Multi-Agent Division of Labor
Approach A simulates the role structure of a real security team, with four roles collaborating:
- Orchestrator: Defines the audit strategy, splits tasks, and aggregates and deduplicates results.
- Reconnaissance agent: Parses the project structure and identifies frameworks, routes, and external input entry points.
- Analyzer: Reviews files or modules in depth and flags suspicious points using a vulnerability knowledge base.
- Verifier: Writes exploit scripts for suspicious points, executes them in a sandbox, and returns evidence.
The essence of this division is breaking a long-context task into multiple short-context subtasks, avoiding missed detections caused by attention dilution in a single inference pass, while decoupling “finding” from “proving.”
4.2 Sandbox Verification: Turning “Suspected” into “Evidence”
The verification stage is the dividing line for the entire approach. Most tools stop after outputting “an injection may exist here,” whereas the verifier constructs a minimal input and actually executes it. Only when an observable result is obtained (such as command output or unauthorized file content) is the issue upgraded to a confirmed defect. A simplified flow is shown below:
# Pseudocode: the verifier's minimal loopfinding = analyzer.report() # suspicious point output by the analyzerpoc = verifier.generate_poc(finding) # generate a minimal verification scriptresult = sandbox.run(poc) # run in an isolated environment with no production network or real credentialsif result.confirmed:report.mark(finding, level="confirmed", evidence=result.trace)else:report.mark(finding, level="suspected", reason=result.reason)
The sandbox must follow the principle of least privilege: no external network access, no real keys, a separate file system, and resource quotas, so that the verification action itself does not introduce risk.
4.3 Engineering Advantages of the Lightweight Paradigm
The value of Approach B lies in its low integration cost: single-file input, second-level response, and structured output fields (weakness category, severity, confidence). It is naturally suited to being embedded in pre-commit checks and continuous integration pipelines as a fast gate.
5. Deployment Recommendations: Layered Integration and Workflow Orchestration
- Layered deployment: Use the lightweight scanner as a fast gate for every commit and merge request; use the deep audit before releases, after major refactors, or for periodic audits of core modules.
- Tiered result handling: Confirmed items go directly into the remediation workflow; suspected items enter a manual review queue with the original evidence chain and code locations preserved, avoiding “the report is the endpoint.”
- Cost control: Perform incremental audits based on the scope of changes, reuse cached parsing results where possible, increase audit frequency for high-risk modules, and lower the sampling rate for low-risk modules.
- Integration with existing systems: Map results uniformly into an internal defect management platform, and connect to logging services and monitoring alerts to track remediation time and recurrence rates.
- Optional cloud deployment: If a cloud-based approach is used, a container platform can typically host the sandbox, object storage can hold reports, and a message queue can smooth out scheduling peaks, enabling elastic scaling and audit traceability.
6. Limitations and Risk Awareness
Three boundaries must be clearly understood. First, model output is inherently uncertain, and repeated runs on the same project may produce different results, so fixed versions and prompt strategies are needed to ensure reproducibility. Second, business-semantic defects (such as authorization logic flaws or state machine bypasses) still rely heavily on context, and verification success rates remain limited. Third, the scanning process involves sending source code externally, so data masking, permission isolation, and data retention policies should be in place; sensitive projects should prioritize private deployment.
Overall, AI vulnerability discovery has moved from “usable in demos” to “usable in engineering.” The right approach is to treat it as a tireless first-pass screener and evidence generator, while keeping the final judgment in the hands of security engineers.
