Detecting LSB Steganography
Steganography is the practice of concealing a file, message, or image within another file. Unlike cryptography, the goal is to hide the fact that the communication is taking place at all.
Least Significant Bit (LSB) Encoding
In a 24-bit image, each pixel is represented by 3 bytes (Red, Green, Blue). If an attacker modifies the least significant bit of each color channel, the resulting change in color is imperceptible to the human eye, but allows them to store 3 bits of arbitrary data per pixel.
Detection Techniques (Steganalysis)
Detecting LSB steganography requires statistical analysis:
- Visual Attacks: Extracting only the LSBs of an image and rendering them as black/white pixels. A normal image will show structural noise, whereas encrypted payload data will look like pure random static.
- Chi-Square Test: Statistical test to detect anomalies in the probability distribution of pixel values.
- File Size Anomalies: While LSB doesn't change dimensions, appending data to the end of a file (a cruder form of stego) inflates the file size without changing the visual image.
Common Mistakes
| Mistake | Consequence | Better Approach |
|---|---|---|
| FileReader.readAsArrayBuffer | Browser Crash (OOM) | Use File.slice for chunks |
| Rendering full DOM | Browser freeze | Virtualized list rendering |
FAQ
What is the max file size?
By using slicing and streams, we can handle files limited only by your OS filesystem (e.g., 2TB on NTFS), not your RAM.