Code Monkey home page Code Monkey logo

-reverse-engineering's Introduction

Frinet

Multi-platform trace generation with Frida, combined with a modified version of the Tenet plugin for exploration.

Blogpost on the Synacktiv website

General use case : Tracing the execution of a specific function in a userland process, on a Frida-compatible system (Tested on Linux/Android/iOS/Windows).

Tenet

This repository contains our customized fork of Tenet in the tenet subdirectory. As explained in the README, we did not do a pull request (yet) because our new features break some of the legacy features.

Our custom version is required for use with this tracer, but can still process traces from other Tenet tracers.

This repository needs to be cloned using the recursive flag :

git clone --recursive https://github.com/synacktiv/frinet.git

Tracer

Features

Compatible with Windows, Linux, Android & iOS

Fully supported architecture :

  • arm64
  • x64

Partially supported architectures (slower and less precise memory tracking, but usually good enough) :

  • arm
  • x86

Dependencies

Python3 and Frida

pip install frida

How to use

usage: python3 trace.py [-h] [-v] [-D DEVICE] [-U] [-R] [-H HOST] [-m]
                          [-a ARGS] [-e] [-s] [-E END]
                          {spawn,attach} ... process module addr

positional arguments:
  {spawn,attach}
    spawn               Spawn process
    attach              Attach to process
  process               attach:[process name or PID]; spawn:[binary path or
                        package name]
  module                module name to instrument
  addr                  entrypoint function address

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         verbose output
  -D DEVICE, --device DEVICE
                        connect to device with the given ID
  -U, --usb             connect to USB device
  -R, --remote          connect to remote frida server
  -H HOST, --host HOST  connect to remote frida server on host
  -m, --multirun        do not unhook after first execution
  -a ARGS, --args ARGS  comma-separated argument list for spawn (including
                        binary name) : "/bin/sh,-c,ls"
  -e, --exclude         exclude all other modules (memory tracing will be
                        inaccurate)
  -s, --slow            use slower JS implementation (multiarch)
  -E END, --end END     specify end address instead of function exit (-1 to
                        never end)

Example : Spawn a new process to trace

python3 trace.py spawn [BIN_PATH] [MODULE_NAME] [FUNC_ADDR] -a [ARGS]
python3 trace.py spawn /bin/ls ls 0x1234 -a '/bin/ls,-la'

This will trace one execution of the function at address 0x1234, until it returns.

It is also possible to specify an end address with "-E", or trace multiple executions with "-m".

Example : Attach to a process on Android device

python3 trace.py attach [PROCNAME_OR_PID] [MODULE_NAME] [FUNC_ADDR] -U
python3 trace.py attach sh sh 0x1234 -U

Tenet

Dependencies

IDA Pro (tested on Version 8.3.230608 Linux x86_64 but should work in most recent versions compatible with Tenet legacy)

How to use

cp tenet/plugins/tenet_plugin.py ~/.idapro/plugins
cp -R tenet/plugins/tenet ~/.idapro/plugins

Then, in IDA after loading the correct binary :

File -> Load file -> Tenet trace file

For more information, see the README.md from our Tenet fork, as well as the original author's blogpost about the tool :

New features

Some new features have been added to the Tenet plugin. The compressed trace format feature has been removed for now, as it needs to be modified to handle the added features.

Most notably :

  • The Call tree view window gives a clickable indented overview of the whole execution trace.
  • The Seach bytes feature is available in the Memory views context menu, and does the search in both space and time

-reverse-engineering's People

Contributors

hexa-synacktiv 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.