简体   繁体   English

如何挂钩我的Android应用程序的系统调用(非root设备)

[英]How to hook system calls of my android app (non rooted device)

I am trying to intercept all system calls made by my Android app on a non rooted device. 我试图拦截我的Android应用程序在非root设备上进行的所有系统调用。

So every time my app writes/reads a file, I want to intercept the system call and encrypt/decrypt the stream for security purposes. 因此,每次我的应用程序写入/读取文件时,我都会拦截系统调用并加密/解密流以用于安全目的。 The encryption part is no problem, but how do I intercept the system calls? 加密部分没问题,但我如何拦截系统调用?

Because parts of the app are modules developed by third party providers of which I can not change the source code, there is no other way to make sure that data is stored securely. 由于应用程序的某些部分是由第三方提供商开发的模块,我无法更改源代码,因此没有其他方法可以确保数据安全存储。

Since I do not have root access I cannot access the address of the system call table as described here and I can not do this through an LKM module as well. 由于我没有root访问权限,因此无法访问此处所述的系统调用表的地址,我也无法通过LKM模块执行此操作。

I would appreciate any suggestions, thanks. 我要感谢任何建议,谢谢。

Edit: 编辑:

Ok I got the code link form Simone Margaritelli to work now! 好的,我现在可以使用Simone Margaritelli的代码链接了! the reason why my code kept crashing is because i had to set the right memory access permisions: 我的代码一直崩溃的原因是因为我必须设置正确的内存访问权限:

uint32_t page_size = getpagesize();
uint32_t entry_page_start = reloc& (~(page_size - 1));
mprotect((uint32_t *)entry_page_start, page_size, PROT_READ | PROT_WRITE);

就是你如何在没有root权限的情况下在Android上挂钩系统调用(当然只适用于你自己的进程,这不是系统范围的)。

You can reference Suterusu . 你可以参考Suterusu But it's not thread safe, and I'm also trying to find a thread safe solution. 但它不是线程安全的,我也试图找到一个线程安全的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在没有根设备的情况下在android中跟踪系统调用? - How to trace system calls in android with not rooted device? 如何挂接我的Android应用程序的系统调用 - How to hook system calls of my android app 使用系统签名的应用程序在无根的android设备上使用iptables - using iptables on non rooted android device using system signed app 如何在没有root设备的情况下在system / app目录中安装android应用程序,以便用户无法卸载该应用程序 - How to install android app in system/app directory without rooted device so that user can not uninstall that app android - 从应用程序内部更改有根设备的系统设置 - android - changing the system settings of a rooted device from inside the app Android应用程序可以将自身复制到有根设备上的系统目录中吗? - Can an Android app copy itself to the system directory on a rooted device? 我的应用如何在非root设备上访问管理员级权限? - How can my app access admin level privileges on non-rooted device? 我有一个植根设备,如何将我的应用程序构建为系统应用程序? - I have a rooted device, how can i build my application as system app? 如何在包含 magisk 应用程序的根设备中限制我的 android 应用程序? - How to restrict my android app in rooted device which contain magisk app? 适用于root用户的设备的设备管理应用 - Device admin app for rooted android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM