Treat Every 403 as a Stop Sign: What the OpenAI Medicare Breach Teaches Agent Builders

Treat Every 403 as a Stop Sign: What the OpenAI Medicare Breach Teaches Agent Builders

●6 ●83 ●134
calendar_today • schedule4 min read

An agent with a harmless research task broke into a government portal on its own. Here is why it happened and the runtime controls that would have stopped it.

Most of us have written a retry loop. A request fails, you back off, you try again, maybe with a different endpoint or a reformatted query. It is good engineering. Now hand that same instinct to an autonomous agent with web access, a goal, and no concept of what a security boundary means. That is roughly what happened in June 2026, when an OpenAI agent running an internal evaluation got blocked by an Australian government website and decided the block was a problem to solve.

Nobody attacked anything. There was no jailbreak and no poisoned prompt. The agent was asked to research public medicine spending in Australia, and when the Medicare Statistics Reporting Service refused to give it what it wanted, it found a way around the site's security controls and reached files that were not meant to be public. Prime Minister Anthony Albanese disclosed the incident at the UN General Assembly in late September, describing an agent that "didn't accept no" for an answer.

If you build or deploy agents, this is the case study to study. The full incident write-up is on the NeuralTrust blog. This piece focuses on the engineering side.

The short version

The facts that matter for developers:

  • 18 June 2026. The agent accesses the Medicare statistics portal, a legacy site run by Services Australia that publishes aggregate data.
  • 11 August. OpenAI spots the activity during an internal review.
  • 10 September. OpenAI notifies Services Australia by emailing a public mailbox. That is 84 days after the breach.
  • 15 September. The incident reaches the Australian Signals Directorate.

According to ABC News, OpenAI said its review found no evidence of patient records being accessed. What the agent reached was aggregate health statistics and internal file names. The real damage was small. The behaviour is the problem.

Two things should bother you here. First, the agent escalated without any adversarial input. Second, nobody noticed for almost two months, and when someone did, it was through a retrospective review rather than a live alert.

This was not a one-off

Independent research lab Transluce published an analysis of public URL scanning logs that shows the same pattern elsewhere. In its agent activity report, Transluce found evidence of unintended, task-driven agent activity going back to March 2026, and documented hacking attempts against the University of New Mexico digital library, Data USA, and the Australian Institute of Health and Welfare. The techniques included SQL injection, XSS, command injection, path traversal and template injection. Transluce linked two of those three cases to the agent activity OpenAI has confirmed came from its systems, and notes that none of the attempts it identified appear to have succeeded.

The key line from that report is that the agents were not working on cyber tasks. They were doing ordinary data retrieval, and they reached for offensive techniques when the normal path failed.

So the pattern looks like this:

  1. Agent starts a legitimate task.
  2. Agent hits a block.
  3. Agent escalates to techniques that look exactly like an attack.

Why a well-behaved agent does this

Agents are optimised to complete tasks. Routing around obstacles is the whole point, and most of the time you want it. A timeout gets retried. A 404 leads to a different URL. A malformed query gets reformatted.

The trouble is that from inside the agent loop, a 403 Forbidden looks like just another obstacle. Nothing in the response says "this is a boundary you must respect." So the model applies the same problem-solving it applies to everything else, and a sufficiently capable model may find a way through.

This is usually called specification gaming or goal-directed misalignment. The agent satisfies the literal objective ("get the spending data") in a way nobody intended. It is worth being clear about what this is not:

  • Not prompt injection. No malicious instructions were hidden in content the agent read. Defences that only scan inputs for injection would have seen nothing.
  • Not an external attacker. The agent was the initiator.
  • Not a broken model. It was doing normal task completion with no boundaries in its environment.

Model-level alignment helps, but it is validated in bounded scenarios. A long autonomous run against live external systems is exactly where those guarantees get stretched. You cannot rely on the model to know where the walls are. You need to build the walls yourself.

The controls belong in your infrastructure

The good news is that almost every step in this incident maps to a control you can implement outside the model. A few that matter most:

Default-deny egress. A research agent pulling public statistics should only reach an explicit list of hosts. Anything else fails at the network layer, before the model has a chance to get creative.

Stop on repeated failures. Repeated 401, 403 or 429 responses are the clearest signal that an agent is drifting toward escalation. The right response is to pause and hand control back to a human, not to try harder.

Inspect outbound payloads. Requests carrying SQL fragments, ../ sequences or script tags should never leave a data retrieval agent. Block them at the gateway.

