arXiv:2602.23121cs.CRcs.AI2026-02被引 11

用深度学习自动检测C代码漏洞,准确率优于已有方法。

Automated Vulnerability Detection in Source Code Using Deep Representation Learning

  • 基于卷积神经网络,将代码分词为91类并转为二值向量输入
  • 在标准数据集上实现高精度下更高召回率,优于前人工作
  • 可在真实内核代码中发现漏洞,误报率低,适合安全审计场景

每年都会发现大量软件漏洞,存在被利用和系统被攻破的重大风险。本文提出一种卷积神经网络模型,可有效识别C语言代码中的缺陷。模型训练使用两个互补数据集:由Draper实验室通过三种静态分析工具生成的机器标注数据集,以及NIST SATE Juliet人工标注数据集,该数据集专为测试静态分析器设计。与Russell等人工作相比,本研究聚焦于C语言程序,从而可针对该语言优化检测技术。数据去重后,将输入代码分词为91个类别,类别值转换为二值向量以节省内存。第一层卷积设计确保整个标记编码信息完整传递给滤波器。模型包含两层卷积与池化层,以及两层全连接层,用于将程序分类为常见弱点枚举(CWE)类别或“干净”类。在要求高精度的前提下,模型在该数据集上的召回率高于前人工作。此外,在自建的Linux内核数据集上,模型成功发现了真实存在的漏洞,且误报率较低。

原文摘要 · Abstract (English)

Each year, software vulnerabilities are discovered, which pose significant risks of exploitation and system compromise. We present a convolutional neural network model that can successfully identify bugs in C code. We trained our model using two complementary datasets: a machine-labeled dataset created by Draper Labs using three static analyzers and the NIST SATE Juliet human-labeled dataset designed for testing static analyzers. In contrast with the work of Russell et al. on these datasets, we focus on C programs, enabling us to specialize and optimize our detection techniques for this language. After removing duplicates from the dataset, we tokenize the input into 91 token categories. The category values are converted to a binary vector to save memory. Our first convolution layer is chosen so that the entire encoding of the token is presented to the filter. We use two convolution and pooling layers followed by two fully connected layers to classify programs into either a common weakness enumeration category or as ``clean.'' We obtain higher recall than prior work by Russell et al. on this dataset when requiring high precision. We also demonstrate on a custom Linux kernel dataset that we are able to find real vulnerabilities in complex code with a low false-positive rate.

代码安全漏洞检测深度学习C语言

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。