PINK CTFMisc
Flashback
The SWF is an ActionScript 2 maze game with five 89×89 levels. Beating it only shows THE MAZE WAS NEVER THE MESSAGE.
- Competition
PINK CTF
- Category
- MiscMedium · estimated
- Source status
- Source-documented · not platform-verified
- Document
- PDF edition2 min read
TL;DR
The SWF is an ActionScript 2 maze game with five 89×89 levels. Beating it only shows THE MAZE WAS NEVER THE MESSAGE. Each level also hides a bitmap: some tiles are drawn with their red channel raised by 7, which you can't see. The five bitmaps never overlap. Stacked together they form a version-18 (89×89) QR code with the finder patterns removed. Paint the finders back in and it decodes to the flag.
Steps
1. Decompress and decompile
flashback.swf starts with CWS, so it is a zlib-compressed Flash 8 movie. Its strings (MTASC_MAIN, initLevel, gateCounts, ALL 5 LEVELS COMPLETE) point to AS2 compiled with MTASC. JPEXS FFDec decompiles it cleanly:
java -jar ffdec.jar -export script decompiled flashback.swfThis produces two classes:
Maze.as: the game itself (maze carving, gates and keys, checkpoints, rendering).D7.as: a data class with maze seedsa(), gate countsb(), five more seedsc(), and five arrays of 496 sixteen-bit wordsd().
2. The win screen is a decoy
When all five levels are finished, Maze.h7() is drawn:
_loc3_ += String.fromCharCode(Number(_loc2_[_loc4_]) ^ _loc4_ * 17 + 93 & 0xFF);Decoding it statically gives THE MAZE WAS NEVER THE MESSAGE., so solving the mazes is pointless.
3. The hidden tint bitmap
initLevel() calls f1(level), which decrypts D7.d()[level] with the same Lehmer PRNG the maze uses (s = s * 48271 % 2147483647, seeded with D7.c()[level]):
q4[_loc5_] = Number(_loc4_[_loc5_]) ^ Number(_loc3_ % 65536);496 words × 16 bits = 7936 ≥ 89 × 89, so each level gets one bit per tile. f2(x, y) reads that bit, and f3 uses it when drawing every wall and floor tile:
if(!f2(x,y)) return gray << 16 | gray << 8 | gray;var _loc5_ = gray + 7; // red +7 onlyreturn _loc5_ << 16 | gray << 8 | gray;On a background of gray 12–23, a +7 bump in red is effectively invisible: that's the "flashback" hiding in the level.
4. Stack the five levels
Each level tints about 780 tiles (about 10%), spread evenly over walls, floor and the solution path, so the bits have nothing to do with the maze layout. However, the five sets never overlap, and their union covers exactly 49% of the grid:

The union is clearly a QR code. 89×89 modules is QR version 18: the timing patterns on row and column 6 alternate perfectly, and the alignment patterns are visible. Only the three finder patterns have been blanked:

5. Restore the finders and decode
Painting the three 7×7 finder patterns, with their white separators, back into the corners is enough for OpenCV's QRCodeDetector:

$ python solve.pywin screen: THE MAZE WAS NEVER THE MESSAGE.tinted tiles per level: [780, 780, 779, 779, 779] max overlap: 1flag: PINK{Fl4sh_Pl4y3r_escape_the_maze}Flag
Flag
PINK{Fl4sh_Pl4y3r_escape_the_maze}
Source-documented · not platform-verified
