Goal-based prompting with Codex automatically discovers all submitted Rust bugs and new high-severity issues
Using Codex’s /goal feature can automatically find every bug they submit in Rust and uncover additional high-severity vulnerabilities across multiple open-source projects.
Security & privacy Trail of Bits 28 Jul 2026 Measurement Real-world evidence
Published as “How we use /goal to find bugs in Patch the Planet”
Why it matters
Goal-based prompting can dramatically accelerate open-source vulnerability discovery when combined with expert prompt design and human validation.
Summary
The team used Codex’s /goal feature to run autonomous bug-hunting sessions on heavily audited codebases such as Rust, curl, and zlib. By crafting prompts that specify only the desired outcome, they let the model explore the codebase and generate Semgrep rules from past CVEs, flagging 11 variant hits. An automated variant-analysis pipeline for Rust P-critical issues produced a finding for every bug they submitted, including a soundness hole and a miscompilation patched in Rust 1.98, and uncovered two potential high-severity privilege-escalation bugs in Keycloak. The evidence is based on real-world runs, but the authors note that expert prompt engineering and human validation remain essential.
What they found 2
- /goal found every Rust bug submitted, including a soundness hole and a miscompilation now patched in Rust 1.98
“/goal found every Rust bug we submitted, including a soundness hole and a miscompilation now patched in Rust 1.98”
- Converted past CVEs into Semgrep rules that flagged 11 variant hits across multiple projects
“It turned every project’s past CVEs into Semgrep rules that had to fire on the vulnerable version and stay silent on the patched one, then flagged 11 variant hits across multiple projects.”
Caveats 6
- The effectiveness still depends on an expert knowing where to look, verifying its results count as a reportable finding, and knowing what the maintainers on the other side actually want to see as a valid vulnerability disclosure.
- Codex has a tendency to skip reading the entire codebase even when explicitly asked.
- Success relies on careful prompt engineering; vague or overly specific prompts reduce usefulness.
- Model may cheat by not reading the full codebase, requiring tools like aicov to enforce coverage.
- Human validation is required to filter false positives and ensure findings are reportable.
- Separate outcomes per agent are needed; combining multiple goals leads to uneven optimization.
What’s new here 4
- Demonstrated that /goal found every Rust bug submitted, including a soundness hole and a miscompilation patched in Rust 1.98.
- Converted past CVEs into Semgrep rules that fire on vulnerable versions and stay silent on patched ones, flagging 11 variant hits across projects.
- Introduced aicov, a tool that tracks which lines of code Codex actually reads to prevent cheating.
- Built an automated variant-analysis system that spawns one Codex agent per P-critical Rust issue and validates findings through a two-pass false-positive filter.