• Stars
    star
    307
  • Rank 136,109 (Top 3 %)
  • Language
    Jupyter Notebook
  • License
    GNU Affero Genera...
  • Created about 5 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ•ต๏ธ Dart / Flutter VM snapshot analyzer

โš ๏ธ Warning: This project is outdated. The format of Dart snapshots changes CONSTANTLY, and any Dart RE tools like this one NEED constant maintenance or they stop working with newer versions of Dart / Flutter. Contributions are welcome, but I currently do not have the time to invest in monitoring changes to the VM and keeping this updated.

So, if your snapshot was produced by a reasonably modern version, it probably won't parse [correctly]. Still, if you want to try, you'll probably need at least the fix in #3.


darter: Dart snapshot parser

darter is a Python module that can fully parse the data inside a Dart snapshot (i.e. the libapp.so file in a release Flutter app).

Features:

  • Parses 100% of the snapshot data, including memory structures.
  • Supports many architectures and the three snapshot types (old, AppJIT and AppAOT).
  • Usually zero-config: autodetects flags & settings from the snapshot.
  • Extracts the blobs from app.so or .snapshot files automatically.
  • Stores back-references, so you can navigate the graph easily.
  • Debugging output & strict mode controls.
  • Disassembles and analyzes the compiled code to find references to VM objects.

Examples of what you can do with the parsed info:

  • Extract string table of the application
  • Find usages of a certain object
  • Export metadata for Radare2
  • Deobfuscate a snapshot by matching it with a reference one
  • Generate call graph, library dependency graph, etc.

Note: Keep in mind that this is for parsing binary (i.e. architecture-dependent) snapshots. .dill files and some .snapshot files contain Kernel AST, which is a completely different format and currently not supported by darter. [Learn more]

How to use

Most of the code is zero-dependency, except for:

  • parse_elf_snapshot(...) requires pyelftools

  • the darter.asm module (for analyzing the assembled code) requires Capstone (and its python binding)

darter in itself is just a module, it has no stand-alone program or CLI.
The recommended way to use it is by including it in a notebook and playing with the parsed data.

Install Jupyter and open the 1-introduction notebook for a basic walkthrough of the parsed data; then head to 2-playground which contains more interesting examples of use.

It's highly recommended that you first play with a known snapshot (i.e. that you have built yourself or have the code), before analyzing the snapshot you are after.

Status

The parser is still at an early stage and will not work in every case.

  • It has been heavily tested on AppAOT Product snapshots on ARM and ARM64.
  • It has been lightly tested on AppJIT Release snapshots on x64.
  • The disassembly analysis is architecture-dependent, and currently supports ARM and ARM64.
  • The rest of the code is mostly architecture-independent, but it may not work on other architectures without some modifications.

This parser was written based on dart-sdk at 1ef83b86ae. The snapshot format is internal to the VM. It dumps some of the objects as they appear in memory; you need to know how the VM (arch, compile flags) was compiled in order to parse it. It can change frequently between versions, as there's not a standard spec (AFAIK) for the format.

Any help or donations are welcome.

Technical details

Given an data section and an instructions section (and optionally a base):

  • Parse the clusters allocation section, building the reference table.
  • Parse the clusters fill section.
  • Parse the root object.
  • Link the references between objects.
  • Parse the native structures (OneByteString, CodeSourceMap, Instructions, etc.).
  • The resulting VM objects (and cluster descriptions) are returned.

The information is returned as parsed as much as possible, so that it is easy to manipulate. Back-references are tracked too, so that it's easy to know where a certain object is referenced from.

darter can parse both 'VM' snapshots and 'isolate' ones (the ones we care about).

The darter.asm module disassembles the compiled code and analyzes it. This is crucial for AOT snapshots, because we get no high-level bytecode.

See also

If you are new to Dart / Flutter reverse-engineering, it's a good idea to read this introduction first: https://mrale.ph/dartvm/

The relevant code on snapshot serialization is at runtime/vm/clustered_snapshot.cc and runtime/vm/raw_object.h.

There's also additional info in the info directory.

More Repositories

1

protobuf-inspector

๐Ÿ•ต๏ธ Tool to reverse-engineer Protocol Buffers with unknown definition
Python
957
star
2

cursed_gpu_linux

โš™๏ธ Attempt to run Linux in a GPU shader
C
70
star
3

curl-benchmark

๐Ÿ•ฐ Tool to measure timing of an HTTP(S) load
Python
50
star
4

dm500-satip

๐Ÿ“ก Kernel & firmware image to turn a DM500 into a SAT>IP server
CSS
36
star
5

node_bpf

๐Ÿ”ฌ eBPF / libbpf bindings for Node.js
TypeScript
30
star
6

jackpifm

๐Ÿ“ก Turn your Raspberry Pi into an FM transmitter broadcasting live audio from JACK
C
24
star
7

v8u

Sugar for your Node C++ addons
C++
23
star
8

node_netlink

โš’ Use Netlink from Node.js
TypeScript
22
star
9

hackrf.js

๐Ÿ“ป Control HackRF devices from Node.js
TypeScript
20
star
10

ptproxy

๐Ÿ“ก proxy HTTP/1.1 requests over a sensitive point-to-point link
Rust
17
star
11

