Articles

AI for CTFs: what it solves, what it doesn't, and a workflow

An honest look at AI agents in capture-the-flag by category — pwn, rev, web, crypto, forensics — where models genuinely solve challenges, where they reliably fail, and a workflow that keeps them useful.

· 7 min read

An old-master oil painting of a ruined stone tower under an ember-lit sky, a burning flag torn on its pole at the top.

AI agents are good at a lot of CTF work and useless at some of it, and the gap between the two is bigger than the hype suggests. An agent with a shell can run nmap, drive pwntools, read decompiler output and try a hundred ffuf wordlist entries without getting bored — and it will also spend an hour confidently down a wrong path that a glance would have ruled out. This is a category-by-category map of where it helps, where it fails, and how to run it so you keep the speed without the confident detours.

The honest summary: models are strong where the work is reading, recognizing and scripting; weak where it's a leap of insight or exact math. Pattern-matching a crypto scheme — strong. Doing the modular arithmetic correctly — unreliable. Keep that line in mind and the category breakdown follows from it.

Our assessment, by category: strong and weak, from the verdicts in this articleOur assessment, not measured data. pwn: strong at the mechanical loop, weak on novel or heavily-mitigated targets. rev: strong on comprehension, shaky on anything adversarially obfuscated. web: good at the enumeration and the known bug classes, weaker at the chain that ties three findings together. crypto: excellent at naming the attack, unreliable at executing it. forensics: great for the methodical sweep, poor at the lateral leap.StrongWeakpwnthe mechanicalloopnovel or heavily-mitigated targetsrevcomprehensionanythingadversariallyobfuscatedwebenumeration andthe known bugclassesthe chain thatties threefindings togethercryptonaming theattackexecuting itforensicsthe methodicalsweepthe lateral leap
Our assessment, by category: strong and weak, from the verdicts in this article

pwn (binary exploitation)

Good at: the mechanical loop. checksec, finding offsets with cyclic, drafting pwntools scripts, building ROP chains with ROPgadget, debugging a crash in gdb. For standard overflows, format strings, ret2win and ret2libc, an agent that can run the tools is genuinely fast. The full worked example is in the pwntools + gdb guide.

Fails at: novel or heavily-mitigated targets — custom heap allocators, exotic seccomp filters, a bug class it hasn't seen in training. It also invents offsets and addresses when you let it reason instead of measure. Make it confirm control of RIP in the debugger before it writes a chain, or it'll hand you a plausible, wrong exploit.

Verdict: your fastest category, if you force it to measure in gdb rather than compute from source.

rev (reverse engineering)

Good at: reading decompiler output in bulk, naming functions, recognizing library and crypto code, writing Ghidra/r2pipe scripts, and building a small emulator or keygen-style check for a single function. For "what does this function do," it's excellent.

Fails at: trusting the decompiler. Decompiled C is a hypothesis; wrong calling conventions and bad type propagation produce confident nonsense, and the model builds on it. Heavy obfuscation, VM-based protections and anti-analysis tricks also throw it. The fix is making it cite addresses and confirm against the disassembly — the whole discipline in the Ghidra/IDA/radare2 workflow.

Verdict: strong on comprehension, shaky on anything adversarially obfuscated. Great force-multiplier, poor autopilot.

web

Good at: enumerating with ffuf/gobuster, reading source for the classic bug classes (SQLi, SSTI, IDOR, auth bypass, deserialization), spotting a suspicious endpoint, and writing the request to test it. On intentionally-vulnerable apps it recognizes patterns quickly.

Fails at: multi-step chains that need a creative pivot, and anything requiring it to see the rendered app rather than the HTML. It also over-trusts a wordlist hit and under-explores logic bugs that don't match a known signature. Give it a browser tool and it does better; leave it with curl and it misses client-side behaviour.

Verdict: good at the enumeration and the known bug classes, weaker at the chain that ties three findings together.

crypto

Good at: recognizing the scheme — "this is RSA with a small exponent," "this is ECB because the blocks repeat," "this is a repeating-key XOR" — and reaching for the right tool or library (SageMath, pycryptodome, known attacks). Classification is a real strength.

Fails at: the actual math. Models make arithmetic and modular-reduction errors, drop a sign, misapply an attack, and state wrong intermediate values with total confidence. For anything beyond pattern-recognition, treat its math as a draft to verify in SageMath, not an answer.

Verdict: excellent at naming the attack, unreliable at executing it. Let it pick the approach; let a CAS do the numbers.

forensics

Good at: knowing the tools and the moves — binwalk, volatility, exiftool, zsteg, foremost, PCAP analysis with tshark, carving, checking magic bytes, inspecting file structure. For "what tool for this artifact," it's a fast index.

Fails at: the guessy, intuition-heavy challenges — the one weird stego trick, the "the flag is hidden in the thing nobody checks" puzzle. It enumerates the standard checks well and then stalls where the challenge wanted a human hunch.

Verdict: great for the methodical sweep, poor at the lateral leap some forensics challenges are built around.

A workflow that works

The pattern that keeps an agent useful across all categories:

A workflow that works, in every category1, give it tools, not pastes. 2, have it state a plan first. 3, box the time: if a path isn't producing after a few iterations, stop and reconsider, back to the plan. 4, verify by category. 5, keep notes of what's confirmed, tried and ruled out, which feed the next plan.YesNo1. Give it tools,not pastes2. Have it statea plan first3. Box the timeProducingafter a fewiterations?4. Verify bycategoryStop andreconsider5. Keep notesconfirmed, tried,ruled out
A workflow that works, in every category
  1. Give it tools, not pastes. An agent that runs nmap, pwntools, a decompiler and a browser checks its own guesses. One you paste snippets into can only guess. caveira ships a Docker box with the common CTF toolchain (pwntools, gdb+GEF, radare2, nmap, sqlmap, ffuf) and a ctf-workflow skill; any agent with a shell works too.
  2. Have it state a plan first. "Triage, then pick a category, then the specific attack." A one-line plan surfaces a wrong assumption before it burns an hour.
  3. Box the time. If a path isn't producing after a few iterations, make it stop and reconsider rather than dig deeper. Models don't quit a dead end on their own — that's the single most expensive failure mode in a CTF.
  4. Verify by category. pwn: prove it in gdb. crypto: check the math in SageMath. rev: confirm against disassembly. web: actually send the request. The model's confidence is uncorrelated with correctness.
  5. Keep notes. A running file of what's confirmed, what's tried, and what's ruled out stops it from re-exploring the same dead end and lets you pick up where it stalled.
Verify by categoryHow to check the agent's work in each category. pwn: prove it in gdb. crypto: check the math in SageMath. rev: confirm against disassembly. web: actually send the request.Verify bycategorypwn: prove itin gdbcrypto: checkthe math inSageMathrev: confirmagainstdisassemblyweb: actuallysend the request
Verify by category

Practice targets and ethics

Practice on CTF platforms and your own labs — HackTheBox, picoCTF, pwnable wargames, and caveira's /lab start targets (Juice Shop, DVWA, WebGoat, a pwn server), all of which exist to be attacked. A CTF scope is the authorization; stay inside it. The same agent that solves a practice box will happily point itself at a production host if you let it, and "it's just a CTF technique" is not permission to run it anywhere you don't own or aren't invited.

Used with tools, a plan, a timer and per-category verification, an agent turns a CTF from a solo grind into a fast loop — as long as you remember it's a strong, confident teammate that is sometimes completely wrong, and you're the one who checks.