DNS Cache Snooping

The DNS server reveals to outside parties whether names are in its cache, letting them infer which sites and services its users have recently looked up.

SeverityLow
CVSS 3.13.7 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator
CVSS 4.06.3 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-204: Observable Response Discrepancy
MITRE ATT&CKT1592.002 Software, T1591.002 Business Relationships
CategoryInformation Disclosure

Description

The DNS server answers queries from its cache for parties who should not be able to see it. By sending a query with the recursion desired flag cleared, an attacker asks the server to answer only from what it already holds: an answer means that someone using the server has looked up that name recently, and the remaining time to live shows roughly when. Where non-recursive queries are refused, the same can sometimes be inferred from response times or from the time to live values in recursive answers.

Repeated over time, the technique shows which software vendors, update services, banks, suppliers and online services the organisation uses, and when. This supports targeted phishing, for example impersonating a supplier or service the organisation is known to use, and helps in choosing exploits for the software in use. The information is indirect and limited to names that someone has recently looked up, and reaching an internal resolver usually requires a foothold on the internal network, so the impact on its own is low; it is most relevant for resolvers that can be reached from the internet.

As Microsoft's guidance notes, the technique works even against a server that does not resolve recursively for third parties, as long as it gives them records from its cache. The issue is confirmed with dig and its +norecurse option, or with the Nmap dns-cache-snoop script, from a host that should not be using the server, and scanners report it as DNS server cache snooping remote information disclosure.

Remediation

Stop answering cache queries from parties outside the organisation:

  • Do not let untrusted networks reach recursive resolvers: block inbound DNS from the internet to them, and keep public authoritative DNS on separate servers with recursion disabled.
  • On BIND, restrict cache access to internal clients with allow-query-cache and allow-recursion.
  • On Unbound, give internal networks the allow action in access-control rather than allow_snoop, since allow refuses cache answers to non-recursive queries; reserve allow_snoop for administrators' hosts.
  • On Windows DNS Server, which allows recursion by default, Microsoft's guidance is to keep recursive servers on networks that untrusted clients cannot reach, or to disable recursion on servers that only serve their own zones.

Cache snooping by users who are entitled to use an internal resolver is generally an accepted risk. Confirm the fix by repeating the non-recursive queries from an untrusted network and checking that they are refused.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Network Services Findings

Every Network Services finding