Cache Poisoning
Cache poisoning is an attack in which an attacker inserts false or malicious data into a cache so that subsequent requests return the attacker-controlled content instead of the legitimate response. Victims who rely on the poisoned cache receive incorrect or harmful information without any indication that something is wrong. The attack exploits the trust that systems and users place in cached data.
Cache poisoning is a class of security vulnerability in which an attacker causes invalid, forged, or malicious entries to be stored in a caching layer, which are then served as authoritative responses to subsequent requestors. The attack manifests in at least two distinct contexts: DNS cache poisoning, in which false resource records are inserted into a DNS resolver cache causing clients to resolve domain names to attacker-controlled IP addresses; and web cache poisoning, in which an attacker exploits web server and cache behavior, typically through HTTP response splitting or manipulation of cache key logic, to cause a shared cache to store and serve a harmful HTTP response to other users. Web cache poisoning typically requires flaws in the web application or cache configuration, while DNS cache poisoning typically exploits weaknesses in resolver transaction ID validation or source port randomization. In both cases, the poisoned entry persists for the duration of the cache TTL, potentially affecting all users served by that cache.
Why it matters
Cache poisoning is significant because caches are designed to be trusted intermediaries that improve performance and availability. When an attacker successfully poisons a cache, the malicious response is served automatically to every subsequent user who queries that cache, multiplying the impact of a single successful attack across a potentially large population without requiring the attacker to interact with each victim individually. The poisoned entry persists for the duration of the cache TTL, meaning remediation requires not just fixing the underlying flaw but also invalidating or waiting out the cached content.
In the DNS context, a poisoned resolver cache can redirect users to attacker-controlled infrastructure, enabling phishing, credential harvesting, malware delivery, or man-in-the-middle attacks, all while the victim's browser displays a familiar domain name. In the web cache context, a poisoned shared cache can cause a harmful HTTP response, such as one containing malicious scripts or redirects, to be served to all users whose requests match the cached entry. Both variants are particularly difficult for end users to detect because the content appears to originate from a legitimate source.
The Kaminsky vulnerability, disclosed in 2008, is a well-documented example of the DNS variant's severity. Dan Kaminsky demonstrated that weaknesses in DNS resolver transaction ID validation and source port randomization allowed an attacker to poison resolver caches at scale, potentially affecting large portions of internet traffic. The disclosure prompted an industry-wide emergency patching effort and accelerated adoption of source port randomization and DNSSEC as mitigations.
Who it's relevant to
Inside Cache Poisoning
Common questions
Answers to the questions practitioners most commonly ask about Cache Poisoning.