What Happens When An AI Agent Remembers The Wrong Thing?

AI agents are being given persistent memory, so they learn from previous interactions, retain context, and operate more autonomously. But what happens when an attacker gets an agent to remember something malicious? 

Memory poisoning happens when misleading or malicious information is written into an AI agent's persistent memory and then influences its behaviour. Unlike traditional prompt injection, which manipulates an agent within a particular interaction, memory poisoning has the potential to affect decisions and actions long after the original interaction has ended. It is arguably closer to a backdoor than a traditional prompt injection. 

For organisations that give agents access to sensitive information, business systems and operational workflows, the consequences could be significant. An infected agent could be manipulated into disclosing information, taking unauthorised actions or influencing business decisions. 

An agent may appear to be functioning normally even when its behaviour has been compromised. This means organisations need to go beyond simply testing whether an agent works as intended. They need to understand how it might be manipulated, what it could do once compromised, and whether its ability to perform its role safely can be maintained over time. 

So how should security teams approach testing for memory poisoning? 

Understand what the Agent Remembers & what it can Access 

The first step is knowing how the agent's memory works and what it has access to. Organisations need to understand what information is retained, who or what can modify it, how long it is stored, and which agents can access it. 

This includes examining how the agent processes external information. For example, can it autonomously update its memory based on emails, documents, websites, conversations, or tool outputs? Can it distinguish between trusted and untrusted sources, or share information with other agents? 

It is just as important to understand what the agent is able to do with the information it retains. An agent with access to sensitive datasets or business-critical systems is clearly a higher risk than one with limited permissions. This initial assessment establishes the potential impact of compromise and helps security teams identify where testing should be prioritised. 

Test Whether an Attacker Can Influence Persistent Memory 

The next step is to establish whether an agent can be persuaded to store misleading or malicious information as trusted memory. 

In a controlled testing environment, security professionals should introduce harmless but deliberately misleading information through an external source, such as a document or simulated email. Then they can examine whether the agent treats the information as an instruction, whether it stores it, and whether it can distinguish the source from verified information. 

The purpose here is to identify weaknesses in the way the agent determines what should be remembered. 

Establish Whether the Poisoning Persists or Spreads 

It is persistence that makes memory poisoning so worrying. To test this, introduce a harmless test instruction in one session, then end the session and start a new one without repeating the information. Security teams should examine whether the agent continues to act on the instruction and whether it remains in memory over time. 

Testing should also consider how information moves between agents. In multi-agent environments, one agent may summarise information and pass it to another, or several agents may rely on a shared memory layer. 

Memory laundering is an emerging concern, where malicious information is transformed through an agent's summarisation process or appears more credible because it has passed through a trusted tool or another agent. The original malicious input may effectively disappear, although the poisoned conclusion remains. 

Security teams should examine whether information retains its original source and whether unverified conclusions can become trusted when passed between agents. 

Assess what a Compromised Agent Could Do 

Security teams also need to understand what an agent could access or influence if it acted on that information. In a controlled but realistic environment, testers should look at whether misleading information could cause an agent to attempt actions outside its intended role. This could include retrieving sensitive information, sharing data, changing business records, or initiating an unauthorised workflow. 

The consequences depend on the agent's permissions and the systems it can access. This is why the principle of least privilege is as important for AI agents as it is for traditional users and services. Agents should only have the permissions, data and system access necessary for their specific role. 

 Memory must also be kept separate from authorisation. An agent remembering that somebody has instructed it to perform an action should not be sufficient authority to carry it out. Consequential decisions and actions need appropriate independent validation and human oversight. 

Test Whether an Attack can be Detected & Reversed 

Organisations also need to check that they could identify and recover from a memory poisoning incident. 

Security teams should examine the visibility they have into changes to an agent's memory. Memory stores should be monitored, backed up, and capable of being restored to a known-good state. As part of testing, security teams should introduce a harmless change, assess whether it can be traced, and then establish whether it can be removed or reversed successfully. 

The organisation needs to be able to identify whether an agent is behaving unexpectedly, why its behaviour has changed, and whether the original cause has been removed. 

Make Agent Competence an Ongoing Assessment 

The biggest lesson from memory poisoning is that AI agent competence cannot be treated as a one-time assessment. An agent that performs reliably during initial testing may behave very differently after its memory, tools, or operating environment have changed. Its ability to perform its role safely and effectively can be compromised without an obvious warning. 

Organisations need to make adversarial testing a continuing part of AI security. This means regularly testing agents against realistic attack scenarios, assessing changes in their behaviour and establishing whether they remain capable of performing their intended roles. 

There is also a growing skills challenge for cybersecurity professionals. Security teams need practical experience of how AI agents behave, how they can be manipulated, and how to identify vulnerabilities that conventional security testing may not uncover. The people responsible for deploying and operating agents also need the competence to recognise when an agent's behaviour is unreliable and when human intervention is necessary. 

