Retour au classement

ptswarm/reFlutter

Python

Flutter Reverse Engineering Framework

mobile-securityreverse-engineeringbugbountyssl-pinning
Croissance des étoiles
Étoiles
1.5k
Forks
187
Croissance hebdomadaire
Issues
11
5001k
sept. 2021avr. 2023déc. 2024juil. 2026
ArtefactsPyPIpip install reflutter
README

Twitter

stars workflow

This framework helps with Flutter apps reverse engineering using the patched version of the Flutter library which is already compiled and ready for app repacking. This library has snapshot deserialization process modified to allow you perform dynamic analysis in a convenient way.

Key features:

  • socket.cc is patched for traffic monitoring and interception;
  • dart.cc is modified to print classes, functions and some fields;
  • contains minor changes for successfull compilation;
  • if you would like to implement your own patches, there is manual Flutter code change is supported using specially crafted Dockerfile

Supported engines

  • Android: arm64, arm32;
  • iOS: arm64;
  • Release: Stable, Beta

Install

# Linux, Windows, MacOS
pip3 install reflutter

Usage

impact@f:~$ reflutter main.apk

Please enter your Burp Suite IP: <input_ip>

SnapshotHash: 8ee4ef7a67df9845fba331734198a953
The resulting apk file: ./release.RE.apk
Please sign the apk file

Configure Burp Suite proxy server to listen on *:8083
Proxy Tab -> Options -> Proxy Listeners -> Edit -> Binding Tab

Then enable invisible proxying in Request Handling Tab
Support Invisible Proxying -> true

impact@f:~$ reflutter main.ipa

Traffic interception

You need to specify the IP of your Burp Suite Proxy Server located in the same network where the device with the flutter application is. Next, you should configure the Proxy in BurpSuite -> Listener Proxy -> Options tab

  • Add port: 8083
  • Bind to address: All interfaces
  • Request handling: Support invisible proxying = True

You don't need to install any certificates. On an Android device, you don't need root access as well. reFlutter also allows to bypass some of the flutter certificate pinning implementations.

Usage on Android

The resulting apk must be aligned and signed. I use uber-apk-signer java -jar uber-apk-signer.jar --allowResign -a release.RE.apk. To see which code is loaded through DartVM, you need to run the application on the device. Note that you must manually find what _kDartIsolateSnapshotInstructions (ex. 0xB000 ) equals to using a binary search. reFlutter writes the dump to the root folder of the application and sets 777 permissions to the file and folder. You can pull the file with adb command

impact@f:~$ adb -d shell "cat /data/data/<PACKAGE_NAME>/dump.dart" > dump.dart
file contents
Library:'package:anyapp/navigation/DeepLinkImpl.dart' Class: Navigation extends Object {  

String* DeepUrl = anyapp://evil.com/ ;

 Function 'Navigation.': constructor. (dynamic, dynamic, dynamic, dynamic) => NavigationInteractor { 
  
              Code Offset: _kDartIsolateSnapshotInstructions + 0x0000000000009270
  
                   }
    
 Function 'initDeepLinkHandle':. (dynamic) => Future<void>* { 
  
              Code Offset: _kDartIsolateSnapshotInstructions + 0x0000000000412fe8
  
                   }
    
 Function '_navigateDeepLink@547106886':. (dynamic, dynamic, {dynamic navigator}) => void { 
  
              Code Offset: _kDartIsolateSnapshotInstructions + 0x0000000000002638
  
                   }
 
       }
 
Library:'package:anyapp/auth/navigation/AuthAccount.dart' Class: AuthAccount extends Account {

PlainNotificationToken* _instance = sentinel;
 
 Function 'getAuthToken':. (dynamic, dynamic, dynamic, dynamic) => Future<AccessToken*>* { 
  
               Code Offset: _kDartIsolateSnapshotInstructions + 0x00000000003ee548
  
                   }
  
 Function 'checkEmail':. (dynamic, dynamic) => Future<bool*>* { 
  
               Code Offset: _kDartIsolateSnapshotInstructions + 0x0000000000448a08
   
                   }

 Function 'validateRestoreCode':. (dynamic, dynamic, dynamic) => Future<bool*>* { 
  
               Code Offset: _kDartIsolateSnapshotInstructions + 0x0000000000412c34
   
                   }

 Function 'sendSmsRestorePassword':. (dynamic, dynamic) => Future<bool*>* { 
  
               Code Offset: _kDartIsolateSnapshotInstructions + 0x00000000003efb88
  
                   }
       }

Usage on iOS

Use the IPA file created after the execution of reflutter main.ipa command. To see which code is loaded through DartVM, you need to run the application on the device. reFlutter prints its output in console logs in XCode with the reflutter tag.

