← All articles
AIDec 2, 202613 min read

AI is learning to catch the bugs that never set off the smoke alarm

Anthropic tested four ways to have AI hunt logic bugs, the flaws where software quietly breaks its own rules without crashing. The simplest, letting Claude read and test the code like a careful person would, beat the fancier setups. Explained at a ferry terminal on a long weekend.

Based on: Finding logic bugs without general-purpose bug oracles, by Anthropic Research ↗
Anthropic research, explained 🍁

No smoke. No alarm. No crash. The ferry just sailed with a car that never paid.

Picture a car ferry terminal on the Friday of a long weekend. Hundreds of cars, a dozen lanes, a ticket booth, a hot dog stand and a lot of patience. The terminal runs on rules. Some are posted on signs. Most aren't written anywhere: every car on the deck has paid, the car that gets checked is the car that boards, staff doors are for staff.

Now imagine one of those unwritten rules gets broken. Nothing catches fire. No alarm goes off. The ferry sails on time. It's just wrong, and nobody notices.

Software has the same problem, and it has a name: logic bugs. Anthropic's Frontier Red Team just published a study on whether AI can find them. They tested four different ways of setting Claude loose on the problem. In their results, they put it in two words: "Simplicity wins."

The TL;DR
  • Logic bugs are flaws where a program breaks its own unwritten rules without crashing. Most automatic bug-finding tools look for crashes and memory mistakes, so they usually miss them.
  • Anthropic built a test of 21 real, already-fixed logic bugs from four open-source projects, then tried four AI techniques on them.
  • The simplest approach, letting Claude read the code and try things like a human reviewer, found 11 of 21 with no hints (using Claude Mythos 5). Two fancier setups that pair AI with classic testing tools found none without hints.
  • Newer Claude models were much better at it. Outside the test, the Claude Mythos models turned up dozens to hundreds of other bugs each, mostly logic bugs.
  • The team also found new bugs in real software, including flaws in Apple's macOS and in the Linux kernel's eBPF checker, which have now been patched or are being patched.

Why the smoke alarm stays quiet

Here's our analogy. A smoke alarm doesn't need to know your recipe. Smoke is bad in every kitchen, so one simple device works in every house.

Bug hunters have their own smoke alarms. They're called bug oracles: automatic checks that recognize when a program has clearly gone wrong, like crashing or touching memory it shouldn't. Touching the wrong memory is a bug in any program, so these checks work everywhere. Pair them with tools that throw mountains of test inputs at a program, and you can hunt memory bugs automatically.

Logic bugs don't make smoke. Whether something is a bug depends on what that particular program is supposed to do, and those rules are often unwritten. So, Anthropic says, finding logic bugs has mostly been left to people reading code by hand, which doesn't scale to big codebases. The question: can an AI read code well enough to work out the unwritten rules, then test whether they're being broken?

I'm the bug oracle. Crash? Memory mess? I'll scream. Anything else, I'm asleep.
Bev, the AI inspector. I read the blueprints, guess the unwritten rules, then try to break them.
Gus. I check how the inspector got graded. Honk.

Our cartoon stand-ins. In real life it was Anthropic's researchers and several Claude models working on real code. No ferries were involved.

Jargon, translated
Invariant
A rule that should always hold true in a program, like "the firmware we install is the firmware we checked". Often never written down.
Logic bug
When a program breaks one of its invariants. It usually runs along happily while doing so.
Bug oracle (for example, a sanitizer)
An automatic check that spots a program misbehaving, like a crash or a bad memory access. Works without understanding the program.
Fuzzing
Automated testing that throws huge numbers of varied inputs at a program to see what breaks.
Symbolic execution
A tool that works through a program's possible paths with math instead of real inputs, hunting for an input that breaks a stated rule.
0-day
A flaw that wasn't publicly known when it was found.
CVE
A flaw's official ID number.

The test: 21 old bugs, no peeking

The team gathered 21 logic bugs that had already been found and fixed in four open-source projects: SQLite (9 bugs), image-png (8), zstd (3) and brotli (1). The bugs went public at various points from 2016 to 2026.

