TL;DR
- Understand + two local AI models found verified vulnerabilities in 80 of 241 DARPA Cyber Grand Challenge services (33.2%).
- No compiling, no fuzzing, no code sent to the cloud. Everything ran on one MacBook Pro.
- Works with any static analyzer that outputs SARIF, not just Understand’s Bug Finder.
Why Static Analysis + Local AI Needs a Real Code Database
Anyone who has run static analysis on a large C or C++ codebase knows the two classic frustrations:
- Too much noise on the things static analysis checks. A tool flags a null pointer dereference inside a switch statement without knowing that the callers or macros upstream make that branch impossible.
- Blind spots on the things static analysis doesn’t check. Multi-step protocol parsers, subtle integer wraparounds feeding
calloc, off-by-one loop bounds, or odd callback tables.
The obvious modern temptation is to throw an LLM at the source tree and tell it to “find bugs.” On a real codebase (say, 40,000 functions across 242 services) that doesn’t work. You either blow past context limits, burn days of compute, or drown in hallucinated “theoretical issues.”
This is where Understand’s .und database changes the math. Understand already knows every function definition, caller (callby), callee (call), macro expansion, struct layout, complexity metric, and global variable write (setby/modifyby) across the entire project. Instead of asking an LLM to read everything, we let Understand do what it’s good at, finding the interesting slices, and let local AI do what it’s good at, reasoning about whether a specific slice is actually broken.
The Pipeline: Find, Slice, and Adversarially Verify
Here’s the pipeline we built and tested. It has zero external Python dependencies and runs directly under Understand’s bundled upython.
- Find candidates (unified SARIF from any static analyzer)
- Understand Bug Finder, or any SARIF-producing static analyzer: The triage stage accepts any standard SARIF 2.1.0 file, whether it came from Understand’s Bug Finder/CodeCheck, Clang Static Analyzer, Coverity, CodeQL, Cppcheck, Semgrep, or your own custom checks. Pass multiple
--sarifinputs to get a single deduplicated run. - Understand
.undAI graph miners: Query the.unddatabase to slice out the riskiest ~1–2% of code across 9 bug classes (taint, bounds, arithmetic, error_paths, callbacks, contracts, parser, lifetime, and concurrency). A fast local model (gemma-4-26b-a4b) proposes concrete SARIF candidates.
- Understand Bug Finder, or any SARIF-producing static analyzer: The triage stage accepts any standard SARIF 2.1.0 file, whether it came from Understand’s Bug Finder/CodeCheck, Clang Static Analyzer, Coverity, CodeQL, Cppcheck, Semgrep, or your own custom checks. Pass multiple
- Understand semantic slicing + two-stage triage
- Both SARIF streams merge into a single triage pass. For each finding, Understand pre-fetches the enclosing function, linkage (static vs. public), caller call sites, called helper bodies, struct/typedef definitions, and guard macros. It also exposes live read-only
.undtools (get_callers,get_function_definition,get_symbol_info,read_source_lines,search_code). - Stage 1 (fast local screener): Clears obvious false positives quickly, cutting 63.8% of Bug Finder noise on
cb-multiosand 97.4% on a llama.cpp fork. - Stage 2 (cross-family adversarial verifier): A stronger local model from a different model family (
gpt-oss-safeguard-120bon MLX) actively tries to disprove the remaining findings using live.undtool calls.
- Both SARIF streams merge into a single triage pass. For each finding, Understand pre-fetches the enclosing function, linkage (static vs. public), caller call sites, called helper bodies, struct/typedef definitions, and guard macros. It also exposes live read-only
- One interactive HTML report
- Everything lands in a single offline HTML file filtered to actionable findings (true_positive and needs_review), with step-by-step code walkthroughs, Simplified Technical English explanations, and the AI’s full tool-call trail.

