The chisquare attack is a simble and famous method to test the Robustness of the security system against the attacks. It depend on probability analysis of stego image after put the information inside it using LSB method then compare it with the probability analysis of original image to check the difference between them. If the difference near zero it means no information inside the image otherwise if near one it means the image held the information.
A chi-square test for independence compares two variables in a contingency table to see if they are related. In a more general sense, it tests to see whether distributions of categorical variables differ from each another. You can find the code of Chi-square test from here. https://in.mathworks.com/matlabcentral/fileexchange/4779-chi-square-test
In some papers of steganography, the authors perform chi square test steganalysis. Article Application of Lah transform for security and privacy of dat...