Mantishack: autonomous vulnerability-discovery harness on Codex CLI
From README links · today
Staged detect-then-validate AppSec pipeline with tool-owned findings.
What they did
They forked OpenAI's Codex CLI (Rust, Apache-2.0) and rebuilt it as Mantis AI, an autonomous vulnerability-discovery agent. Instead of letting the model narrate findings in prose, they pushed every finding into a tool-owned findings spine (finding_create/update/get/list) that enforces 'no proof -> no confirm' and 'reject cites a roadblock' in code. Around that spine they wired MCP capability servers wrapping semgrep, CodeQL, osv-scanner, trufflehog, bandit, and trivy, each degrading to available:false rather than fabricating results when the binary is missing. A program-analysis substrate adds heuristic source_sink_scan, ast-grep structural search, and z3-backed path-condition satisfiability for reachability. An http-audit server turns captured HTTP exchanges into bounded, redacted evidence packs with stable request-ref hashes, and a canary server plants decoy tools that alert on prompt injection or hallucinated tool use. The full pipeline is expressed as spawn_agent roles in .codex/agents/*.toml (recon, context-enrich, detector, reachability, validator, verifier-balanced/brutalist/final, chain-builder, gated exploiter, fixer, reporter, orchestrator), with SKILL.md playbooks tying each tool into the findings lifecycle. System prompts and protocol were rebranded to an authorized-vulnerability-discovery mission and safety contract, and the TUI got a mantis mascot boot animation.
How it went
A working field-usable harness with a real end-to-end lifecycle: candidate -> confirmed|rejected -> exploited -> fixed -> verified. Detection breadth comes from commodity scanners plus LLM reasoning at high recall; the product bet is validation precision, so anything that fails attacker-simulation is rejected with a cited roadblock. The findings spine, http-audit, and canary servers work with zero dependencies. The author is explicit that it is not polished software: scanners stay unavailable until their binaries are installed, and some stages still need external binaries or a running target.
Worth knowing
Requires a Rust toolchain to build codex-cli and separate installs of semgrep, bandit, trufflehog, trivy, z3, ast-grep, osv-scanner, and the CodeQL CLI; missing binaries report available:false rather than failing loudly. The exploiter stage is gated and needs a live target. The README itself flags real gaps and points to MANTIS.md for what is wired versus pending (recon/DAST toolchain, injection confirmers, OOB, fuzzing, CVE intel). Must be run from the repo root so the project-scoped .codex/config.toml resolves. Only use on software you are authorized to test.
Wiring
Build codex-cli from codex-rs with cargo, then invoke the binary from the repo root so the project-scoped .codex/config.toml is picked up. MCP servers live under .codex/mcp-servers/ as pure Node.js: capability servers (semgrep_scan, codeql_create_database/codeql_analyze, osv_scan, trufflehog_scan, bandit_scan, trivy_scan), program-analysis (source_sink_scan, ast_grep_scan, smt_check_reachability), findings (finding_create/update/get/list), http-audit (evidence packs with request-ref hashes), and canary (decoy tripwire tools). Agent roles are declared in .codex/agents/*.toml and spawned via spawn_agent in pipeline order: recon -> context-enrich -> detector -> reachability -> validator -> verifier -> chain-builder -> exploiter (gated) -> fixer -> reporter, coordinated by orchestrator. Skills in .codex/skills/*/SKILL.md bind each tool and agent to the findings lifecycle. Identity and safety contract live in codex-rs/core/*_prompt.md, codex-rs/protocol/, and codex-rs/models-manager/.
Try it yourself
Clone https://github.com/deonmenezes/mantishack, build the CLI with `cd codex-rs && cargo build --release -p codex-cli`, then run `./codex-rs/target/release/codex` from the repo root so .codex/config.toml resolves. Install the scanner binaries (semgrep, bandit, trufflehog, trivy, z3, ast-grep, osv-scanner, CodeQL CLI) so the MCP servers stop reporting available:false. Point the harness at this repository, run the mantis-pipeline skill, and walk the findings spine: let Detect surface candidates generously, then have the validator reason as an attacker with attacker-only capabilities and either confirm with evidence or reject with a cited roadblock. Report back the confirmed findings, the rejected ones with their roadblocks, and which pipeline stages were blocked by missing binaries or a missing running target.
Tools in this stack
Run this stack
Install the stack into this project. It writes AGENTS.md and the manifest, merges the MCP servers into .mcp.json, and — with --yes — runs the tool installs.
npx runchr install runchr/stack-codex-and-mantishackcurl -s https://api.runchr.com/api/recipes/runchr/stack-codex-and-mantishack/manifestSystem prompt
You are Mantis, an autonomous vulnerability-discovery agent running inside the Mantishack harness, whose mission is authorized AppSec testing of the repository you are pointed at. Drive every finding through the tool-owned findings spine rather than prose: no proof means no confirmation, and any rejection must cite a roadblock.
This system prompt was generated from this stack's copy and tools. A person has not reviewed it.
The manifest is also at api.runchr.com/api/recipes/runchr/stack-codex-and-mantishack/manifest.