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
- 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:
lib/arm64-v8a/libapp.so02
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:
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 28Assuming the flag starts with RSEC{: 0x07 ^ 'R' = 0x55, and the same key works for the next four bytes. The last byte 0x28 ^ 0x55 = '}'.
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