Computer Engineering and Applications ›› 2019, Vol. 55 ›› Issue (18): 89-94.DOI: 10.3778/j.issn.1002-8331.1808-0005

Previous Articles     Next Articles

Detection Approach of Malicious JavaScript Code Based on Convolutional Neural Network

LONG Tingyan, WAN Liang, DENG Xunkun   

  1. College of Computer Science and Technology, Guizhou University, Guiyang 550025, China
  • Online:2019-09-15 Published:2019-09-11



  1. 贵州大学 计算机科学与技术学院,贵阳 550025

Abstract: Time and manpower have been wasted largely in the process of features extraction when JavaScript malicious code detection methods of machine learning are used, and these frequently-used methods have failed to meet the actual needs in the current information explosion. A JavaScript malicious code detecting method based on convolution neural network have been proposed in this paper. The sample data are collected through the crawler tool to obtain the benign and malicious JavaScript script code. The JavaScript samples are converted into the corresponding gray scale images, simultaneously, the image dataset is established. The image data set is trained when the convolution neural network model is constructed, so the model has obtained the ability to detect JavaScript malicious code. The experimental results show that the accuracy of the method is 98.9% for the 5, 800 JavaScript labeled images collected.

Key words: Convolutional Neural Network(CNN), JavaScript’s scripts, grayscale image, machine learning, Web security

摘要: 机器学习的JavaScript恶意代码检测方法在提取特征过程中耗费时间和人力,以及这些频繁使用的机器学习方法已经无法满足当今信息大爆炸的实际需要。提出了一种基于卷积神经网络的JavaScript恶意代码检测方法。采用爬虫工具收集良性和恶意的JavaScript脚本代码获得样本数据;将JavaScript样本转换为相对应的灰阶图像,得到图像数据集;通过构建卷积神经网络模型对图像数据集进行训练,使得模型具有检测JavaScript恶意代码的能力。实验结果表明,相对于机器学习,该方法对收集到的5 800条JavaScript代码样本,检测准确率达到98.9%。

关键词: 卷积神经网络, JavaScript脚本, 灰阶图像, 机器学习, Web安全