Skip to content
Adam Omar Saleh

RSEC CTF placeholder badge (unofficial)RSEC CTFReverse Engineering / Mobile

calc

A Flutter calculator app. All the Dart logic is AOT-compiled into libapp.so, so Java decompilers see nothing useful.

Competition
RSEC CTF placeholder badge (unofficial)RSEC CTF
Category
Reverse Engineering / MobileMedium · estimated
Source status
Source-documented · not platform-verified
Document
PDF edition1 min read

Brief

The challenge

Category
Reverse Engineering (Android / Flutter)
File
calc.apk

TL;DR

A Flutter calculator app. All the Dart logic is AOT-compiled into libapp.so, so Java decompilers see nothing useful. Dumping the Dart object pool with Blutter reveals a 36-byte list next to the "ACCESS GRANTED" widget; XOR with 0x55 gives the flag.

01

Recon

The APK is an obfuscated release build made with Flutter 3.13.2. The Java/Kotlin side is just the Flutter embedding; the real code is in:

Text
lib/arm64-v8a/libapp.so

02

Dumping the Dart snapshot

Blutter is the usual tool for Flutter AOT snapshots, but two problems came up:

  • This Flutter version stores everything in one combined snapshot, which the current Blutter release can't read. I patched a local copy in WSL (~/blutter) to load it (run_blutter.sh, step1.sh – step7.sh).

  • Full analysis ran out of memory, so I used Blutter's no-analysis mode. It gives names and the object pool but no disassembly, so I wrote dart_dis.py, a small disassembler that labels references into the object pool.

03

The encoded flag

Right next to the "ACCESS GRANTED" result widget in the object pool is a constant list of 36 integers:

Text
07 06 10 16 2e 27 66 23 30 27 26 3c 3b 32 0a 33 39 20 21 21 30 27 0a 3b 3a 21 0a 21 3d 34 21 0a 37 34 31 28

Assuming the flag starts with RSEC{: 0x07 ^ 'R' = 0x55, and the same key works for the next four bytes. The last byte 0x28 ^ 0x55 = '}'.

Python
data = bytes.fromhex("070610162e2766233027263c3b320a333920212130270a3b3a210a213d34210a37343128")print(bytes(b ^ 0x55 for b in data).decode())

Flag

Flag

RSEC{r3versing_flutter_not_that_bad}

Source-documented · not platform-verified

PDF edition

Writeup PDF

Formatted edition of this walkthrough, built from my source notes · 2 pages.