paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Identifying Smart Contract Security Issues in Code Snippets from Stack Overflow

识别 Stack Overflow 代码片段中的智能合约安全问题
ISSTA Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis2024匹配度 6/10 · 论文属于LLM辅助程序分析:用微调Llama2补全不完整代码片段,再以符号执行检测漏洞,契合AI→PL方向;但应用场景是智能合约安全,未覆盖用户核心关注的ML系统/Agentic程序、浮点程序分析或贝叶斯程序分析,且所用模型偏旧。引用 12 inbox
Jiachi Chen, Chong Chen, Jiang Hu, John Grundy, Yanlin Wang, Ting Chen, Zibin Zheng
crossref: 2026-09-12

AI 速览

一句话:提出 SOChecker,首个面向 Stack Overflow 不完整智能合约代码片段的漏洞检测工具,结合微调 Llama2 补全与符号执行。

智能合约开发者经常在 Stack Overflow(SO)等问答平台上寻求开发问题的解决方案,但社区回答中的代码片段可能隐藏漏洞,直接复用到合约中会带来被攻击的风险。作者开展在线调查并收到 74 份开发者回复,结果显示多数(86.4%)受访者在复用 SO 代码片段时并未充分考虑安全性;而现有漏洞检测工具通常针对完整合约开发,无法有效分析 SO 上典型的不完整片段。为此,作者提出 SOChecker:先利用微调的 Llama2 模型进行代码补全,再对补全后的代码应用符号执行方法进行漏洞检测。在从智能合约相关 SO 帖子收集的 897 条代码片段数据集上,SOChecker 取得了 68.2% 的 F1 分数,大幅超过 GPT-3.5(20.9%)与 GPT-4(33.2%)。研究结果凸显了提升问答网站代码片段安全性的必要性。

问题
智能合约开发者常直接复用 Stack Overflow 回答中的代码片段,但这些片段可能含有隐藏漏洞,而现有漏洞检测工具面向完整合约设计,无法分析这类不完整片段。
方法
先使用微调的 Llama2 模型对不完整的智能合约代码片段进行代码补全,再对补全后的代码应用符号执行方法以检测潜在漏洞。
评估
在从 Stack Overflow 智能合约相关帖子中收集的 897 条代码片段数据集上评测,SOChecker 的 F1 达到 68.2%,明显优于 GPT-3.5(20.9%)和 GPT-4(33.2%)。
原文摘要(Abstract)

Smart contract developers frequently seek solutions to developmental challenges on Q&A platforms such as Stack Overflow (SO). Although community responses often provide viable solutions, the embedded code snippets can also contain hidden vulnerabilities. Integrating such code directly into smart contracts may make them susceptible to malicious attacks. We conducted an online survey and received 74 responses from smart contract developers. The results of this survey indicate that the majority (86.4%) of participants do not sufficiently consider security when reusing SO code snippets. Despite the existence of various tools designed to detect vulnerabilities in smart contracts, these tools are typically developed for analyzing fully-completed smart contracts and thus are ineffective for analyzing typical code snippets as found on SO. We introduce SOChecker, the first tool designed to identify potential vulnerabilities in incomplete SO smart contract code snippets. SOChecker first leverages a fine-tuned Llama2 model for code completion, followed by the application of symbolic execution methods for vulnerability detection. Our experimental results, derived from a dataset comprising 897 code snippets collected from smart contract-related SO posts, demonstrate that SOChecker achieves an F1 score of 68.2%, greatly surpassing GPT-3.5 and GPT-4 (20.9% and 33.2% F1 Scores respectively). Our findings underscore the need to improve the security of code snippets from Q&A websites.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot8457,
  title = {Identifying Smart Contract Security Issues in Code Snippets from Stack Overflow},
  author = {Jiachi Chen and Chong Chen and Jiang Hu and John Grundy and Yanlin Wang and Ting Chen and Zibin Zheng},
  booktitle = {ISSTA},
  year = {2024},
  doi = {10.1145/3650212.3680353}
}