[英]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上挂钩系统调用(当然只适用于你自己的进程,这不是系统范围的)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.