Skip to content

How do you spot JNI API functions in shared libraries #77

@gaojun0816

Description

@gaojun0816

In order to find out the dynamically registered JNI functions, you have to spot the use of JNI API function RegisterNatives. In your nativedroid, you have follow in code to find it and hook it with a customized SimProcedure:

if 'jniRegisterNativeMethods' in project.loader.main_object.imports or \
                '_ZN7android14AndroidRuntime21registerNativeMethodsEP7_JNIEnvPKcPK15JNINativeMethodi' in \
                project.loader.main_object.imports:
            project.hook_symbol('jniRegisterNativeMethods', RegisterNativeMethods(analysis_center))

This code appears in the function dynamic_register_resolve in file nativedroid/analyses/resolver/dynamic_register_resolution.py. However, I checked with many cases with several tools radare2, objdump besides angr. None of these tools provide the symbol tables contains these JNI API functions.

So I'd like to know are you sure this part of the code is really working? How did you make it work? Have you done anything extra with angr which I did not notice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions