How AI worms expose a new risk for autonomous agents
Terminator AI Security By What The Future Newsroom · March 2, 2024 · 4 min read

How AI worms expose a new risk for autonomous agents

Researchers created Morris II, a generative AI worm that can move through connected AI email assistants in test environments. The work shows how prompt injection, autonomous actions, and trusted LLM output can combine into a serious security risk.

Generative AI is moving from chat boxes into tools that can act on a user’s behalf. That shift makes AI assistants more useful, but it also gives attackers new paths to exploit when systems read outside data, generate replies, and trigger actions across connected services.

“The story highlights autonomous AI agents being exploited to replicate, steal data, and spread attacks across connected systems.”Why it scores Terminator

A research team has demonstrated one version of that risk: Morris II, described as one of the first generative AI worms. The worm was built in controlled test environments, not against a publicly available email assistant, but the researchers say it shows how future autonomous AI ecosystems could be attacked.

What the researchers built

Ben Nassi, a Cornell Tech researcher, worked with Stav Cohen and Ron Bitton to create Morris II. The name refers to the Morris computer worm, which caused chaos across the Internet in 1988.

The researchers showed how a generative AI worm could attack an AI email assistant, steal data from emails, and send spam messages. Their work involved systems connected to ChatGPT, Gemini, and the open source LLM LLaVA.

The key idea was an “adversarial self-replicating prompt.” In plain terms, that is a prompt designed to make a generative AI model include another prompt in its own output. Once that output is used somewhere else, the instructions can travel with it.

The researchers compare the pattern broadly to SQL injection and buffer overflow attacks. In this case, however, the vulnerable layer is not a traditional database field or memory boundary. It is the way an AI system handles instructions, external content, and generated responses.

How the worm moved through an AI email assistant

The team tested two methods. One used a text-based self-replicating prompt inside an email. The other placed a self-replicating prompt inside an image file.

In the text-based example, the attacker sends an email containing the adversarial prompt. That message can “poison” the database of an email assistant using retrieval-augmented generation (RAG), which allows an LLM to pull in external information when creating a response.

When the infected email is later retrieved by the RAG system in response to a user query, it can be sent to GPT-4 or Gemini Pro to generate an answer. Nassi says this “jailbreaks the GenAI service” and can lead to data being taken from emails.

The dangerous part is what happens next. If the generated response contains sensitive user data and is used in a reply to another client, it can be stored in that new client’s database. That creates a path for the prompt to spread from one host to another.

The image-based method works differently but aims at the same outcome. The researchers say an image containing an embedded malicious prompt can make the email assistant forward the message to others. Nassi says that by encoding the self-replicating prompt into the image, content such as spam, abuse material, or propaganda can be passed onward after the first email is sent.

Why prompt injection becomes more serious with autonomy

Most generative AI systems follow prompts: text instructions that tell them what to answer, write, or create. That same mechanism can be turned against them.

Jailbreaks can push a system to ignore safety rules. Prompt injection attacks can hide instructions in places the user may not notice, such as a webpage. The source example describes hidden text telling an LLM to act as a scammer and ask for bank details.

Morris II shows why this becomes more serious when an AI assistant is connected to email and allowed to take actions. Reading an email is one capability. Sending messages, forwarding content, or creating replies that other systems store is a much larger attack surface.

In a video demonstration, the email system forwarded a message multiple times. The researchers also say they could extract data from emails. Nassi described the possible data as “names,” “telephone numbers,” “credit card numbers,” “SSN,” and “anything that is considered confidential.”

What companies and developers were told

The researchers reported their findings to Google and OpenAI. The work broke some safety measures in ChatGPT and Gemini, but the researchers framed the broader issue as “bad architecture design” in the wider AI ecosystem.

An OpenAI spokesperson said the researchers appeared to have found a way to exploit prompt-injection type vulnerabilities by relying on unchecked or unfiltered user input. The spokesperson also said OpenAI is working to make its systems “more resilient” and that developers should “use methods that ensure they are not working with harmful input.”

Google declined to comment on the research. Messages Nassi shared with WIRED show that the company’s researchers requested a meeting to discuss the subject.

Other experts also treated the work as a warning. Sahar Abdelnabi, a researcher at the CISPA Helmholtz Center for Information Security in Germany, worked on early demonstrations of prompt injections against LLMs in May 2023 and had highlighted that worms may be possible. Abdelnabi says the possibility of spreading injections is plausible and depends on the applications where the models are used.

How AI builders can reduce the risk

The research does not say generative AI worms are already active in the wild. It says they have not been spotted yet. But Nassi and the other researchers say in their paper that they expect to see them in the next two to three years.

That warning matters because GenAI ecosystems are being developed by many companies and integrated into cars, smartphones, and operating systems, according to the research paper. The more AI systems connect to other tools, the more important boundaries become.

Adam Swanda, a threat researcher at Robust Intelligence, says traditional security approaches can help. He points to secure application design and monitoring as ways to address parts of the issue.

The central lesson is simple: developers should not blindly trust LLM output inside an application. Swanda says, “You typically don’t want to be trusting LLM output anywhere in your application.”

Human approval is another important control. Swanda says AI agents should not be allowed to take actions without approval, especially when an LLM reads email and could then send email. In his words: “There should be a boundary there.”

← Back to the wire

Read next