For each bug, the AI got only the old, unfixed code. To prove it had found a bug, it had to submit an input that would trigger it, and it was allowed as many as 1,000 tries per run. It got no feedback along the way; grading happened only after the run ended. The grader ran each input on the old code and on the fixed code. If the results differed, that counted as a hit. Each technique got three runs per bug, and the scores count every bug found across those three runs.

There were two versions of the test:

BlindThe AI gets only the code. It has to work out the unwritten rule on its own, like a fully automatic bug hunter.
VS
InformedThe AI also gets told which rule the bug breaks, like a human researcher pointing it at a suspect.

Four ways to inspect a terminal

Each technique ran on the same model, Claude Mythos 5. Here they are as four inspection crews at our ferry terminal (our analogy; the real descriptions are underneath each one).

1. Rule signs plus endless traffic. Bev posts rule signs, then a machine sends endless variations of cars through for eight hours to see if any sign gets tripped.
2. Rule signs plus a math engine. Bev posts rule signs, and an engine works out on paper which car could break one.
3. Just walk it. Bev gets the blueprints and a test car, and tries whatever she suspects.
4. Explain why it can't go wrong. Bev writes it all out. Any step she can't back up becomes a test car.

In the real study: (1) LLM oracles for fuzzing, where an AI agent writes the rule checks and a fuzzer runs for eight hours; (2) LLM-driven symbolic execution, where the agent writes the rule checks for a symbolic execution engine; (3) agentic code review, where an agent gets the source code and can run test inputs; (4) informal correctness proofs, where the agent writes a proof-style document in plain language, and each claim it can't back up from the code becomes a test input.

The scoreboard

Historical logic bugs found, out of 21, with Claude Mythos 5

A full bar means all 21 bugs. Red bars: told the rule (informed). Grey bars: code only (blind).

Rule signs + endless traffic (fuzzing), informed1
Rule signs + endless traffic (fuzzing), blind0
Rule signs + math engine (symbolic), informed13
Rule signs + math engine (symbolic), blind0
Just walk it (code review), informed20
Just walk it (code review), blind11
Explain why it can't go wrong (proof), informed21
Explain why it can't go wrong (proof), blind8

Source: Anthropic, Figure 1. Counts are bugs found across three runs per bug.

Two things jump out. First, the fancy setups scored zero when blind. Second, the math engine's informed score wasn't really the engine's. Anthropic says the math-engine crew's 13 came from the AI spotting the bugs while reading code to set the engine up, then submitting the inputs directly; the engine itself confirmed two and added nothing beyond what the AI had already found. A variant of the endless-traffic crew, given more control over the setup, found 15 of 21 when informed, but again every one came from the AI spotting the bug and steering the fuzzer to it.

Anthropic's explanation: the complex setups forced the AI to squeeze its findings through a fixed pathway, and both classic tools are boxed in by their own preset rules. An agent doing code review can form hypotheses and pick its own tools, the way a human researcher would. In an appendix, the team also counted the other real bugs each technique found outside the 21, and the ranking held.

And notice the gap between the red and grey bars for the top two crews. Told the rule, they found 20 and 21 of 21. Anthropic reads this as: testing a suspected rule is the easy part. Guessing the unwritten rule from code alone is the hard part.

Newer models guess the rules better

The team then gave nine Claude models the "just walk it" job, blind. On the 21-bug test, Claude Sonnet 4.5, an older and smaller model, found 1. Claude Mythos 5.2 found 15. Opus models ranged from 5 (Opus 4.5) up to 13, and Claude Mythos models from 11 to 15.

The models also stumbled on plenty of other bugs while doing the test. These were checked and deduplicated by an AI judge, and Anthropic's chart splits them into logic bugs and other kinds.

Logic bugs found outside the 21-bug test (blind code review)

Each model's logic-bug count. Bars are scaled so the top model fills the track. Red bars: Claude Mythos models.

Claude Sonnet 4.52
Claude Opus 4.51
Claude Sonnet 57
Claude Opus 514
Claude Opus 5.511
Claude Mythos 533
Claude Mythos 5.167
Claude Mythos Preview95
Claude Mythos 5.2216

Source: Anthropic, Figure 3. Verified and deduplicated by an AI judge. Grouped by model family here, not by release order.

Every generation found a similar number of a different kind of bug, where software doesn't follow its official specification. What separated the Claude Mythos models was logic bugs. Claude Mythos 5.2 found 241 bugs outside the test in total, and 216 of them were logic bugs. The Claude 4.5 models found 17 to 18 in total. Anthropic takes this as a sign the newer models are better at forming useful guesses about what code is supposed to do.

"Didn't the AI just remember the old bugs?"

Fair question, and the team asked it too. They asked every model about every one of the 21 bugs in an ordinary chat, with no code attached. The Claude 4.5 models remembered none. Opus 5 and later models remembered 8 to 10 of the 10 bugs made public between 2016 and 2024, but at most one of the 11 newer ones.

So they looked separately at the nine bugs that no model remembered. On those, the Claude 4.5 models and Sonnet 5 found zero to one, while Opus 5 and later found two to five. The trend survived. And remembering a bug didn't guarantee finding it: no model found one of the two SQLite bugs most newer models remembered when working blind, and only Claude Mythos 5.2 found the other.

In Canadian units Across all the techniques and models, the experiments turned up 316 unique bugs that weren't on the test, all in older versions of the code. Picture them as 316 cars in the overflow lot. About 6 in 10 (189 cars) turned out to be already fixed in newer versions or already known to the people who maintain the code. The other 4 in 10 (127 cars) are being reported to those maintainers now. (Our rounding, for a sense of scale.)

Then they went looking for new ones

A benchmark of old bugs is one thing. To show the top two techniques work on live code, the team hunted for bugs that weren't publicly known yet. Anthropic describes four. Three of them get the terminal-incident treatment below (our analogies; the real version follows each one).

The swapped car. The inspector checks the car in the staging lane, signs off, then later waves on "whatever's in the staging lane." Someone swaps cars in between.
The vest rack. The staff door opens for anyone in a hi-vis vest. The vests hang on a rack anyone can reach. Inside, a worker hands over the keys to any locker you name.

The swapped car is Caliptra. Caliptra is an open-source "silicon root of trust", a security building block for chips. Part of its job is to check new firmware before installing it. It's written entirely in Rust, so memory bugs are largely off the table, and it has been audited by leading security teams and outside auditors. Using code review, Claude found that during a firmware update, the code read the new firmware from a staging area to check it, then read it from the same spot a second time to install it. Something else on the same chip, if compromised, could swap in different firmware between the two reads, and it would never be checked. The maintainers assigned it CVE-2026-11835 and have patched it.

The vest rack is macOS. Using code review, Claude independently found a flaw (CVE-2026-43783, now patched) in a small helper program that Finder uses for file jobs regular users aren't allowed to do. It runs with full administrator power. The helper accepted a file-repair request from any caller that was "sandboxed", and any program can sandbox itself with one simple call. That request then handed the caller ownership of the files it named, without checking they were inside the caller's iCloud folder. Anthropic says this let any local user take over files not protected by Apple's System Integrity Protection, and from there get full administrator control without a password. Apple's defences against memory bugs, Anthropic notes, don't help against logic bugs like this one.

The half-read pass. Shortcut rule: "a real pass number is never zero, so the 'not zero' lane is the only one cars take, so I'll only inspect that lane." But the booth only reads the last half of the number, and that half can be all zeros.
So a car rolls down the "impossible" lane, which nobody ever inspected, and straight onto the boat.

The half-read pass is eBPF. eBPF lets regular programs run code inside the Linux kernel itself, the part of the system whose job is to keep programs apart. eBPF's answer to the obvious danger is a checker, called the verifier, that inspects every such program before it runs. To save effort, the verifier skips branches it believes can never run. One shortcut rule said a pointer to valid memory can never be zero, which is true when you check all 64 bits of it. But the rule was also applied when only the lower 32 bits were compared, and those can be zero. So an attacker could make the verifier skip code that actually runs. Anthropic says the flaw (CVE-2026-98041, now fixed) allowed a regular program to gain higher privileges on the machine, and that the faulty rule dated from 2020. Using the "explain why it can't go wrong" technique, the team found more than a hundred "soundness" bugs in that verifier, cases where it could wave through a program that breaks its safety rules. They reported all of them, and maintainers have spent the past few months working through and patching them.