To Do

  • Display absolute code offset for functions;
  • Extract more strings and fields;
  • Add socket patch;
  • Extend engine support to Debug using Fork and Github Actions;
  • Improve detection of App.framework and libapp.so inside zip archive

Build Engine

The engines are built using reFlutter in Github Actions to build the desired version, commits and snapshot hashes are used from this table. The hash of the snapshot is extracted from storage.googleapis.com/flutter_infra_release/flutter/<hash>/android-arm64-release/linux-x64.zip

release

gif

Custom Build

If you would like to implement your own patches, manual Flutter code change is supported using specially crafted Docker

sudo docker pull ptswarm/reflutter

# Linux, Windows
EXAMPLE BUILD ANDROID ARM64:
    sudo docker run -e WAIT=300 -e x64=0 -e arm=0 -e HASH_PATCH=<Snapshot_Hash> -e COMMIT=<Engine_commit> --rm -iv${PWD}:/t ptswarm/reflutter

FLAGS:
    -e x64=0                         <disables building for x64 archiitechture, use to reduce building time>
    -e arm=0                         <disables building for arm archiitechture, use to reduce building time>
    -e WAIT=300                      <the amount of time in seconds you need to edit source code>
    -e HASH_PATCH=[Snapshot_Hash]    <here you need to specify snapshot hash which matches the engine_commit line of enginehash.csv table best. It is used for proper patch search in reFlutter and for successfull compilation>
    -e COMMIT=[Engine_commit]        <here you specify commit for your engine version, take it from enginehash.csv table or from flutter/engine repo>
Dépôts similaires
MobSF/Mobile-Security-Framework-MobSF

Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis.

JavaScriptnpmGNU General Public License v3.0static-analysisdynamic-analysis
opensecurity.in
21.5k3.7k
Hacker0x01/hacker101

Source code for Hacker101.com - a free online web and mobile security class.

SCSSOthereducationhacking
hacker101.com
14.5k2.7k
OWASP/mastg

The OWASP Mobile Application Security Testing Guide (MASTG) is a comprehensive manual for mobile app security testing and reverse engineering. It describes technical processes for verifying the OWASP Mobile Security Weakness Enumeration (MASWE) weaknesses, which are in alignment with the OWASP MASVS.

PythonPyPICreative Commons Attribution Share Alike 4.0 Internationalmobile-apppentesting
mas.owasp.org
13.1k2.8k
OWASP/owasp-mastg

The Mobile Application Security Testing Guide (MASTG) is a comprehensive manual for mobile app security testing and reverse engineering. It describes the technical processes for verifying the controls listed in the OWASP Mobile Application Security Verification Standard (MASVS).

PythonPyPICreative Commons Attribution Share Alike 4.0 Internationalmobile-apppentesting
mas.owasp.org
12k2.4k
firerpa/lamda

Android Full-Stack Device Control Platform: WebRTC/H.264 remote desktop, UI/OCR/image-matching automation, one-click MITM, built-in Frida, proxy/VPN/frp/P2P networking, MCP/Agent, 160+ APIs, designed for multi-device clusters and engineered deployments.

PythonPyPIMIT Licenseadbandroid
device-farm.com
7.9k1.1k
dwisiswant0/apkleaks

Scanning APK file for URIs, endpoints & secrets.

PythonPyPIApache License 2.0mobile-securityandroid-security
6.2k583
charles2gan/GDA-android-reversing-Tool

the fastest and most powerful android decompiler(native tool working without Java VM) for the APK, DEX, ODEX, OAT, JAR, AAR, and CLASS file. which supports malicious behavior detection, privacy leaking detection, vulnerability detection, path solving, packer identification, variable tracking, deobfuscation, python&java scripts, device memory extraction, data decryption, and encryption, etc.

PythonPyPIApache License 2.0decompilervulnerability-scanners
twitter.com/charles_gan1
4.8k567
vaib25vicky/awesome-mobile-security

An effort to build a single place for all useful android and iOS security related stuff. All references and tools belong to their respective owners. I'm just maintaining it.

pentestingios
3.5k376
m0bilesecurity/RMS-Runtime-Mobile-Security

Runtime Mobile Security (RMS) 📱🔥 - is a powerful web interface that helps you to manipulate Android and iOS Apps at Runtime

JavaScriptnpmGNU General Public License v3.0mobile-securityandroid-security
twitter.com/mobilesecurity_
3k411
Impact-I/reFlutter

Flutter Reverse Engineering Framework

PythonPyPIGNU General Public License v3.0bugbountymobile-security
2.7k291
iddoeldor/frida-snippets

Hand-crafted Frida examples

JavaScriptnpmfridahooking
2.5k439
dpnishant/appmon

Documentation:

JavaScriptnpmApache License 2.0androidios-app
dpnishant.github.io/appmon
1.6k280