Don't Be Afraid of the Dark
Don't Be Afraid of the Dark
Platform: hackerlab | Category: Steganography | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2025-12-22 | Status: Solved Techniques: Alpha channel value analysis, Binary mask generation from alpha differences, Invisible data in transparency layer
Summary
Task: PNG image that appears completely black. Solution: Analyzed alpha channel variations (254 vs 255) and created binary mask to reveal hidden flag text.
Don't Be Afraid of the Dark — hackerlab.pro
Description
"Don't be afraid of the dark, it's the place where you can hide" - August Verona
The task contains task.zip with an image task.png (1240x720 PNG with RGBA).
Analysis
Step 1: Initial Inspection
The image appears completely black. All pixels have RGB = (0, 0, 0).
python read-only • copy allowedfrom PIL import Image import numpy as np img = Image.open("task.png") arr = np.array(img) print(f"Mode: {img.mode}") # RGBA print(f"Size: {img.size}") # (1240, 720) print(f"RGB unique values: {np.unique(arr[:,:,:3])}") # [0] - all black
Step 2: Hint in the Description
The phrase "Don't be afraid of the dark" hints that data is hidden in the "darkness". Since RGB channels are empty, we check the alpha channel.
Step 3: Alpha Channel Analysis
python read-only • copy allowedalpha = arr[:, :, 3] unique_alpha = np.unique(alpha) print(f"Unique alpha values: {unique_alpha}") # [254, 255] # Pixel count print(f"Alpha=254: {np.sum(alpha == 254)}") # 33881 pixels print(f"Alpha=255: {np.sum(alpha == 255)}") # the rest
Findings:
- 2 unique alpha values: 254 and 255
- 33881 pixels with alpha=254 (slightly transparent)
- Remaining pixels with alpha=255 (fully opaque)
The difference between 254 and 255 is invisible to the human eye but encodes hidden information.
Solution
Create a binary mask: pixels with alpha=254 become white, the rest become black.
python read-only • copy allowed#!/usr/bin/env python3 from PIL import Image import numpy as np # Load the image img = Image.open("task.png") arr = np.array(img) # Extract alpha channel alpha = arr[:, :, 3] # Create binary mask # alpha=254 -> white (255) - hidden content # alpha=255 -> black (0) - background mask = np.where(alpha == 254, 255, 0).astype(np.uint8) # Save the result Image.fromarray(mask).save("hidden_alpha.png") print("Saved: hidden_alpha.png")
Result
The resulting image shows the flag text in white on black background:
CODEBY{REDACTED}
Theory
Alpha Channel Steganography
The alpha channel defines pixel transparency:
- 255 = fully opaque
- 0 = fully transparent
- 1-254 = partially transparent
The difference between adjacent values (e.g., 254 and 255) is practically invisible visually but can encode binary data:
- alpha=255 → bit 0
- alpha=254 → bit 1
In this case, a simple approach was used: pixels with alpha=254 form visible text when visualized.
Why This Works
- The human eye cannot distinguish 0.4% difference in transparency
- Most image viewers ignore the alpha channel when displaying
- Black RGB (0,0,0) makes any transparency variations invisible