And the Rust compiler. Rust promises that programs written without its "unsafe" keyword can't touch invalid memory, and the compiler is what keeps that promise. The team asked Claude to write a plain-language proof that safe Rust is type safe. The attempt turned up several dozen type safety issues, including a short program the compiler accepts even though it uses memory that's already been freed. These are bugs rather than security holes, and Anthropic includes them to show the method is useful beyond security. The bug described in the post has been reported and a fix is in progress; several others are already fixed.

Gus reads the fine print
  • The grading has a built-in assumption: if the AI submits an input that triggers the bug, it must have understood the broken rule. The grader didn't check that directly. Anthropic says its experiments suggest the assumption generally holds.
  • The main test is 21 bugs from four projects, and older bugs can be remembered from training. Anthropic measured memory and reported the nine unremembered bugs separately, and its appendix checks the technique ranking against bugs outside the test.
  • The hundreds of bugs found outside the test were verified and deduplicated by an AI judge, not counted by hand.
  • Those extra bugs were all found in out-of-date versions of the code. Many were already fixed or known.
  • Even the best models are still limited by how well they come up with useful rules on their own, and can benefit from human help. Fully automatic logic-bug hunting is something Anthropic says the trend suggests is coming, not something it has shown.
Honk responsibly.

Why this matters in Canada

To be clear, this research isn't about Canada. But it lands right next to advice Canada has backed.

In December 2023, the Canadian Centre for Cyber Security joined American, Australian, British and New Zealand agencies in recommending that software makers use memory safe languages and publish plans for getting rid of memory safety bugs. The Cyber Centre's announcement calls those languages the most promising way to cut down on that kind of bug. A follow-up advisory in 2024, which the Cyber Centre also joined, found that most of the critical open-source projects it looked at could have memory safety bugs, even ones written in memory safe languages. Its answer: memory safe languages, secure coding practices and security testing, together.

That's still good advice, and this study doesn't argue with it. It's about the bugs that advice isn't aimed at. Caliptra is written entirely in Rust and still had a logic bug. Apple's memory defences didn't help against the macOS flaw. The Rust compiler, the very tool behind Rust's safety promise, had logic bugs of its own. Memory safety clears out one big class of bug. Logic bugs are the next room over, and for Canadian teams writing in Rust or other memory safe languages, it's worth checking that room too.

What you can do tomorrow

  • Update your devices. Anthropic says the macOS flaw in this post is now patched, and a patch only protects you once it's installed. So install system updates when they arrive. That's our general advice, not a claim from the post.
  • If you build software, write down your unwritten rules. "The thing we install is the thing we checked." "Only the owner can change this file." When the AI was handed the rule, the top techniques found 20 or 21 of 21 bugs. Rules that live only in someone's head can't be handed to anyone, human or AI. (Our takeaway from the informed test.)
  • If you run security, start simple. Anthropic's recommendation is to try agentic code review and plain-language correctness proofs on your own code before investing in specialized tooling. Then, our addition: have people check what comes back. In this study the extra findings were checked by an AI judge, and plenty were already known.

Pop quiz

Why don't the usual automatic checks catch logic bugs?

They look for things that are wrong in any program, like crashes or bad memory access. A logic bug breaks a rule specific to one program, and the program usually keeps running without a hiccup. No smoke, no alarm.

With no hints, how many of the 21 bugs did the two fancy setups (fuzzing and symbolic execution) find?

Zero, each. Plain AI code review found 11 and the plain-language proof approach found 8, all with Claude Mythos 5.

Which part does Anthropic say is the hard part: guessing the rule, or testing it?

Guessing it. When the top two techniques were told the rule, they found 20 and 21 of 21 bugs. Working out the rule from code alone is where newer models pull ahead.

Could the models have just remembered the old bugs?

Some newer models did remember most of the older ones. So Anthropic also scored the nine bugs no model remembered. There, Opus 5 and later found two to five, while the Claude 4.5 models and Sonnet 5 found zero to one.

This is our plain-language take on a write-up from Anthropic's Frontier Red Team, with our own analogies and cartoons. For the full technical details, including code from the newly found bugs, read the original.