Cache poisoning is planting malicious or altered data in a cache so that later users or processes receive it as if it were legitimate. A cache stores a copy of data to serve it faster, so if a bad entry gets in, every request that uses that entry can be affected until it expires or is removed. Caches exist in many places, including web caches, DNS resolvers, package caches and build caches.

The danger is the reach. One successful insertion can affect many users, or in a software build, produce compromised output that is then used elsewhere. In the context of AI agents, poisoned stored content could influence later actions.

Whether an attack works depends on how the cache decides which requests are the same and who can write to it. Careful design makes poisoning harder, and a poisoned entry that expires quickly limits the effect, but a lack of visible symptoms does not mean a cache is clean.

To reduce risk, keep caches separated by trust level so untrusted input cannot write to shared entries, validate and normalize the data that forms cache keys, verify the integrity of cached artifacts, set sensible expiry times and be able to purge caches quickly when something looks wrong.