OSX Network Share Mounter - Metasploit
This page contains detailed information about how to use the post/osx/manage/mount_share metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: OSX Network Share Mounter
Module: post/osx/manage/mount_share
Source code: modules/post/osx/manage/mount_share.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): OSX
Target service / protocol: -
Target network port(s): -
List of CVEs: -
This module lists saved network shares and tries to connect to them using stored credentials. This does not require root privileges.
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/manage/mount_share
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/manage/mount_share
msf post(mount_share) > show options
... show and set options ...
msf post(mount_share) > set SESSION session-id
msf post(mount_share) > 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/manage/mount_share")
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 osx/manage/mount_share post exploitation module looks in the msfconsole:
msf6 > use post/osx/manage/mount_share
msf6 post(osx/manage/mount_share) > show info
Name: OSX Network Share Mounter
Module: post/osx/manage/mount_share
Platform: OSX
Arch:
Rank: Normal
Provided by:
Peter Toth <[email protected]>
joev <[email protected]>
Compatible session types:
Meterpreter
Shell
Available actions:
Name Description
---- -----------
LIST Show a list of stored network share credentials
MOUNT Mount a network shared volume using stored credentials
UMOUNT Unmount a mounted volume
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
PROTOCOL smb yes Network share protocol. (Accepted: smb, nfs, cifs, ftp, afp)
SESSION yes The session to run this module on.
VOLUME localhost yes Name of network share volume. `set ACTION LIST` to get a list.
Description:
This module lists saved network shares and tries to connect to them
using stored credentials. This does not require root privileges.
Module Options
This is a complete list of options available in the osx/manage/mount_share post exploitation module:
msf6 post(osx/manage/mount_share) > show options
Module options (post/osx/manage/mount_share):
Name Current Setting Required Description
---- --------------- -------- -----------
PROTOCOL smb yes Network share protocol. (Accepted: smb, nfs, cifs, ftp, afp)
SESSION yes The session to run this module on.
VOLUME localhost yes Name of network share volume. `set ACTION LIST` to get a list.
Post action:
Name Description
---- -----------
LIST Show a list of stored network share credentials
Advanced Options
Here is a complete list of advanced options supported by the osx/manage/mount_share post exploitation module:
msf6 post(osx/manage/mount_share) > show advanced
Module advanced options (post/osx/manage/mount_share):
Name Current Setting Required Description
---- --------------- -------- -----------
OSASCRIPT_PATH /usr/bin/osascript yes Path to the osascript executable.
RECENT_PLIST_PATH ~/Library/Preferences/com.apple.recentitems.plist yes Path to the finder recent plist.
SECURITY_PATH /usr/bin/security yes Path to the security executable.
SIDEBAR_PLIST_PATH ~/Library/Preferences/com.apple.sidebarlists.plist yes Path to the finder sidebar plist.
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/manage/mount_share module can do:
msf6 post(osx/manage/mount_share) > show actions
Post actions:
Name Description
---- -----------
LIST Show a list of stored network share credentials
MOUNT Mount a network shared volume using stored credentials
UMOUNT Unmount a mounted volume
Evasion Options
Here is the full list of possible evasion options supported by the osx/manage/mount_share post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(osx/manage/mount_share) > 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:
- No Network Share credentials were found in the keyrings
- Could not check keyring contents: Security binary not found.
- No favorite shares were found
- Could not check sidebar favorites contents: Sidebar plist not found
- No recent shares were found
- Could not check recent favorites contents: Recent plist not found
- No volumes found in /Volumes
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.
No Network Share credentials were found in the keyrings
Here is a relevant code snippet related to the "No Network Share credentials were found in the keyrings" error message:
63:
64: if action.name == 'LIST'
65: if file?(security_path)
66: saved_shares = get_keyring_shares(security_path)
67: if saved_shares.length == 0
68: print_status("No Network Share credentials were found in the keyrings")
69: else
70: print_status("Network shares saved in keyrings:")
71: print_status(" Protocol\tShare Name")
72: saved_shares.each do |line|
73: print_good(" #{line}")
Could not check keyring contents: Security binary not found.
Here is a relevant code snippet related to the "Could not check keyring contents: Security binary not found." error message:
72: saved_shares.each do |line|
73: print_good(" #{line}")
74: end
75: end
76: else
77: print_error("Could not check keyring contents: Security binary not found.")
78: end
79: if file?(sidebar_plist_path)
80: favorite_shares = get_favorite_shares(sidebar_plist_path)
81: if favorite_shares.length == 0
82: print_status("No favorite shares were found")
No favorite shares were found
Here is a relevant code snippet related to the "No favorite shares were found" error message:
77: print_error("Could not check keyring contents: Security binary not found.")
78: end
79: if file?(sidebar_plist_path)
80: favorite_shares = get_favorite_shares(sidebar_plist_path)
81: if favorite_shares.length == 0
82: print_status("No favorite shares were found")
83: else
84: print_status("Favorite shares (without stored credentials):")
85: print_status(" Protocol\tShare Name")
86: favorite_shares.each do |line|
87: print_uri(line)
Could not check sidebar favorites contents: Sidebar plist not found
Here is a relevant code snippet related to the "Could not check sidebar favorites contents: Sidebar plist not found" error message:
86: favorite_shares.each do |line|
87: print_uri(line)
88: end
89: end
90: else
91: print_error("Could not check sidebar favorites contents: Sidebar plist not found")
92: end
93: if file?(recent_plist_path)
94: recent_shares = get_recent_shares(recent_plist_path)
95: if recent_shares.length == 0
96: print_status("No recent shares were found")
No recent shares were found
Here is a relevant code snippet related to the "No recent shares were found" error message:
91: print_error("Could not check sidebar favorites contents: Sidebar plist not found")
92: end
93: if file?(recent_plist_path)
94: recent_shares = get_recent_shares(recent_plist_path)
95: if recent_shares.length == 0
96: print_status("No recent shares were found")
97: else
98: print_status("Recent shares (without stored credentials):")
99: print_status(" Protocol\tShare Name")
100: recent_shares.each do |line|
101: print_uri(line)
Could not check recent favorites contents: Recent plist not found
Here is a relevant code snippet related to the "Could not check recent favorites contents: Recent plist not found" error message:
100: recent_shares.each do |line|
101: print_uri(line)
102: end
103: end
104: else
105: print_error("Could not check recent favorites contents: Recent plist not found")
106: end
107: mounted_shares = get_mounted_volumes
108: if mounted_shares.length == 0
109: print_status("No volumes found in /Volumes")
110: else
No volumes found in /Volumes
Here is a relevant code snippet related to the "No volumes found in /Volumes" error message:
104: else
105: print_error("Could not check recent favorites contents: Recent plist not found")
106: end
107: mounted_shares = get_mounted_volumes
108: if mounted_shares.length == 0
109: print_status("No volumes found in /Volumes")
110: else
111: print_status("Mounted Volumes:")
112: mounted_shares.each do |line|
113: print_good(" #{line}")
114: end
Go back to menu.
Related Pull Requests
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #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
- #4372 Merged Pull Request: code style
Go back to menu.
See Also
Check also the following modules related to this module:
Authors
- Peter Toth <globetother[at]gmail.com>
- joev
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.