2

I was reading this Frida release page and noticed it made the following reference:

Short of writing the whole agent in C, one could go ahead and build a native library, and load it using Module.load(). This works but means it has to be compiled for every single architecture, deployed to the target, etc.

The CModule feature is fantastic for Frida-centric actions, but it would be nice to load generic shared-objects into the target process. CModule appears to be written for performance optimization within Stalker and related code. Any attempt to do something "extra" results in something like this will result in compile-time (at runtime, by the embedded TinyCC) errors such as:

Compilation failed: In file included from module.c:3:\nmodule.c:3: error: include file 'dlfcn.h' not found"

^ Attempt at writing a CModule stub that dlopen'd a shared object from disk.

But the comment by Ole in the link above alludes to this being possible, though I can't find any references other than the NodeJS C++ Addons features that are, of course, specific to NodeJS.


tl;dr How does one load a generic object such that all of its exported functions are callable from Javascript? Is this possible?

2

I was misinterpreting the context of the comment in the original link, it seems. I was under the impression that Module.load was a v8-ism, while it in fact appears to be a Frida-API.

https://frida.re/docs/javascript-api/#module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.