Skip to content

Simply exclude runtime loaded code from instrumentation with Frida mode #1708

@Ha0ris

Description

@Ha0ris

Is your feature request related to a problem? Please describe.

I am currently experiencing a problem with the Frida mode in Android. My harness calls the Android runtime to setup an environment that allows targeting a JNI function. The most convenient way is to use dlopen to load the library so I don't have to link it at compile time. The Android runtime is something quite large with many dependencies, so I don't want to instrument this part. However, currently it doesn't seem possible to simply prevent instrumentation of the loaded code at runtime (and potentially its dependencies).

Describe the solution you'd like

It might be handy with Frida mode to be able to exclude from instrumentation all code that is loaded at runtime so that instrumentation is only kept on what is specified in the Fuzzer configuration.

I think the most convenient way to do this would be to keep the current default behavior, but offer the user to explicitly exclude code loaded at runtime with an environment variable.

The variable could be : AFL_FRIDA_INST_NO_DYNLOAD and the associated JS function setInstrumentNoDynamicLoad().

What do you think about it? I could do the PR with pleasure.

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