通过在 Xcode 里的 Other Linker Flags 设置参数,可以防止App被注入dylib(仅限于iOS 10 以下系统)  比如,某艺,XX音乐等

dylib无法注入,也就意味着没办法用cycript动态调试App,只能干瞪眼

Other Linker Flags 参数

-Wl,-sectcreate,__RESTRICT,__restrict,/dev/null

通过阅读dyld源代码,我们可以得知其大概原理

static ImageLoader* loadPhase3(const char* path, const char* orgPath, const LoadContext& context, std::vector<const char*>* exceptions)
{
ImageLoader* image = NULL;
if ( strncmp(path, "@executable_path/", ) == ) {
// executable_path cannot be in used in any binary in a setuid process rdar://problem/4589305
if ( sProcessIsRestricted )
throwf("unsafe use of @executable_path in %s with restricted binary", context.origin);
}
else if ( (strncmp(path, "@loader_path/", ) == ) && (context.origin != NULL) ) {
// @loader_path cannot be used from the main executable of a setuid process rdar://problem/4589305
if ( sProcessIsRestricted && (strcmp(context.origin, sExecPath) == ) )
throwf("unsafe use of @loader_path in %s with restricted binary", context.origin);
}
else if (sProcessIsRestricted && (path[] != '/' )) {
throwf("unsafe use of relative rpath %s in %s with restricted binary", path, context.origin);
} return loadPhase4(path, orgPath, context, exceptions);
}

当dylib加载路径是以 @executable_path、@loader_path 或者不是以 '/'开头,则会抛出异常使进程结束。

针对以上情况,分享一个修改__RESTRICT命令的工具,原理是将Mach-O文件中的 RESTRICT命令改为 SESTRICT,使该命令因为无法识别而失效。

github源码地址

使用

./AAntiCrack --replace-restrict  <应用可执行文件mach-o>

此工具还有注入dylib功能,将dylib与mach-o放在同一目录下,然后执行

./AAntiCrack --replace-restrict -i dylib路径 <应用可执行文件mach-o>

即可实现动态库注入,与反反注入

相关链接:

  http://bbs.iosre.com/t/tweak-app-app-tweak/438

最新文章

  1. jsp基础知识
  2. 新增资产时YTD折旧与累计折旧录入错误如何处理
  3. jQuery经典面试题及答案精选(转)
  4. number-of-segments-in-a-string
  5. 关于CQRS(老外经典好文)
  6. Java 声明和访问控制(二) this关键字的访问
  7. 编码问题 php字符编码转换类
  8. python学习笔记:2.python基础
  9. Django 表关系
  10. Mac下软件包管理器-homebrew
  11. js插件---bootstrap-datepicker.js是什么
  12. textarea标签内的文字无缘故居中解决原因
  13. Cookie安全小结
  14. MongoDB常用命令总结
  15. 并发编程概述--C#并发编程经典实例
  16. python3转变exe的方法
  17. 【转】Kafka 之 中级
  18. slf4j+log4j2 pom配置
  19. OpenSSL编程
  20. sql server 2012 登录失败出现10048错误

热门文章

  1. STL中heap相关函数
  2. go语言入门(一)
  3. substring() slice() substr()的区别联系
  4. caffe源码整个训练过程
  5. 在数据库中(Oracle),根据时间查询数据: to_date()和to_char()函数
  6. Codeforces 822D My pretty girl Noora(最小素因子的性质)
  7. plt-3D打印1
  8. es 插件
  9. xcode上真机调试iphone4s出现“There was an internal API error.”解决方案
  10. 谨防“USB杀手”