Skip to content
New issue

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

Hooks on methods within dynamically loaded DEX do not work #39

Open
cryptax opened this issue Jan 19, 2021 · 1 comment
Open

Hooks on methods within dynamically loaded DEX do not work #39

cryptax opened this issue Jan 19, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@cryptax
Copy link
Contributor

cryptax commented Jan 19, 2021

The APK loads dynamically (using DexClassLoader) another DEX file. I want to hook a method inside that second dex.

With Dexcalibur, I am able to search for that method, and create a custom hook ("probe on") for it. For example, in the image below I probe a method a() which is contained within a dynamically loaded dex.

dexcalibur-probe-a

The custom hook appears ok in Dexcalibur. See the custom hook at the bottom.

dexcalibur-custom-hook

Unfortunately, it does not work! When I spawn Dexcalibur, the hook never gets called : no logs appear for it (for other hooks, logs appear fine).

  • I am 100% certain though the hooked method is called. I tried with Frida, and hooked that function, and I get in the hook fine.
  • I tried to hook another method from that dynamically loaded dex: onCreate() from a class which is actually the main of the loaded dex. Same, no logs appear for onCreate with Dexcalibur.

Conclusion: I think something is broken with the implementation of those dyn hooks.

NB. I do not recall the Dexcalibur console showing anything abnormal.

Desktop (please complete the following information):

  • OS: Linux Mint
  • Node JS version: 12.20
  • Dexcalibur version (see 'package.json' or output) : 0.7.3
  • Sample I tried it with: Android/Alien malware dc215663af92d41f40f36088ec1b850b81092ea94a4a061a9ce88178daee965a. You can get it from github (September 2020). Beware: it is malicious!
@cryptax cryptax added the bug Something isn't working label Jan 19, 2021
@FrenchYeti
Copy link
Owner

FrenchYeti commented Jan 19, 2021

It is a long time issue which will be patched.

Hook of methods loaded dynamically should be deployed when the its bytecode is loaded. In other words, hooks definition should be called from DexClassLoader hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants