# USCSA: Evolution-Aware Security Analysis for Proxy-Based Upgradeable Smart Contracts

Crypto.world

> Upgradeable smart contracts use a proxy pattern to change logic while keeping a stable address, but each upgrade can introduce new bugs. Existing static analysis tools generally scan only one version…

**arXiv**: 2512.08372

**Published**: 2025-12-09

**Authors**: Xiaoqi Li, Lei Xie, Wenkai Li, Zongwei Li

## AI summary

## Overview

**Research area:** Blockchain security, specifically vulnerability detection for proxy-based upgradeable smart contracts on Ethereum.

**Technical level:** Advanced. The paper assumes familiarity with Solidity, proxy upgrade patterns, abstract syntax trees, static analysis tools, and large language model prompting.

**Scope:** USCSA is an evolution-aware analysis framework that compares successive versions of upgradeable contracts to determine whether code changes introduced, fixed, or left unchanged security vulnerabilities, and to attribute detected vulnerabilities to specific code modifications.

## What This Paper Is About

Upgradeable smart contracts use a proxy pattern to change logic while keeping a stable address, but each upgrade can introduce new bugs. Existing static analysis tools generally scan only one version at a time, so they cannot link code changes to newly appearing risks. The paper builds USCSA to compare versions structurally, match detected vulnerabilities to the changes that caused them, and use an LLM to explain and label the resulting risk patterns.

## Key Contributions

1. **USCSA framework:** An upgrade-aware security analyzer that uses Abstract Syntax Tree (AST) difference analysis to capture structural changes between contract versions and map those changes to specific source-code locations, establishing a link between code modifications and vulnerabilities.
2. **Semantic matching algorithm:** A multi-dimensional matching method that scores each change-vulnerability pair using position, pattern, semantic, and change-type factors, with an acceptance threshold of 0.6 confidence.
3. **LLM-assisted attribution:** Integration of large language models to refine matching results, perform root-cause and impact analysis, assign risk-pattern labels, and generate remediation recommendations and an upgrade security checklist.
4. **Empirical evaluation:** Analysis of 3,546 upgradeable contract cases with reported precision of 92.26%, recall of 89.67%, and F1-score of 90.95% on a manually verified sample of 500 contracts.

## Main Findings

- **Detection performance:** On 500 randomly sampled and manually verified contracts, USCSA achieved 92.26% precision, 89.67% recall, and 90.95% F1-score.
- **Dataset scale:** The study collected and analyzed 3,546 upgradeable smart contract cases, obtaining source code, transaction logs, and upgrade events through the Etherscan API.
- **Vulnerability volume:** Among the 3,546 analyzed contracts, 4,872 vulnerability instances were identified, averaging 1.37 vulnerabilities per contract.
- **Risk distribution:** High-risk, medium-risk, and low-risk vulnerabilities accounted for approximately 28%, 52%, and 20% of findings respectively.
- **Enhanced matching coverage:** Enabling the enhanced matching mode identified additional semantic-level vulnerabilities, increasing detection coverage by approximately 15%.
- **Comparison with Slither:** USCSA's matching module improved detection accuracy for upgrade-induced vulnerabilities by approximately 18% compared with conventional tools such as Slither, and showed better performance on multi-version upgrade paths.
- **Upgrade-specific flaw classes:** Combining Slither with the enhanced semantic matcher surfaced proxy storage collisions, newly introduced upgrade vulnerabilities, and behavioral inconsistencies.
- **Upgrade classification:** The framework classifies upgrades into four cases based on whether a bug exists in V1 and V2: vulnerability introduced (risk increased), vulnerability fixed (security improved), smooth upgrade (no security impact), and invalid upgrade (uncertain, needs analysis).

## Methodology in Plain English

USCSA first reconstructs the history of a proxy contract. It reads event logs to find the logic contract versions, retrieves their source code from Etherscan, and orders versions using a dual sorting algorithm that combines semantic parsing of version numbers with time-series analysis. A data fusion pipeline and automated downgrade mechanism support analysis at scale.

For each pair of successive versions (V1 and V2), the system builds ASTs using two engines: Falcon as the primary engine and ANTLR4 as a backup. It checks AST quality using node integrity, structural integrity, and semantic integrity indicators. The GumTree algorithm then compares the two trees and maps structural differences back to code-level modifications, extracting identifiers such as function and variable names.

