We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Steps to reproduce:
// main.c #include <dlfcn.h> #include <stdio.h> #include <error.h> int main() { void *handle = dlopen("./shared.so", RTLD_NOW); if (!handle) error(1, 0, "%s", dlerror()); // Clear dlerror. dlerror(); char *(*foo)() = dlsym(handle, "foo"); char *last_error = dlerror(); if (last_error) error(1, 0, "%s", last_error); puts(foo()); }
─────────────────────────────────────────────────────────────
// shared.c char *foo() { return "shared function"; }
gcc -g -shared -o shared.so shared.c && gcc -g -o main main.c
frida-trace -s foo -- ./main
I think this code here needs to also run whenever dlopen is called (and maybe also on dlclose?): https://github.com/frida/frida-tools/blob/main/agents/tracer/agent.ts#L198-L217
I tried this patch but I couldn't get frida-tools to build locally.
diff --git a/agents/tracer/agent.ts b/agents/tracer/agent.ts index db24781..7030d01 100644 --- a/agents/tracer/agent.ts +++ b/agents/tracer/agent.ts @@ -31,13 +31,28 @@ class Agent { } } - this.start(spec).catch(e => { + let start = () => this.start(spec).catch(e => { send({ type: "agent:error", message: e.message }); }); + start(); + + Interceptor.attach(Module.getExportByName('libc.so', 'dlopen'), { + onEnter: function (args) { + let path = args[0].readCString(); + console.log(`rehook functions on dlopen(${path})`); + }, + onLeave: async function (retval) { + if(!retval.isNull()) { + await start(); + console.log("hooked dlopen"); + } + } + }); + return { id: Process.id, platform: Process.platform,
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Steps to reproduce:
─────────────────────────────────────────────────────────────
gcc -g -shared -o shared.so shared.c && gcc -g -o main main.c
frida-trace -s foo -- ./main
. Observe that it says "Started tracing 0 functions."I think this code here needs to also run whenever dlopen is called (and maybe also on dlclose?): https://github.com/frida/frida-tools/blob/main/agents/tracer/agent.ts#L198-L217
I tried this patch but I couldn't get frida-tools to build locally.
The text was updated successfully, but these errors were encountered: