← Lab /Software

LLMs can automatically inject vulnerabilities into Solidity contracts, but only 16.6% survive validation

LLM-based generation can produce vulnerable smart contracts suitable for evaluating detection tools

Software arXiv 2 Sep 2026 Method Prototype evidence

Published as “Automated Vulnerability Injection in Smart Contracts Using Large Language Models”

Why it matters

The verified vulnerable-contract dataset can be used to more accurately benchmark and improve smart-contract static analysis tools.

Summary

LLM-based injection of vulnerabilities into Solidity contracts is feasible but yields a low success rate: only 32 out of about 1,000 generated candidates (16.58%) survive full validation. The surviving contracts cover 25 vulnerability types and expose gaps in three popular static analysis tools, which together detect only 9 of the 25 injected types and fail on legacy Solidity code. The study also highlights practical challenges such as LLM non-determinism, difficulty preserving business logic, and limited diversity of generated bugs.

What they found 2

  1. Only 32 confirmed vulnerable contracts survive the full pipeline, a 16.58% survival rate.

    “Applied to real-world contracts from SmartBugs, LLMs generate nearly 1,000 candidate variants; after deduplication and validation, 32 confirmed vulnerable contracts spanning 25 vulnerability types survive (a 16.58% survival rate).”

  2. Static analysis tools detect only a minority of the injected vulnerabilities.

    “Only 9 of the 25 injected types are detected by at least one tool, and most true positives concentrate in a few types with clear syntactic signatures.”

Caveats 6

  • As shown in Table IV, only 32 of 193 non-duplicate contracts survive all steps.
  • 13 (40.6%) could not be analyzed by any of the three tools due to static analysis failures.
  • Business logic verification is the main bottleneck.
  • LLM-based injection converges toward a narrow set of patterns.
  • Manual validation is a scalability bottleneck.
  • Contract complexity amplifies injection difficulty.

What’s new here 4

  • Uses large language models to perform in-place vulnerability injection directly into contract code, rather than inserting external snippets.
  • Targets a broad set of 49 OpenSCV vulnerability types, far more than prior injection tools.
  • Implements a four-step validation pipeline (compilation, injection verification, business logic verification, vulnerability confirmation) to ensure realistic ground truth.
  • Provides a verified dataset that reveals complementary and incomplete coverage among static analysis tools.