# LLM Security Scanning in Practice: 14 High-Severity Bugs in Two Weeks
Large language models can find deep, logic-level vulnerabilities in mature C++ codebases. This article breaks down a published benchmark — 14 high-severity bugs in about two weeks on ~6,000 files — explains why ownership and lifetime reasoning gives LLMs an edge over rule-based SAST, and lays out a practical hybrid pipeline: candidate scoring, rules plus model division of labor, mandatory evidence constraints, dynamic verification, and incremental gating. It closes with four hard limits (hallucination, context truncation, prompt injection, compliance) and an adoption checklist.
1. Where “human eyes on code” breaks down
Anyone who has done a security audit on a large C++ codebase knows the pattern: one segfault, one suspicious memory access, sixty thousand symbols, hundreds of thousands of lines, a call chain spanning a dozen files — and by the fortieth jump, a human has already lost context. The bottleneck isn’t engineer skill. It’s that human working memory doesn’t scale with the dependency graph of a modern codebase.
Traditional static analysis (SAST) tries to close that gap with automation, but its ceiling is set by its rule set. Tell it “an uncontrolled format string is dangerous,” and that is the only pattern it hunts. Defect classes the rules don’t cover — and logic bugs that only surface across functions and modules — sit in a blind spot. That produces two chronic symptoms: false negatives on real vulnerabilities, and false positives at volume from pattern matches.
When LLMs entered this stage, what changed was the analysis paradigm, not matching speed. The model doesn’t compare features against code; it reads code as a semantic object. It understands what a component is responsible for, traces data from external input all the way to a dangerous sink, and infers object ownership and lifetime. That is precisely the part rule engines cover worst.
2. The measured numbers: why this figure is worth attention
A recently disclosed industry benchmark produced fairly persuasive quantitative results. An AI research team collaborated with a large open-source browser community to systematically scan the project’s C++ code:
| Metric | Value |
|---|---|
| Scan scope | ~6,000 C++ source files |
| Scan duration | ~2 weeks (including long-running autonomous execution) |
| Reports submitted | 112 |
| Confirmed vulnerabilities | 22 (14 high, 7 medium, 1 low) |
| Time to first finding | ~20 minutes |
| Report confirmation rate | ~20% |
A few points are worth unpacking.
The target was the hardest tier. The scanned project is one of the most heavily tested open-source projects in the world, with decades of security audit history and continuous attention from high-intensity researchers. Finding 14 high-severity bugs in a codebase where the low-hanging fruit was picked long ago suggests the model isn’t contributing textbook defects, but deep path problems that repeated human audits missed. According to the disclosing party, this volume is close to one-fifth of that community’s high-severity fixes for all of 2025.
Coverage spread horizontally. Findings spanned the scripting engine, the bytecode/sandbox runtime, the rendering pipeline, and memory management — not one corner mined repeatedly. That indicates long context and autonomous execution genuinely support breadth of exploration across modules.
A 20% confirmation rate is not low. These are raw, fully automated findings with no human filtering applied. Human security researchers typically see confirmation rates around 30%–50%, so the gap is now down to the same order of magnitude — and given the difference in labor cost, the shift in cost-to-output ratio is structural.
One telling process detail. At first the research team manually re-verified every report before submitting. After a handful, the community side said per-item verification wasn’t necessary: submit in batches and let maintainers triage. That is a de facto endorsement of AI report quality, and it means the serial “AI finds → human verifies” bottleneck can be partially removed.
The market noticed. Once the capability was public, several security vendors and cloud providers saw their stock drop a few percent that day. Capital markets price “the marginal cost of auditing collapses” far more sharply than they react to a feature demo.
3. Why LLMs can surface “logic” bugs
Breaking the mechanism down, the advantage comes from three things:
- Context capacity. A million-token window puts “a single file + related headers + callers + data structure definitions” in view at once, rather than relying on fragile symbol-table assembly.
- Long-horizon autonomous execution. In an agent loop, the model decides for itself which function to read next — iterative evidence gathering instead of a one-shot verdict.
- Ownership and lifetime reasoning. Use-after-free, type confusion, double free, and initialization-order bugs are fundamentally violations of ordering and ownership constraints. They are closer to natural-language reasoning than to syntax pattern matching.
A representative defect pattern:
// Typical lifetime defect (illustrative)Element* g_active = nullptr;void OnPointerDown(Element* e) {g_active = e;e->AddRef();}void OnPointerUp() {Element* t = g_active;g_active = nullptr;t->Release(); // refcount hits zero -> object destroyedDispatchEventSync(); // synchronous dispatch; callbacks may run script and re-enter this modulet->UpdateCursor(); // <-- use after free}
A conventional rule engine will typically report only the local pattern “pointer used after Release.” It struggles to recognize that DispatchEventSync is a re-entrant script execution boundary. The model’s reasoning chain fills that step in explicitly: Release invalidates the object → synchronous dispatch permits arbitrary script callbacks → a callback can extend or mutate object state → the later dereference is a use-after-free. What it outputs is a hypothesis with an evidence path, not just an alert.
4. A hybrid scanning pipeline you can actually run
Scanning a whole repository with an LLM alone is both expensive and inefficient. The more practical engineering approach is layered filtering: use deterministic methods to narrow the field, and spend expensive semantic reasoning where things actually look suspicious.
Layer 1: Rank candidate files. Don’t scan in a flat sweep. Score and queue by “change surface + attack surface + memory-operation density + historical defect density”:
score = (2.0 * is_recently_changed+ 1.5 * parses_untrusted_input+ 1.2 * has_raw_memory_ops+ 1.0 * ownership_complexity # shared ownership, refcounting, GC interaction+ 0.8 * historical_cwe_density) # defect density for this directory
Layer 2: Split the work between rules and the model. The rule engine handles high-certainty, enumerable patterns (format strings, command concatenation, out-of-bounds indexing). The model handles cross-function data flow and lifetime reasoning. Then intersect and diff the two result sets.
Layer 3: Enforce evidence requirements. This is the single most important lever for controlling false positives. At the prompt level, force structured output, and downgrade anything lacking a reachable path to “needs manual review”:
[Constraints]- Audit only. Do not emit directly exploitable attack payloads.- Every finding must include: defect class, triggering preconditions, a fulldata-flow path (file:line), a minimal fix, and a confidence score (0-1).- If no complete reachable path can be given, mark needs-review.Such findings must not be counted as high severity.[Output] JSON: {"type","cwe","severity","evidence_path":[...],"preconditions":[...],"confidence","fix"}
Layer 4: Close the loop with dynamic verification. The model’s job is to “propose falsifiable hypotheses”; dynamic tooling decides whether they hold. Attach fuzzing, memory-error detection, and boundary/invariant assertions to suspicious input points, and build minimal reproducers for paths that look like logic bugs. Only findings that are reproduced or disproved by code get written to the database. This pushes false positives down substantially.
Layer 5: Incremental scanning and gating. Full deep scans are costly and belong in off-peak windows; day-to-day scanning should cover only the changeset:
# Nightly full scan + incremental diff scan (illustrative)on:pull_request:paths: ["**/*.cc", "**/*.h"]schedule:- cron: "0 19 * * *" # full deep scan scheduled in an off-peak windowjobs:ai-audit:runs-on: [self-hosted, sandbox]steps:- checkout- restore-build-db # reuse compile DB / symbol index, avoid re-indexing- run: ai-scanner scan --scope diff --max-file-tokens 60000 --evidence-required- run: ai-scanner report --gate new-high --fail-on true
Runtime recommendations: run scanning as stateless container jobs on a container platform, use a message queue to smooth and distribute load, store scan artifacts and reports in object storage, and monitor token consumption, per-file latency, and confirmation/false-positive trends through your logging and alerting services. For confidential codebases, prefer a private network or self-hosted deployment, and enforce sandbox isolation for scanning containers with networking disabled or restricted to an outbound allowlist.
5. Four boundaries you have to face
- Hallucination and fabricated evidence. The model may invent functions or fields that don’t exist. Requiring “file:line” evidence and pulling the caller’s code snippet into the same context mitigates this substantially, but manual spot-checking is still necessary.
- Cross-module blind spots from context truncation. Files that exceed budget need call-graph slicing, not a simple truncation from the top — otherwise the deep cross-file paths most likely to hide a bug are exactly what gets cut.
- Prompt injection. Code comments, documentation, and third-party dependencies can embed malicious instructions aimed at the auditing model. Treat all code content as untrusted data, and keep instructions and data strictly separated in the prompt structure.
- Compliance and authorization boundaries. Scan only code you own or are authorized to review; keep model output limited to defect localization and fix guidance rather than exploitable payloads; and define code egress and retention policies in advance.
6. Conclusion and action checklist
LLMs don’t make static security analysis replace humans. What they do is push the marginal cost of auditing down by roughly an order of magnitude: critical paths that could previously only be sampled can now be covered exhaustively, and backlogs that sat for months can be cleared week by week.
If you want to start on your own codebase, work in this order:
- Pick a moderately sized module with high historical defect density as a pilot, and use your existing set of known vulnerabilities as a recall baseline.
- Fix the metrics up front: effective finding rate, duplicate rate, false-positive rate, time from discovery to fix, and regression rate.
- Build the loop “AI proposes hypotheses → dynamic tooling verifies → humans adjudicate → rules are codified,” feeding high-value findings back into deterministic rules so the next round is cheaper.
- Require a reachable path and a minimal reproducer for every high-severity conclusion, and never auto-file a ticket without evidence.
One last point: the real barrier in this method isn’t wiring up the model. It’s three engineering capabilities — context construction, evidence constraints, and a verification loop. Whoever gets those three solid turns “14 high-severity bugs in two weeks” from an occasional news item into repeatable routine output.
