The popularization of the Internet has made the buffer overflow attack become one of the favorite attacks used by hackers and the most concern in the information security field. Therefore, the buffer overflow attack also becomes one of the foci of the antivirus software nowadays. It is reported that there has been malicious buffer overflow codes embedded in the digital images to avoid the detection of anti-virus systems. Steganalytic techniques use statistical analysis to detect the existence of the embedded information. The purpose of this paper is to propose a steganalysis-based technique to detect the embedded malicious code. Meanwhile, the support vector machine (SVM) is integrated with the proposed technique to provide an automatic mechanism to solve the problem of tuning the parameters used in the proposed technique. Experimental results show that the proposed technique can effectively detect the malicious code embedded in the innocent images. The achievement of this study can be integrated with antivirus software to avoid this kind of information security accidents.