← Back to Writeups
CUSTOMEasySteganography

Наименее значимый мем

XESXOR9/10/20262 min read
#steganography#custom#easy#bit_manipulation#lsb_extraction#linux

Наименее значимый мем

Platform: duckerz | Category: Steganography | Type: Challenge | Difficulty: Easy | OS: Linux | Author: XESXOR | Date: 2026-01-09 | Status: Solved Techniques: bit_manipulation, lsb_extraction

Summary

Task: PNG image with a meme, title hints at LSB. Solution: Extract least significant bits from RGB channels to reveal hidden flag.

Наименее значимый мем — duckerz CTF

Description

Вот это смешной мем, я не могу XD

Files: meme.png (PNG 300x300, RGBA, 124KB)

Analysis

Hint in the Title

The task title "Наименее значимый" (Least Significant) is a direct hint at the LSB (Least Significant Bit) steganography technique.

File Analysis

Format: PNG
Size: 300x300 pixels
Color: 8-bit RGBA (4 channels)
File size: 124KB

PNG is an ideal format for LSB steganography since it uses lossless compression, which preserves all data bits. ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

LSB Theory

LSB steganography hides data in the least significant bits of each pixel's color channel. Changing the least significant bit has virtually no effect on the visual appearance of the image (a color change of 1 out of 256 shades is imperceptible to the human eye).

Extraction Algorithm

  1. Read all image pixels
  2. For each pixel, extract the LSB from R, G, B channels
  3. Collect bits into bytes (8 bits each)
  4. Decode bytes as text
  5. Search for the flag by pattern

Solution Code

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

python
#!/usr/bin/env python3
"""
LSB Steganography Extractor
Extracts hidden data from least significant bits of image pixels
"""

from PIL import Image
import re

def extract_lsb(image_path, flag_pattern=r'DUCKERZ\{[^}]+\}'):
    """Extract LSB data from image and search for flag"""
    
    img = Image.open(image_path)
    pixels = list(img.getdata())
    
    # Extract LSB from each RGB channel
    bits = []
    for pixel in pixels:
        for channel in pixel[:3]:  # RGB channels only (skip Alpha)
            bits.append(channel & 1)  # Get least significant bit
    
    # Convert bits to bytes
    data = []
    for i in range(0, len(bits) - 7, 8):
        byte = 0
        for j in range(8):
            byte = (byte << 1) | bits[i + j]
        data.append(byte)
    
    # Convert to string and search for flag
    result = bytes(data)
    text = result.decode('latin-1')
    
    flags = re.findall(flag_pattern, text)
    if flags:
        return flags[0]
    return None
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

if __name__ == "__main__":
    flag = extract_lsb('meme.png')
    print(f"Found flag: {flag}")

Execution

bash
$ python3 solve.py
Found flag: DUCKERZ{REDACTED}

Alternative Tools

bash
# zsteg - automatic LSB analysis
zsteg meme.png

# stegsolve - GUI tool
java -jar stegsolve.jar

# Python with numpy (faster for large images)
import numpy as np
from PIL import Image

img = np.array(Image.open('meme.png'))
lsb = img[:,:,:3] & 1  # Extract LSB from RGB

Notes

  • LSB is the most basic steganography technique
  • Only works with lossless formats (PNG, BMP, TIFF)
  • JPEG uses lossy compression and destroys LSB data
  • Data can be hidden in different bit planes (not just LSB)
  • For more complex tasks, check different combinations of channels and bits ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