Giter Club home page Giter Club logo

yj's Introduction

前言

YJ是一款基于Frida框架的款Native层逆向分析的交互式工具,就像在GUN-LINUX上使用GDB工具一样,设计YJ的灵感来自GNU-GDB调试工具,它通过交互命令模式轻松地向展示你想要窥探的内存数据

Frida是一个底层hook工具及框架。提供了hook工具的同时也提供了大量的API操作,基于Frida框架的大多都是一些对Java代码层的一个Hook集成,而对于Native层方面较为全面的分析工具很零碎

安装

首先你得有Frida,我在开发和测试阶段分别采用了frida-15.2.2frida-16.0.0,而在完成开发的阶段已经发布了16.0.10,最后采用16.0.3是出于16.0.0发布的snapshots功能,它能提高YJ加载到交互界面的性能,目前该功能还在测试阶段,在不久后将会发布

pip3 install frida==16.0.0
git clone https://github.com/yang-datong/YJ-3.git

使用

通过ADB连接上已经开启了frida-serverAndroid手机

cd YJ-3
python3 exp.py [你的目标应用名称]

iShot_2023-02-20_21.45.30

看起来有点意思,这是一个简单的内置shell交互模式

试用了一些python内置shell库都感觉不够轻量

YJ提供了一些在我用GDB调试时的一些常见命令,具体可以看help命令的输出文本,默认YJ启动的是attach模式直接附加到当前的App中:

可以通过python3 exp.py --help来查看spawn模式来调试目标进程,或者通过load来加载你的脚本(默认加载脚本为model/main.js)

  • 如果你有明确的逆向分析函数的话你可以直接使用breakpoint [functionName]来对目标地址下监控点(breakpoint支持对函数名、lib库名+具体偏移偏移、计算表达式下监控点,然后也可以删除当前监控点,重新监控到另一个地址)

iShot_2023-02-20_22.14.07

  • 如果没有明确分析具体的函数,那么可使用watch命令来监控具体的lib库内存,如下:

iShot_2023-02-20_22.20.10

如果该lib库是个热点库,那么立马会回收到监控的内存空间具体调用信息,

iShot_2023-02-20_22.19.16

找到目标地址后,unwatch停止内存监控,进入一下操作,通过breakpoint [address]对目标地址下入监控点

iShot_2023-02-20_22.32.27

当地址被执行时,那么就进入到我们的内存视图(arm64的寄存器非常多,这里一整页已经装不下了)

iShot_2023-02-20_22.26.18

iShot_2023-02-20_22.36.23

现在可以尽情享受了,你可以通过'print'、'hex'、'telescope'、'hexdump'等命令详细的查看指定的内存数据,比如

iShot_2023-02-20_22.41.52

无Root

对于无root设备frida提供了frida-gadget库,之前将gadget.so用脚本一键注入到目标进行并使YJ调试上去的时候发现apktool重新打包的性能消耗太严重,考虑到稳定性现在只保留一键注入到lib库中,后续的打包以及绕过操作自行处理

iShot_2023-02-20_22.53.33

通过bash inject.sh [gadgetInteractionType]可以选择你的gadget执行的模式,如监听模式脚本模式具体看https://frida.re/docs/gadget/

脚本模式中默认使用的脚本为explore.js 你可以在main()中定义你的规则

环境问题

电脑:目前只支持在bashpython环境中的机器,大众的来说Mac OSGUN-Linux可用,Windows不可用(以后会考虑在powershell中实现类bash的功能)

手机:目前只支持Android

调试目标:目前只支持Android Native层调试,Java层无任何支持

后续

  • 性能优化:会考虑热点功能函数使用全C实现
  • 自定义插件入口:扩展功能编解码器中直接从内存抽帧
  • 多平台支持:Windows
  • 数据结构详细分析:堆链条、内核结构、更详细完整的内存信息

开源协议

!!!免责声明!!!

因为设计到了逆向安全领域,所以不得不慎重声明,本项目使用Apache License 2.0开源协议

1.授权使用者免费使用个人专利

2.使用者必须放置协议说明

3.使用者需要对修改部分声明

4.禁止用作者的名号进行商业广告

5.原作者不承担代码使用后风险

本项目仅作为学习使用,一切后果本人概不负责

yj's People

Contributors

yang-datong 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.