A static detection stage runs on both versions, using Slither alongside AST differential analysis. The framework focuses on two main scenarios: V1 clean and V2 vulnerable (a directly explainable upgrade-induced risk), and V1 vulnerable and V2 fixed (useful for improving upgrade strategy). The other two combinations act as control groups.

The change-vulnerability matching algorithm scores every change against every detected vulnerability. Position matching compares line-number distance, with scores of 1.0 for zero distance, 0.8 for up to 2 lines, 0.5 for up to 5 lines, 0.2 for up to 10 lines, and 0.1 otherwise. Pattern matching counts common keywords in a plus-or-minus 5-line window around the change, adding 0.1 per keyword up to 1.0. Semantic matching combines six weighted features: fuzzy function name matching (0.3), AST node type relevance (0.2), keyword overlap in descriptions (0.15), change operation type similarity (0.15), common vulnerability trait matching (0.1), and change impact area (0.1). Change-type matching uses a predefined mapping between AST operation types and vulnerability types. The overall confidence is a weighted sum of 0.3 for position, 0.25 for pattern, 0.3 for semantic, and 0.15 for change type, capped at 1.0; pairs above 0.6 are retained and sorted by confidence.

Finally, structured prompts direct an LLM to analyze five dimensions: vulnerability root cause, security impact of the change, correlation between change type and vulnerability type, risk-pattern labeling, and remediation recommendations. Output is in JSON format. The LLM also extracts recurring upgrade error patterns, such as missing privilege control, unsynchronized state variables, and external call risks, which are standardized into risk labels and an upgrade security checklist.

## Why This Matters

**Impact on research:** The paper moves smart contract vulnerability detection from single-version scanning to evolution-aware analysis, making the causal link between a code change and a new vulnerability an explicit, scored object of study. It also demonstrates a concrete division of labor between deterministic static analysis and LLM-based reasoning, which is relevant to work on explainable and attributable security tooling.

**Real-world applications:**

- **Smart contract audit firms:** Reviewing a proposed upgrade against the currently deployed version to see whether the change introduces risk before it goes live.
- **DeFi and NFT protocols using proxy patterns:** Continuous monitoring of upgrade history, including OpenZeppelin-based deployments, to catch storage collisions or reinitialization problems.
- **Blockchain explorers and security monitoring services:** Enriching upgrade event feeds with risk classifications and generated reports.
- **Development teams:** Using the generated upgrade checklist and recommendation manual to reduce manual audit effort and avoid recurring upgrade mistakes.

**Industry relevance:** Upgradeable contracts hold substantial value and upgrade mistakes have caused large losses, including the 2016 DAO incident cited at over $60 million and a May 2025 incident involving the Cetus protocol cited at over $220 million. A reproducible, quantifiable upgrade audit process with JSON reports fits directly into existing security workflows and toolchains.

## Future Directions

1. **Cross-chain expansion:** Extending USCSA beyond Ethereum to platforms such as Solana and Polkadot, and supporting cross-chain and cross-version upgrade analysis.
2. **Stronger semantic matching:** Optimizing the matching algorithm to raise confidence in the correlation between code changes and vulnerabilities, particularly in complex contract scenarios where the paper reports attribution instability.
3. **Broader case coverage:** Extending the dataset to the DeFi and NFT sectors and collecting diverse upgrade examples to build a knowledge base and upgrade guidelines.
4. **Reducing manual audit cost:** Using accumulated LLM-generated patterns and checklists to further automate review, which requires more data support to stabilize results in complex cases.

## Target Audience

Security researchers and graduate students working on smart contract vulnerability detection; blockchain security auditors and tooling engineers who need version-aware analysis; and protocol developers or maintainers of upgradeable contracts who want to understand how upgrade-induced risks can be detected and attributed before deployment.

## Authors’ abstract

In the case of upgrading smart contracts on blockchain systems, it is essential to consider the continuity of upgrades and subsequent maintenance. In practice, upgrade operations often introduce new vulnerabilities. Existing static analysis tools usually only scan a single version and are unable to capture the correlation between code changes and emerging risks. To address this, we propose an Upgradeable Smart Contract Security Analyzer, USCSA, which uses Abstract Syntax…

[The full abstract on arXiv](https://arxiv.org/abs/2512.08372)

[Read the original paper](https://arxiv.org/abs/2512.08372)

---

Canonical: https://crypto.world/paper/uscsa-evolution-aware-security-analysis-for-proxy-based-upgradeable-2512.08372
