Leveraging LLM to Detect and Correct Vulnerabilities in Code

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Artificial intelligence has significantly affected various domains recently, notably code-level application security. Vulnerable code snippets can easily propagate across different software platforms, making early detection and correction crucial. Existing machine learning applications often fail to provide comprehensive and accurate results, necessitating time-consuming manual inspections by developers. This paper explores using a fine-tuned large language model (LLM) to detect vulnerabilities in source code. Leveraging the Mistral LLM and LangGraph, the model was trained on a custom dataset to improve performance in identifying and addressing code vulnerabilities. The approach involves fine-tuning models to classify code as vulnerable or non-vulnerable, identifying the Common Weakness Enumeration (CWE) for vulnerable code, and generating secure replacements. The study compares the performance of fine-tuned models with standard LLMs and other detection tools, highlighting the limitations of existing methods. The results demonstrate improved accuracy, reduced false positive and negative rates, and maintained code privacy and security within the local system. This advancement underscores the potential of fine-tuned LLMs and iterative frameworks like LangGraph to improve code security in modern software development.

Original languageEnglish (US)
Title of host publicationComputational Science and Computational Intelligence - 11th International Conference, CSCI 2024, Proceedings
EditorsHamid R. Arabnia, Leonidas Deligiannidis, Farzan Shenavarmasouleh, Soheyla Amirian, Farid Ghareh Mohammadi
PublisherSpringer Science and Business Media Deutschland GmbH
Pages324-339
Number of pages16
ISBN (Print)9783031951268
DOIs
StatePublished - 2025
Event11th International Conference on Computational Science and Computational Intelligence, CSCI 2024 - Las Vegas, United States
Duration: Dec 11 2024Dec 13 2024

Publication series

NameCommunications in Computer and Information Science
Volume2505 CCIS
ISSN (Print)1865-0929
ISSN (Electronic)1865-0937

Conference

Conference11th International Conference on Computational Science and Computational Intelligence, CSCI 2024
Country/TerritoryUnited States
CityLas Vegas
Period12/11/2412/13/24

All Science Journal Classification (ASJC) codes

  • General Computer Science
  • General Mathematics

Fingerprint

Dive into the research topics of 'Leveraging LLM to Detect and Correct Vulnerabilities in Code'. Together they form a unique fingerprint.

Cite this