OSX VPN Manager - Metasploit
This page contains detailed information about how to use the post/osx/manage/vpn metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: OSX VPN Manager
Module: post/osx/manage/vpn
Source code: modules/post/osx/manage/vpn.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 VPN connections and tries to connect to them using stored credentials.
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/vpn
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/vpn
msf post(vpn) > show options
... show and set options ...
msf post(vpn) > set SESSION session-id
msf post(vpn) > 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/vpn")
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/vpn post exploitation module looks in the msfconsole:
msf6 > use post/osx/manage/vpn
msf6 post(osx/manage/vpn) > show info
Name: OSX VPN Manager
Module: post/osx/manage/vpn
Platform: OSX
Arch:
Rank: Normal
Provided by:
Peter Toth <[email protected]>
Compatible session types:
Meterpreter
Shell
Available actions:
Name Description
---- -----------
CONNECT Connect to a VPN using stored credentials
DISCONNECT Disconnect from a VPN
LIST Show a list of VPN connections
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
NETWORKSETUP_PATH /usr/sbin/networksetup yes Path to the networksetup executable.
SCUTIL_PATH /usr/sbin/scutil yes Path to the scutil executable.
SESSION yes The session to run this module on.
VPN_CONNECTION OSX_VPN yes Name of VPN connection. `set ACTION LIST` to get a list.
Description:
This module lists VPN connections and tries to connect to them using
stored credentials.
Module Options
This is a complete list of options available in the osx/manage/vpn post exploitation module:
msf6 post(osx/manage/vpn) > show options
Module options (post/osx/manage/vpn):
Name Current Setting Required Description
---- --------------- -------- -----------
NETWORKSETUP_PATH /usr/sbin/networksetup yes Path to the networksetup executable.
SCUTIL_PATH /usr/sbin/scutil yes Path to the scutil executable.
SESSION yes The session to run this module on.
VPN_CONNECTION OSX_VPN yes Name of VPN connection. `set ACTION LIST` to get a list.
Post action:
Name Description
---- -----------
LIST Show a list of VPN connections
Advanced Options
Here is a complete list of advanced options supported by the osx/manage/vpn post exploitation module:
msf6 post(osx/manage/vpn) > show advanced
Module advanced options (post/osx/manage/vpn):
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/manage/vpn module can do:
msf6 post(osx/manage/vpn) > show actions
Post actions:
Name Description
---- -----------
CONNECT Connect to a VPN using stored credentials
DISCONNECT Disconnect from a VPN
LIST Show a list of VPN connections
Evasion Options
Here is the full list of possible evasion options supported by the osx/manage/vpn post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(osx/manage/vpn) > 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.
Invalid action
Here is a relevant code snippet related to the "Invalid action" error message:
38: ])
39:
40: end
41:
42: def run
43: fail_with(Failure::BadConfig, "Invalid action") if action.nil?
44:
45: scutil_path = datastore['SCUTIL_PATH'].shellescape
46: networksetup_path = datastore['NETWORKSETUP_PATH'].shellescape
47: vpn_name = datastore['VPN_CONNECTION']
48:
Aborting, scutil binary not found.
Here is a relevant code snippet related to the "Aborting, scutil binary not found." error message:
45: scutil_path = datastore['SCUTIL_PATH'].shellescape
46: networksetup_path = datastore['NETWORKSETUP_PATH'].shellescape
47: vpn_name = datastore['VPN_CONNECTION']
48:
49: if not file?(scutil_path)
50: print_error("Aborting, scutil binary not found.")
51: return
52: end
53:
54: if not file?(networksetup_path)
55: print_error("Aborting, networksetup binary not found.")
Aborting, networksetup binary not found.
Here is a relevant code snippet related to the "Aborting, networksetup binary not found." error message:
50: print_error("Aborting, scutil binary not found.")
51: return
52: end
53:
54: if not file?(networksetup_path)
55: print_error("Aborting, networksetup binary not found.")
56: return
57: end
58:
59: # Fetch the list of configured VPN connections
60: cmd_list = "#{scutil_path} --nc list"
<VPN_NAME> not found
Here is a relevant code snippet related to the "<VPN_NAME> not found" error message:
81: print_status("#{vpn_name} already connected")
82: return
83: end
84:
85: unless disconnected_names.include?(vpn_name)
86: print_error("#{vpn_name} not found")
87: return
88: end
89:
90: cmd_up = "#{networksetup_path} -connectpppoeservice '#{vpn_name}'"
91: vprint_status(cmd_up)
<VPN_NAME> not found
Here is a relevant code snippet related to the "<VPN_NAME> not found" error message:
95: print_status("#{vpn_name} already disconnected")
96: return
97: end
98:
99: unless connected_names.include?(vpn_name)
100: print_error("#{vpn_name} not found")
101: return
102: end
103:
104: identifier = parse_vpn_connection_identifier(vpn_data, vpn_name)
105: unless identifier
Could not parse <VPN_NAME> identifier
Here is a relevant code snippet related to the "Could not parse <VPN_NAME> identifier" error message:
101: return
102: end
103:
104: identifier = parse_vpn_connection_identifier(vpn_data, vpn_name)
105: unless identifier
106: print_error("Could not parse #{vpn_name} identifier")
107: return
108: end
109: cmd_down = "#{scutil_path} --nc stop #{identifier}"
110: vprint_status(cmd_down)
111: cmd_exec(cmd_down)
Go back to menu.
Related Pull Requests
- #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
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5173 Merged Pull Request: fix fail_with errors
- #2632 Merged Pull Request: Module post osx vpn
Go back to menu.
See Also
Check also the following modules related to this module:
- post/osx/manage/mount_share
- post/osx/manage/record_mic
- post/osx/manage/sonic_pi
- post/osx/manage/webcam
Authors
- Peter Toth <globetother[at]gmail.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.