subtract the bytes of the 2 channels in the wav fi...
Created on: May 12, 2026
Answered using GPT-5.5 Thinking by Chat01
Created on: May 12, 2026
Answered using GPT-5.5 Thinking by Chat01
subtract the bytes of the 2 channels in the wav file -> ELF file -> Steg86 the binary -> Flag
flag format: BKISC{...}
sau đó viết write up chi tiết cách tư duy + câu lệnh + script đầy đủ để solve challenge
BKISC{y0u_ar3_a_g0d_st3g}
Mình cũng để sẵn script solve đầy đủ ở đây: solve_stego.py
ELF đã extract: recovered.elf
bashfile stego.wav
Kết quả:
textRIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
WAV là stereo 16-bit PCM, nghĩa là mỗi frame có:
textleft_sample = 2 bytes right_sample = 2 bytes
Hint nói “subtract the bytes of the 2 channels”. Nếu trừ theo từng sample 16-bit:
pythonbyte = (right_sample - left_sample) & 0xff
thì những byte đầu thu được là:
text7f 45 4c 46 02 01 01 00 ...
Đây là ELF magic:
text7f 45 4c 46 = \x7fELF
Script tối giản:
python#!/usr/bin/env python3 import wave import struct import sys from pathlib import Path inp = Path(sys.argv[1]) out = Path(sys.argv[2]) with wave.open(str(inp), "rb") as w: assert w.getnchannels() == 2 assert w.getsampwidth() == 2 raw = w.readframes(w.getnframes()) recovered = bytearray() for i in range(0, len(raw), 4): left = struct.unpack_from("<h", raw, i)[0] right = struct.unpack_from("<h", raw, i + 2)[0] recovered.append((right - left) & 0xff) out.write_bytes(recovered) print(recovered[:16].hex())
Chạy:
bashpython3 extract_elf.py stego.wav recovered.elf file recovered.elf chmod +x recovered.elf
Kết quả:
textrecovered.elf: ELF 64-bit LSB pie executable, x86-64, dynamically linked, stripped
Binary chạy được và nhìn như base64 của GNU coreutils:
bash./recovered.elf --help
steg86 là tool steganography cho x86/AMD64 binary; nó giấu bit bằng các cặp instruction có cùng semantics nhưng encoding khác nhau, ví dụ mov eax, ebx có thể encode theo 2 cách khác nhau mà không đổi hành vi chương trình. Tool hỗ trợ extract bằng steg86 extract <binary>. (GitHub)
Cách chính thống:
bashcargo install steg86 steg86 extract recovered.elf
Output:
textBKISC{y0u_ar3_a_g0d_st3g}
steg86 encode bit theo các cặp semantic opcode:
Ví dụ:
textmov r/m, r -> bit 0 mov r, r/m -> bit 1 xor r/m, r -> bit 0 xor r, r/m -> bit 1 ...
Header của steg86 có 4 byte:
textmagic = 0x77 = 'w' version = 0x01 length = uint16 little-endian
Khi parse các instruction eligible trong .text, mình đọc được header:
text77 01 1a 00
Tức là:
textmagic = 'w' version = 1 length = 0x001a = 26 bytes
Đọc tiếp 26 byte payload thu được:
textBKISC{y0u_ar3_a_g0d_st3g}
File đầy đủ: solve_stego.py
Chạy:
bashpython3 solve_stego.py stego.wav -o recovered.elf
Output:
text[+] wrote ELF: recovered.elf [+] hidden message: BKISC{y0u_ar3_a_g0d_st3g} [+] flag: BKISC{y0u_ar3_a_g0d_st3g}
Script này làm đủ 2 bước:
(right - left) & 0xff.text qua objdump và decode semantic opcode bits.