arXiv:2610.32453cs.CROct 2026

Manuscript Offprint

arXiv:2610.32453

Beyond Copying: Lifelong Smart Contract Security Task Construction via Protocol Mutation

Zifan Peng, Peng Huang, Jingyi Zheng, Yingjie Xue, Xuechao Wang, Xinlei He, Xia Hu, Dongrui Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

AI agents can inspect code and run tests to support smart contract security. SlowMist reports about 38.6billioninlossesacrossthebroaderblockchainecosystem.Existingevaluationscanrewardmemorizedorcopiedanswers,includingattackcoderecoveredfrompublicblockchaintransactions.Reconstructingcontractsandvalidatingtasksalsorequirecostlymanualeffort.Toaddresstheseissues,weproposeCONSTRAINTDIAL,aframeworkforlifelongconstructionofsmartcontractsecuritytasksviaprotocolmutation.Itautomateslocalcontractreconstructionandusesattackexecutiontoselectchangestotherequiredcallsorinputs.Executionchecksguiderevisionsthatmaketheoriginalattackfailwhilepreservingexploitability,thesecurityobjective,andnormalfunctionality.Newincidentsandauditfindingsenterthesameprocedure.WithCONSTRAINTDIAL,weconstruct3,045taskinputsfrom203publiccases,coveringdetect,exploit,andpatch.Comparedwithreconstructionalone,protocolmutationreducessuccesswithsuppliedpublicanswersby10.9percentagepointsonaverageacrossdetect,exploit,andpatch.Thefractionoftaskssolvedbycopyingonlineanswersfallsby9.3points.38.6 billion in losses across the broader blockchain ecosystem. Existing evaluations can reward memorized or copied answers, including attack code recovered from public blockchain transactions. Reconstructing contracts and validating tasks also require costly manual effort. To address these issues, we propose CONSTRAINTDIAL, a framework for lifelong construction of smart contract security tasks via protocol mutation. It automates local contract reconstruction and uses attack execution to select changes to the required calls or inputs. Execution checks guide revisions that make the original attack fail while preserving exploitability, the security objective, and normal functionality. New incidents and audit findings enter the same procedure. With CONSTRAINTDIAL, we construct 3,045 task inputs from 203 public cases, covering detect, exploit, and patch. Compared with reconstruction alone, protocol mutation reduces success with supplied public answers by 10.9 percentage points on average across detect, exploit, and patch. The fraction of tasks solved by copying online answers falls by 9.3 points. ^{1}$

1 Introduction

Smart contracts enforce transaction rules and manage assets through publicly accessible code on blockchains, and vulnerabilities in their code can directly affect user funds (Atzei et al., 2017). As of September 2026, SlowMist (SlowMist) records 2,277 incidents and about $38.6 billion in losses across the blockchain ecosystem. Large language model (LLM)-based agents have demonstrated the ability to inspect source code, use tools, and execute tests (Yang et al., 2024), suggesting their potential to assist cybersecurity tasks, including blockchain security analysis.

Several benchmarks have therefore been proposed to evaluate the capabilities of agents in this domain. However, existing benchmarks face two problems. (1) LLM-based agents may complete tasks using memorized or copied answers. Prior studies (Dong et al., 2024; Riddell et al., 2024) have found evidence that models have memorized answers to some public benchmark problems. In smart contract settings, agents can also obtain attack calls and inputs directly from public blockchain transactions (ethereum.org), reports, and reproduction code. When tasks retain the relevant contracts and protocol state, these attack steps may still work. Some security benchmarks (Wang et al., 2026a; Huang et al., 2026) mitigate such leakage by restricting network for agents, but these restriction may also hinder legitimate agent capabilities, such as installing dependency and consulting documentation. (2) Task construction and expansion rely on costly manual effort and are difficult to scale. Existing benchmarks (Huang et al., 2026; Wang et al., 2026a) require manual annotation review, task setup, and test development, preventing fully automated construction and requiring further human effort for new cases.

In this work, our key observation is that the conditions for reaching a vulnerable operation can change while the operation itself remains unchanged. Mutation testing (Papadakis et al., 2019) changes programs to assess tests, inspiring us to change protocol conditions to construct new security tasks. By altering how the required states

†^{\dagger}Corresponding Author: Dongrui Liu (liudongrui@pjlab.org.cn).

1^{1}The dataset and construction code are released at https://huggingface.co/datasets/Ziffer/constraintdial and https://github.com/sfofgalaxy/ConstraintDial.

or inputs are prepared, we can change the function calls or inputs needed to trigger an attack while preserving the underlying vulnerability. This lets us change the calls and inputs needed to exploit a known vulnerability and measure how agents adjust existing answers. The key challenge is to automate the generation and validation of such mutations so that the original attack fails while the underlying exploitability, the security objective, and normal functionality are preserved.

To address this, we propose CONSTRAINTDIAL, an automated framework for lifelong construction of smart contract security tasks via protocol mutation. To require agents to check existing answers against the current contracts, our framework uses attack execution to select protocol mutations that change the function calls or inputs required for the attack. A validation process is adopted to ensure the original attack fails while an adapted attack remains feasible and both the security objective and normal functionality preserved. Remembered or retrieved answers can provide a starting point, while the changed calls or inputs require agents to adjust the original attack code. New incidents and audit reports become new tasks through the same procedure, expanding the task collection over time. To scale and reduce manual effort, the framework reconstructs the relevant contracts locally, runs tests automatically, and uses failed tests to guide revisions to the contracts and attack code.

With CONSTRAINTDIAL, we construct 1,015 task inputs for each of detect, exploit, and patch, 3,045 in total. We compare agent performance with and without supplied public answers on the same cases, keeping network access open in both settings. The main contributions are summarized as follows:

  • We propose CONSTRAINTDIAL, an automated framework for lifelong construction of smart contract security tasks via protocol mutation.

  • We construct a benchmark, ReCast, with 203 public cases and 5 protocol versions for detect, exploit, and patch tasks, containing 3,045 task inputs in total.

  • We evaluate 6 LLM-based agents on sampled tasks with open network access. Experiments show that CONSTRAINTDIAL reduces success with supplied public answers by 10.9 percentage points on average across detect, exploit, and patch, compared with reconstructed tasks before mutation. The fraction of tasks solved by copying online answers falls by 9.3 percentage points on average.