arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2209.07957cs.CRcs.LG
收藏

使用Transformer检测恶意Source Code

Malicious Source Code Detection Using Transformer

Ben-Gurion University(本-古里安大学)

Chen Tsfaty, Michael Fire

摘要:

开源代码被认为是现代软件开发中的常见做法。然而,重复使用其他代码会使恶意攻击者能够访问广泛的开发人员社区,从而访问依赖于它的产品。这些攻击被归类为供应链攻击。近年来,越来越多的供应链攻击在软件开发过程中利用开源,自动或手动地中继下载和安装过程。多年来,已经发明了许多方法来检测易受攻击的软件包。但是,在包中检测恶意代码并不常见。这些检测方法可以大致分类为使用(动态)和不使用(静态)代码执行的分析。在这里,我们介绍了恶意源代码检测使用Transformers(MSDT)算法。MSDT是一种基于深度学习方法的新型静态分析,可检测源代码包的真实代码注入情况。在这项研究中,我们使用MSDT和一个包含60多万个不同函数的数据集来嵌入各种函数,并对生成的向量应用聚类算法,通过检测离群值来检测恶意函数。我们进行了广泛的实验,并证明了我们的算法能够检测到注入恶意代码的功能,精度@k值高达0.909。

英文摘要:

Open source code is considered a common practice in modern software development. However, reusing other code allows bad actors to access a wide developers' community, hence the products that rely on it. Those attacks are categorized as supply chain attacks. Recent years saw a growing number of supply chain attacks that leverage open source during software development, relaying the download and installation procedures, whether automatic or manual. Over the years, many approaches have been invented for detecting vulnerable packages. However, it is uncommon to detect malicious code within packages. Those detection approaches can be broadly categorized as analyzes that use (dynamic) and do not use (static) code execution. Here, we introduce Malicious Source code Detection using Transformers (MSDT) algorithm. MSDT is a novel static analysis based on a deep learning method that detects real-world code injection cases to source code packages. In this study, we used MSDT and a dataset with over 600,000 different functions to embed various functions and applied a clustering algorithm to the resulting vectors, detecting the malicious functions by detecting the outliers. We evaluated MSDT's performance by conducting extensive experiments and demonstrated that our algorithm is capable of detecting functions that were injected with malicious code with precision@k values of up to 0.909.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