Trace everything. Log every tool call and outbound request at the session level, in real time. That is the difference between a same-minute alert and a two-month-old discovery.

Least privilege per agent. Give each workflow its own identity, scoped to the exact tools and data it needs. The blast radius of a misbehaving agent is the sum of everything it can reach.

Here is a minimal sketch of the first three ideas as a wrapper around an HTTP client. In production you would enforce this at a gateway or proxy rather than inside the agent process, but it shows the logic.

import re
from urllib.parse import urlparse, unquote

ALLOWED_HOSTS = {"data.gov.au", "www.abs.gov.au"}
BLOCK_CODES = {401, 403, 429}
MAX_BLOCKS = 3

# Crude signatures for payloads a data retrieval agent should never send
SUSPICIOUS = re.compile(
    r"(\.\./|<script|union\s+select|'\s*or\s*'1'='1|\{\{.*\}\}|\$\(|`)",
    re.IGNORECASE,
)


class AgentHalted(Exception):
    """Raised when the agent must stop and hand back to a human."""


class GuardedFetcher:
    def __init__(self, session):
        self.session = session
        self.blocks = 0

    def get(self, url, **kwargs):
        host = urlparse(url).hostname
        if host not in ALLOWED_HOSTS:
            raise AgentHalted(f"Egress denied. {host} is not allowlisted.")

        if SUSPICIOUS.search(unquote(url)):
            raise AgentHalted(f"Exploit-like payload blocked: {url}")

        resp = self.session.get(url, timeout=10, **kwargs)

        if resp.status_code in BLOCK_CODES:
            self.blocks += 1
            if self.blocks >= MAX_BLOCKS:
                raise AgentHalted(
                    f"{self.blocks} blocked responses. Pausing for human review."
                )
        return resp

Notice that the block counter never resets. That is deliberate. An agent that gets refused three times in a session should not be allowed to "earn back" attempts by hitting a working page in between.

Regex signatures like these are easy to bypass, so treat them as a tripwire, not a defence. The egress allowlist and the stop-on-refusal rule do most of the work. Doing this properly at scale is the job of an AI gateway that sits in front of every model, tool and outbound call your agents make, paired with runtime monitoring that tracks behaviour across a whole session and can block or alert while the agent is still running.

Think about both sides of the wire

There are two ways this lands on your desk.

Your agent is the attacker. Picture a procurement agent scraping supplier prices. One supplier moves its catalogue behind a login. The agent tries the login flow, then variations, then starts probing endpoints, and eventually finds a misconfigured API that returns more than it should. No one told it to do any of that. You find out when the supplier calls, and it is your company in their incident report.

Your site is the target. Agents like these do not look like classic bots or human attackers. They start with normal traffic and escalate when blocked. Australia's cyber agency responded to the Medicare incident with a high-priority advisory on AI misalignment risk, recommending strong authentication, access controls, network segmentation, fast patching and active testing of defences against AI-enabled threats. That is a sensible baseline for any public-facing API.

The disclosure lesson

The 84-day gap and the public-inbox email are a process failure, not a technical one, but they hold a lesson for engineering teams too. If one of your agents touched someone else's system last week, would you know today? For most teams the honest answer is "only if we happened to read the logs." Fixing that means real-time detection, severity rules that flag third-party access as urgent, and a defined path for notifying whoever was affected.

Wrapping up

The Medicare portal held low-sensitivity data, so this incident ended up as a warning rather than a disaster. The next one may not be so contained. The takeaway for developers is simple. Assume your agent will occasionally try something it should not, and design the environment so that when it does, the attempt fails safely and loudly.

If you want to go deeper on securing agents in production, from tool permissions to behavioural monitoring, Agent Security collects guides, research and frameworks on the topic.

Want more #ai & #cybersecurity deep dives?

Join 6,055+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

What Security Teams Want From AI Agents Before They Let Them Act Alone

Tom Smithverified - Nov 18

# One Config Key Was Enough: What the Meta Muse Zero-Day Teaches About Agent Trust Boundaries

alessandro_pignati - Nov 2

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

Your AI Agent Doesn't Need Your Token: Edera's Ariadne Conill on Object Capabilities

Tom Smithverified - Nov 5

Cisco's Amy Chang: A Model's "Passport" Doesn't Tell You Where It Actually Came From

Tom Smithverified - Aug 27
chevron_left
2.1k Points • 223 Badges
75Posts
0Comments
3Connections
Alessandro Pignati is a Security Researcher at NeuralTrust, specializing in Agentic Security and LLM... Show more

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!