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

╄→гoц情女王★ 提交于 2019-12-04 10:41:41

问题


I am trying to intercept all system calls made by my Android app on a non rooted device.

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.

I would appreciate any suggestions, thanks.

Edit:

Ok I got the code link form Simone Margaritelli to work now! 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);

回答1:


This is how you can hook syscalls on Android without root permissions ( only working for your own process of course, this is not system wide ).




回答2:


You can reference Suterusu. But it's not thread safe, and I'm also trying to find a thread safe solution.



来源:https://stackoverflow.com/questions/23443848/how-to-hook-system-calls-of-my-android-app-non-rooted-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!