A Quick Look at the 9 Understand .und Miners
Each miner queries Understand’s .und graph for a specific structural risk pattern and hands the AI only the relevant slice (call chain, callers, or function body) instead of the whole codebase.
| Miner | What Understand Extracts | What the AI Looks For |
|---|---|---|
| taint | 1–3 hop call-graph paths (call/callby) from input primitives (recv, read, fgets, getenv) to sensitive sinks (memcpy, strcpy, calloc, sprintf, system). | Unvalidated lengths/inputs reaching memory, format, or command sinks. |
| bounds | Loop-bearing functions (Cyclomatic + CountLineCode) with direct array writes or pointer arithmetic, plus sample callers. | Off-by-one loop writes, negative indices, and out-of-bounds array accesses. |
| arithmetic | Functions mixing narrowing casts (int, short, uint16_t), multiplication, or shifts with allocation/buffer sizing. | Integer overflow/wraparound, unsigned underflow (0 - 1), and signed/unsigned bypasses. |
| error_paths | Complex functions (Cyclomatic >= 5) calling resource acquirers (malloc, fopen, socket, locks). | Leaks, double-frees, or held locks on early return / goto / exception paths. |
| callbacks | Functions using function-pointer types ((*)) or indirect/indexed dispatch (tbl[i](...), p->fn(...)) plus callers. | Out-of-bounds dispatch tables, NULL/uninitialized function-pointer calls, control-flow hijacking. |
| contracts | Functions with 4+ callers (callby), comparing return-value/NULL check patterns across call sites. | Odd-one-out callers that skip checks or cleanup conventions other callers obey. |
| parser | High-complexity switch/case dispatchers, protocol/VM parsers, and format-string callers (printf, snprintf, syslog). | Format-string injection, missing opcode bounds checks, switch fall-through, state desync. |
| lifetime | Callers of free/realloc/delete/destroy/release primitives, bundled with their own callers. | Use-after-free, double-free, mid-buffer frees, and dangling pointers after failed realloc. |
| concurrency | Shared mutable globals/statics (setby/modifyby/useby) across functions with inconsistent locking. | Data races, missing mutexes, and unsafe signal/thread flags (auto-skips single-threaded targets). |
Example Command Lines
Everything runs directly under Understand’s bundled upython against a local LM Studio server (http://localhost:1234/v1) or any OpenAI-compatible endpoint.
# 1. Hunt for bugs using Understand .und graph miners + fast local MoE -> SARIF
PYTHONPATH=src /Applications/Understand.app/Contents/MacOS/upython -m bugfinder_hunt \
--db ~/src-examples/cb-multios/cb-multios.und \
--src ~/src-examples/cb-multios \
--checks contracts,taint,error_paths,bounds,arithmetic,lifetime,parser,callbacks \
--max-per-check 0 \
--max-per-dir 2 \
--min-confidence 0.85 \
--base-url http://localhost:1234/v1 \
--model google/gemma-4-26b-a4b-qat \
--max-tool-rounds 0 \
--workers 2 \
-o cb-multios-customer-d2-hunt.sarif
# 2. Adversarially verify & merge ANY SARIFs (e.g. Bug Finder + AI Hunter) -> HTML report
PYTHONPATH=src /Applications/Understand.app/Contents/MacOS/upython -m bugfinder_triage \
--db ~/src-examples/cb-multios/cb-multios.und \
--sarif ~/src-examples/cb-multios/bugfinder-results.sarif \
--sarif cb-multios-customer-d2-hunt.sarif \
--src ~/src-examples/cb-multios \
--base-url http://localhost:1234/v1 \
--model google/gemma-4-26b-a4b-qat \
--max-tool-rounds 0 \
--escalate-model gpt-oss-safeguard-120b-mlx \
--escalate-below 0.90 \
--escalate-tool-rounds 2 \
--escalate-reasoning-effort medium \
--workers 2 \
-o cb-multios-customer-d2-triage.html
For a multithreaded C/C++ project like llama.cpp, use --checks all so concurrency runs too, or scope a daily PR check with --git-diff main.
Testing Against a Known Benchmark: DARPA CGC (cb-multios)
To test this against known ground truth rather than cherry-picked toy files, I pointed the pipeline at Trail of Bits’ cb-multios, which contains 242 C/C++ services from the DARPA Cyber Grand Challenge. 241 of them have official #ifdef PATCHED blocks marking the exact seeded vulnerabilities.
Everything ran on a single 128 GB M5 Max MacBook Pro using local US-origin models in LM Studio (MLX). No binaries were compiled, executed, or fuzzed.
Here’s how the unified static pipeline compares with published results on DARPA CGC:
| Tool / Approach | Official CGC Challenges Hit | Method |
|---|---|---|
| Traditional static analyzers (Clang SA, Cppcheck, CodeQL) | ~2% – 20% | Purely static |
Understand .und + local US AI (single run: 26b-a4b → gpt-oss-120b) | 21.6% (52 / 241) | Purely static, 100% local, 0 errors |
| Understand unified static pipeline (Bug Finder + AI miners combined) | 33.2% (80 / 241) | Purely static, zero execution |
| DARPA CGC finals autonomous systems (Mayhem, Mechanical Phish, etc.) | ~20% – 35% | Dynamic fuzzing + symbolic execution |
| Offline fuzzing + hybrid symbolic (hours per binary) | ~40% – 65% | Heavy dynamic execution + harnesses |
A few things stood out in the data:
- Every part of the pipeline pulled its weight. Understand Bug Finder contributed 128 verified bugs (after 63.8% false-positive reduction), including 3 unique official CGC PATCHED challenges (Finicky_File_Folder, Mount_Filemore, commerce_webscale) that the AI miners didn’t hit. All 8 single-threaded AI miners also contributed official CGC PATCHED hits (taint: 14, error_paths: 13, bounds: 12, arithmetic: 11, callbacks: 6, contracts: 5, parser: 3, lifetime: 1).
- The bugs it found weren’t trivial lint issues. They included:
- Remote code execution via attacker-controlled function pointers (Game_Night, CableGrind) and an arbitrary memory write treating a string-parsed value as a pointer (greeter).
- Attacker-controlled format strings (Checkmate, CNMP) and an overlong UTF-8 path-traversal bypass (UTF-late).
- Classic stack/heap overflows (CTTP copying 2 MB into a 4 KB stack buffer, CGC_Hangman_Game, Casino_Games, The_Longest_Road, FISHYXML).
- Subtle logic and lifetime bugs: a Y-bounds check using
&&instead of||(CGC_Image_Parser), a negative-price balance bypass (Music_Store_Client), a list-iterator use-after-free (QuadtreeConways), and a double-free on key replacement (One_Vote).
- Why zero race conditions on
cb-multios? DARPA CGC’s DECREE OS had only 7 syscalls and no threads, so the 9th miner (concurrency) skipped it automatically. When we pointed the same pipeline at a real multithreaded C++ inference engine (llama-cpp-turboquant), concurrency found 5 verified data races, including one in the new TurboQuant quantization code (ops.cpp↔ggml-turbo-quant.c).
Two Practical Lessons From Running This Locally
Building this for real engineering teams, not just a demo, taught us a couple of things:
- Don’t let a model family grade its own homework. Early on, I hunted with
gemma-4-26b-a4band verified withgemma-4-31b. On 247 shared findings, 31b rubber-stamped 114 false positives at 1.00 confidence while barely calling any Understand tools. Switching Stage 2 to a different model family (gpt-oss-safeguard-120bon MLX) broke that confirmation bias immediately. It made 465 live Understand tool calls across the run and cut 575 of 1,140 hunter candidates (50.4%) as false positives, at roughly 10× the speed of heavier reasoning models we tested.

gpt-oss-safeguard-120b-mlx) finishing with live measured ETA, Understand tool calls, 55.8 tok/s throughput, and zero errors.- Local tooling has to hold up in real-world use. Running 1,100+ items locally shows you fast what a real product needs: file-first
.undindexing (so scanning 40,000 functions takes seconds, not minutes), disk-cached.undcontexts, atomic cache writes, endpoint preflight checks, default token caps against runaway repetition loops, and graceful Ctrl-C handling that still writes a usable partial report.

--reuse-any-model-cache.Where We’re Taking This
The big takeaway for me isn’t that AI replaces static analysis. It’s that static analysis plus a rich semantic code database (.und) makes local AI dramatically smarter, faster, and quieter.
Understand already holds the graph and cross-reference data needed to slice a massive codebase down to the ~1% that matters, and to give a verifier the ground truth to prove or disprove a bug. Because it consumes standard SARIF 2.1.0 (including multiple SARIF files at once), teams can feed in any static analyzer they already run alongside Understand’s Bug Finder and .und AI miners, and get one verified, low-noise report privately on their own machine.
If you want to try this on your own codebase, contact [email protected] and we’ll get it to you. And let us know which codebases or static analyzers you’d like to see us test next.






