name: stego-analysis
description: Steganography analysis and hidden data extraction. Use this skill whenever the user needs to find or extract hidden data from files (images, audio, video, documents, archives) or text-based steganography. Trigger on requests involving: hidden messages, steganography, LSB extraction, metadata analysis, file forensics, embedded files, spectrogram analysis, or any task where data might be concealed within another file. Make sure to use this skill for CTF challenges, security audits, or any investigation where hidden content is suspected.
Steganography Analysis
A structured approach to finding and extracting hidden data from files and text. This skill treats steganography as a forensics problem: identify the real container, enumerate high-signal locations, then apply content-level extraction techniques.
Workflow & Triage
Follow this prioritized workflow for any steganography investigation:
1. Container Identification
First, determine what you're actually working with:
file <filename>
file -b <filename>
xxd <filename> | head -20
python3 scripts/check_file_type.py <filename>
Why this matters: Many stego challenges use mismatched extensions (e.g., a PNG disguised as a JPG). The actual file format determines which tools and techniques apply.
2. Metadata & String Inspection
Extract all metadata and readable strings before diving into content analysis:
python3 scripts/extract_metadata.py <filename>
strings <filename> > strings.txt
strings -n 10 <filename> | grep -iE "(flag|secret|hidden|ctf|password|key)"
tail -c 10000 <filename> | strings
Why this matters: Hidden data often appears in metadata fields, appended after the file's actual content, or as readable strings. This is the fastest way to find low-hanging fruit.
3. Format-Specific Analysis
Based on the file type, apply targeted techniques:
Image Steganography
Images are the most common stego container. Prioritize these checks:
Quick Wins
binwalk -e <image>
foremost -i <image>
zcat <(pngcheck -v <image>) 2>&1 | grep -A5 "chunk"
file <image>
strings <image> | grep -i "PNG\|JFIF\|GIF"
LSB & Bit-Plane Analysis
For PNG/BMP files, check for Least Significant Bit manipulation:
python3 scripts/extract_lsb.py <image> --bits 1-4 --output lsb_output/
python3 scripts/visualize_bitplanes.py <image>
steghide extract -sf <image>
zsteg <image>
JPEG-Specific
exiftool <image>
jpeginfo <image>
exiftool -Comment <image>
GIF Multi-Frame
convert <gif> -coalesce frames/frame_%03d.png
file frames/*.png
Audio Steganography
Audio files hide data in samples, spectrograms, or as DTMF tones.
Spectrogram Analysis
sox <audio> -n spectrogram spectrogram.png
ffmpeg -i <audio> -filter_complex "spectrumpic" spectrogram.png
Look for: Text, QR codes, or images visible in the frequency spectrum.
Sample-Level Analysis
python3 scripts/extract_audio_lsb.py <audio> --bits 1-2
sox <audio> silence -v -d 0.5 -t 0.1 silence_analysis.txt
DTMF Tones
sox <audio> -n stat -V 3 2>&1 | grep -i "tone\|frequency"
sox <audio> -n spectrogram dtmf_spectrogram.png
Text Steganography
Text that renders normally but contains hidden data through encoding tricks.
Unicode & Zero-Width Characters
python3 scripts/detect_zwc.py <textfile>
python3 scripts/remove_zwc.py <textfile> > cleaned.txt
python3 scripts/check_homoglyphs.py <textfile>
Whitespace Encoding
python3 scripts/decode_whitespace.py <textfile>
cat -A <textfile> | grep -E "\s\$"
Base64 & Encoded Strings
strings <textfile> | grep -E "^[A-Za-z0-9+/]{20,}={0,2}$" | base64 -d 2>/dev/null
strings <textfile> | grep -E "^[0-9a-fA-F]{20,}$" | xxd -r -p
Document Steganography
PDFs and Office files are containers first. Focus on embedded content.
PDF Analysis
pdftk <pdf> cat output extracted/
qpdf --show-npages <pdf>
qpdf --json <pdf> | python3 -m json.tool
python3 scripts/extract_pdf_streams.py <pdf>
pdftotext <pdf> -layout text.txt
strings <pdf> | grep -iE "(flag|secret|hidden)"
Office Files (DOCX, XLSX, PPTX)
unzip -l <file>
unzip <file> -d extracted/
cat extracted/_rels/*.rels
cat extracted/[Content_Types].xml
find extracted/ -name "*.png" -o -name "*.jpg" -o -name "*.pdf"
ZIP Archives
zipinfo -l <archive>
unzip -o <archive> -d extracted/
file extracted/*
zip2john <archive>
Malware & Delivery Steganography
Payloads hidden in valid-looking files with marker-delimited text.
Common Patterns
strings <image> | grep -A5 -B5 "BEGIN\|END\|PAYLOAD\|DATA"
strings <image> | grep -E "^[A-Za-z0-9+/]{50,}={0,2}$"
xxd <image> | grep -E "(\x90{10,}|\x00{10,})"
Network-Based Steganography
tshark -r <pcap> -Y "http" -T fields -e http.file_data
tshark -r <pcap> -Y "http.request" -T fields -e http.request.full_uri
Common Tools Reference
Installation
sudo apt install binwalk foremost zsteg steghide exiftool
sudo apt install sox ffmpeg qpdf pdftk
pip install pillow pydub pycryptodome
Quick Reference
| Tool | Purpose |
|---|
binwalk | Find embedded files in containers |
foremost | Carve files from raw data |
zsteg | PNG steganography scanner |
steghide | Extract hidden data (password-protected) |
exiftool | Read/modify metadata |
sox | Audio analysis and spectrogram |
strings | Extract readable text from binaries |
file | Identify file type by magic bytes |
Debugging & Verification
When Nothing Works
- Re-check the file type:
file <filename> - is it what you think?
- Look at raw bytes:
xxd <filename> | head -50 - any obvious patterns?
- Check file size:
ls -la - is it suspiciously large for its type?
- Try multiple tools: Different tools detect different patterns
- Check for compression:
file <filename> might show "compressed data"
Verify Extraction
file extracted_file
strings extracted_file | head -20
file extracted_image && identify extracted_image
file extracted_text && head -20 extracted_text
Tips for Success
- Start simple: Metadata and strings often reveal the answer before complex analysis
- Document everything: Keep notes on what you've tried and what you found
- Check file sizes: Unusually large files often contain appended data
- Look for patterns: Repeated bytes, unusual sequences, or obvious markers
- Combine techniques: Sometimes you need to extract, then analyze the extracted content
- Don't ignore the obvious: Sometimes the hidden data is in plain sight (comments, metadata)
Next Steps
After initial analysis:
- If you found embedded files, analyze them recursively
- If you extracted encoded data, decode it and check for more hidden content
- If spectrogram shows text, transcribe it and check for encoding
- If you found a password-protected container, try common CTF passwords or brute force
Remember: steganography is often layered. What you extract might contain more hidden data.