Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Dart AOT snapshot

From ReverseEngineering.wiki
Format
Magic F5 F5 DC DC (int32 0xdcdcf5f5, little-endian)
Extensions libapp.so, app.so, snapshot
Endianness little
License BSD-3-Clause (dart-lang/sdk)
Website https://github.com/dart-lang/sdk
On this wiki Facts · Code · Notes · Topics

Serialized Dart heap and compiled code of a Flutter or dart compile app: in Android Flutter apps the libapp.so holds it, and its header (magic F5 F5 DC DC, length, kind, 32-hex-digit snapshot hash, features string) ties it to one Dart VM build.

What it is

A release Flutter app on Android contains lib/<abi>/libapp.so (the Dart AOT code, an ELF shared library) and lib/<abi>/libflutter.so (the Flutter engine with the Dart VM runtime). The app logic is in libapp.so as machine code for the Dart AOT calling convention plus a serialized object heap; a normal disassembler sees functions without names or familiar structure, and libapp.so has no usable symbols. The ELF dynamic symbols of libapp.so are the data and text symbols named in runtime/include/dart_api.h. At the Dart 3.10.0 tag (commit b1a587b650ac) they are _kDartVmSnapshotData, _kDartVmSnapshotInstructions, _kDartVmSnapshotBss, _kDartIsolateSnapshotData, _kDartIsolateSnapshotInstructions, _kDartIsolateSnapshotBss and _kDartSnapshotBuildId (lines 4030-4036). The tags 2.10.0, 2.17.0, 2.18.0, 2.19.0, 3.0.0, 3.2.0 to 3.12.0 define the VM and isolate names too. At the later main commit 689733bf0d0c the VM/isolate split is gone from dart_api.h and the single-snapshot names _kDartSnapshotData, _kDartSnapshotText, _kDartSnapshotBss and _kDartSnapshotBuildId are defined (lines 4095-4104), so a tool that looks up _kDartVmSnapshotData fails on very new toolchains. Unverified: which Flutter release first ships the single-snapshot layout in a real libapp.so; check with readelf --dyn-syms.

Snapshot header

From runtime/vm/snapshot.h (dart-lang/sdk): offset 0 magic int32 0xdcdcf5f5 (bytes F5 F5 DC DC), offset 4 length (int64, excluding the magic), offset 12 kind (int64: 0 kFull, 1 kFullJIT, 2 kFullAOT, 3 kModule); header size 20. After the header comes the snapshot hash: 32 ASCII hex characters, the MD5 of the VM source files listed in tools/make_version.py (VM_SNAPSHOT_FILES, e.g. snapshot.cc, raw_object.h, symbols.cc). SnapshotHeaderReader::VerifyVersion in runtime/vm/app_snapshot.cc compares it and fails with Wrong full snapshot version, expected '<hash>' found '<hash>'. Then a NUL-terminated features string (Dart::FeaturesString in runtime/vm/dart.cc): build mode (release/product/debug), flag list such as no-asserts, then for code snapshots the target arm64 / x64 / arm ... and OS android / ios ...; a mismatch yields Snapshot not compatible with the current VM configuration.

The features string is built by Dart::FeaturesString (runtime/vm/dart.cc lines 904-1010 at 689733bf0d0c): first one of debug, product or release; for code-including snapshots the flags asan, msan, tsan, shared_data (each with a no- prefix when off), code_comments, dwarf_stack_traces; then the architecture ( ia32, x64, arm, arm64e, arm64, riscv32, riscv64), the OS ( android, fuchsia, ios, macos, linux, windows) and compressed-pointers or no-compressed-pointers. The mismatch error text is Snapshot not compatible with the current VM configuration: ... (app_snapshot.cc line 9868). The wrong-version error is Wrong full snapshot version, expected '%s' found '%s' (the word is script instead of full for non-full kinds; lines 9813-9846). Debug builds of Flutter apps use the kernel format instead: see Format:Dart kernel.

Why the hash matters

