用语法分析和抽象语法树检测服务器端脚本恶意代码,准确率远超传统杀毒软件。
SCORE: Syntactic Code Representations for Static Script Malware Detection
- 通过语法高亮和抽象语法树提取脚本结构特征
- 在40万+脚本上测试,真阳性率比主流杀软高81%、误报率仅0.17%
- 适合云安全防护、静态脚本检测场景的开发者与安全团队
随着企业广泛采用云技术,服务器端脚本攻击带来的安全威胁日益突出,此类脚本可窃取数据、泄露凭证并破坏系统运行。与具有标准格式(如ELF、PE)的可执行文件不同,脚本为明文文件且语法多样,传统检测方法难以应对。为此,本文提出基于深度学习的静态脚本恶意代码检测新方法,从明文代码中提取两类特征:语法高亮(SCH)与抽象语法树(AST)。SCH利用复杂正则表达式解析关键字、变量名等语法元素;AST生成程序的层次化结构表示。进而设计序列模型与图模型,利用上述特征进行恶意代码识别。在超过40万份Bash、Python和Perl脚本上评估,使用9万份平衡数据集进行训练、验证与测试,其余数据用于后续分析。实验表明,该方法真阳性率(TPR)比领先的基于签名的杀毒方案最高提升81%,同时保持0.17%的低误报率(FPR),显著优于多种神经网络检测器,验证了其在学习代码恶意性方面的有效性。
原文摘要 · Abstract (English)
As businesses increasingly adopt cloud technologies, they also need to be aware of new security challenges, such as server-side script attacks, to ensure the integrity of their systems and data. These scripts can steal data, compromise credentials, and disrupt operations. Unlike executables with standardized formats (e.g., ELF, PE), scripts are plaintext files with diverse syntax, making them harder to detect using traditional methods. As a result, more sophisticated approaches are needed to protect cloud infrastructures from these evolving threats. In this paper, we propose novel feature extraction and deep learning (DL)-based approaches for static script malware detection, targeting server-side threats. We extract features from plain-text code using two techniques: syntactic code highlighting (SCH) and abstract syntax tree (AST) construction. SCH leverages complex regexes to parse syntactic elements of code, such as keywords, variable names, etc. ASTs generate a hierarchical representation of a program's syntactic structure. We then propose a sequential and a graph-based model that exploits these feature representations to detect script malware. We evaluate our approach on more than 400K server-side scripts in Bash, Python and Perl. We use a balanced dataset of 90K scripts for training, validation, and testing, with the remaining from 400K reserved for further analysis. Experiments show that our method achieves a true positive rate (TPR) up to 81% higher than leading signature-based antivirus solutions, while maintaining a low false positive rate (FPR) of 0.17%. Moreover, our approach outperforms various neural network-based detectors, demonstrating its effectiveness in learning code maliciousness for accurate detection of script malware.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。