CTF-writeups

View on GitHub

24h@CTF Cassette track A Writeup

Category

Steganography

Description

The challenge provides a wav file containing a secret message (the flag) and the original audio file

Writeup

The challenge is in the steganography category, so we can expect to find the flag in the spectrogram of the audio file:

sox secret.wav -n spectrogram -o secret_low_resolution.png

produces

secret_low_resolution

where you can barely see some letters and digits mixed with the original spectrogram.

To properly read the flag we can subtract the image corresponding to the original file from the image corresponding to the secret file. The default resolution is too low to read the string, so we should increase the spectrogram resolution with -X (pixels/second) and -Y (y height in pixels) options.

sox secret.wav -n spectrogram -o secret.png -X 200 -Y 2050
sox original.wav -n spectrogram -o original.png -X 200 -Y 2050

and then subtract the images with the following python script that also converts the result in a black and white image to read easily the flag.

from PIL import Image, ImageChops

im1 = Image.open(r"secret.png")
im2 = Image.open(r"original.png")

diff = ImageChops.difference(im1, im2)


thresh = 8
fn = lambda x : 255 if x > thresh else 0
r = diff.convert('L').point(fn, mode='1')
r.save('diff_b_w.png')

diff.save('diff.png')

The final result is the following and, with some patience and guessing, you can read the flag

secret_low_resolution

Flag

FLAG{W3lc0m3_t0_4ud10_St3G4n0gr4pHy}


If you find errors or you want to contribute to this writeup go to the GitHub repository or contact me opening an issue.