Into The Matrix
Challenge Information
- Name: Into The Matrix
- Points: 100
- Category: AI
- Objective: Decode the contents of an NPY file to retrieve the flag.
Solution
Initial Inspection:
- Given an NPY file in CTF, a common format for storing NumPy arrays, the first step is to visualize its contents.
Visualization:
Loaded the NPY file into Python using NumPy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
import numpy as np import matplotlib.pyplot as plt from sklearn.manifold import MDS from tqdm import tqdm file_path = 'matrix.npy' data = np.load(file_path) print("Data shape:", data.shape) mds = MDS(n_components=2, dissimilarity='precomputed', n_init=4, random_state=42) for _ in tqdm(range(2), desc="Performing MDS", total=2): pos = mds.fit_transform(data) plt.figure(figsize=(10, 10)) plt.scatter(pos[:, 0], pos[:, 1], c='blue', label='Signal Origins') plt.xlabel('MDS Component 1') plt.ylabel('MDS Component 2') plt.title('MDS Visualization of Distance Matrix') plt.legend() plt.show()
I wasn’t able to figure out what the graph meant, but my teammate Nem4ros suggested that it appeared to be SHCTF24{intro_to_ml}, but submitting this flag failed.
Brute Forcing Variations:
- Since whe know what the the flag approximately look like, we brute forced the flag, including:
SHCTF24{intr0_to_ml}
SHCTF24{1ntro_to_ml}
SHCTF24{intro_to_ml}
- …
- Eventually, one of these variations worked as the valid flag.
- Since whe know what the the flag approximately look like, we brute forced the flag, including:
Flag
- Flag:
SHCTF24{XXXXXXXXXX}