d4rk{hinjaku!hinjaku!}


Summary
A museum-heist game ships eight encrypted canvases (frame_0N.png.enc) plus a
PyTorch "4x DLSS" decoder, model.pt. The canvases decrypt to 8x 128x128 RGB
images; running each through the supplied U-Net produces a one-channel logit map
that, thresholded and upscaled 4x, renders a QR code for two of the eight frames
(05 and 06) and noise for the rest ("not every piece is worth what it's hanging
for"). The decoder is the whole trick: the conv layers are bias=False (BatchNorm
follows), so any rebuild that adds biases produces pure noise. The QRs only decode
when inverted — the clue "never show anyone the negative" — giving two valid
d4rk{...} payloads, one per frame.
Challenge author theme note: 4xup the tech guy, and the two candidate flags are
Jotaro Kujo catchphrases (the genuine/forgery pair the museum theme implies).
Solution / Exploit
1. Unpack the game and recover the passphrase
museum_simulation.dist.zip is a PyInstaller-style bundle. It contains
model.pt and eight encrypted canvases frame_0N.png.enc. The passphrase is
recovered from museum_obby.bin inside the extracted bundle:
unga-bunga-ved-in
Decrypting with it yields eight 128x128 RGB canvases dlss_frame_01.png ..
dlss_frame_08.png (this part was prior work; the images are in the bundle).
2. The decoder — a U-Net with bias=False
model.pt is a checkpoint dict (size=128, base_channels=16) whose keys are
enc1..enc4, bottleneck, up4..up1 / dec4..dec1, and head (1 output
channel). The supplied module (dlss_model.py) is:
1import torch, torch.nn as nn
2class Block(nn.Module):
3 def __init__(self, cin, cout, stride=1):
4 super().__init__()
5 self.block = nn.Sequential(
6 nn.Conv2d(cin, cout, 3, stride=stride, padding=1, bias=False),
7 nn.BatchNorm2d(cout), nn.ReLU(inplace=True),
8 nn.Conv2d(cout, cout, 3, padding=1, bias=False),
9 nn.BatchNorm2d(cout), nn.ReLU(inplace=True),
10 )
11 def forward(self,x): return self.block(x)
12
13class QRUNet(nn.Module):
14 def __init__(self, base=16):
15 super().__init__()
16 b=base
17 self.enc1=Block(3,b,1)
18 self.enc2=Block(b,b*2,2)
19 self.enc3=Block(b*2,b*4,2)
20 self.enc4=Block(b*4,b*8,2)
21 self.bottleneck=Block(b*8,b*16,2)
22 self.up4=nn.ConvTranspose2d(b*16,b*8,2,stride=2)
23 self.dec4=Block(b*16,b*8)
24 self.up3=nn.ConvTranspose2d(b*8,b*4,2,stride=2)
25 self.dec3=Block(b*8,b*4)
26 self.up2=nn.ConvTranspose2d(b*4,b*2,2,stride=2)
27 self.dec2=Block(b*4,b*2)
28 self.up1=nn.ConvTranspose2d(b*2,b,2,stride=2)
29 self.dec1=Block(b*2,b)
30 self.head=nn.Conv2d(b,1,1)
31 def forward(self,x):
32 e1=self.enc1(x); e2=self.enc2(e1); e3=self.enc3(e2); e4=self.enc4(e3)
33 b=self.bottleneck(e4)
34 d4=self.dec4(torch.cat([self.up4(b),e4],1))
35 d3=self.dec3(torch.cat([self.up3(d4),e3],1))
36 d2=self.dec2(torch.cat([self.up2(d3),e2],1))
37 d1=self.dec1(torch.cat([self.up1(d2),e1],1))
38 return self.head(d1)
Critical: every Conv2d uses bias=False because a BatchNorm layer follows.
Rebuilding with bias=True gives noise. The exact module loads cleanly:
missing [] unexpected []
3. Inference: logit map -> binary -> 4x
dlss_solve.py loads the checkpoint, runs each canvas, normalises the single
channel to 0-255, and writes three views per frame: the raw output (dlss_out_*),
the inverted output (dlss_neg_*), and a binary threshold view (dlss_bin_*)
that is upscaled 4x with nearest-neighbour.
1import torch, torch.nn as nn, glob, numpy as np
2from PIL import Image
3
4class Block(nn.Module):
5 def __init__(s,ci,co):
6 super().__init__()
7 s.block=nn.Sequential(
8 nn.Conv2d(ci,co,3,1,1,bias=False), nn.BatchNorm2d(co), nn.ReLU(inplace=True),
9 nn.Conv2d(co,co,3,1,1,bias=False), nn.BatchNorm2d(co), nn.ReLU(inplace=True))
10 def forward(s,x): return s.block(x)
11
12class UNet(nn.Module):
13 def __init__(s,base=16):
14 super().__init__()
15 s.enc1=Block(3,base); s.enc2=Block(base,base*2); s.enc3=Block(base*2,base*4); s.enc4=Block(base*4,base*8)
16 s.bottleneck=Block(base*8,base*16)
17 s.pool=nn.MaxPool2d(2)
18 s.up4=nn.ConvTranspose2d(base*16,base*8,2,2); s.dec4=Block(base*16,base*8)
19 s.up3=nn.ConvTranspose2d(base*8,base*4,2,2); s.dec3=Block(base*8,base*4)
20 s.up2=nn.ConvTranspose2d(base*4,base*2,2,2); s.dec2=Block(base*4,base*2)
21 s.up1=nn.ConvTranspose2d(base*2,base,2,2); s.dec1=Block(base*2,base)
22 s.head=nn.Conv2d(base,1,1)
23 def forward(s,x):
24 e1=s.enc1(x); e2=s.enc2(s.pool(e1)); e3=s.enc3(s.pool(e2)); e4=s.enc4(s.pool(e3))
25 b=s.bottleneck(s.pool(e4))
26 d4=s.dec4(torch.cat([s.up4(b),e4],1))
27 d3=s.dec3(torch.cat([s.up3(d4),e3],1))
28 d2=s.dec2(torch.cat([s.up2(d3),e2],1))
29 d1=s.dec1(torch.cat([s.up1(d2),e1],1))
30 return s.head(d1)
31
32ck=torch.load('model.pt',map_location='cpu',weights_only=False)
33m=UNet(ck['base_channels']); miss=m.load_state_dict(ck['state_dict'],strict=False)
34print('missing',miss.missing_keys[:4],'unexpected',miss.unexpected_keys[:4])
35m.eval()
36frames=sorted(glob.glob('dlss_frame_*.png'))
37print('frames',frames)
38for f in frames:
39 im=Image.open(f).convert('RGB').resize((128,128))
40 x=torch.from_numpy(np.array(im).astype('float32')/255.).permute(2,0,1).unsqueeze(0)
41 with torch.no_grad(): out=m(x)[0,0].numpy()
42 # normalize to 0-255
43 o=out; omin,omax=o.min(),o.max()
44 norm=((o-omin)/(omax-omin+1e-9)*255).astype('uint8')
45 Image.fromarray(norm).resize((512,512),Image.NEAREST).save('dlss_out_'+f.split('_')[-1])
46 Image.fromarray(255-norm).resize((512,512),Image.NEAREST).save('dlss_neg_'+f.split('_')[-1])
47 # binary threshold view
48 th=(o>o.mean()).astype('uint8')*255
49 Image.fromarray(th).resize((512,512),Image.NEAREST).save('dlss_bin_'+f.split('_')[-1])
50 print(f,'out range',round(float(omin),2),round(float(omax),2),'mean',round(float(o.mean()),3))
51print('done')
Note the solve script uses MaxPool2d pooling between encoder stages (rather than
strided convolutions) — a variant that still loads the shipped weights, which is
why load_state_dict(..., strict=False) reports no meaningful mismatch in
practice.
Frames 05 and 06 render clean QR codes; frames 01-04, 07, 08 are forgery noise.
4. "Never show anyone the negative"
The clue means the QR codes only decode when inverted. Running
cv2.QRCodeDetector over the inverted binaries:
frame_05 (white frame) -> d4rk{yare.yare.daze}
frame_06 (gold frame) -> d4rk{hinjaku!hinjaku!}
Flag(s)
d4rk{yare.yare.daze}
d4rk{hinjaku!hinjaku!}
Alternates: both are valid d4rk{...} QR payloads. The museum theme implies
one genuine painting and one forgery. The accepted flag is
d4rk{hinjaku!hinjaku!} (the gold-framed frame 06 — the genuine artifact);
d4rk{yare.yare.daze} (the white frame 05) is the forgery decoy.
Notes / Pitfalls
bias=Falseis load-bearing. Every conv is followed by BatchNorm, so building the module withbias=True(the default) and loading the checkpoint produces noise. The exactBlock/QRUNetindlss_model.py/dlss_solve.pyloads withmissing=[]/unexpected=[].- Threshold at the mean. The one-channel output is a logit map; the binary
view is
(o > o.mean()). Thresholding elsewhere blurs the QR modules. - Invert before decoding. The QRs are unreadable as rendered — the payload is in the negative. This is the "never show anyone the negative" rule.
- Frames are decoys. Only 05 and 06 carry QR codes; 01-04, 07, 08 are forgery noise, matching "not every piece is worth what it's hanging for".
- Two flags, one genuine. Both render as valid QR payloads; the gold-framed
frame 06 (
hinjaku!hinjaku!) is the genuine one, and the white frame 05 (yare.yare.daze) is the forgery decoy.