node_bpfcc

๐Ÿ”ฌ BPF Compiler Collection (BCC) frontend for Node.js
C++
16
star
12

ilo-protocol

๐Ÿ–ฅ Node.js implementation of HPE iLO 4 remote console protocol
TypeScript
16
star
13

simplejack

Simple, realtime JACK audio in Node.JS
C++
13
star
14

a4s

๐Ÿ“ AWS Signature v4 primitives and high-level utilities
TypeScript
10
star
15

quickvm

๐Ÿ•ต๏ธ The crappy, magical string Java/Android decrypter
Java
9
star
16

emucore

๐Ÿ”ฌ Emulate function calls on a coredump
Python
6
star
17

py-struct

๐Ÿ”ฌ Fixed struct serialization system, using Python 3.9 annotated type hints
Python
6
star
18

redasm-abc

๐Ÿ•ต๏ธ Easy-to-use, simple assistant for SWF disassembly.
D
6
star
19

mp4parser

๐Ÿ•ต๏ธโ€โ™€๏ธ MP4 parser / dissector for the command line
Python
6
star
20

shinigami-eyes-archive

repository containing all versions of the Shinigami Eyes extension that were ever published to a browser store
JavaScript
6
star
21

show-the-power

ใ€ฝ๏ธ Tracks power your laptop is using, and shows it in a realtime graph
JavaScript
5
star
22

node-openni

Node.JS bindings for the OpenNI library.
C++
5
star
23

parport.js

[DEPRECATED] High-level Node.JS interface to parallel ports.
C++
5
star
24

ccv15

An effort to migrate Community Core Vision 1.5 to other platforms.
C
4
star
25

domestic-bot

๐Ÿ  Personal Telegram bot living at our house server
JavaScript
4
star
26

rds-utils

General utilities for RDS
C++
4
star
27

trinket-midi-adapter

๐ŸŽน MIDI-to-USB adapter using an Adafruit Trinket
C
4
star
28

finite-algebra

โ™พ (prototype of) library for finite algebra
Python
4
star
29

bdf2tikz

๐Ÿ–‹ Typeset Quartus II schematics using TikZ (LaTeX)
Python
3
star
30

vwf2tikz

๐Ÿ–‹ Typeset Quartus II waveform files using TikZ (LaTeX)
Python
3
star
31

mildsunrise

personal info ๐Ÿ˜Š
3
star
32

guifi-earth

See the structure of the guifi.net network in Google Earth.
CoffeeScript
2
star
33

voltrinket

ใ€ฝ๏ธ Let your Trinket measure voltage
Python
2
star
34

img4tool

portable IMG4 file parser
Python
2
star
35

dcs-utils

Utilities for the DCS-2121 IP camera.
JavaScript
2
star
36

code-challenge

Submissions to the 2021 Code Challenge from Telefรณnica
Python
1
star
37

led-meter

๐Ÿšฅ Turn some LEDs into an audio meter
Python
1
star
38

CodeMakeup

Because CodeMirror needs more themes!
1
star
39

stbx25xx-linux

Port of Linux for IBM STBx25xx boards (fork of http://stbx25xx-linux.sf.net; adds support for Dreambox DM500)
C
1
star
40

ev3j

๐Ÿค– Java library for LEGO Mindstorms EV3 interfacing
Java
1
star
41

redasm-abc-old

[DEPRECATED] An assistant to RABCDAsm
Java
1
star
42

nice-ace-ambiance

Theme of the Nice-Ace collection.
JavaScript
1
star
43

power-trinket

ใ€ฝ๏ธ DC power monitoring using a Trinket and INA219 breakout
C++
1
star
44

network-utils

โš™๏ธ Network-related utility scripts
Shell
1
star
45

nice-ace

Collection of attractive themes for the ACE editor.
1
star
46

CodeMakeup-dabbit

Theme of the CodeMakeup collection.
JavaScript
1
star
47

university-2b-icom-lab

๐Ÿ“š Reports for lab sessions in ICOM
TeX
1
star
48

satip

Automatically exported from code.google.com/p/satip
C
1
star
49

firmware-mod-kit

Automatically exported from code.google.com/p/firmware-mod-kit
C
1
star
50

university-3a-psavc-lab

๐Ÿ“š Lab files and memories for PSAVC
TeX
1
star
51

hormone-converter

๐Ÿ’Š Unit converter app for hormone levels
Elm
1
star
52

sonoff-transparent-switch

๐Ÿ’กโš™๏ธ Firmware for Itead Sonoff relays that allows attaching a physical switch
C++
1
star
53

the-auto-grapher

Your terminal wants some function plotting.
1
star
54

university-4b-tfg

๐Ÿ“š Degree thesis, "Analysis and mitigation of writeback cache lock-ups in Linux"
Jupyter Notebook
1
star
55

visural-common

visural-common is a general purpose Java library. Highlights include - an AOP caching solution for Guice based projects, a HTTP 301 Redirect Servlet Filter, a runtime class path scanner, a Base64 encoder/decoder, CSV reading/writing, a HTML "sanitizer", and a "Resource Transform Filter", which does automatic LessCSS compilation, DataURI/MHTML image inlining and CSS/Javascript compression for web applications.
Java
1
star