The hash identifies the Dart VM version that wrote the snapshot, because the object layouts and class ids change between Dart releases. Any tool that parses the heap (class table, object pool, strings) must match the exact version. Method: read the 32-char hash from libapp.so (it is a plain string in the data of the isolate snapshot) and look it up against a table of known hashes to get the Dart SDK version (and from it the Flutter version); the same hash is also embedded in libflutter.so, which gives a cross-check. Unverified: the hash-to-version tables kept by community tools (blutter keeps its own mapping); to build your own, run tools/make_version.py logic (MD5 over those files) at a Dart tag.

Reading the hash and the matching engine (blutter's extract_dart_info.py)

Read at worawit/blutter commit 4a60ac648bf4 (extract_dart_info.py, lines 15-57 and 59-102). From libapp.so: find the dynamic symbol _kDartVmSnapshotData (size must exceed 128), seek to its address plus 20 (the header size), read 32 ASCII characters (the snapshot hash), then read the NUL-terminated features string and split it on spaces (for example the build mode, no-asserts..., the target arch and OS). From libflutter.so: scan .rodata for 40-hex-character strings delimited by NULs (the script expects exactly two: engine ids, one of which is the engine commit) and for a version string of the form <dart version> (stable|beta|dev). When the version string is missing the script requests https://storage.googleapis.com/flutter_infra_release/flutter/<engine id>/dart-sdk-windows-x64.zip and reads dart-sdk/revision (Dart commit) and dart-sdk/version from the zip. Unverified: that every libflutter.so build keeps exactly two such hash strings; the script asserts it. Its x64 test compares e_machine to EM_IA_64 (a likely slip for EM_X86_64), so x86-64 libflutter.so may be rejected: Unverified.

Source of the hash: tools/make_version.py (lines 20-45 at dart-lang/sdk 689733bf0d0c) computes hashlib.md5() over the files app_snapshot.cc/.h, dart.cc, dart_api_impl.cc, datastream.h, image_snapshot.cc/.h, object.cc/.h, raw_object.cc/.h, snapshot.cc/.h, symbols.cc/.h under runtime/vm, in that order, and runtime/vm/version_in.cc (line 31) substitutes it for {{SNAPSHOT_HASH}}. Because the hash covers those source files, two Dart releases with identical VM sources share one hash.

Tools (leads, Unverified here)

  • blutter (worawit/blutter): compiles a matching Dart runtime and dumps classes, functions with offsets and object pool for an ARM64 libapp.so, producing Frida/IDA/Ghidra scripts.
  • reFlutter (Impact-I/reFlutter): patches a matching libflutter.so to dump snapshot info / bypass TLS pinning in a re-packed APK.
  • Dart AOT code in Ghidra/IDA: registers are fixed. Checked in dart-lang/sdk runtime/vm/constants_arm64.h (main @ 13c953d2c4, lines 50-63, 144-158 read): on arm64 x15 is the Dart-code stack pointer (SPREG, not a thread pointer; the C++ SP is the real sp), x26 = THR (current thread), x27 = PP (object pool pointer), x28 = HEAP_BITS (write-barrier mask << 32 | heap base >> 32), x22 = NULL_REG (cached null object), x24 = CODE_REG, x21 = DISPATCH_TABLE_REG (AOT only). An earlier version of this page wrongly called x15 thread-pointer related.

See Technique:Cross-platform app frameworks, Format:ELF, Platform:Android.

Decompilers

See Technique:Choosing a decompiler and Tool:Blutter (Android arm64 libapp.so, annotated assembly, no Dart source).

Code & repositories

  • https://github.com/dart-lang/sdk @ 689733bf0d0c33d3e0061b92dba77cb3e04cbeb2 · license: BSD-3-Clause
    Dart SDK source: snapshot header, snapshot hash, features string.
    Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-18
  • https://github.com/worawit/blutter @ 4a60ac648bf448c5a7596437243bcd0b9376fdf0 · license: MIT (read from LICENSE; GitHub's API was busy)
    Blutter Flutter libapp.so analysis
    Tested on: source read, not run: not run; README read · checked 2026-10-18