mlsanityData to 14 Oct 2026

Malicious Source Code Detection Using Transformer

arXiv 2209.07957 ↗First posted 16 Sep 2022cs.CR cs.LGcited by 4

Not on the map. Why?

Abstract (arXiv)

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.

Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 20 of its 89 references that are in the map. First posted on arXiv 16 Sep 2022.

Builds on

20 of 89 references.

References · 20

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  5. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  6. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  7. 2020Unsupervised Translation of Programming Languagescited by 263
  8. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 179
  9. 2022ECOD: Unsupervised Outlier Detection Using Empirical Cumulative Distribution Functionscited by 153
  10. 2020A Transformer-based Approach for Source Code Summarizationcited by 133
  11. 2018Automated Vulnerability Detection in Source Code Using Deep Representation Learningcited by 114
  12. 2020Backstabber's Knife Collection: A Review of Open Source Software Supply Chain Attackscited by 61
8 more
  1. 2020Semantic Robustness of Models of Source Codecited by 45
  2. 2019Small World with High Risks: A Study of Security Threats in the npm Ecosystemcited by 37
  3. 2018Automatic Generation of Text Descriptive Comments for Code Blockscited by 18
  4. 2016A deep language model for software codecited by 14
  5. 2014Convolutional Neural Networks over Tree Structures for Programming Language Processingcited by 10
  6. 2021A Large-Scale Security-Oriented Static Analysis of Python Packages in PyPIcited by 4
  7. 2018An Empirical Analysis of Vulnerabilities in Python Packages for Web Applicationscited by 2
  8. 2019Scalable Source Code Similarity Detection in Large Code Repositoriescited by 2

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2023: 1; 2024: 0; 2025: 2; 2026: 1.

4 papers.