Enhancing Software Supply Chain Security: Leveraging AI for Suspicious Code Detection in Open Source Repositories

The XZ backdoor incident, where malicious code was stealthily introduced into a widely used compression library, exposed the growing risks in the open source software supply chain and highlighted the enormous challenges faced by open source maintainers. These maintainers are often burdened with reviewing massive volumes of code contributions, which makes it difficult to manually catch subtle security threats such as backdoors. This thesis proposes to detect suspicious code in open source repositories using AI, helping maintainers by automating the identification of potentially harmful code. This elaborate will concentrate mostly on Trojan horse attack, the technique used to obfuscate them, and how AI, specifically Large Language Models (LLMs), can be employed to detect those kind of attacks. The study also explores the use of the Perplexity measure. Initial experiments suggested that Perplexity could effectively flag anomalies. However, the results also revealed its limitations, particularly in distinguishing between truly malicious behavior and unconventional, yet benign, coding styles. Lastly, state-of-the-art models were evaluated for their ability to detect malicious patterns in codebases using zero-shot classification. Among them, the LLamaguard 3 model, despite its compact size, demonstrated remarkable capabilities, outperforming larger models. It achieved an accuracy of 98.04% and an F1-score of 91.73% on the evaluated dataset.

Publication Details

Journal
Electronic Theses and Dissertations Repository (University of Pisa)
Published
2025-05-22
Primary Topic
Advanced Malware Detection Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Enhancing Software Supply Chain Security: Leveraging AI for Suspicious Code Detection in Open Source Repositories

Electronic Theses and Dissertations Repository (University of Pisa)
Advanced Malware Detection Techniques
article

Enhancing Software Supply Chain Security: Leveraging AI for Suspicious Code Detection in Open Source Repositories

article en

Abstract

The XZ backdoor incident, where malicious code was stealthily introduced into a widely used compression library, exposed the growing risks in the open source software supply chain and highlighted the enormous challenges faced by open source maintainers. These maintainers are often burdened with reviewing massive volumes of code contributions, which makes it difficult to manually catch subtle security threats such as backdoors. This thesis proposes to detect suspicious code in open source repositories using AI, helping maintainers by automating the identification of potentially harmful code. This elaborate will concentrate mostly on Trojan horse attack, the technique used to obfuscate them, and how AI, specifically Large Language Models (LLMs), can be employed to detect those kind of attacks. The study also explores the use of the Perplexity measure. Initial experiments suggested that Perplexity could effectively flag anomalies. However, the results also revealed its limitations, particularly in distinguishing between truly malicious behavior and unconventional, yet benign, coding styles. Lastly, state-of-the-art models were evaluated for their ability to detect malicious patterns in codebases using zero-shot classification. Among them, the LLamaguard 3 model, despite its compact size, demonstrated remarkable capabilities, outperforming larger models. It achieved an accuracy of 98.04% and an F1-score of 91.73% on the evaluated dataset.

Electronic Theses and Dissertations Repository (University of Pisa)
Peace, Justice and strong institutions
Openalex Percentile: Top 43%
Advanced Malware Detection Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.