tên challenge: Zopslop Mô tả: The flag is hidden i...

Criado em: 9 de maio de 2026

Respondido usando GPT-5.5 Thinking por Chat01

Pergunta

chall.zip

tên challenge: Zopslop
Mô tả: The flag is hidden inside the attachment.
flag format: BKISC{...}
solve challenge rồi viết write up chi tiết kèm câu lệnh + script

Pensamento

undefined

Pensamento

Final steps for the Vietnamese write-up

In the final Vietnamese version, I’ll include the necessary commands with a link to the full script file in the sandbox. I might skip including the full script in the write-up, but I’ll add key snippets and offer a downloadable version. I’ll make sure to discuss the decoy QR and cite relevant sources, like RAR5 format encryption.

Thought for 21m 49s

Resposta

Flag

text
BKISC{h0w_d1d_y0u_gue55_1t?}

Full solve script: solve_zopslop.py

Chạy:

bash
python3 solve_zopslop.py chall.zip

Output chính:

text
[+] FLAG = BKISC{h0w_d1d_y0u_gue55_1t?}

Write-up: Zopslop

1. Recon ban đầu

bash
file chall.zip unzip -l chall.zip mkdir work unzip -q chall.zip -d work cd work file step_1.zip

chall.zip chỉ chứa step_1.zip.

Kiểm tra các ZIP signature trong step_1.zip:

bash
python3 - <<'PY' from pathlib import Path b = Path("step_1.zip").read_bytes() for sig in [b"PK\x03\x04", b"PK\x07\x08", b"PK\x01\x02", b"PK\x05\x06"]: print(sig, [i for i in range(len(b)) if b.startswith(sig, i)]) PY

Kết quả đáng chú ý:

text
b'PK\x03\x04' [0, 263, 1733] b'PK\x05\x06' [1711, 2514]

Có 2 ZIP bị nối vào nhau. ZIP thứ hai bắt đầu tại offset 1733.

Tách file:

bash
dd if=step_1.zip of=part1.zip bs=1 count=1733 status=none dd if=step_1.zip of=part2.zip bs=1 skip=1733 status=none unzip -l part1.zip unzip -l part2.zip

part1.zip có:

text
zip_password.txt step_2.zip

part2.zip có:

text
step_2.png

2. QR PNG là decoy

Extract part2.zip:

bash
mkdir part2 unzip -q part2.zip -d part2

Decode QR:

bash
python3 - <<'PY' import cv2 img = cv2.imread("part2/step_2.png") print(cv2.QRCodeDetector().detectAndDecode(img)[0]) PY

Kết quả:

text
https://www.youtube.com/watch?v=dQw4w9WgXcQ

Đây chỉ là Rickroll, không phải hướng giải chính.


3. Decode password cho step_2.zip

Extract part1.zip:

bash
mkdir part1 unzip -q part1.zip -d part1

zip_password.txt nhìn như text bình thường, nhưng bị chèn rất nhiều ký tự Unicode U+200E.

Decode bằng cách bỏ U+200E:

bash
python3 - <<'PY' from pathlib import Path s = Path("part1/zip_password.txt").read_text("utf-8") pwd = "".join(c for c in s if c != "\u200e") print(pwd) PY

Password thu được:

text
super_duper_omega_very_secret_password_hehehehehehe_not_guessy_at_all_10957129085701395809137580139758013957813095713

step_2.zip dùng WinZip AES, unzip thường không giải được method 99, nên mình decrypt bằng script. WinZip AES dùng PBKDF2-HMAC-SHA1, AES-CTR và HMAC kiểm tra integrity.


4. Extract step_2.zip

Trong solve script, phần xử lý ZIP AES làm các bước:

python
km = pbkdf2_hmac("sha1", password, salt, 1000, 2 * key_len + 2) aes_key = km[:key_len] mac_key = km[key_len:2 * key_len] verifier = km[-2:]

Sau khi decrypt, thu được:

text
step_2/step_3.rar step_2/zip_password

5. Decode whitespace password cho RAR

File step_2/zip_password chỉ gồm whitespace Unicode. Mỗi ký tự whitespace biểu diễn 1 nibble hex.

Mapping dùng để decode:

python
mp = {chr(i): ((i & 0xf) + 2) & 0xf for i in range(0x2000, 0x2008)} mp.update({ " ": 0xf, "\n": 0xe, "\r": 0xe, "\t": 0xd, chr(0x85): 0x0, chr(0xa0): 0x1, })

Command decode:

bash
python3 - <<'PY' from pathlib import Path s = Path("step_2/zip_password").read_text("utf-8") mp = {chr(i): ((i & 0xf) + 2) & 0xf for i in range(0x2000, 0x2008)} mp.update({ " ": 0xf, "\n": 0xe, "\r": 0xe, "\t": 0xd, chr(0x85): 0x0, chr(0xa0): 0x1, }) vals = [mp[c] for c in s] b = bytes((vals[i] << 4) | vals[i + 1] for i in range(0, len(vals) - 1, 2)) print(b.decode("latin1").rstrip("\r\n")) PY

Password RAR:

text
white_space_encoding_is_not_that_guessy_right_or_is_it?_09178093762985078932p587892305873298057129851987513987

6. RAR5 layer

step_3.rar là RAR5 encrypted. Trong archive có:

text
step_3/decrypt.py step_3/decrypt.py:secret

:secret là NTFS Alternate Data Stream được lưu dưới dạng RAR5 service header STM.

RAR5 lưu thông tin file encryption trong extra record type 0x01; record này chứa version, flags, KDF count, salt, IV và password check value. RAR technical note cũng mô tả flag 0x0002 là tweaked checksums, ảnh hưởng checksum chứ không đổi cách decrypt data. (WinRAR)

Sau khi giải RAR layer, lấy được decrypt.py:

python
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives import padding from cryptography.hazmat.backends import default_backend import base64 key = b"bkisctfisthebest" iv = b"theremustbesmthg" with open("encrypt.bin", "rb") as f: ciphertext = base64.urlsafe_b64decode(f.read()) cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=default_backend()) decryptor = cipher.decryptor() padded_plaintext = decryptor.update(ciphertext) + decryptor.finalize() unpadder = padding.PKCS7(128).unpadder() plaintext = unpadder.update(padded_plaintext) + unpadder.finalize() print(plaintext)

File encrypt.bin lấy từ ADS :secret:

text
Adb_rVwlsUXfgGBstyss1jSDxlh37npYHcTj5vgVwH0=

Chạy decrypt:

bash
python3 decrypt.py

Output:

text
b'BKISC{h0w_d1d_y0u_gue55_1t?}'

Script tự động

Mình đã để script đầy đủ ở đây:

solve_zopslop.py

Cài dependency nếu máy thiếu:

bash
python3 -m pip install cryptography rarfile sudo apt install gcc libarchive-dev

Chạy:

bash
python3 solve_zopslop.py chall.zip

Script tự làm toàn bộ:

text
chall.zip → step_1.zip → split ZIP nối ZIP → decode U+200E password → decrypt WinZip AES step_2.zip → decode whitespace password → decrypt/patch RAR5 layer → lấy decrypt.py + encrypt.bin → AES-CBC decrypt flag

Compartilhar esta Q&A