Smart contracts have transformed decentralized finance, but flaws in their logic still create major security threats. Most existing vulnerability detection techniques focus on well-supported languages like Solidity, while low-resource counterparts such as Vyper remain largely underexplored due to scarce analysis tools and limited labeled datasets. Training a robust detection model directly on Vyper is particularly challenging, as collecting sufficiently large and diverse Vyper training datasets is difficult in practice. To address this gap, we introduce Sol2Vy, a novel framework that enables cross-language knowledge transfer from Solidity to Vyper, allowing vulnerability detection on Vyper using models trained exclusively on Solidity. This approach eliminates the need for extensive labeled Vyper datasets typically required to build a robust vulnerability detection model. We implement and evaluate Sol2Vy on various critical vulnerability types, including reentrancy, weak randomness, and unchecked transfer. Experimental results show that Sol2Vy, despite being trained exclusively on Solidity, achieves strong detection performance on Vyper contracts and significantly outperforms prior state-of-the-art methods.
翻译:智能合约变革了去中心化金融,但其逻辑中的缺陷仍构成重大安全威胁。现有漏洞检测技术主要聚焦于Solidity等支持完善的语言,而Vyper等低资源语言因分析工具匮乏及标注数据集稀缺而鲜少被探索。直接在Vyper上训练鲁棒检测模型尤为困难,实践中难以收集规模充足且多样化的Vyper训练数据集。为弥补这一空白,我们提出Sol2Vy——一种实现从Solidity到Vyper跨语言知识迁移的新型框架,允许仅使用Solidity训练的模型对Vyper合约进行漏洞检测。该方法无需构建鲁棒漏洞检测模型通常所需的大量标注Vyper数据集。我们在多种关键漏洞类型(包括重入攻击、弱随机性及未检查转账)上实现并评估了Sol2Vy。实验结果表明,尽管仅基于Solidity训练,Sol2Vy在Vyper合约上仍展现出强大的检测性能,并显著优于现有最先进方法。