When verified source code becomes attack input: DeLLMGuard defends against LLM-based smart contract vulnerability scanningWhen Verified Source Becomes Attack Input: Defending Smart Contracts Against LLM-Based Vulnerability Scanning
The authors propose a deployment-level defense framework, DeLLMGuard, which on 387 real vulnerable contracts reduces the root-cause identification accuracy of three LLM agents from 23.5% to 6.6%.
The adversary is a malicious blockchain user who uses automated LLM tools to discover vulnerabilities in deployed smart contracts, with the goal of stealing assets or disrupting contract functionality; they can freely interact with contracts, use commercial or open-source LLMs and public on-chain information, and are not assumed to be unaware of the DeLLMGuard mechanism, but cannot obtain the private deployment mappings that project teams provide to authorized auditors.
- Smart contract projects conventionally publish and verify source code on explorers, but LLM agents can turn public source code into input for large-scale malicious vulnerability scanning; defenses must preserve both source-code disclosure and authorized auditing.
- DeLLMGuard uses four components—factory deployment, delegatecall layering, proxy slot interference, and comment perturbation—to separate public source-code addresses from runtime execution, forcing agents to first recover cross-contract relationships; the Verification Layer verifies that the transformation does not break the business implementation.
- Tested three LLM agents on 387 real vulnerable contracts derived from SCONE-bench; the full combination lowered overall root-cause Correct from 23.5% to 6.6%, outperforming the closed-source BIC baseline on the non-agent set; still below baseline after being told about the defense mechanism.
- The authors note: adaptive attackers may recover these contract relationships in the future; evaluation is conducted in a simulated chain environment rather than on the public network; there are only 46 agent cases, so the PDC evidence is weak; and not all contract architectures and vulnerability types are covered.
- Evaluated models
- GLM 5.2GPT 5.5Claude Opus 4.8
- Benchmarks
- SCONE-benchDeFiHackLabs
- Metrics
- CorrectCorrect + Partial Correct
The DeLLMGuard framework separates a smart contract's public source code from its runtime execution through multiple contract addresses, defending against LLM-based vulnerability scanning while preserving source code disclosure and authorized auditing. Evaluated in an environment derived from SCONE-bench on 387 real vulnerable contracts and three LLM agents, the framework reduces the agents' overall accuracy in identifying vulnerability root causes from 23.5% to 6.6%, outperforming the closed-source bytecode baseline on the main non-agent set.
Paper analysis
What problem does this paper attempt to solve?
How to defend against automated vulnerability scanning by LLM agents while preserving contract source code disclosure and authorized auditing.
Core problem: publicly verified contract source code is being turned by LLM agents into scalable input for malicious vulnerability scanning; how to raise the cost of automated scanning while preserving source-code disclosure and audit workflows.
- Problem scenario: DeFi projects conventionally publish and verify source code on explorers such as Etherscan to establish transparency and trust; the authors state that Anthropic SCONE-bench and OpenAI EVM-bench show frontier LLM agents can autonomously discover and exploit real contract vulnerabilities, and a Halborn report notes signs that the 2025 Balancer attack (losses exceeding $120 million) used LLM assistance.
- Offense-defense asymmetry: the authors state attackers need only one profitable vulnerability, while defenders must manually verify all findings; Code4rena discourages LLM-generated submissions due to the high proportion of invalid findings. Contracts are immutable, owners are anonymous, and vulnerability disclosure channels are lacking, making the risk more prominent than in traditional software.
- Shortcomings of existing methods: the authors state that many existing LLM defenses rely on specially trained models or controlled execution environments, assumptions that do not hold on public blockchains—attackers control their own models and tools; deployment-level protection of public contracts is largely unexplored.
- Threat model (Section 3.4):
- Goal: exploit vulnerabilities to transfer contract assets to the attacker's account (Asset Theft), or disrupt contract functionality (Contract Disruption).
- Knowledge: access to public information such as verified source code, bytecode, storage, and historical transactions; the paper does not assume the design or transformation mechanism of DeLLMGuard is secret.
- Capabilities: can create EOAs and contracts, freely interact with deployed contracts, use commercial or open-source LLMs and analysis tools such as Foundry, and can perform static analysis, decompilation, transaction tracing, and local execution.
- Victim system: deployed smart contracts whose source code is publicly verified on explorers; attackers cannot obtain the private deployment mappings that project teams give to authorized auditors.
- Paper proposes: DeLLMGuard, a deployment-level defense framework that uses multi-address deployment to separate public source code from runtime execution, forcing agents to first reconstruct cross-contract context; a built-in Verification Layer ensures the transformation does not change the business implementation.
What related research exists?
Related work falls into three categories: general software vulnerability detection, smart contract LLM auditing, and attack-defense benchmarks; there is also research on prompt injection defenses and abuse of source code verification.
LLM vulnerability detection for general software
- RepoAudit (Guo et al., ICML 2025)—repository-level auditing through autonomous code exploration and path verification.
- CyberGym (Wang et al., ICLR 2026)—builds reproducible environments from real software vulnerabilities to evaluate agents' ability to generate executable PoCs.
LLM vulnerability detection for smart contracts
- GPTScan (Sun et al., ICSE 2024)—combines LLM semantic reasoning with program analysis to detect logic vulnerabilities.
- iAudit (Ma et al., ICSE 2025)—domain fine-tuning plus multi-agent collaboration, outputting vulnerability judgments and explanations.
- ABAuditor (Zhang and Zhang, NeurIPS 2024)—LLM extraction of financial semantics plus rule-based reasoning to detect vulnerabilities that cause financial loss.
Attack-defense benchmarks and background
- SCONE-bench (Xiao et al., 2025)—evaluates attack agents that can call tools and interact with a local chain environment; this paper's evaluation environment is derived from it, and the dataset is also built starting from its 417 tasks.
- EVMbench (OpenAI, 2026)—evaluates agents' ability to detect, patch, and exploit vulnerabilities.
- The introduction also cites Ma et al. (NDSS 2024) on abuse of Ethereum contract verification services; the BIC baseline is based on its source-verification preemption technique.
Other LLM defenses
- The introduction names StruQ (Chen et al., USENIX Security 2025) and IsolateGPT (Wu et al., NDSS 2025); the authors state that such defenses rely on specially trained models or controlled execution environments, assumptions that do not hold on public blockchains.
Positioning: the authors state that DeLLMGuard is the first deployment-level defense framework against automated LLM vulnerability scanning while preserving source-code disclosure and security auditing, differing from defense approaches that rely on model-side or environment-side assumptions.
How does the paper address this problem?
Uses multi-address deployment to separate public source code from runtime, forcing agents to recover proxy, delegate, and factory relationships; the Verification Layer ensures the business remains unchanged.
Overall approach: DeLLMGuard does not change business logic or hide source code; instead, it uses standard EVM deployment mechanisms to insert additional proxy, delegatecall, and factory relationships between the public entry address and the source code disclosure address, turning vulnerability analysis from local source code reasoning into cross-contract execution context reconstruction; errors by agents in recovering relationships propagate to subsequent vulnerability analysis.
Design requirements and workflow
- Four requirements (Section 3.2): R1 does not change Solidity/EVM and uses standard contracts and deployment mechanisms; R2 can distinguish direct from proxy deployment and place components in the right positions; R3 the business bytecode and logic after transformation are verifiably preserved; R4 source code remains public and does not rely on hiding source code.
- Workflow (Figure 1): Proxy Analyzer first identifies proxy–implementation relationships and compiler versions → applies the corresponding guard components and records the transformed deployment relationships → Verification Layer verifies → only deployments that pass verification proceed to downstream LLM evaluation.
Four guard components
- DLC (Delegate Layering Component): places a guard contract at the entry address, with the business contract deployed at another address; the guard reads the implementation address from a dedicated routing slot and forwards via delegatecall (Figure 2), so that the entry address loses direct association with the business source code, and agents must additionally perform bytecode decompilation and deployment transaction analysis.
- PDC (Proxy Diversification Component): used only for confirmed proxies; writes shadow identities into unused proxy-related slots, covering four types of slots—EIP-1967 admin/beacon, EIP-1822 PROXIABLE, and ZeppelinOS admin (Table 1)—while the original implementation slot and forwarding logic remain unchanged, creating competing proxy resolution clues.
- FIC (Factory Indirection Component): uses a factory contract to deploy the business contract via CREATE/CREATE2, with both the factory and business source code disclosed at the factory address, and only bytecode at the entry address; agents must recover the creation relationship to find the source code.
- CPC (Comment Perturbation Component): modifies non-executable comments without changing compilation behavior, serving as a lightweight text-layer intervention.
- Combined use: components can be used independently or in combination; the combined configuration (Figure 9) stacks the analysis steps introduced by each component.
Verification Layer
- Acceptance condition: Accept = Pdep ∧ Proute ∧ Pruntime ∧ Psource ∧ Pstate, i.e., the transformed deployment is accepted only if all five types of predicates—deployment relationship, routing, runtime bytecode, source code, and state—pass.
- Checks: Pdep recomputes CREATE/CREATE2 addresses; Proute verifies delegate targets and proxy forwarding; Pruntime requires that the business runtime bytecode reached after transformation is identical to the original deployment; Psource requires that the disclosed source code, after ignoring comments and formatting, has a token sequence identical to the original business source code; Pstate restricts state changes to not exceed the write sets declared by each component.
BIC baseline and evaluation judgment
- BIC (Bytecode Inline Component): a comparison baseline rather than a guard component; it inlines the original runtime bytecode into a wrapper for return, and browser verification exposes only the wrapper source code, failing R4, and is used only to compare the "source code unavailable" case.
- Success judgment: full root-cause identification counts as attacker success (Correct), and Correct + Partial is also reported; deepseek-v4-flash is used as the judge, whose prompt contains only one hidden root-cause record and one agent report, judging whether the report covers each required fact, with labels derived by a deterministic program.
What experiments did the paper conduct?
387 real vulnerable contracts, three frontier LLM agents: the full combination lowered overall Correct from 23.5% to 6.6%, outperforming the closed-source baseline on the non-agent set.
Experimental setup
- Models tested: GLM 5.2, GPT 5.5, Claude Opus 4.8; each model runs once per test case, with a 45-minute timeout per run and no total context length limit.
- Dataset: starting from 417 tasks in SCONE-bench, 398 have public source code; after deployment validation in the PARSEC sandbox, 387 cases were frozen (341 non-agent, 46 agent), covering incidents from 2020–2026 on Ethereum, BNB Smart Chain, Base, and Arbitrum.
- Baselines: original setting (Baseline), Comment injection with CPC only, and Bytecode inline of the closed-source BIC.
- Metrics and review: the primary metric is Correct (fully covers the root cause), the secondary metric is Correct + Partial; the reviewer is deepseek-v4-flash, and the prompt contains only one hidden root-cause record and one report; 194 cases were sampled using the Cochran formula for manual judgment, with Cohen's κ of 0.767 against the LLM review.
- Root-cause annotation: structured records were extracted from PoC comments in DeFiHackLabs and independently reviewed by two experts each with more than three years of contract security experience.
- Sandbox: PARSEC replays historical chain state on a local Anvil fork; agents initially have only the public entry address.
Main results
According to Table 2, strict correct (counts outside parentheses):
Swipe horizontally to read the table
Group Configuration GLM 5.2 GPT 5.5 Claude Opus 4.8 Non-agent (N=341) Baseline 31.96% 28.15% 14.37% Non-agent Comment injection 29.03% 24.63% 18.18% Non-agent Bytecode inline 13.49% 9.09% 7.33% Non-agent FIC+DLC+CPC 12.90% 3.52% 3.23% Agent (N=46) Baseline 19.57% 10.87% 10.87% Agent Comment injection 4.35% 4.35% 8.70% Agent Bytecode inline 2.17% 10.87% 6.52% Agent FIC+PDC+DLC+CPC 13.04% 6.52% 2.17% - Overall effect: the authors report that the full combination on all 387 cases lowered Correct from 23.5% to 6.6% and Correct+Partial from 42.3% to 13.4%; on the non-agent set the relative declines for the three models were 59.6%, 87.5%, and 77.6%, averaging 74.9%.
- Comparison with the closed-source baseline: on the non-agent set, DeLLMGuard's strict correct is lower than BIC (the authors state this shows bytecode decompilation weakens source-hiding defenses, and cross-address recovery is a stronger obstacle); on the agent set, BIC is lower for GLM (2.17% vs. 13.04%), and this conclusion is based on the non-agent set.
- Agent-set exception: the direction is consistent across all models on the agent set, but the authors note that due to the low baseline and small sample, the differences are not statistically significant.
Failure analysis (RQ2)
- Structural traversal generally succeeds: Table 4 shows that the proportion of DLC targets Followed in non-agent runs was 96.48%/81.23%/94.13% (GLM/GPT/Claude), and the actual PDC targets were Followed in agent runs at 91.30%/60.87%/86.96%; yet the accuracy in Table 2 still dropped substantially, which the authors state shows that recovering structure does not equal being able to identify vulnerabilities.
- FIC is the hardest point: across all models, only 43 agent-cases found the Factory address, 15 actively queried, and none queried the Factory for source code; Figure 13 shows that the deployment receipt already exposed the Factory address, yet agents continued decompiling without following up.
- PDC only creates distracting clues: of 138 agent agent-cases, 50 (36.23%) inspected PDC-managed slots, only 8 (5.80%) surfaced the exact decoy address, and 6 (4.35%) actively queried; 110 (79.71%) still recovered the implementation along the actual forwarding path.
- Different model bottlenecks: the authors state that GPT is stuck at business code recovery (Decompiled only 0.88%/2.17%), Claude is stuck at reading decompiled code (6.74%/6.52%), and GLM can decompile (59.24%/52.17%) but vulnerability reasoning is the bottleneck.
Ablation and adversarial robustness (RQ3, RQ4)
- Ablation (Table 2): on the non-agent set, FIC contributes the largest consistent decline (Correct from 109/96/49 to 55/21/12); adding DLC further lowers it to 50/12/11; PDC has a small effect and is inconsistent across models; CPC has no consistent marginal benefit (authors' conclusion, Finding 7).
- Adversarial robustness (Table 5): after informing the system prompt of the full defense pipeline and the semantics of each component, GLM's non-agent strict correct is 10.26% (lower than its 12.90% when uninformed), and GPT rises from 3.52% to 9.38%, still far below the baseline of 28.15%; individual values on the agent set are slightly above baseline, which the authors describe as isolated changes and do not interpret as the defense instead helping informed attackers.
Other ablations and analyses
- Cost (Table 3): on the non-agent set under DeLLMGuard, tool calls changed from 13,022/3,429/9,920 to 28,905/4,338/21,145 (GLM/GPT/Claude); cost changes on the agent set go in different directions, which the authors attribute to some runs misjudging the outer guard and terminating early.
- CPC-only baseline: on the non-agent set, strict correct changed from 31.96%/28.15%/14.37% to 29.03%/24.63%/18.18%, a small and inconsistent effect (Claude actually rose).
- Qubit case: the GPT baseline reached the business logic in 19 calls ($0.130); under DeLLMGuard it mistakenly treated the routing-slot constant as the implementation address and reported not detected after 10 calls.
What are some points that can be further explored?
The authors list three limitations: adaptive attackers, simulated environments, and evaluation coverage; the experiments cover 387 cases, three models, and a single run.
Limitations noted by the authors and future directions
- Adaptive attackers (Section 7): DeLLMGuard does not make the introduced contract relationships inaccessible; the SCONE harness already provides decompilation, transaction analysis, and execution tracing, so in principle the transformed deployment can be recovered; current agents often cannot effectively use these capabilities across contracts, but future agents or analysis tools may weaken the defense's effectiveness.
- Simulated deployment environment (Section 7): for safety and ethics, transformed vulnerable contracts are evaluated only in an isolated chain environment and were not deployed on the public network; PARSEC replays historical chain state to approximate real analysis.
- Evaluation coverage (Section 7): the evaluation covers 387 contracts and three LLM agents, but does not cover all contract architectures or vulnerability types; there are only 46 agent cases, so the evidence for PDC is weaker than for the non-agent set; the authors state that evaluating more real cases in the future could further test the generality of the conclusions.
Scope of experimental coverage
- The models tested are GLM 5.2, GPT 5.5, and Claude Opus 4.8, three in total; the adversarial robustness experiment (Table 5) ran only GLM and GPT, two models.
- The dataset is 387 cases derived from SCONE-bench (341 non-agent, 46 agent), covering incidents from 2020–2026 on four EVM-compatible chains: Ethereum, BNB Smart Chain, Base, and Arbitrum.
- The evaluation scope stops at vulnerability discovery (root-cause identification) and does not include end-to-end exploit construction and execution; each model runs once per test case, and the paper does not report multiple repetitions.
- The reviewer is deepseek-v4-flash; manual agreement was measured on a 194-case sample with Cohen's κ of 0.767.
- The defense components cover four types of agent slot conventions (Table 1); PDC takes effect only on the 46 agent cases.
Summarize the main content of the paper
DeLLMGuard uses multi-address deployment to increase the context reconstruction cost of LLM scanning, reducing Correct from 23.5% to 6.6% on 387 cases.
A smart contract defense paper: addressing the problem that LLM agents turn publicly verified source code into scalable input for malicious vulnerability scanning, it proposes a deployment-level framework, DeLLMGuard, which raises the cost of automated scanning while preserving source code disclosure and authorized auditing.
- Method highlights: Using four composable components—FIC (factory deployment), DLC (delegatecall layering), PDC (proxy slot shadow identity), and CPC (comment perturbation)—it separates the public entry address from the business source code, forcing agents to first recover the cross-address proxy, delegate, and factory relationships; the Verification Layer uses five types of predicates—deployment, routing, runtime, source, and state—to verify that the transformation does not break the business implementation; the BIC closed-source scheme serves only as a comparison baseline.
- Main results: On 387 real vulnerable contracts derived from SCONE-bench (341 non-proxy, 46 proxy), testing GLM 5.2, GPT 5.5, and Claude Opus 4.8, the full combination reduces overall Correct from 23.5% to 6.6% (Table 2); on the non-proxy set the relative reductions are 59.6%/87.5%/77.6%, and these are lower than the closed-source BIC baseline's 13.49%/9.09%/7.33%.
- Mechanism findings: Agents generally can traverse the structures introduced by DLC and PDC (DLC target Followed is at most 96.48%), yet rarely recover factory creation relationships (43 cases found, 15 cases queried, 0 cases checked source code); the authors state that cross-contract recovery remains the main difficulty for automated LLM scanning; ablation shows FIC contributes the most, while PDC and CPC have small and inconsistent effects.
- Robustness: After informing the system prompt of the full defense mechanism, GPT non-proxy strict correct rises from 3.52% to 9.38%, still far below the baseline 28.15% (Table 5); the authors state that mechanism knowledge cannot reliably restore baseline analysis capability.
- Authors' conclusion: Cross-contract recovery can reduce the effectiveness of automated scanning without hiding source code; they also acknowledge three limitations: adaptive attackers, simulated environments, and evaluation coverage (only 46 proxy cases).