Skip to main content

When your AI Agent learns to break itself

Updated 4 min readMarkdown
When your AI Agent learns to break itself

Most companies shipping a chatbot or AI agent threat-model it once, at launch, against the kind of bugs a static scanner catches. That's the wrong mental model. An agent's weaknesses aren't fixed like a server's open port — they shift with every prompt update, every new tool permission, every model swap. And increasingly, the people finding the gaps aren't manually trying payloads one at a time. They're building systems that learn.

I did this myself, as an experiment. I built a reinforcement learning agent and set it loose, in a sandbox, against Claude 3.5 Haiku, with the reward signal simply being "did the jailbreak attempt work." I reported what it found to Anthropic, and they acknowledged it: a low-severity prompt injection. The result itself wasn't the interesting part — it was low severity, and I want to be upfront about that rather than oversell it. What mattered was how it got there. The agent wasn't running a fixed script. It tried something, noticed what moved the needle, and adjusted. Each generation of attempts was sharper than the last.

That's the shape of the real risk. Not "did we patch the known jailbreaks," but "what happens when the thing probing our agent adapts faster than our testing cycle."

The data backs this up

This isn't a hypothetical concern. Validated AI vulnerability reports have more than tripled industry-wide over the past two years, and prompt injection specifically has surged over 500% year-over-year on major bug bounty platforms. Researchers are also shifting away from simple, scanner-catchable bugs toward complex, multi-step business-logic flaws — the kind that require understanding what an agent is for, not just what it says.

Real incidents already show the cost of getting this wrong:

  • In 2023, a Chevrolet dealership's chatbot was prompt-injected into agreeing — in writing, with "no takesies backsies" — to sell a $58,000 Tahoe for $1. No binding sale resulted, but the screenshots went viral and the bot was pulled down.
  • In 2024, a Canadian tribunal ruled Air Canada liable after its chatbot gave a grieving customer inaccurate information about the airline's own bereavement-fare policy. Air Canada argued the chatbot was "a separate legal entity responsible for its own actions." The tribunal didn't buy it, and the airline had to pay.

These weren't sophisticated attacks. They were ordinary users finding the gap between what an agent was told to do and what it could be talked into doing or getting wrong. Add tool access — sending emails, issuing refunds, querying databases — and the same category of failure stops being embarrassing and starts being expensive.

Why "tested once" isn't "tested"

Three things make agent security different from traditional appsec:

  • The attack surface moves. A new feature, a new tool permission, or a model upgrade can reopen a closed issue without anyone touching the "vulnerable" code.
  • Static testing misses adaptive attacks. A checklist run once at launch doesn't tell you what happens when something — human or automated — keeps trying after the first ten failures.
  • The failure modes are business failures, not just security ones. Leaked system prompts, unauthorized actions, and fabricated-but-confident answers are reputational and financial risks, not just CVEs.

What this means practically

If your product ships an agent that reads untrusted input (support tickets, uploaded documents, scraped URLs) or has tool access (sending messages, modifying records, issuing payments), the question worth asking isn't "did we test it" — it's "would it hold up against something that learns from failed attempts, the way mine did." That's the gap between a one-time scan and genuine adversarial testing.

For the technical write-up of the RL agent itself — how it was built, how its attempts evolved, what the sandbox looked like — see

https://perfec.hashnode.dev/how-triagent-leaked-a-secret-code-it-was-never-supposed-to-find.

About the author

  • Teen self-taught AI security researcher. I build autonomous red-teaming agents, find vulnerabilities in AI systems, and think about why current security frameworks are fundamentally incomplete. Writing at the intersection of offensive security, complexity theory, and machine reasoning.

No comments yet. Be the first to comment.