In today's digital era, network communication has become ubiquitous, evincing pressing concerns regarding the confidentiality of transmitted information. Given heightened public scrutiny of information security, image steganalysis has emerged as a pivotal concern within the ambit of information security. To further optimize the image steganalysis algorithm, attention mechanism is introduced into convolutional neural network, which further improves the accuracy and recognition efficiency of the algorithm. The experimental results show that by conducting steganalysis on 20,000 images in the database, the recognition accuracy of the research model is 92.58%, and the error recognition rate is 13.44%, which basically meets the research requirements. After conducting a performance test of the attention module and implementing it, the analysis model's error rate has decreased to different extents. Comparing the performance of the algorithms using the wavelet obtained weights and spatial universal wavelet relative distortion algorithms as detection criteria, the error rates of steganalysis under four parameter settings are 21.4%, 11.6%, 20.8%, and 13.9%, respectively. These are the lowest values in each model, further verifying the optimization performance.