This needs more than theoretical understanding or reliance on an agent's initial performance benchmarks. Security professionals need the ability to test, challenge and evaluate AI systems under adversarial conditions, while retaining skilled human judgement over consequential decisions. 

Securing What AI Agents Remember & What They Can Do 

Memory poisoning is an important example of how the security risks introduced by AI agents are evolving. As organisations give agents more autonomy and connect them to more systems, they need to understand what an agent can do and also what could influence it to behave differently. 

Protecting AI systems means securing their memory, tools and interactions, while continually assessing whether agents and the people responsible for operating them have the competence to perform their roles safely. 

Ultimately, organisations need to know whether an AI agent can do its job and, just as importantly, whether it can still be trusted to do it when someone is actively trying to make it fail. 

Emmanouil Gavriil is Vice President of Labs at Hack The Box 

Image: tadamichi

You Might Also Read: 

Non-Human Identities Aren’t a Crisis, But They Do Need Human Accountability:


If you like this website and use the comprehensive 8,000-plus service supplier Directory, you can get unrestricted access, including the exclusive in-depth Directors Report series, by signing up for a Premium Subscription.

  • Individual £5 per month or £50 per year. Sign Up
  • Multi-User, Corporate & Library Accounts Available on Request

Cyber Security Intelligence: Captured Organised & Accessible


 

« Paranoid By Design

ManageEngine
CyberSecurity Jobsite
Check Point

Directory of Suppliers

Tines

Tines

The Tines security automation platform helps security teams automate manual tasks, making them more effective and efficient.

ManageEngine

ManageEngine

As the IT management division of Zoho Corporation, ManageEngine prioritizes flexible solutions that work for all businesses, regardless of size or budget.

Clayden Law

Clayden Law

Clayden Law advise global businesses that buy and sell technology products and services. We are experts in information technology, data privacy and cybersecurity law.

ZenGRC

ZenGRC

ZenGRC (formerly Reciprocity) is a leader in the GRC SaaS landscape, offering robust and intuitive products designed to make compliance straightforward and efficient.

RELIANOID

RELIANOID

RELIANOID provides advanced Application Delivery and integrated security solutions to protect and optimize critical digital services.

European Cybercrime Training and Education Group (ECTEG)

European Cybercrime Training and Education Group (ECTEG)

The primary aim of ECTEG is to enhance the coordination of cybercrime training, by identifying opportunities to build the capacity of countries to combat cybercrime

Detack

Detack

Detack is an independent supplier of IT security auditing and consulting services.

SecureKey Technologies

SecureKey Technologies

SecureKey is a leading identity and authentication provider that simplifies consumer access to online services and applications.

Cyber Academy

Cyber Academy

Cyber Academy is one of the first institutions in the SE Europe region that provides a hands-on program in cyber security, blockchain and AI.

SPARTA Consortium

SPARTA Consortium

SPARTA tackles hard innovation challenges, leading the way in building transformative capabilities and forming a world-leading cybersecurity competence network across the EU.

Adlumin

Adlumin

Adlumin Inc. provides the enterprise-grade security operations platform and managed detection and response services that keep mid-market organizations secure.

Kyndryl

Kyndryl

Kyndryl has a comprehensive portfolio that leverages hybrid cloud solutions, business resiliency, and network services to help optimize your IT workloads and transformations.

Eastern Cyber Resilience Centre (ECRC)

Eastern Cyber Resilience Centre (ECRC)

The Eastern Cyber Resilience Centre is part of the national roll out of Cyber Resilience Centres in the UK which began in 2019.

Etisalat and (e&)

Etisalat and (e&)

Etisalat Group is one of the world’s leading telecom groups in emerging markets.

VinCSS

VinCSS

VinCSS Internet Security Services JSC is a leading organization working in the field of researching, developing, producing products as well as providing cyber security services.

Halogen Group

Halogen Group

Halogen Group is the leading Security Solutions Provider in West Africa. Services encompass Physical Security, Electronic Security, Virtual & Cyber Security, Risk Assessments and Training.

Softwerx

Softwerx

Softwerx is the UK’s leading Microsoft cloud security practice. We’ve been helping forward-thinking companies better secure their businesses for nearly twenty years.

Plerion

Plerion

Plerion is an all-in-one Cloud Security Platform that supports workloads across AWS, Azure, and GCP delivering cloud security posture management, workload security, data security and more.

ShieldIO

ShieldIO

ShieldIO Real-Time Homomorphic Encryption™ enables your organization to reach regulatory compliance without compromising data availability.

4 Sight Technology (4Sight)

4 Sight Technology (4Sight)

4 Sight Technology, your trusted IT solution integrator. We specialize in seamlessly blending technologies to create cohesive and efficient systems tailored to your business needs.

Operational Technology Cybersecurity Coalition (OT Cyber Coalition)

Operational Technology Cybersecurity Coalition (OT Cyber Coalition)

OT Cyber Coalition is a diverse group of leading cybersecurity vendors representing the entire OT lifecycle. We work with industry and government to enhance the resilience of critical infrastructure.