SeqTrans: Automatic Vulnerability Fix via Sequence to Sequence Learning

Jianlei Chi, Yu Qu, Ting Liu, Qinghua Zheng, Heng Yin
10/21/2020
81 citations
cs.CRcs.SE

Official code: SAP/project-kb (135 stars, Python, Apache-2.0, last commit 2025-03-27). 1 more implementation below.

Abstract

Software vulnerabilities are now reported at an unprecedented speed due to the recent development of automated vulnerability hunting tools. However, fixing vulnerabilities still mainly depends on programmers' manual efforts.

Show full abstract

Developers need to deeply understand the vulnerability and try to affect the system's functions as little as possible. In this paper, with the advancement of Neural Machine Translation (NMT) techniques, we provide a novel approach called SeqTrans to exploit historical vulnerability fixes to provide suggestions and automatically fix the source code. To capture the contextual information around the vulnerable code, we propose to leverage data flow dependencies to construct code sequences and fed them into the state-of-the-art transformer model. The fine-tuning strategy has been introduced to overcome the small sample size problem. We evaluate SeqTrans on a dataset containing 1,282 commits that fix 624 vulnerabilities in 205 Java projects. Results show that the accuracy of SeqTrans outperforms the latest techniques and achieves 23.3% in statement-level fix and 25.3% in CVE-level fix. In the meantime, we look deep inside the result and observe that NMT model performs very well in certain kinds of vulnerabilities like CWE-287 (Improper Authentication) and CWE-863 (Incorrect Authorization).

View on arXivView PDF

Code Implementations(2)

Code implementations of this paper
RepositoryTypeStarsLanguageLicenseLast commit
SAP/project-kbOfficial135PythonApache-2.02025-03-27
chijianlei/SeqTransOfficial17Java–2022-03-09
SAP/project-kbOfficial100%
Apache-2.0

Home page of project "KB"

13582Python, TeX1 years agoApache-2.0
open-sourcevulnerability-data

SeqTrans: Automatic Vulnerability Fix via Sequence to Sequence Learning

175Java, C++Dec 30, 20214 years ago

Similar Papers

Cite this paper

@article{chi2020seqtrans,
  title  = {SeqTrans: Automatic Vulnerability Fix via Sequence to Sequence Learning},
  author = {Jianlei Chi and Yu Qu and Ting Liu and Qinghua Zheng and Heng Yin},
  year   = {2020},
  eprint = {2010.10805},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2010.10805}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2010.10805.svg)](https://codeofpaper.com/paper/2010.10805)

Discussion