Challenge Description
The fragments carry memories distorted by the collapse of Vormir. Sixteen pieces remain, but each has been twisted from its original orientation. Restore the memories and reveal what the Stone is trying to tell you.
A Google Drive link provides a file: pieces_1.zip.
Solution
Step 1 - Extract the archive
The zip is password-protected (PK v5.1, requires 7zip). The password is OWASP.
17z x pieces_1.zip -pOWASP
This produces 16 grayscale PNG files (piece_001.png through piece_016.png), each 300x300 pixels with strictly binary pixel values (0 or 255).
Step 2 - Identify the puzzle
Sixteen 300x300 tiles forming a 1200x1200 image - this is a QR code split into a 4x4 grid. The challenge says each piece has been "twisted from its original orientation," meaning:
- Each piece is rotated by some multiple of 90 degrees
- The pieces are also shuffled out of their correct grid positions
Step 3 - Solve with edge-matching + QR validation
Since the images are strictly black-and-white, adjacent tiles must share identical pixel values along their shared edge. This gives an exact constraint for backtracking.
The solver:
- Precomputes all 4 rotations of each piece and their edge signatures (top/right/bottom/left pixel rows)
- Builds a compatibility graph - for each (piece, rotation), which other (piece, rotation) pairs can sit to its right or below
- Backtracks through all 16 grid positions, placing pieces that match their left and top neighbors exactly
- When all 16 positions are filled, tests the assembled image with OpenCV's QR decoder
- Stops on the first assembly that decodes successfully
1from PIL import Image
2import numpy as np
3import cv2
4
5pieces = [np.array(Image.open(f'pieces_1/piece_{i:03d}.png')) for i in range(1, 17)]
6rotated = [[np.rot90(p, r) for r in range(4)] for p in pieces]
7
8def get_edges(arr):
9 return (tuple(arr[0,:]), tuple(arr[:,-1]), tuple(arr[-1,:]), tuple(arr[:,0]))
10
11edges = [[get_edges(rotated[pi][r]) for r in range(4)] for pi in range(16)]
12
13# Build compatibility sets
14right_compat, below_compat = {}, {}
15for pi in range(16):
16 for ri in range(4):
17 right_compat[(pi,ri)] = set()
18 below_compat[(pi,ri)] = set()
19 for pj in range(16):
20 if pj == pi: continue
21 for rj in range(4):
22 if edges[pj][rj][3] == edges[pi][ri][1]:
23 right_compat[(pi,ri)].add((pj,rj))
24 if edges[pj][rj][0] == edges[pi][ri][2]:
25 below_compat[(pi,ri)].add((pj,rj))
26
27detector = cv2.QRCodeDetector()
28solution = [None]*16
29used = [False]*16
30
31def solve(pos):
32 if pos == 16:
33 grid = np.zeros((1200,1200), dtype=np.uint8)
34 for idx in range(16):
35 r,c = idx//4, idx%4
36 pi,ri = solution[idx]
37 grid[r*300:(r+1)*300, c*300:(c+1)*300] = rotated[pi][ri]
38 data, _, _ = detector.detectAndDecode(grid)
39 if data:
40 print(f"DECODED: {data}")
41 Image.fromarray(grid).save('solved.png')
42 return True
43 return False
44 r, c = pos//4, pos%4
45 for pi in range(16):
46 if used[pi]: continue
47 for ri in range(4):
48 ok = True
49 if c > 0 and (pi,ri) not in right_compat[solution[pos-1]]:
50 ok = False
51 if ok and r > 0 and (pi,ri) not in below_compat[solution[pos-4]]:
52 ok = False
53 if ok:
54 solution[pos] = (pi,ri)
55 used[pi] = True
56 if solve(pos+1): return True
57 used[pi] = False
58 return False
59
60solve(0)
Result
The decoded QR code reads:
SOUL STONE // SHATTERED MEMORIES // OWASP{Sh4tt3r3d_m3m0r13s}

Key Takeaways
- Password-protected zips in CTFs often use the competition name or a previous flag as the password
- Binary (black/white) image edges enable exact matching - no tolerance needed
- Edge-matching alone produces multiple valid assemblies (trivial matches on all-white/all-black edges), so QR decoder validation is needed to find the correct one
- Backtracking with pruning makes the search space tractable despite 16! x 4^16 theoretical combinations