Skip to main content
QUICK REVIEW

[Paper Review] SecureFalcon: Are We There Yet in Automated Software Vulnerability Detection with LLMs?

Mohamed Amine Ferrag, Ammar Battah|arXiv (Cornell University)|Jul 13, 2023
Software Engineering ResearchComputer Science10 citations
TL;DR

SecureFalcon fine-tunes FalconLLM 7b to detect vulnerabilities in C code using the FormAI dataset, achieving 94% accuracy in vulnerability detection and enabling repair suggestions.

ABSTRACT

Software vulnerabilities can cause numerous problems, including crashes, data loss, and security breaches. These issues greatly compromise quality and can negatively impact the market adoption of software applications and systems. Traditional bug-fixing methods, such as static analysis, often produce false positives. While bounded model checking, a form of Formal Verification (FV), can provide more accurate outcomes compared to static analyzers, it demands substantial resources and significantly hinders developer productivity. Can Machine Learning (ML) achieve accuracy comparable to FV methods and be used in popular instant code completion frameworks in near real-time? In this paper, we introduce SecureFalcon, an innovative model architecture with only 121 million parameters derived from the Falcon-40B model and explicitly tailored for classifying software vulnerabilities. To achieve the best performance, we trained our model using two datasets, namely the FormAI dataset and the FalconVulnDB. The FalconVulnDB is a combination of recent public datasets, namely the SySeVR framework, Draper VDISC, Bigvul, Diversevul, SARD Juliet, and ReVeal datasets. These datasets contain the top 25 most dangerous software weaknesses, such as CWE-119, CWE-120, CWE-476, CWE-122, CWE-190, CWE-121, CWE-78, CWE-787, CWE-20, and CWE-762. SecureFalcon achieves 94% accuracy in binary classification and up to 92% in multiclassification, with instant CPU inference times. It outperforms existing models such as BERT, RoBERTa, CodeBERT, and traditional ML algorithms, promising to push the boundaries of software vulnerability detection and instant code completion frameworks.

Motivation & Objective

  • Motivate improved software vulnerability detection using large language models (LLMs).
  • Fine-tune FalconLLM for binary vulnerability classification in C code samples.
  • Create and utilize the FormAI dataset to evaluate vulnerability detection performance.
  • Provide a vulnerability repair capability via prompting a repair-oriented model.
  • Assess configuration variants and practical deployment considerations for SecureFalcon.

Proposed method

  • Fine-tune FalconLLM 7b on FormAI-derived C code with 42 CWE labels.
  • Preprocess data by removing header noise, HTML, and email addresses; encode labels numerically.
  • Implement a two-label vulnerability scoring head mapping 768-dim decoder output to 2 classes with a sigmoid.
  • Use Rotary Position Embedding (RoPE) in self-attention and an MLP with GELU activations in decoder layers.
  • Train with AdamW optimizer, LR schedules (2e-2 and 2e-5), early stopping, and cross-entropy loss.
  • Evaluate two configurations (121M and 44M parameters) and demonstrate vulnerability repair via Falcon-40B-Instruct prompts.
Figure 1 : Top 10 most frequent vulnerabilities categories in FormAI dataset.
Figure 1 : Top 10 most frequent vulnerabilities categories in FormAI dataset.

Experimental results

Research questions

  • RQ1Can FalconLLM be effectively fine-tuned to distinguish vulnerable vs. non-vulnerable C code samples?
  • RQ2What is the impact of model size (121M vs 44M) on vulnerability detection performance?
  • RQ3How well does SecureFalcon perform on the FormAI-based vulnerability distribution across 42 CWE categories?
  • RQ4Can the system be extended to propose remediation steps for detected vulnerabilities?

Key findings

  • SecureFalcon achieves high accuracy in vulnerability detection on FormAI-derived data (specific metric: accuracy reported in training epochs for configurations).
  • Two configurations (121M and 44M) show progressive improvements in accuracy during training across epochs under different learning rates (LR=2e-5 and LR=2e-2).
  • For SecureFalcon 121M with LR=2e-5, training accuracy reaches 0.97 and validation accuracy 0.94 by epoch 7.
  • The FormAI dataset comprises 112,000 C programs with 42 CWE categories and 197,800 vulnerabilities across labeled samples.
  • The study also demonstrates using FalconLLM as a repair system to suggest fixes after vulnerability detection.
Figure 2 : SecureFalcon model architecture.
Figure 2 : SecureFalcon model architecture.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.