Artificial Intelligence 5 min read 1065 words

AI agents that find and exploit a zero-day almost on their own

ES
AI agents that find and exploit a zero-day almost on their own

If you’ve ever watched a line of ants get into the kitchen, you know they’re in no hurry and never get tired. They try the gap under the window, the skirting board, the socket… and if there’s no way in, they keep trying. Until one finds the hole, and then they all go. Well, that’s what Amazon has just described, with AI agents and servers instead of ants and kitchens.

In a post on its security blog, Amazon Threat Intelligence describes a campaign in which some attackers (whom Amazon attributes, with moderate confidence, to a China-nexus group) gave a group of agents a list of IP addresses and a three-word goal: “obtain shell access”. And the agents, without anyone telling them what to do next, ended up finding a vulnerability nobody knew about and getting root on a server.

How it came to light

The first part has its irony. On 10 September, Amazon found a server running an instance of Cairn, an open source framework for autonomous penetration testing with agents, open to the internet with no authentication. Anyone could see the project configuration, the operator’s prompts and everything the agents had done. The prompts were in Simplified Chinese, the scripts used China Standard Time, and the targets were universities in East Asia outside mainland China, over about 48 hours starting on 8 September. In other words, the attackers left their own door open while trying to open everybody else’s.

Cairn was built for defenders: you give it a starting point and a goal in plain language, and it coordinates several agents to find the way there. According to Ars Technica, it can use Claude Code, Codex or others as its engine, and Palo Alto Networks had already seen it this month in another campaign with 25 autonomous operations against at least 19 organisations, at least 10 of which were breached. How easy it is to use is precisely what makes it attractive to those who shouldn’t be using it.

What the agents did

The campaign had a bit of everything, and the interesting part is seeing it side by side:

TargetDurationWhat they triedResult
Unauthenticated Redis at a universityabout 16 hours, 148 consecutive actionsReplication to load code, escaping the scripting sandbox, writing the configuration, corrupting memory, Log4Shell on another service, SSRF in a Qdrant to map the Docker network, credentials against PostgreSQL and SSHNothing worked
A university GPU serverover 6 hoursAbout 80 real usernames taken from directories, lab websites and academic papers, and over 30,000 combinations against SSH, VPN, NAS and the campus portalNothing worked
Open source medical imaging AI applicationabout 11 minutesIdentify the framework, map the API, test path traversal on a file upload parameterWriting files and, later, root

The first two rows seem almost more revealing to me than the third. A human would have got bored long before action 148 against a Redis that wouldn’t budge. The agents didn’t: sixteen hours straight, with no lunch breaks or office hours, adapting to each failure. That they got nothing says a lot about how well that server was protected, and that they tried everything says a lot about what’s coming.

The bug

The third row is the headline one. The application had an endpoint for uploading files with a parameter for the name, and that name was used as-is to build the path on disk. It’s good old path traversal: if the name is ../../something, the file ends up wherever the attacker wants. An example of what it usually looks like (it isn’t the application’s code, which Amazon doesn’t identify):

# The name comes from the client and is used as-is
destination = os.path.join(UPLOAD_DIR, filename)
with open(destination, "wb") as f:
    f.write(content)

The clever part came later. In a subsequent session, the agents used the bug to write a reverse shell into sitecustomize.py, a file Python automatically imports every time the interpreter starts. Then they called a training endpoint in the application itself, which spawned a new Python process… which imported the file and opened a shell for them. As root, because the application ran as root.

Amazon was fairly sure it was a zero-day: there was no patch, issue, advisory or mention in any vulnerability database. They reported it to the maintainers, who have already published the fix and a GitHub advisory. And in another session the attacker did step in: they gave the agents a proxy into another university’s network, going through a server running the same application (Amazon infers they had already compromised it with the same bug), and asked them to carry on from there.

What I take away

A few days ago I wrote about how Calif found Java4Shell with Codex for less than 200 dollars, and in the Dragos report on the canaries another AI pentesting framework showed up testing the stolen keys. The pieces are falling into place: AI has made both finding bugs and exploiting them enormously cheaper, and launching a campaign no longer takes a team of experts, just a list of IPs and a sentence.

The good news is that the bug they found is nothing sophisticated, which means the defences don’t have to be either:

  • Never trust the filename the client sends. The simplest thing is to generate your own; if you have to keep it, resolve the path and check it’s still inside the upload directory:
from pathlib import Path

base = Path(UPLOAD_DIR).resolve()
destination = (base / filename).resolve()
if not destination.is_relative_to(base):
    raise ValueError("Path not allowed")
  • Don’t run applications as root, least of all those that receive files. With an unprivileged user, writing to the system’s sitecustomize.py wouldn’t have been possible, and the bug would have amounted to much less.
  • Don’t expose to the internet what doesn’t need it. An unauthenticated Redis or an internal research tool reachable from outside are invitations, and now there’s someone accepting them 24 hours a day.

Amazon closes with an idea I find very sensible: if an agent finds and exploits a bug in minutes, it’s done before many security teams have even looked at the alert, so you need to automate the response to high-confidence detections and leave people overseeing outcomes, not reviewing every action. Which, come to think of it, is the same thing I ask of the agents I use: let them do the heavy lifting and let me review what matters.