Steganography

Steganography

One-liner: The art and science of hiding data inside innocuous carrier files (images, audio, video) to conceal its very existence.

🎯 What Is It?

Steganography conceals information within other non-secret data, making the hidden message invisible to casual observation. Unlike encryption, which scrambles data so it's unreadable, steganography hides that there's any secret data at all.

Key difference:

πŸ€” Why It Matters

Red Team / Offensive

Blue Team / Defensive

Forensics

πŸ”¬ How It Works

Core Principles

  1. Carrier File: The innocent-looking file (image, audio, video)
  2. Payload: The hidden data embedded inside
  3. Embedding Algorithm: Method used to hide data (LSB, EOF, etc.)
  4. Password/Key: Optional encryption of hidden data

Technical Deep-Dive

Least Significant Bit (LSB) Injection

Original pixel RGB: (11010101, 10101010, 11110000)
Hidden bit: 1

Modified pixel:     (11010101, 10101011, 11110000)
                                      ^
                              Changed LSB

The change is imperceptible to human eyes but carries hidden data.

Common Embedding Locations

Method Description Detectability
LSB Modify least significant bits of pixels Low (most common)
EOF (End of File) Append data after file end marker Medium (file size increases)
Metadata Embed in EXIF/comments High (easily checked)
Whitespace Use invisible characters in text Medium (unusual patterns)

Example: Hiding Text in Image

# Embed secret.txt inside image.jpg (steghide)
steghide embed -cf image.jpg -ef secret.txt -p MyPassword

# Extract hidden data
steghide extract -sf image.jpg -p MyPassword

πŸ› οΈ Common Tools

Tool Purpose Use Case
steghide Hide/extract data from JPEG/WAV/BMP General purpose stego
steghide LSB steganography for PNG/BMP CTF challenges
exiftool Read/write metadata Check for hidden data in metadata
binwalk Analyze files for embedded data Forensic analysis
stegsolve Analyze images bit-by-bit CTF / forensics
zsteg PNG/BMP stego detection Detect LSB stego
OpenStego GUI stego tool User-friendly hiding/extraction

Installation (Linux)

# Steghide
sudo apt install steghide

# Binwalk
sudo apt install binwalk

# Zsteg (Ruby gem)
gem install zsteg

πŸ›‘οΈ Detection & Prevention

How to Detect (Blue Team)

How to Prevent / Mitigate

Detection Commands

# Check file for embedded data
binwalk image.jpg

# Extract all embedded files
binwalk -e image.jpg

# Analyze PNG/BMP for LSB stego
zsteg image.png

# Check metadata
exiftool image.jpg

πŸ“Š Types/Categories

Type Carrier Medium Example
Image Stego JPEG, PNG, BMP Most common in CTFs
Audio Stego WAV, MP3, FLAC Spectrograms, LSB
Video Stego MP4, AVI High capacity, complex
Text Stego TXT, HTML, source code Whitespace, Zero-width chars
Network Stego Protocol headers, timing Covert channels

🎀 Interview Angles

Common Questions

STAR Story

Situation: During a threat intelligence investigation, we suspected an insider was exfiltrating sensitive documents, but DLP showed no alerts.
Task: Determine if data exfiltration was occurring through non-traditional channels.
Action: Analyzed outbound network traffic and noticed employee uploading unusually large vacation photos. Used binwalk and steghide to examine imagesβ€”discovered embedded compressed archives containing source code. Correlated upload times with file access logs.
Result: Identified insider threat, recovered exfiltrated IP, and implemented image re-encoding at upload to prevent future stego-based exfiltration.

βœ… Best Practices

❌ Common Misconceptions

πŸ“š References