I am trying to hook the native libraries in Android. Basically I am trying to hook the socket calls in libjavacore.so
file.
Similar Approach as mentioned here
For example:
Get socket address (
dlsym()
) inlibc.so
.Then search for the socket address in
libjavacore.so
file in sections like.got
,.plt
,.dlsym
,.dynamic
.Replace the actual socket address with custom socket address at the location where actual socket address is present in memory.
The above approach is working for me in case of 32 bit Android devices. But is not working for me in case of 64 bit Android devices. Tried using proper data types like uint_ptr
so that it will get auto adjusted. But still failing. When I further debugged found that libjavacore.so
file is of 32 bit ELF running on 64 bit system. So, tried using uint32_t
and uint64_t
types as well and trying with both. But still failing.