mac上的应用提权
一个mac上的app需要在/Applications/My.app/Contents/MacOS路径下创建一个配置文件,在开启root权限的账户下运行时ok,但是在没有开启root权限的账户下运行时,创建文件会失败,报"Permission Denied"
花时间了解了一下mac上的应用提权,由于安全的原因,提权方式一直在调整,目前苹果推荐的方式是使用Security Manager,并提供了一个例子:SMJobBless
以下引用自stackoverflow http://stackoverflow.com/questions/18404884/c-show-osx-permission-dialog
"
Originally, Apple provided a function 'AuthorizationExecuteWithPrivileges' that allowed an application to launch another with root privileges. This has since been deprecated for security reasons.
The dialog here is a bit misleading. Apple provides authorization services that launches the dialog under various different situations, but usually from an application having called the function AuthorizationCopyRights, after having setup rules in an authorization database (the file at /etc/authorization) and having created the Authorization reference with AuthorizationCreate.
Security on OSX is split between a security daemon, a security agent and applications. An application can restrict features using this system, or request authorisation for the user to enter credentials so it can launch a privileged application, which is what you need to do.
It's important to note that the dialog has not been presented by the application, but by the Security Agent, which is solely responsible for the security GUI. The daemon actually processes the authorization.
Apple's method for elevation is to have all applications run with Standard User rights and should a privileged task be required, then this must be factored out into a separate application which is registered to run with launchd and given the elevated privileges. The example Apple provides isSMJobBless.
While the calling code of the example is written in Objective-C, the important functions are just C functions in the SMJobBlessAppController.m file, most notably AuthorizationCreate to create an authorisation reference and the code in the Objective-C function blessHelperWithLabel:error: at the bottom of the file.
Begin with this help document on SMJobBless, which details the process.
Finally, if you're using Qt, you'll need to include Apple's Security framework for the required function calls. To do that, just add the following to your .pro file: -
QMAKE_LFLAGS += -F /System/Library/Frameworks/Security.framework/
LIBS += -framework Security
"
附:
1.Enable and using the "root" user in mac os x
https://support.apple.com/en-us/HT204012
mac上的应用提权的更多相关文章
- iOS冰与火之歌(番外篇) - 基于PEGASUS(Trident三叉戟)的OS X 10.11.6本地提权
iOS冰与火之歌(番外篇) 基于PEGASUS(Trident三叉戟)的OS X 10.11.6本地提权 蒸米@阿里移动安全 0x00 序 这段时间最火的漏洞当属阿联酋的人权活动人士被apt攻击所使用 ...
- CGI PL PERL脚本 提权
windows 2003 下,安装ActivePerl-5.16.2.1602-MSWin32-x86-296513 IIS 添加CGI支持.并在对应网站配置下面,添加CGI后缀或PL后缀 与 对应的 ...
- 从getshell到提权
从getshell到提权 一.起因 学校推出新的党建系统,之前党建系统还参与开发,后来因为一些原因没有开发,主要想看看这届工作室的学弟.学妹代码水平,把源码撸下来审计一下,工作室用git开发的,记着上 ...
- 9.CVE-2016-5195(脏牛)内核提权漏洞分析
漏洞描述: 漏洞编号:CVE-2016-5195 漏洞名称:脏牛(Dirty COW) 漏洞危害:低权限用户利用该漏洞技术可以在全版本Linux系统上实现本地提权 影响范围:Linux内核>=2 ...
- Linux提权小结
原文链接:http://zone.secevery.com/article/1104 Linux提权1.信息收集2.脏牛漏洞提权3.内核漏洞exp提权4.SUID提权 0x00 基础信息收集(1):内 ...
- 脏牛提权CVE-2016-5195
gcc -pthread dirtyc0w.c -o dirtyc0w 尝试使用gcc -pthread dirtyc0w.c -o dirtyc0w 编译该POC文件 gcc命令是一个编译器套件,可 ...
- 记一次 lampiao渗透(Drupal+脏牛提权)
vulnhub|渗透测试lampiao 题记 最近在打靶机,发现了一个挺有意思的靶机,这里想跟大家分享一下. 环境准备 vulnhub最近出的一台靶机 靶机(https://www.vulnhub.c ...
- 通过Mysql提权的几种姿势
本文记录利用mysql数据库,在拿到shell之后进行提权的两种方法. 一.UDF提权 原理:UDF是mysql的一个拓展接口,UDF(Userdefined function)让用户通过该接口可以自 ...
- 史上最全Linux提权后获取敏感信息方法
http://www.freebuf.com/articles/system/23993.html 在本文开始之前,我想指出我不是专家.据我所知,在这个庞大的区域,没有一个“神奇”的答案.分享,共享( ...
随机推荐
- Android ViewDragHelper及移动处理总结
概述 2013年谷歌i/o大会上介绍了两个新的layout: SlidingPaneLayout和DrawerLayout,现在这俩个类被广泛的运用.我们知道在我们实际的开发中往往会涉及到很多的拖动效 ...
- Android 获取View宽度
/***************************************************************************** * Android 获取View宽度 * ...
- win7下出现'telnet' 不是内部或外部命令,也不是可运行的程序或批处理文件的解决方法
在win7竟然不可能使用telnet命令,使用时会出现“'telnet' 不是内部或外部命令,也不是可运行的程序或批处理文件”,研究了很多,才终于明白WIN7默认是没有安装这个命令. 处理办法: 依次 ...
- B. Blown Garland
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- sscanf非常的重要
刚进研究生阶段,发现曾经学习的c语言真的好少好少,很少能够看见scanf printf等..... 以后实验的80%以上都是在linux下面 老师让我看看关于一个日志会聚的一个项目模块 发现基本上都是 ...
- 如何从kernel源码中查出版本号(转载)
转载:http://m.android.tgbus.com/tgmobile/arc/174624.shtml 目前查版本号的方法都是在编译以后从rootfs里看的,难道从源码就看不到,一定要编译以后 ...
- PTA 水...
习题4-2 求幂级数展开的部分和 (20分) 已知函数e^x可以展开为幂级数1+x+x2/2!+x3/3!+⋯+xk/k!+⋯1+x+x^2 /2! + x^3 /3! + \cdots + x^k ...
- 安全性测试入门 (三):CSRF 跨站请求伪造攻击和防御
本篇继续对于安全性测试话题,结合DVWA进行研习. CSRF(Cross-site request forgery):跨站请求伪造 1. 跨站请求伪造攻击 CSRF则通过伪装成受信任用户的请求来利用受 ...
- centos走一波
Cpu 作为一个具有特定功能的芯片,里面含有微指令集 如果你想让主机进行什么特异的运算,就需要参考Cpu是否有相关内置的微指令集 才可以由于Cpu的工作主要在于 管理和运算 ,因此Cpu内又可以分为两 ...
- JSP | 基础 | JSP行为 | incline && forward
语法 描述 jsp:include 用于在当前页面中包含静态或动态资源 jsp:forward 从一个JSP文件向另一个文件传递一个包含用户请求的request对象 index.jsp <%@ ...