Giter VIP home page Giter VIP logo

dynamiccodemonitorandreplace-pipeline's Introduction

DynamicCodeMonitorAndReplace-pipeline

Dynamic Code Loading Monitor

  • This tool is developed to monitor dynamic code loading in Android apps and replace the dynamically loaded code with our injected one.

Java/Dex

  • Replaces loaded .dex with agent's dex
  • Forwards call to agent's function with function name as an argument
  • Makes a toast with function name

Native

  • It modifies apk file to inject agent(libagent.so) library under lib/{abi}
  • libagent.so:
    • sets a signal handler for SIGSEGV(11) signal to "handle_signal" function
    • if signal code is SEGV_ACCERR then calls the report function with the address of the crash
    • "report" function is replaced by our frida function in "main.js"
  • main.js
    • Hooks mmap, mmap64 and mprotect to keep track of executable memory blocks
    • Removes executable flag from loaded memory blocks
    • Replaces "report" function with our own function that checks if the crash address is in the dynamically loaded memory blacklist

Requirements

  • Required binaries from Android SDK in platform-tools/

  • adb

  • apksigner

  • aapt

  • python

  • pip

  • d8

  • Python requirements

pip install -r requirements.txt
  • JDK-11 (check with javac --version)
  • Agent.class (if exists remove it in the device, /data/local/tmp/agent.dex)
javac agent-dex/Agent.java
  • classes.dex of Agent.class (this will pushed to device automatically)
cd agent-dex
d8 --release Agent.class
  • Running emulator
  • Frida servers in frida-servers/ (these will be pushed to device regarding to their ABI automatically)
  • Execute run.py [ WARNING: This will run the app on the connected device]
python run.py -a app.apk --verbose

dynamiccodemonitorandreplace-pipeline's People

Contributors

mohamedmostafadawood avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.