chi-square attack
termKept in this browser · My desk
Westfeld and Pfitzmann's 1999 statistical test for LSB replacement, which checks whether the counts of each pair of values that differ only in the last bit have been equalized, as embedding random bits does.
Overwriting least significant bits moves values only within pairs (2i, 2i + 1) and keeps each pair's total, so the mean of each pair is the expected count after embedding and no original image is needed. Applied to growing samples of an image, the test exposed EzStego, Steganos and JSteg at once; it is weak against short messages scattered at random, does not see LSB matching, and Provos's OutGuess (2001) was designed to defeat it.
The formula. With k pairs, the expected count in pair i is n*ᵢ = (n₂ᵢ + n₂ᵢ₊₁)/2 and the observed count is the even member n₂ᵢ; χ² = Σ (nᵢ − n*ᵢ)²/n*ᵢ with k − 1 degrees of freedom, and the upper-tail probability p is read as the probability of embedding. Each expected count must exceed 4. A worked case. For a toy histogram of 300 pixels with counts 40, 20, 30, 50, 60, 30, 25, 45, χ² is 13.69 and p is about 0.003; after all least significant bits are replaced (31, 29, 41, 39, 44, 46, 36, 34), χ² is 0.11 and p is about 0.99. Results. On EzStego's half-filled image, p was 0.88 with 1% of the pixels and fell to essentially 0 once the sample passed the message; S-Tools at 50% capacity escaped, at 99.5% it did not. Provos's extended version slides a fixed 3.2% sample across the file to catch partial distortions.
Also known as: chi-squared attack, chi-square steganalysis, westfeld-pfitzmann attack, pairs of values attack, ataque qui-quadrado
Sources
- Westfeld and Pfitzmann, Attacks on Steganographic Systems, Information Hiding 1999 (read 2026-11-17): pairs of values, expected and observed frequencies, k − 1 degrees of freedom, p as probability of embedding; EzStego, S-Tools, Steganos and JSteg experiments
- Provos, Defending Against Statistical Steganalysis, USENIX Security 2001 (read 2026-11-17): extended test with a sliding 3.2% sample; OutGuess's corrections defeat it
- Westfeld, F5: ein steganographischer Algorithmus, VIS 2001 (read 2026-11-17): the test on a JSteg image at 50% capacity, 1.00 up to 54% of the sample, 0.00 from 59%
- Fridrich, Goljan and Du, 2001 (read 2026-11-17): reliable for known placement; scattered messages detected only when comparable to the number of pixels