arXiv:2507.22447cs.CRcs.LG2025-07被引 6

用大模型+图学习破解恶意脚本混淆,检测准确率提升超10%。

Breaking Obfuscation: Cluster-Aware Graph with LLM-Aided Recovery for Malicious JavaScript Detection

  • 通过多阶段提示工程让大模型逐步还原混淆代码结构并生成标准化语法树。
  • 在两个基准数据集上达到94.64%和97.71%的F1分数,优于现有方法10.74%以上。
  • 创新性融合节点聚类与层级图注意力,有效捕捉嵌套函数中的语义关系。

随着基于Web的应用和云服务的快速发展,恶意JavaScript代码持续威胁用户隐私、系统完整性和企业安全。然而,由于复杂的代码混淆技术及JavaScript语言特性(如嵌套闭包和语法灵活性),检测仍具挑战性。本文提出DeCoda,一种结合大语言模型(LLM)去混淆与代码图学习的混合防御框架:(1) 设计多阶段精炼的提示学习管道,使LLM逐步重构混淆输入的原始代码结构,并生成标准化抽象语法树(AST);(2) 针对动态类型导致的语义节点分散与深层嵌套函数破坏作用域捕获的问题,提出聚类感知图(Cluster-wise Graph),融合图变压器网络、节点聚类与节点-聚类注意力机制,同时捕捉局部节点语义与全局聚类级结构关系。实验表明,该方法在两个基准数据集上分别取得94.64%和97.71%的F1分数,较最先进基线提升10.74%和13.85%。在固定假阳性率(FPR=0.0001, 0.001, 0.01)下,真阳性率(TPR)分别高出基线4.82、5.91和2.53。结果验证了基于大模型的去混淆有效性,凸显建模聚类级关系在恶意代码检测中的重要性。

原文摘要 · Abstract (English)

With the rapid expansion of web-based applications and cloud services, malicious JavaScript code continues to pose significant threats to user privacy, system integrity, and enterprise security. But, detecting such threats remains challenging due to sophisticated code obfuscation techniques and JavaScript's inherent language characteristics, particularly its nested closure structures and syntactic flexibility. In this work, we propose DeCoda, a hybrid defense framework that combines large language model (LLM)-based deobfuscation with code graph learning: (1) We first construct a sophisticated prompt-learning pipeline with multi-stage refinement, where the LLM progressively reconstructs the original code structure from obfuscated inputs and then generates normalized Abstract Syntax Tree (AST) representations; (2) In JavaScript ASTs, dynamic typing scatters semantically similar nodes while deeply nested functions fracture scope capturing, introducing structural noise and semantic ambiguity. To address these challenges, we then propose to learn hierarchical code graph representations via a Cluster-wise Graph that synergistically integrates graph transformer network, node clustering, and node-to-cluster attention to simultaneously capture both local node-level semantics and global cluster-induced structural relationships from AST graph. Experimental results demonstrate that our method achieves F1-scores of 94.64% and 97.71% on two benchmark datasets, demonstrating absolute improvements of 10.74% and 13.85% over state-of-the-art baselines. In false-positive control evaluation at fixed FPR levels (0.0001, 0.001, 0.01), our approach delivers 4.82, 5.91, and 2.53 higher TPR respectively compared to the best-performing baseline. These results highlight the effectiveness of LLM-based deobfuscation and underscore the importance of modeling cluster-level relationships in detecting malicious code.

恶意代码检测大模型图神经网络

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。