← Latest papers
💻 computer science

Zero-Shot Vulnerability Detection in Low-Resource Smart Contracts Through Solidity-Only Training

This paper introduces Sol2Vy, a novel framework that enables zero-shot vulnerability detection in low-resource Vyper smart contracts by transferring knowledge from models trained exclusively on Solidity, thereby overcoming the scarcity of labeled Vyper datasets and outperforming existing state-of-the-art methods.

Original authors: Minghao Hu, Qiang Zeng, Lannan Luo

Published 2026-03-24
📖 5 min read🧠 Deep dive

Original authors: Minghao Hu, Qiang Zeng, Lannan Luo

Original paper dedicated to the public domain under CC0 1.0 (http://creativecommons.org/publicdomain/zero/1.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a master security inspector for a city. You have spent years studying the blueprints of Solidity buildings (the most common type of smart contract). You know exactly where the hidden traps, weak locks, and structural flaws are because you have a massive library of blueprints labeled "Safe" and "Unsafe."

Now, a new type of building material called Vyper has appeared. It looks different on the outside (the syntax is more like Python than the old style), but the physics of how the buildings stand and function are actually very similar. The problem? You have almost no blueprints for Vyper buildings, and certainly no labeled ones showing you where the traps are. If you tried to learn Vyper from scratch, you'd be stuck because there isn't enough data.

Enter Sol2Vy: The "Universal Translator" Inspector.

This paper introduces a clever framework called Sol2Vy that solves this problem. Instead of trying to learn Vyper from scratch, it teaches the inspector to look at the essence of the building, ignoring the superficial differences in the paint and brickwork.

Here is how it works, broken down into three simple steps:

1. The "Universal Blueprint" (SlithIR)

First, the system takes both Solidity and Vyper blueprints and translates them into a Universal Intermediate Language called SlithIR.

  • The Analogy: Think of Solidity and Vyper as two different languages (like English and French). SlithIR is like a "Universal Code" or a "Morse Code" that strips away the grammar and vocabulary differences. It reduces both languages down to their raw, logical instructions: "Move money here," "Check if the user is allowed," "Wait for a signal."
  • The Problem: Even in this universal code, the English version and the French version still look slightly different because of how the original languages were built.

2. The "Shape-Shifting" Training (Unsupervised Learning)

Before the inspector can catch criminals, they need to learn that a "door" in English and a "porte" in French are the same thing.

  • The Analogy: The system takes thousands of unlabeled blueprints from both languages and forces them to look the same in its mind. It uses a mathematical trick (called MMD Loss) to squash the differences between the two languages together.
  • The Result: The system learns a "language-agnostic" view. It stops seeing "Solidity" or "Vyper" and starts seeing pure logic patterns. It learns that a "Reentrancy" vulnerability (a specific type of trap where a thief can call a function twice before the first one finishes) looks the same in the universal code, regardless of which language the building was written in.

3. The "Zero-Shot" Detective (Supervised Learning & Testing)

Now comes the magic.

  • Step A: The system is trained on the Solidity library (which is huge and full of labeled traps). It learns to spot the traps using the universal logic it just mastered.
  • Step B: The system is then handed a Vyper building. It has never seen a labeled Vyper trap before.
  • The Magic: Because the system learned the universal logic in Step 2, it looks at the Vyper building, sees the same logical trap it learned in Solidity, and says, "Aha! This is a Reentrancy trap!"
  • The Result: It detects vulnerabilities in Vyper without ever needing a single labeled Vyper example. This is called Zero-Shot Detection.

Why is this a big deal?

  • The Old Way: Traditional tools (like Slither or Mythril) are like inspectors who only know English. When they see a French building, they get confused by the different words and miss the traps, or they get so many "false alarms" (thinking a normal door is a trap) that they become useless.
  • The New Way (Sol2Vy): It's like an inspector who understands the physics of the building, not just the language. It ignores the "French" words and spots the structural flaw immediately.
  • The Proof: The paper shows that Sol2Vy is much better than existing tools. It catches almost all the real traps (low False Negatives) and rarely cries wolf (low False Positives), even though it was trained only on Solidity data.

A Real-World Metaphor: The Car Mechanic

Imagine you are a mechanic who has fixed millions of Toyota cars. You know exactly what a broken fuel pump sounds like in a Toyota.
Suddenly, a new brand of car, Vyper, comes out. It has a different engine layout and different dashboard buttons. You have no manuals for Vyper.

  • Old Approach: You try to guess based on the dashboard buttons. You fail because the buttons are in different places.
  • Sol2Vy Approach: You learn to listen to the sound of the engine (the SlithIR). You realize that a broken fuel pump makes the exact same rattle in a Vyper as it does in a Toyota. So, you listen to the Vyper engine, hear the rattle, and say, "That's a broken fuel pump," even though you've never seen a Vyper manual.

Summary

Sol2Vy is a smart bridge. It takes the massive knowledge we have about one language (Solidity), translates it into a universal logic, and applies it to a new, data-scarce language (Vyper). It allows us to secure new, emerging technologies without waiting years to collect enough data to train a new AI from scratch.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →