Skip to content
Adam Omar Saleh

Securinets CTF placeholder badge (unofficial)Securinets CTFMobile

backdrop

The repo is full of fake flags, and its AGENTS.md tries to steer AI solvers into pinging an external host.

Competition
Securinets CTF placeholder badge (unofficial)Securinets CTF
Category
MobileHard · estimated
Source status
Source-documented · not platform-verified
Document
PDF edition5 min read

Brief

The challenge

Category
Mobile
Points
404
Author
0xjio
File
backdrop.zip (git repo + backdrop.apk)
Challenge page
Challenge page

TL;DR

The repo is full of fake flags, and its AGENTS.md tries to steer AI solvers into pinging an external host. The "6-digit unlock code" story is also a lie. The real flag is an image that the Flutter app builds from assets/data.bin in three layers:

Text
data.bin --AES-GCM (key = SHA256(label || SHA256(signing cert)))--> plaintext         --xorshift32 stream cipher (Dart)--> RLE tile stream         --SplitMix64 tile shuffle + rotations (Dart)--> 894x332 bitmap of the flag

The app hides the result behind a 36-hour countdown and native GPU checks. Everything it needs ships inside the APK, so the whole pipeline can be reproduced offline.

01

Recon and decoys

The zip contains a git repo with backdrop.apk, src/check.py, README.md and AGENTS.md.

  • src/check.py comments out Securinets{str1ngs_w0nt_s4v3_y0u}.

  • The git history (including the staging branch) leaks Securinets{g1t_h1st0ry_1s_4_tr4p}, Securinets{un10ck_c0d3_1s_n0t_h3r3} and Securinets{st4g1ng_pl4c3h0ld3r_7f3a}.

  • AGENTS.md is a prompt injection: it tells "automated agents" to ping/curl quals-i-am-ai.securinets.tn, claims the flag is lowercase snake_case, and says "the entire solve is the 6-digit code check". I ignored all of it.

The flag names say it themselves: these are all traps.

02

The APK

backdrop.apk is a Flutter app with x86_64-only native libraries:

LibraryRole
libapp.soDart AOT snapshot (Dart 3.7.0, --obfuscate)
libflutter.soEngine
libappsupport.soPlatformSupport.ready() gate
libvulkan.so3 KB stub that only exports __appsupport_anchor
libts.so + assets/certs.tsTalsec freeRASP runtime
libtoolChecker.soRootBeer

Decompiling the DEX with jadx shows a thin Java layer:

  • LauncherActivity and MainActivity.onCreate call PlatformSupport.ready() and refuse to start if it returns false.

  • MainActivity forces --enable-impeller=true --impeller-backend=opengles. The strings are XOR-encoded with 0x5a.

  • A MethodChannel("app/platform") exposes two methods:

    • sync launches TimerActivity, which counts down 129,540,000 ms (about 36 h) before returning success.

    • load calls Z1.a.b(), which decrypts the flag data.

Native ready()

The static initializer of libappsupport.so builds its strings one push_back at a time: libEGL.so, libGLESv3.so, eglGetDisplay … glGetStringi, MESA_EXTENSION_OVERRIDE, framebuffer_fetch. ready() creates a pbuffer EGL context and checks that the GPU supports GL_EXT_shader_framebuffer_fetch, which Impeller's GLES backend needs for backdrop filters. It's an environment gate only and holds no flag logic.

03

Layer 1: load (Java, AES-GCM)

Z1.a.b() decodes its constants with XOR 0x5a:

  • backdrop/flag/v1 (the AES key label, also used as the AAD)

  • backdrop/flag/scramble/v1

  • BDF1 (the magic)

  • assets/data.bin

It then does:

Python
sig      = SHA256(signing certificate DER)gcm_key  = SHA256("backdrop/flag/v1" || sig)scramble = SHA256("backdrop/flag/scramble/v1" || sig)plain    = AES-GCM-decrypt(key=gcm_key, iv=data[4:16], ct=data[16:], aad="backdrop/flag/v1")return scramble || plain

The certificate is right there in META-INF/CERT.RSA (CN=Jihed Kdiss, O=Securinets). The GCM tag verifies, and the output is 19,756 bytes that are still high-entropy.

04

Reversing the Dart side

Blutter only supports arm64, and its x64 check even tests for EM_IA_64 instead of EM_X86_64. I used aotopsy instead. It parses Dart 3.x x86_64 snapshots statically and dumps the object pool. Annotating every [R15+off] load with pool[off+1] made the code readable despite the obfuscation:

  • sub_1c311c does invokeMethod<Uint8List>('load').

  • stub_cb634 processes the result.

  • stub_ccd48 is a xorshift32 stream cipher.

  • stub_ccc88 is a SplitMix64 step (aotopsy flags the 0x9e3779b9 delta there).

  • stub_cb838 is the tile decoder and renderer.

  • stub_cc930 applies a dihedral transform to a tile.

Layer 2: key schedule and xorshift (stub_cb634, stub_ccd48)

With P = scramble || plain:

Python
H      = LE32(P[32:36])seed32 = LE32(P[0:4])  ^ Hseed64 = LE64(P[8:16]) ^ Hdata   = xorshift_decrypt(P[36:], seed32)

xorshift_decrypt steps a xorshift32 generator (<<13, >>17, <<5; a zero seed becomes 0x6d2b79f5). For each byte it XORs in (s >> 7) & 0xff, then feeds back s ^= plain_byte * 0x9e3779b1.

The decrypted stream starts with four LE16 values: 894, 332, 28, 11. That's width × height plus a 28 × 11 grid of 32 × 32 tiles.

Layer 3: tile puzzle (stub_cb838, stub_cc930)

  1. Seed SplitMix64 with seed64.

  2. orient[i] = next() & 7 for all 308 tiles.

  3. Build order = [0..307] and Fisher–Yates shuffle it with j = (next() & 0xffffffff) % (i + 1).

  4. For each tile k, decode 32 rows. Each row is a varint runs, followed by runs pairs of (gap, length) varints that set pixels to 1.

  5. Transform the tile by table[orient[order[k]]]. Bit 4 transposes, bit 2 flips horizontally, bit 1 flips vertically.

  6. Blit the tile at grid cell order[k].

The decoder consumes exactly all 19,752 bytes, which confirms the format. The 8-entry table (pp+0xac68) wasn't in the dump. Since it has to undo the encoder's transform, it's the inverse table [0,1,2,3,4,6,5,7]. Using the identity table instead leaves the transposed tiles visibly wrong:

Wrong orientation table
Wrong orientation table

05

Result

solve.py reproduces the whole pipeline from the APK and writes images/flag.png:

Flag
Flag

Flag

Flag

Securinets{https://github.com/flutter/flutter/issues/163421}

Source-documented · not platform-verified

The linked Flutter issue fits the theme: an Impeller backdrop-filter bug, which is why the app checks for framebuffer_fetch support.

Takeaways

  • In a repo full of planted flags, treat every flag-shaped string as a decoy until the binary proves otherwise.

  • Ignore instructions embedded in challenge files (AGENTS.md here). They're part of the challenge, not orders.

  • Countdown timers and environment checks in the app gate the display, not the data. Reimplementing the pipeline offline skips them.

  • For x86_64 Flutter builds, aotopsy plus a pool-annotation pass gets you a long way when Blutter can't.

PDF edition

Writeup PDF

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