- 问题背景
- 解决方法
- 总结
阅读之前注意:
本文阅读建议用时:10min
本文阅读结构如下表:
项目 | 下属项目 | 测试用例数量 |
---|---|---|
问题背景 | 无 | 0 |
解决方法 | 无 | 1 |
总结 | 无 | 0 |
问题背景
一个测试的项目,给自己的应用签task_for_pid-allow。
在工程中创建了pidTest.entitlements,如下图:
ViewController.m代码非常简单,如下:
#import <Foundation/NSProcessInfo.h>
#import <mach-o/dyld_images.h>
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
kern_return_t rc;
mach_port_t task;
int pid;
pid = [[NSProcessInfo processInfo] processIdentifier];//获取进程的id,即平常使用ps -e | grep xxx得到的进程端口号
rc = task_for_pid(mach_task_self(), pid, &task);
if (rc) { fprintf (stderr, "task_for_pid() failed with error %d - %s\n", rc, mach_error_string(rc)); exit(1); }
printf ("RC %d - Task: %d\n",rc, task);
}
但是Xcode无法编译通过,提示如下:
Showing All Messages
👎 Automatic signing is unable to resolve an issue with the “get_pid” target’s entitlements. Automatic signing can’t add the task_for_pid-allow entitlements to your provisioning profile. Switch to manual signing and resolve the issue by downloading a matching provisioning profile from the developer website. Alternatively, to continue using automatic signing, remove these entitlements from your entitlements file and their associated functionality from your code. (in target ‘get_pid’)
其中重点是Automatic signing can’t add the task_for_pid-allow entitlements to your provisioning profile,以及Switch to manual signing。
解决方法
参考不越狱可以砸壳了可以解决。
翻译叫“通灵纸”漏洞?作者说就算没有iOS背景或者漏洞利用背景的人,也能理解这个。
原理是构建特定的xml签名文件,利用系统4个模块对xml文件的解析不同,导致上层看不到,但是底层检测到是有权限的。
总结
构建特定的xml签名文件,可以给应用签上task_for_pid-allow等其他权限属性。
如果本文对你有帮助,不如请我一罐可乐吧 🎃