cd /news/artificial-intelligence/a-year-ago-we-fixed-ai-s-bugs-now-ai… · home › topics › artificial-intelligence › article
[ARTICLE · art-181864] src=geocod.io ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

A year ago, we fixed AI's bugs. Now AI finds ours

An AI-assisted security audit at Geocodio uncovered a high-severity two-factor authentication bypass in the company's PHP application, caused by a loose type comparison in which the JSON boolean true equals the integer 4821. Geocodio said the vulnerability has been fixed and that it has no evidence it was ever exploited. The audit used parallel subagents to trace execution paths, a critic agent to challenge each finding, and reproducible tests to confirm results before reporting.

recommendation

Run staged AI security audits with parallel scanning subagents, a critic agent to challenge findings, and reproducible tests before trusting any result; enforce strict input typing to rule out loose-comparison bypasses.

more in playbook: Securing agents and AI tools
read3 min views5 publishedDec 4, 2026
A year ago, we fixed AI's bugs. Now AI finds ours
Image: source

engineering at Geocodio

Take a look at this simplified piece of PHP:

$expectedCode = 4821;

if ($request->input('code') == $expectedCode) {
    // Second factor verified.
}

See the vulnerability?

Here's a hint:

true == 4821; // true

During a recent AI-assisted security audit at Geocodio, we found a high-severity vulnerability in our two-factor authentication caused by exactly this kind of loose type comparison. If the code arrived as the JSON boolean true instead of a string, the SMS second factor could be bypassed entirely.

The vulnerability has been fixed, and we have no evidence that it was ever exploited.

Obvious in hindsight #

Once you see it, it's almost embarrassingly obvious. It would make a good interview question about type safety, and shown these few lines in an interview, we would have spotted the problem in seconds.

Put the same lines inside a large, mature application, surrounded by thousands of lines of perfectly reasonable code, middleware, and abstractions, and it becomes a different challenge.

The fix itself is straightforward:

$code = $request->input('code');

if (
    is_string($code)
    && hash_equals((string) $expectedCode, $code)
) {
    // Second factor verified.
}

We validate the input type and drop the loose comparison, which closes the hole. We also use hash_equals() rather than a regular string comparison, so the check takes the same time whether the first digit is right or not. For a short SMS code, rate limiting does most of that work, but constant-time comparison is a good habit and costs nothing.

The difficult part was never fixing the vulnerability. It was finding it.

Type safety is a security feature #

This discovery came shortly after the introduction of Laravel Go and Laravel Rust. Consider a typed request in Rust:

#[derive(Deserialize)]
struct VerificationRequest {
    code: String,
}

A JSON boolean isn't a string, so deserialization rejects it before it ever reaches the verification logic. With properly typed request structures in Go or Rust, this class of vulnerability is eliminated by design.

Neither language makes an application secure on its own. But every category of mistakes the language rules out is one less category we need to find in code review.

As more of our code is written with AI assistance, I think the strongest argument for type safety is correctness, ahead of performance and developer experience.

The tables are turning #

A year ago, much of the conversation around AI-assisted software engineering was about humans reviewing AI-generated code, fixing its bugs, and catching its security vulnerabilities.

Today, I increasingly find myself on the other side of that equation. This finding didn't come from a single prompt. The audit ran in stages:

  • A large number of subagents scanned the application in parallel, tracing execution paths through the code.
  • Their findings were collected and handed to a critic agent, whose job is to challenge each one.
  • A finding only counted once it was verified and proven with reproducible tests.

AI's value in software engineering now includes how well it can scrutinize code, including the code we wrote ourselves.

What if AI makes software safer? #

There's an ongoing debate about whether AI-generated code is reducing software quality. I think we're missing half of the equation. We're measuring the mistakes AI introduces, but are we also measuring the mistakes it discovers?

Combine stronger type systems, compiler-enforced guarantees, specialized AI security audits, automated regression testing, and experienced engineers, and we might end up with software that is developed faster and is also more thoroughly reviewed, better tested, and more secure than it was a year ago.

AI still makes mistakes, and so do we. What changes is how few of those mistakes survive.

Get new posts in your inbox

We write about what we're working on, thinking about, and getting so excited playing around with that we accidentally stay up a bit too late.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @geocodio 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/a-year-ago-we-fixed-…] indexed:0 read:3min 2026-12-04 · —