Identifying Smart Contract Security Issues in Code Snippets from Stack Overflow
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 8 papers in the map (data through 7 Oct 2026). First posted on arXiv 18 Jul 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2024: 2; 2025: 3; 2026: 3.
8 papers.
- 2024RMCBench: Benchmarking Large Language Models' Resistance to Malicious Codecited by 27
- 2025An Empirical Study of Agent Developer Practices in AI Agent Frameworkscited by 14
- 2024Top General Performance = Top Domain Performance? DomainCodeBench: A Multi-domain Code Generation Benchmarkcited by 13
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completioncited by 7
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoningcited by 3
- 2026PhoenixRepair: Rethinking Repair Strategy Exploration in Software Agentscited by 2
- 2025Towards Secure and Explainable Smart Contract Generation with Security-Aware Group Relative Policy Optimizationcited by 1
- 2025Coinvisor: An RL-Enhanced Chatbot Agent for Interactive Cryptocurrency Investment Analysiscited by 0
- 2026PhoenixRepair: Rethinking Repair Strategy Exploration in Software Agents21 Jul 2026
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoning28 Jan 2026
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion27 Jan 2026
- 2025An Empirical Study of Agent Developer Practices in AI Agent Frameworks1 Dec 2025
- 2025Coinvisor: An RL-Enhanced Chatbot Agent for Interactive Cryptocurrency Investment Analysis20 Oct 2025
- 2025Towards Secure and Explainable Smart Contract Generation with Security-Aware Group Relative Policy Optimization12 Sep 2025
- 2024Top General Performance = Top Domain Performance? DomainCodeBench: A Multi-domain Code Generation Benchmark24 Dec 2024
- 2024RMCBench: Benchmarking Large Language Models' Resistance to Malicious Code23 Sep 2024