VulCoCo: A Simple Yet Effective Method for Detecting Vulnerable Code Clones

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Bui, Tan, Tun, Yan Naing, Nguyen, Thanh Phuc, Su, Yindu, Thung, Ferdian, Li, Yikun, Ang, Han Wei, Yin, Yide, Liauw, Frank, Shar, Lwin Khin, Ouh, Eng Lieh, Zhang, Ting, Lo, David
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866912497278124032
author Bui, Tan
Tun, Yan Naing
Nguyen, Thanh Phuc
Su, Yindu
Thung, Ferdian
Li, Yikun
Ang, Han Wei
Yin, Yide
Liauw, Frank
Shar, Lwin Khin
Ouh, Eng Lieh
Zhang, Ting
Lo, David
author_facet Bui, Tan
Tun, Yan Naing
Nguyen, Thanh Phuc
Su, Yindu
Thung, Ferdian
Li, Yikun
Ang, Han Wei
Yin, Yide
Liauw, Frank
Shar, Lwin Khin
Ouh, Eng Lieh
Zhang, Ting
Lo, David
contents Code reuse is common in modern software development, but it can also spread vulnerabilities when developers unknowingly copy risky code. The code fragments that preserve the logic of known vulnerabilities are known as vulnerable code clones (VCCs). Detecting those VCCs is a critical but challenging task. Existing VCC detection tools often rely on syntactic similarity or produce coarse vulnerability predictions without clear explanations, limiting their practical utility. In this paper, we propose VulCoCo, a lightweight and scalable approach that combines embedding-based retrieval with large language model (LLM) validation. Starting from a set of known vulnerable functions, we retrieve syntactically or semantically similar candidate functions from a large corpus and use an LLM to assess whether the candidates retain the vulnerability. Given that there is a lack of reproducible vulnerable code clone benchmarks, we first construct a synthetic benchmark that spans various clone types. Our experiments on the benchmark show that VulCoCo outperforms prior state-of-the-art methods in terms of Precision@k and mean average precision (MAP). In addition, we also demonstrate VulCoCo's effectiveness in real-world projects by submitting 400 pull requests (PRs) to 284 open-source projects. Among them, 75 PRs were merged, and 15 resulted in newly published CVEs. We also provide insights to inspire future work to further improve the precision of vulnerable code clone detection.
format Preprint
id arxiv_https___arxiv_org_abs_2507_16661
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle VulCoCo: A Simple Yet Effective Method for Detecting Vulnerable Code Clones
Bui, Tan
Tun, Yan Naing
Nguyen, Thanh Phuc
Su, Yindu
Thung, Ferdian
Li, Yikun
Ang, Han Wei
Yin, Yide
Liauw, Frank
Shar, Lwin Khin
Ouh, Eng Lieh
Zhang, Ting
Lo, David
Software Engineering
Code reuse is common in modern software development, but it can also spread vulnerabilities when developers unknowingly copy risky code. The code fragments that preserve the logic of known vulnerabilities are known as vulnerable code clones (VCCs). Detecting those VCCs is a critical but challenging task. Existing VCC detection tools often rely on syntactic similarity or produce coarse vulnerability predictions without clear explanations, limiting their practical utility. In this paper, we propose VulCoCo, a lightweight and scalable approach that combines embedding-based retrieval with large language model (LLM) validation. Starting from a set of known vulnerable functions, we retrieve syntactically or semantically similar candidate functions from a large corpus and use an LLM to assess whether the candidates retain the vulnerability. Given that there is a lack of reproducible vulnerable code clone benchmarks, we first construct a synthetic benchmark that spans various clone types. Our experiments on the benchmark show that VulCoCo outperforms prior state-of-the-art methods in terms of Precision@k and mean average precision (MAP). In addition, we also demonstrate VulCoCo's effectiveness in real-world projects by submitting 400 pull requests (PRs) to 284 open-source projects. Among them, 75 PRs were merged, and 15 resulted in newly published CVEs. We also provide insights to inspire future work to further improve the precision of vulnerable code clone detection.
title VulCoCo: A Simple Yet Effective Method for Detecting Vulnerable Code Clones
topic Software Engineering
url https://arxiv.org/abs/2507.16661