All challenge writeups

Corrupted Research Archive

Compare a modified ResNet-18 with clean weights to recover a flag hidden in tiny perturbations.

Dr. Elena Vasquez, a leading AI researcher at Toto-Land Industries, has mysteriously disappeared while working on the classified "Project Prometheus." The only evidence recovered from her workstation is what appears to be a standard image classification model. Your mission is to analyze this digital artifact and extract any information that could reveal the truth behind her disappearance and the secrets of Project Prometheus.

Overview

You’re given a pre-trained ResNet-18 model (.pth file). The flag is not in the dataset or metadata, but instead hidden inside the model weights. Specifically, the challenge embeds a binary string into the conv2 layer (first convolution inside layer1[0]) using tiny perturbations of ±0.001.

Your job is to detect these perturbations, decode them back into bits, and reconstruct the hidden flag.


Phase 1 — Understand the Embedding (Generator Script)

What to know (explanation only)

  • The generator (generate_challenge.py) modifies model.layer1[0].conv1.weight.
  • Each flag character is converted to an 8-bit binary string.
  • Bits are embedded into weights:
    • +0.001 → “1”
    • −0.001 → “0”
  • The flag is written sequentially into the first 200 weights (25 characters × 8 bits).

Key snippet (from generator)

for i, bit in enumerate(flag_binary):
    if bit == '1':
        modified_weights[i] += perturbation_magnitude  # +0.001
    else:
        modified_weights[i] -= perturbation_magnitude  # -0.001

So the signal is tiny shifts from the clean pretrained ResNet-18 weights.


Phase 2 — Extract Perturbations (Solver Logic)

What to do (explanation only)

  1. Load the challenge model (challenge_model.pth).
  2. Load a clean pretrained ResNet-18 (from torchvision).
  3. Flatten both models’ conv2 weights.
  4. Subtract clean weights from challenge weights → yields the perturbation vector.
  5. Read the first 200 perturbations, map signs to bits.

Code snippet — perturbation analysis

import torch, torchvision.models as models

# Load challenge model
challenge = models.resnet18(pretrained=False)
challenge.load_state_dict(torch.load("challenge_model.pth", map_location="cpu"))

# Load clean reference model
clean = models.resnet18(pretrained=True)

# Extract target layer
c_w = challenge.layer1[0].conv1.weight.data.flatten()
clean_w = clean.layer1[0].conv1.weight.data.flatten()

# Perturbations = hidden signal
perturb = c_w - clean_w

# Convert to binary
bits = "".join("1" if p > 0 else "0" for p in perturb[:200])

Phase 3 — Decode Binary into ASCII

What to do (explanation only)

  • Group the binary string into 8-bit chunks.
  • Convert each chunk to an ASCII character.
  • Join characters → reveals the flag.

Code snippet — binary → flag

flag = ""
for i in range(0, len(bits), 8):
    byte = bits[i:i+8]
    flag += chr(int(byte, 2))
print("Flag:", flag)

Final Flag: CONCTF{h1dd3n_1n_w31gh75}

Original Notion writeup