🔬
CTFs
  • 🚩nitrozeus's CTF Writeups
  • Tutorial
    • Install Windows 10 VM on M1 Mac
  • My Notes
    • Capture-The-Flag
      • Windows Forensics
      • Memory Forensics
      • Base32, Base64
      • Steganography
      • Email Analysis
      • Malware Analysis
      • MD4, MD5 Cracking
      • Social Engineering
      • OSINT
      • Google Dorking
      • Reconnaissance
      • Port Scan (nmap)
  • 2023
    • 🧠BrainHack CDDC 2023
      • Gallery
      • Eazy Network Analysis
      • What the hell happened to the PC?!
      • Audio Steganography
  • 2022
    • 🐱Grey Cat The Flag 2022
      • Parcel
      • Memory Game (Part 1)
      • Too Fast
      • Entry
      • Ghost
      • Firmware
      • Image Upload
      • flappy-js
    • ⛵STANDCON 2022
      • I Sea You (Part 1)
      • Locate Me
      • I Sea You (Part 2)
      • Trolley Trolling
      • A New Gateway
      • Walks like a cat, barks like a dog
      • Shark in the Ocean
      • Atlan Safe P1
      • Gift from Russia
      • Asmuth Shares
      • Memedump
      • Warmup Forensics
    • 🦁STACK the Flags 2022
      • Finding Nyan
      • New Task!
      • Hit you with that
      • Cobalt Struck
      • PyRunner
Powered by GitBook
On this page
  1. 2023
  2. BrainHack CDDC 2023

Audio Steganography

PreviousWhat the hell happened to the PC?!NextGrey Cat The Flag 2022

Last updated 1 year ago

Found a suspicious audio file. Seems like... something is hidden inside... Identify the character strings.

To begin the analysis, we opened the provided .wav file using , a popular audio visualization and analysis tool.

We focused on the Spectrogram feature to inspect the audio's frequency and time domain representation. However, we did not find any immediate visual clues or hidden character strings in this step.

Realizing the potential application of Audio Steganography in hiding information within audio files, we conducted research on the topic.

# Use wave package (native to Python) for reading the received audio file
import wave
song = wave.open("song_embedded.wav", mode='rb')
# Convert audio to byte array
frame_bytes = bytearray(list(song.readframes(song.getnframes())))

# Extract the LSB of each byte
extracted = [frame_bytes[i] & 1 for i in range(len(frame_bytes))]
# Convert byte array back to string
string = "".join(chr(int("".join(map(str,extracted[i:i+8])),2)) for i in range(0,len(extracted),8))
# Cut off at the filler characters
decoded = string.split("###")[0]

# Print the extracted text
print("Sucessfully decoded: "+decoded)
song.close()

In-depth explanation on how the code works.

  1. Importing Required Libraries: The code starts by importing the necessary libraries. In this case, the wave module is imported to work with audio files in the WAV format.

  2. Opening the Audio File: The wave.open() function is used to open the audio file named "song_embedded.wav" in read mode ('rb'). The resulting object, song, represents the opened audio file.

  3. Converting Audio to a Byte Array: The audio file is read and converted into a byte array using the readframes() method of the song object. The getnframes() method is used to determine the total number of frames in the audio file. The resulting byte array is stored in frame_bytes.

  4. Extracting the LSB of Each Byte: The LSB (Least Significant Bit) of each byte in the frame_bytes array is extracted. This is done by performing a bitwise AND operation with 1 (frame_bytes[i] & 1) for each byte in the array. The extracted LSBs are stored as a list in extracted.

  5. Converting Byte Array to String: The extracted LSBs are converted back into a string representation. The code iterates over the extracted list in groups of 8 bits (extracted[i:i+8]), converts each group of 8 bits into a string representation ("".join(map(str,extracted[i:i+8]))), and then converts the resulting binary string into a Unicode character (chr(int(binary_string, 2))). The characters are joined together to form the complete string, which is stored in string.

  6. Removing Filler Characters: The extracted string may contain filler characters that were added during the encoding process. These filler characters are represented by the "###" sequence. The code splits the string at the first occurrence of "###" and keeps only the portion before it. The resulting decoded message is stored in decoded.

  7. Printing the Extracted Text: Finally, the decoded message is printed as a success message using the print() function.

  8. Closing the Audio File: The song.close() statement is used to close the audio file after decoding is complete.

Following the instructions provided with the code, we executed it on the suspicious .wav file. The code analyzed the audio samples and extracted the hidden character strings embedded using the LSB algorithm.

As a result, the secret message was revealed, and we obtained the flag required for the challenge.

During our investigation, we came across a discussing the LSB (Least Significant Bit) algorithm. This algorithm involves replacing the least significant bits of the audio samples with hidden data, making it a common technique for concealing information within digital audio.

🧠
blog post
Sonic Visualiser
Nothing interesting here!
Flag!!