A multi-technology verification method and system for smart contracts
By constructing an intermediate representation of the vulnerability evidence chain and employing a multi-technology verification method, the problem of insufficient accuracy and coverage in detecting Solidity smart contract vulnerabilities in existing technologies is solved, and efficient detection of reentrancy, integer overflow, and access control missing vulnerabilities is achieved.
Patent Information
- Application Number
- CN202611627739.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-21
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies struggle to simultaneously and efficiently detect and verify multiple vulnerabilities in Solidity smart contracts, such as reentrancy, integer overflow, and lack of access control. Furthermore, the lack of a unified semantic representation results in insufficient detection accuracy and coverage.
We construct an intermediate representation of the vulnerability evidence chain, extract key semantic elements through an abstract syntax tree, generate a unified intermediate representation of the vulnerability evidence chain, combine it with the UPPAAL formal verification tool to detect reentrancy vulnerabilities, use the SMT solver to verify integer overflow, and combine semantic analysis to detect access control vulnerabilities.
It improves the accuracy and coverage of Solidity smart contract vulnerability detection, reduces the false positive rate, and enhances the interpretability and reproducibility of the results.
Smart Images

Figure CN123116295A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of blockchain security and smart contract verification software development, specifically involving a multi-technology verification method and system for smart contracts. Background Technology
[0002] Smart contracts are a crucial technology in the blockchain application layer. By deploying contract terms as program code on the blockchain, pre-defined logic can be executed automatically without centralized intermediaries. With their decentralized, automated, and immutable characteristics, smart contracts are widely used in financial transactions, decentralized autonomous organizations (DAOs), and supply chain management. Solidity (the Ethereum high-level programming language for smart contracts) is currently the most widely used contract development language on Ethereum and compatible blockchain platforms. While its syntax is similar to general-purpose high-level languages, its execution results directly impact on-chain assets and permission states; therefore, its security is of paramount importance to blockchain applications.
[0003] From a technical perspective, security vulnerabilities in Solidity smart contracts primarily lie in business logic implementation and state management mechanisms. For example, reentrancy vulnerabilities are a prime example. When a contract calls an external contract before completing its own state update, an attacker could maliciously access critical processes repeatedly, leading to repeated asset transfers. Lack of access control is also a common risk. If a contract lacks strict permission checks for critical operations, attackers could bypass these restrictions and illegally gain control of administrators or key roles. Furthermore, integer overflow and underflow vulnerabilities can cause abnormal numerical calculation results, leading to inconsistencies in contract states or even malicious exploitation, thus threatening asset security. All of these vulnerabilities stem directly from the contract implementation logic and are suitable for automated analysis and verification using techniques such as program analysis, static analysis, and formal verification.
[0004] Existing technologies for smart contracts mainly include static analysis tools, symbolic execution tools, formal verification tools, and rule-based vulnerability scanning methods. Static analysis methods can usually quickly identify risks at the syntax or pattern level, but they lack sufficient understanding of cross-statement data dependencies, state update order, and the effectiveness of permission constraints, making them prone to false positives or false negatives. Symbolic execution and formal verification methods can provide stronger semantic reasoning capabilities, but they are easily limited by path size, modeling assumptions, and solution overhead in complex contracts. Rule-based scanning methods are easy to deploy, but they are difficult to simultaneously cover vulnerabilities with different causes, such as reentrancy, integer overflow, and access control.
[0005] Among existing model verification tools, UPPAAL describes automata with position, migration, and guard conditions, while SPIN describes process behavior with Promela. Both can be used to verify security properties.
[0006] Therefore, the shortcomings of existing technologies are as follows: on the one hand, different vulnerability types rely on different program facts, and a single analysis paradigm is difficult to balance detection coverage, accuracy and interpretability; on the other hand, existing methods often directly target source code syntax or underlying intermediate results, lacking an intermediate representation for vulnerability verification that can uniformly express function bodies, state variables, modifiers, function meta-information and inheritance relationships, making it difficult for subsequent analysis to stably correlate external calls, state updates, arithmetic constraints and authorization logic.
[0007] Therefore, the key technical problem that urgently needs to be solved is: how to build a unified semantic representation for Solidity smart contracts that is oriented towards vulnerability verification, and on this representation, select matching verification technologies for different vulnerability types, thereby improving the accuracy, coverage, and interpretability of vulnerability detection such as reentrancy, integer overflow and underflow, and lack of access control. Summary of the Invention
[0008] This invention addresses the problem that a single analysis method in the prior art is insufficient to simultaneously detect vulnerabilities in multiple types of Solidity smart contracts. The aim is to provide a multi-technology verification method and system for smart contracts.
[0009] Technical solution One aspect of the present invention provides a multi-technology verification method for smart contracts, comprising the following steps: Step S1: Select a compatible compiler version based on the version declaration in the input Solidity smart contract source code.
[0010] Step S2: Compile the contract and generate an Abstract Syntax Tree (AST). The AST includes source file nodes, contract definition nodes, function definition nodes, variable declaration nodes, modifier definition nodes, inheritance relationship nodes, function call nodes, assignment nodes, condition judgment nodes, and arithmetic expression nodes, providing a foundation for subsequent semantic analysis and intermediate representation construction.
[0011] Step S3: Traverse the abstract syntax tree to extract key semantic elements, including: function body, function meta-information, global state variables, modifiers and inheritance relationships, and perform source code fragment recovery, statement normalization, local alias expansion and inheritance modifier matching and processing to construct an intermediate representation of the vulnerability evidence chain; The intermediate representation of the vulnerability evidence chain includes a set of semantic nodes and a set of semantic relationships. The semantic nodes include at least external interaction nodes, state writing nodes, arithmetic operation nodes, authorization constraint nodes, and sensitive operation nodes. The semantic relationships include at least execution order relationships, data dependency relationships, function call relationships, and permission association relationships. Specifically, the intermediate representation of the vulnerability evidence chain is organized using a serializable evidence graph structure, including at least a set of nodes (nodes), a set of edges (edges), a set of storage paths (storage_paths), and a set of function summaries (function_summaries). The execution order of each statement is established according to its normalized statement index (statement_index). Adjacent statement nodes are related by a control-before directed edge, and the order of external interaction nodes and state writing nodes is determined by their respective statement indices. Variable read / write and data dependency relationships are represented by reads, writes, data-dep, and storage-dep edges.
[0012] Step S4: Based on the external interaction nodes and state writing nodes in the vulnerability evidence chain intermediate representation analysis function, extract the value parameter or transfer amount source of the external call, trace the data dependency relationship between the source and the state variable, combine the internal function call relationship, secure call pattern filtering and effective protection mechanism judgment, construct a reentrant temporal verification model, and use the UPPAAL formal verification tool to detect whether there is a reachable path where the external interaction occurs before the relevant state update.
[0013] Step S5: Based on the intermediate representation of the vulnerability evidence chain, identify arithmetic operation nodes and extract target variables, operands, operators and related path conditions. Encode addition overflow, subtraction underflow and multiplication overflow conditions into fixed-length bit vector constraints. Encode security assertions and conditional statements into path constraints. Use the SMT solver to determine whether there are feasible inputs that satisfy the path conditions and trigger overflow or underflow, and output the corresponding counterexample variable values.
[0014] Step S6: Based on the intermediate representation of the vulnerability evidence chain, analyze the sensitive operation nodes in the function, and combine the function body, modifiers, inheritance context, role state variables and authorization constraints in security assertions to determine whether sensitive operations such as low-level calls, asset transfers, self-destruction, state writing, permission variable changes, initialization function calls and external contract calls are protected by effective permissions, thereby identifying access control deficiencies, invalid modifiers or insecure authentication issues.
[0015] Step S7: Organize the detection results into a structured format, output the vulnerability type, the location of the function, and the triggering conditions or counterexample information, and generate a complete security verification report.
[0016] Specifically, step S1 includes the following sub-steps: Step S1-1: Read the Solidity source file to be detected, parse the version declaration, extract the version constraints, and match the available Solidity compiler versions according to the constraint rules to determine the compatible target compilation version, thus preparing for subsequent compilation and intermediate representation generation.
[0017] Step S3 includes the following sub-steps: Step S3-1: Traverse the contract definition nodes in the abstract syntax tree, extract the contract name and its inheritance relationship, and identify the function definition, variable declaration and modifier definition nodes inside the contract to establish the basic structure of core semantic elements such as functions, global variables and modifiers. Step S3-2 involves further parsing the function node to obtain the function name, visibility, application modifiers, and function body statements; at the same time, it extracts information such as global state variables, their types, and initial values from the contract to provide a complete context for subsequent semantic analysis. Step S3-3 involves extracting source code fragments, deleting comments, normalizing whitespace, and serializing statements within the function body, and expanding and replacing local alias variables. For example, when the local variable `amount` is assigned a value by the state variable `balances[msg.sender]`, the `value` parameter `amount` of subsequent calls is associated back with the state variable `balances`, ensuring that function body statements, state variables, external calls, state writes, arithmetic operations, and authorization constraints can be expressed within a unified semantic structure. Finally, an intermediate representation of the vulnerability evidence chain is constructed for subsequent reentrancy verification, integer security verification, and access control verification. When merging inheritance modifiers, the modifier definitions declared by each contract and the linearized inheritance sequence generated by the compiler are stored separately, and collected sequentially from the current contract to the base contract according to this sequence. For modifiers with the same name, only the definition appearing for the first time in the sequence is retained; modifier bodies with different definitions are not concatenated. Inheritance and overriding relationships are verified by the compiler during the compilation phase.
[0018] The vulnerability evidence chain is represented by function body statements, state variables, external calls, state writes, arithmetic operations, authorization constraints, execution order relationships, data dependencies, function call relationships, and permission associations. Function body statements are stored as a sequential list, and function metadata records the function name, visibility, function type, and applied modifiers. External calls, state writes, arithmetic operations, authorization constraints, and sensitive operations are all stored as nodes and associated with function nodes through execution order edges, data dependency edges, permission protection edges, and modifier application edges.
[0019] Step S4 includes the following sub-steps: Step S4-1: Traverse the set of normalized function body statements in the intermediate representation (IR) of the vulnerability evidence chain, identify external call statements and global state variable update statements, and record their relative positions in the function execution order for subsequent behavior relationship analysis. Step S4-2: Analyze the assignment operations involving funds or state variables in the function, and combine the function parameter passing and internal function calls to trace the source of variables and their update positions, and establish the dependency relationship between state variable updates and external calls; Step S4-3: Identify safe or low-risk call patterns such as zero-value calls, self-calls, and fixed-target calls, as well as effective access control logic, and exclude functions with strict access control or safe call patterns from the potential vulnerability candidate set. Step S4-4: Based on the execution order of external interaction nodes and state writing nodes, a function-level temporal behavior model is constructed. Key operations are abstracted into automaton state nodes, and corresponding UPPAAL XML models are generated. Specifically, when an external interaction node is reachable before its corresponding state writing node, or when an external interaction node lacks a corresponding state update node, a reentrant risk path is formed in the model. The key operations include the initial state, external calls, state variable updates, external calls without corresponding updates, and unsafe states. When generating the UPPAAL XML model, a template is created for each candidate function, with `start`, `external_call`, `state_update`, `done`, and `Unsafe` serving as automaton positions. The variables `state_updated`, `auth_guard`, `reentry_lock`, `balance_sufficient`, and `callback_can_reenter` are set. For state update transitions, `state_updated` is set to 1. When an external call occurs before a corresponding state update, a transition to `Unsafe` is generated.
[0020] Steps S4-5 involve using a formal verification tool to verify the properties of the generated automaton model, checking whether the execution order between state variable updates and external calls violates security attributes. If the verification fails, the function is deemed to have a potential reentrancy vulnerability, and the analysis results are recorded. The properties are defined using the UPPAAL CTL formula A[] not P.Unsafe. When a migration path that satisfies state_updated == 0, callback_can_reenter == 1, reentry_lock == 0, auth_guard == 0, and balance_sufficient == 1 reaches Unsafe, the property verification fails, and the corresponding reentrancy risk evidence is output.
[0021] Step S5 includes the following sub-steps: Step S5-1: Traverse the set of function body statements after normalization in the intermediate representation (IR) of the vulnerability evidence chain, identify statements involving integer operations, including addition, subtraction and multiplication operations, and extract key semantic information such as operators, operands and target variables; Step S5-2: Parse the security assertions or conditional statements that appear in the function, extract the logical expressions involving variable relationships, and combine them with the conditional constraints before the operation statements to construct a set of security assertions on the program path; Step S5-3: Based on the extracted operands, operators, and path constraints, map the variables to fixed-length bit vectors and construct a logical constraint model representing integer arithmetic behavior and its overflow conditions, such as addition overflow conditions, subtraction underflow conditions, and multiplication overflow conditions. The bit vector length is determined according to the variable type; uint8, uint16, uint32 up to uint256 are mapped to BitVectors of the same bit width. For mapping type variables, their bit width is determined according to the mapping value type. Let the bit vector width of the target variable be w, and x and y be unsigned operands represented by this bit width, M = 2^w. 1. The conditions for determining addition overflow, subtraction underflow, and multiplication overflow are encoded as ULT(x+y,x), UGT(x+y,x), and UGT(x+y,x), respectively. y,x) and x≠0∧y≠0∧UGT(y,UDiv(M,x)).
[0022] Step S5-4: Integer arithmetic constraints and path conditions are uniformly encoded into SMT formulas and solved using the SMT solver. It is determined whether there are variable assignments that satisfy all path conditions and simultaneously meet the conditions for addition overflow, subtraction underflow, or multiplication overflow. Path conditions are extracted from the conditional expressions in the require, assert, and if statements within the function and added to the solver along with the overflow conditions. For Solidity 0.8.0 and above, ordinary arithmetic has overflow fallback semantics by default. Bit vector verification is only performed on arithmetic within the unchecked code block. Checked arithmetic auxiliary functions of SafeMath or try form are not used as vulnerability trigger points.
[0023] Step S5-5: If the SMT solver returns a satisfactory solution, it indicates that there is a set of variable values that cause integer operations to trigger overflow or underflow under the current path conditions, thus determining that there is an integer security risk; at the same time, the triggering statement, function position, path conditions and counterexample variable values are recorded to form a reproducible vulnerability report. Step S6 includes the following sub-steps: Step S6-1: First, traverse the normalized set of function body statements in the intermediate representation (IR) of the vulnerability evidence chain to identify high-risk operations such as permission variable changes, public initialization functions, and external contract calls. Record the sensitive behavior type, the function it belongs to, the statement position, and the state variables involved as the basis for subsequent permission analysis. The sensitive operations include low-level calls, delegate calls, transfers / sends, self-destruction, array or mapping writes, state variable assignments, and privileged role address identifiers (owner or admin).
[0024] Step S6-2: Combining function modifiers, inherited modifier definitions, role state variables, and security assertion conditions, analyze whether there are access constraints based on caller identity or role control, and construct the association between sensitive operations and authorization constraints. The authorization constraint analysis not only checks the require, assert, and if statements in the function body, but also checks the function body with applied modifiers and the called internal permission verification function. When role variables such as owner and admin appear in the condition and form identity constraints with msg.sender, it is recorded as valid authorization protection.
[0025] Step S6-3: Associate sensitive operations with authorization constraints. If a critical operation is not effectively protected by modifiers, conditional statements, or authorization logic in the called function, or if authentication is performed using an insecure caller source such as tx.origin, then it is determined that there is a risk of missing access control.
[0026] In another aspect, the present invention discloses a multi-technology verification system for smart contracts, used to implement the above-mentioned method, including: an AST generation tool, an AST parsing tool, a vulnerability evidence chain (IR) generation tool, and a vulnerability verification tool.
[0027] An AST generation tool is used to compile and perform syntactic analysis on the input smart contract source code to generate an Abstract Syntax Tree (AST), which serves as the basic representation for subsequent semantic analysis. An AST parsing tool is used to traverse and extract semantics from the abstract syntax tree, obtain structured semantic information such as global state variables, function definitions, function meta-information, modifiers, and inheritance relationships in the contract, and perform standardization, local alias expansion, and irrelevant information filtering on the statements. The vulnerability evidence chain IR generation tool is used to construct an intermediate representation of the vulnerability evidence chain based on the parsed AST. This intermediate representation is used to abstractly express the core semantics of the smart contract, including function bodies, function metadata, modifier semantics, global variable sets, inheritance structures, external interaction nodes, state writing nodes, arithmetic operation nodes, authorization constraint nodes, sensitive operation nodes, execution order relationships, data dependency relationships, function call relationships, and permission association relationships, thereby providing a unified analysis interface for various verification technologies. The vulnerability evidence chain IR generation tool is also used to serialize and save the node set, edge set, storage path set, and function summary set, enabling the reentrancy verification, integer verification, and permission verification modules to read external calls, state writings, arithmetic operations, sensitive operations, and their dependencies through a unified interface.
[0028] The vulnerability verification tool employs formal verification based on control flow and data flow modeling to detect reentrancy vulnerabilities, semantic verification based on constraint extraction and SMT solution to detect integer overflow and underflow vulnerabilities, and a method combining semantic analysis and pattern matching to detect access control vulnerabilities. Each type of vulnerability is analyzed using targeted strategies and supported by semantics through intermediate representations of the vulnerability evidence chain, thereby improving detection accuracy and reducing false positives.
[0029] The vulnerability verification module includes a reentrancy vulnerability verification tool module, an integer overflow vulnerability verification tool module, and an access control vulnerability verification tool module, which are used to verify reentrancy vulnerabilities, integer overflow vulnerabilities, and access control vulnerabilities, respectively.
[0030] Beneficial effects This invention integrates formal verification, SMT constraint solving, and authorization semantic analysis on the basis of the intermediate representation of the vulnerability evidence chain to detect vulnerabilities such as reentrancy, integer overflow and underflow, and missing access control. Compared with directly using a single static rule or simply combining multiple detection tools, this invention can associate external interactions and state writing, arithmetic operations and path conditions, and sensitive operations and authorization constraints through the same evidence chain. This allows different vulnerability types to use verification models that match their causes, thereby more accurately distinguishing low-risk external interactions such as self-calling, fixed address calls, and zero-value calls, arithmetic operations constrained by require or assert, and sensitive operations protected by valid modifiers or identity checks. This reduces false positives and false negatives and improves the interpretability and reproducibility of the detection results. Attached Figure Description
[0031] Figure 1 This is a flowchart illustrating a multi-technology verification method for smart contracts according to an embodiment of the present invention; Figure 2 This is a structural block diagram of a multi-technology verification system for smart contracts according to an embodiment of the present invention.
[0032] Figure 3 This is a schematic diagram of a function-level reentrant verification automaton when an external call precedes a state update in an embodiment of the present invention.
[0033] Figure 4 This is a schematic diagram of the intermediate node relationship in the vulnerability evidence chain, taking the withdraw function as an example, in an embodiment of the present invention. Detailed Implementation
[0034] This invention selects a compatible compiler and generates an Abstract Syntax Tree (AST) through Solidity version declaration. It extracts key contract semantics from nodes such as SourceUnit, ContractDefinition, FunctionDefinition, VariableDeclaration, ModifierDefinition, InheritanceSpecifier, ExpressionStatement, FunctionCall, Assignment, and BinaryOperation in the AST. It then reconstructs statement fragments based on their source code locations, removing comments and redundant whitespace. The system expands local aliases pointing to state variables, merges inherited modifiers, and constructs an intermediate representation of the vulnerability evidence chain that includes function bodies, state variables, function meta-information, modifiers, inheritance relationships, external interaction nodes, state writing nodes, arithmetic operation nodes, authorization constraint nodes, and sensitive operation nodes. On this representation, variable-level dependency tracing and UPPAAL timing verification are used for reentrancy risks, SMT solutions for integer overflow and underflow risks are used for path constraints and bit vector arithmetic conditions, and correlation analysis of sensitive operations and authorization constraints is used for access control risks. The results of various detections are output in a structured manner in the form of evidence chains, triggering conditions, counterexample variable values, and triggered verification models.
[0035] Figure 1 This is a flowchart illustrating a multi-technology verification method for smart contracts in an embodiment of the present invention.
[0036] This embodiment presents a multi-technology verification method for smart contracts, used to determine whether a target Solidity smart contract has security vulnerabilities and to ensure the security of the contract. The method includes the following steps: Step S1: Read the Solidity smart contract to be tested and extract its version declaration. Based on the constraints in the version declaration, select a target version compatible with the source code from the preset Solidity compiler version set.
[0037] Step S1 includes the following sub-steps: Step S1-1: First, obtain the Solidity source file to be detected and identify its version declarations. For the extracted version declarations, parse them according to different constraint forms, and convert the exact version, upper and lower bound constraints, and compatible version ranges into comparable candidate ranges, and determine the target compilation version that meets the conditions accordingly.
[0038] In this embodiment, if the input contract declares a version constraint, the constraint is parsed into a comparable candidate range, and a target version that meets the constraint is selected from a preset version set; this process is only used to ensure that the subsequent syntax analysis matches the semantics of the source code.
[0039] Step S2: Compile the contract and generate an Abstract Syntax Tree (AST). The AST includes at least source file nodes, contract definition nodes, function definition nodes, variable declaration nodes, modifier definition nodes, inheritance relationship nodes, function call nodes, assignment nodes, condition judgment nodes, and arithmetic expression nodes, providing a foundation for subsequent semantic analysis and intermediate representation construction.
[0040] Determine if the smart contract compiles successfully; if it fails, output a compilation failure message and terminate the subsequent analysis process; if it compiles successfully, extract the abstract syntax tree from the compilation result as input for the subsequent intermediate representation construction.
[0041] Step S3: Parse the abstract syntax tree and construct an intermediate representation of the vulnerability evidence chain. Using the abstract syntax tree obtained in step S2 as input, first extract the key semantic structure information of the contract layer and function layer, then clean, normalize, and uniformly organize the extracted results to finally form an intermediate representation of the vulnerability evidence chain that can be shared by subsequent vulnerability analysis modules.
[0042] This step completes both the mapping from the Abstract Syntax Tree (AST) to structured semantic information and the semantic normalization process from the original source code fragments to the standardized representation, thus providing a unified input for subsequent reentrancy, integer overflow, and access control analysis.
[0043] Step S3-1: Traverse the source file nodes and contract definition nodes in the compilation result one by one, establish the initial semantic structure by contract, and extract the state variables, function definitions, function metadata, modifier definitions and inheritance relationships in the contract and save them in the semantic structure. Specifically, the contract definition node is used to obtain the contract name and inheritance relationship, the variable declaration node is used to obtain the state variables, the function definition node is used to obtain the function name, visibility, modifiers and function body, and the function call, assignment and binary operation expression nodes are used to identify external interactions, state writing and arithmetic operations.
[0044] Step S3-2 involves further parsing the function node to obtain the function name, visibility, parameter list, return value information, applied modifiers, and function body statements. The function name, visibility, and parameter information are extracted from the attribute fields of the function definition node; the applied modifiers are extracted from the modifier call nodes associated with the function definition node; and the function body statements are saved according to the statement sequence contained in the function body node in the order of source code execution. Simultaneously, the state variable declaration nodes under the contract definition node are traversed to extract the variable name, variable type, initial value, and visibility information of global state variables. The function information, modifier information, and global state variable information are then associated with the semantic structure of the corresponding contract, providing a complete context for subsequent external interaction identification, state write identification, arithmetic operation identification, and authorization constraint analysis. Step S3-3 involves cleaning and normalizing the extracted semantic structure to generate an intermediate representation of the vulnerability evidence chain (e.g., ...). Figure 4 (As shown). Specifically, the corresponding source code segment is recovered from the source range of the abstract syntax tree node, and comments, blank lines, and irrelevant format differences are removed. Then, local aliases, reference expressions, etc., are expanded and replaced. At the same time, the modifier definitions in the parent contract are merged into the modifier set visible to the child contract. This encapsulates information such as function body statements, global variables, modifiers, inheritance relationships, external interactions, state writing, arithmetic operations, and authorization constraints into a standardized semantic structure, serving as an intermediate representation of the vulnerability evidence chain, thereby providing shared input for various subsequent vulnerability verification modules. In this embodiment, the modifier names and modifier bodies declared by each contract are stored using the identifier of the contract definition node, and the linearized inheritance sequence output by the compiler is read. For the contract to be analyzed, the modifier definitions of each contract are read sequentially from the current contract to the base contract according to this sequence. The modifier set visible to the current contract is constructed using the name as an index. When the names are the same, the definition written for the first time is retained, and subsequent definitions neither overwrite existing definitions nor are concatenated with their modifier bodies. The modifiers applied to function nodes are read from this collection by name, and base class constructor calls are not treated as modifiers. The validity of inheritance relationships and modifier overriding is determined by the Solidity compilation phase mentioned above.
[0045] In this embodiment, the vulnerability evidence chain is represented by semantic information organized on a contract-by-contract basis. For each contract, its global state variables, function set, function meta-information, modifier set, and inheritance relationship are recorded; for each function, the normalized statement sequence, applied modifiers, visibility, and semantic nodes related to state variables, external calls, arithmetic operations, and authorization judgments are recorded.
[0046] The above structure allows for the description of the sequential relationship between external interaction nodes and state writing nodes, the constraint relationship between arithmetic operation nodes and path conditions, and the association relationship between sensitive operation nodes and authorization constraints within the same representation. This intermediate representation is not a simple copy of the AST, but rather reorganizes scattered syntax nodes into a chain of evidence oriented towards vulnerability verification, enabling S4 to S6 to share the same semantic foundation.
[0047] For example, for a withdrawal function containing the statements `amount = balances[msg.sender]`, `msg.sender.call{value:amount}("")`, and `balances[msg.sender] = 0`, the vulnerability evidence chain includes the function name `withdraw`, visibility `public`, external interaction node `call` (value=amount), state writing node `balances[msg.sender] = 0`, data dependency `amount→balances[msg.sender]`, and execution order `call` before state writing. Based on this evidence chain, the reentrancy verification module can directly generate a time-series model where external calls precede related state updates. If the same function also contains `total = total + amount` and `require(total>= amount)`, the integer verification module extracts arithmetic operation nodes and path constraints from the same statement sequence. If the function modifies the `owner` variable but lacks the `msg.sender==owner` class constraint, the access control verification module forms an access control evidence chain from the missing relationship between sensitive operation nodes and authorized constraint nodes.
[0048] In one implementation, the evidence graph is organized into a serializable structured object based on contracts, including a set of nodes, a set of relations, a set of storage paths, and a set of function summaries. Each node records a unique identifier, node type, and corresponding attributes; each relation records the start point, end point, and relation type. Node types include contracts, functions, modifiers, state variables, normalized statements, and external calls, state writes, arithmetic operations, condition checks, and sensitive operations extracted from statements. Statement nodes store the normalized statement text and its sequence number within the function. Relation types include contract declarations, function inclusion statements, statement extraction semantic nodes, adjacent statement order, state variable reads or writes, data dependencies, storage dependencies, modifier applications, and authorization protection. Directed sequential relations between adjacent statements connect statement nodes; semantic nodes such as external calls and state writes are associated with their corresponding statements through extraction relations, and their order is determined by the sequence number of the statement to which they belong. The storage path set records the base variables of state variables and their mapping indices or member access paths; the function summary summarizes state reads and writes, external calls, public entries, used modifiers, and identified protection markers by function. The subsequent analysis module reads these sets and relationships to locate the call statements, related state variables, and write statements.
[0049] Abstract syntax trees (ASTs) can reflect syntactic structure, but the order of external interactions and state writes, the data dependency between call amounts and state variables, the authorization constraints after modifier inheritance, and the correspondence between arithmetic operations and path conditions are usually scattered across different nodes and functions. Directly analyzing these on the AST can easily lead to repeated traversal, unstable semantic associations, and the inability to interpret different vulnerability detection results. This invention introduces an intermediate representation of the vulnerability evidence chain, unifying the organization of function bodies, state variables, external interactions, state writes, arithmetic operations, authorization constraints, modifiers, and inheritance relationships, and recording execution order relationships, data dependency relationships, and permission association relationships. Based on this, reentrant temporal verification models, integer security SMT constraint models, and access control semantic analysis models are derived for different vulnerability causes, enabling different verification technologies to work collaboratively based on the same evidence chain, thereby reducing false positives caused by single-rule detection and improving the interpretability and reproducibility of vulnerability detection results.
[0050] Step S4: Verify the reentrant vulnerability based on the intermediate representation of the vulnerability evidence chain. In this step, the intermediate representation of the vulnerability evidence chain constructed in step S3 is used as input to analyze the set of normalized function body statements in the contract. The focus is on identifying whether there are both external interaction nodes and state writing nodes inside the function, and constructing a reentrant temporal verification model based on the order of their execution.
[0051] Step S4-1: First, traverse the function set of each contract in the intermediate representation of the vulnerability evidence chain, scanning each function body statement. On one hand, identify external interaction nodes, including `call` statements and low-level calls with `value` parameters; on the other hand, identify state writing nodes, including assignments to global state variables, compound assignments, increments and decrements, and state variable updates caused by internal functions. Further determine whether the updated object belongs to the contract's global state variable set. For functions that meet the conditions, record the positions of external interactions and state writing in the execution order, and track state variables related to the transfer amount, thus laying the foundation for subsequent sequential analysis.
[0052] Step S4-2: After identifying the external interaction node and the state writing node, compare the positional relationship of the two types of nodes in the function and perform variable-level dependency judgment: If the value parameter of the external call comes directly from the state variable, or comes from a local variable obtained by assigning a value to the state variable, then the state variable is regarded as the relevant state variable; if the update of the relevant state variable occurs before the external interaction, then this situation usually corresponds to a safer execution mode; if the external interaction occurs before the update of the relevant state variable, or there is no update of the relevant state variable, then the function is regarded as a candidate object with potential reentrancy risk.
[0053] Furthermore, to reduce false positives, low-risk modes such as filtering zero-value calls, calls to the contract itself, calls to fixed target addresses, and ABI-encoded interface distribution are adopted. In addition, the function's meta-information and modifier information are combined to check whether the function has nonReentrant and owner / admin identity verification.
[0054] Step S4-3 identifies safe or low-risk call patterns such as zero-value calls, self-calls, and fixed-target calls, as well as effective access control logic, and excludes functions with strict access control or safe call patterns from the potential vulnerability candidate set. Specifically, the system combines function meta-information and modifier information to check whether the function has effective protection mechanisms such as nonReentrant and owner / admin identity verification, thereby reducing false positives caused by relying solely on statement order judgment.
[0055] Step S4-4: Construct a structured time-series verification model based on the candidate reentrant evidence chains retained after screening (e.g., Figure 3(As shown). The system abstracts candidate functions into a behavioral model consisting of a starting point, external interaction nodes, state writing nodes, and unsafe nodes, and generates a corresponding UPPAAL XML model based on the execution order of external interaction nodes and state writing nodes. The model sets a state update flag `state_updated`, which is set to updated when a state writing event occurs. When an external call event arrives before this flag is set, a conditional transition to Unsafe is set at the call location. When an external interaction node does not have a corresponding state writing node, it is abstracted as an external call state or transition without a corresponding update, and can lead to the Unsafe state.
[0056] Step S4-5: Call the UPPAAL formal verification tool to perform property verification on the timing verification model generated in step S4-4, check whether property A[] not P.Unsafe is satisfied, in order to determine whether there is a reachable path where external interaction precedes the relevant state writing; if the property is not satisfied, it is determined that the function has a potential reentrancy vulnerability, and the external interaction node, state writing node, data dependency relationship and verification result are recorded.
[0057] In one implementation, the model generator generates UPPAAL templates by function. The XML model includes global variable declarations, template, positions, initial positions, transitions, system instances, and property queries. Among the global variables, `state_updated` is initialized to 0, indicating whether a relevant state write has occurred; `callback_can_reenter` represents the abstract callback condition; `auth_guard` and `reentry_lock` represent the identified authorization protection and reentry lock; and `balance_sufficient` represents the abstract state of the balance condition. The template includes `start`, event positions arranged in normalized statement order, `done`, and `Unsafe` positions, with the initial position pointing to `start`. When a state write event is encountered, a transition to the corresponding event position is generated, and `state_updated` is set to 1. If `state_updated` is still 0 when an external call occurs, a transition to `Unsafe` is generated after reaching the call position, with the guard conditions being `state_updated == 0`, `callback_can_reenter == 1`, `reentry_lock == 0`, `auth_guard == 0`, and `balance_sufficient == 1`. If the external call occurs after the state update, a normal transition is generated with the constraint `state_updated==1`. External calls for which no relevant state write was identified are treated as if the state has not yet been updated. The system instantiates the template and queries for the property `A[] not P.Unsafe`; if `Unsafe` is reachable, then the property is not satisfied.
[0058] The function-level verification model constructed by this method consists of control positions, transitions, and guard conditions, which directly correspond to the automata structure of UPPAAL. The inaccessibility of unsafe positions can be verified through security attributes. Therefore, this implementation uses UPPAAL to maintain the correspondence between the generative model and the function-level verification model in terms of positions, transitions, and guard conditions.
[0059] Taking withdrawal scenarios as an example, if the contract updates the user's balance only after transferring assets to an external address, this execution order may create a reentrancy risk; if the balance and other states have already been updated before the external call, the risk is significantly reduced.
[0060] For example, in an externally callable withdrawal function, `msg.sender.call{value: amount}("")` is executed first, followed by `balances[msg.sender]=0`. The model first generates the external call location according to the statement sequence number, and then generates the state write location. When the state update flag is still 0 and the callback can be entered, no authorization protection or reentrant lock is identified, and the balance abstract condition is met, there is a transition to Unsafe at the external call location, so property A[]not P.Unsafe is not satisfied. If `balances[msg.sender]=0` is executed first and then the external call is made, the state write transition first sets `state_updated` to 1, and subsequent calls continue along the normal transition, which does not satisfy the state guard for the transition to Unsafe. If no relevant state write is identified, the external call is also treated as if the state has not been updated.
[0061] When verifying the intermediate representation of the evidence chain for this type of vulnerability, we first identify external interaction nodes and state writing nodes, and trace the data dependency between external call amounts and state variables. Then, we construct a function-level temporal behavior model and use model verification tools to verify whether external interaction may occur before the relevant state writing, thereby reducing false positives caused by relying solely on syntax position judgment.
[0062] Step S5: Verify integer overflow and underflow vulnerabilities using constraint solving methods. In this step, the intermediate representation of the vulnerability evidence chain constructed in step S3 is used as input. The arithmetic operation nodes in the function are traversed to identify candidate operations that may cause integer overflow, underflow, or multiplication overflow. Combined with the existing security assertions and path conditions in the function, these are encoded into bit vector logic formulas. Then, an SMT solver such as Z3 is used to determine whether the corresponding overflow conditions can be satisfied.
[0063] Step S5-1: Identify arithmetic candidate statements in the function and determine the vulnerability type. Scan the normalized function body statements one by one to identify arithmetic update operations that may cause integer exceptions, including addition, subtraction, multiplication, and related assignment operations; after a successful match, abstract the current statement into a candidate operation and classify it into addition overflow, subtraction underflow, or multiplication overflow type according to its semantic form.
[0064] Step S5-2: Extract path conditions and construct a constraint set. After identifying a statement as a candidate overflow point, continue to collect the precondition constraints related to that statement, focusing on extracting the condition expressions in require, assert, and if statements, and filtering out the variable relationships involving candidate operands or target variables; convert these conditions into logical constraints that can be processed by the SMT solver, as path constraints C.
[0065] Step S5-3: Encode arithmetic operations as bit vector overflow conditions and call the solver for verification. After the constraint set is established, use fixed-length bit vectors to model the variables and construct corresponding overflow or underflow judgment formulas for different vulnerability types; where the addition overflow condition is expressed as the addition result being less than at least one operand, the subtraction underflow condition is expressed as the minuend being less than the subtrahend or the operation result being greater than the minuend, and the multiplication overflow condition is specifically expressed as x≠0, y≠0 and y> (2^w 1) / x .
[0066] In one implementation, the bit vector width *w* is determined by the integer declaration of the target variable, with *uint8*, *uint16*, *uint32*, and *uint256* mapped to 8, 16, 32, and 256 bits respectively. The bit width of the mapped element is determined based on the type of the mapped value; if the specific bit width cannot be identified, the default bit width of 256 is used. For compound assignments of the form *x += y*, the original *x* and the right-hand operand *y* are used; for assignments of the form *z = x + y*, the operands *x* and *y* in the right-hand expression are used. Operands and numerical constants are constructed as bit vectors according to the target bit width. For unsigned operations, let the left and right operands of a binary operation be *x* and *y*, and the target width be *w*, with a maximum value M = 2^*w*. 1. The overflow condition for addition is ULT(x+y,x), and the underflow condition for subtraction is UGT(x). The overflow condition for binary multiplication is x≠0 and y≠0, and y>UDiv(M,x). Here, ULT, UGT, and UDiv represent unsigned less than, unsigned greater than, and unsigned integer division of bit vectors, respectively. Specifically, the implementation uses the Z3 Python interface to create BitVec(name,w) variables and BitVecVal(value,w) constants, and encodes resolvable comparisons, conjunctions, disjunctions, and non-zero conditions as path constraints C, which are then added to the solver along with the corresponding overflow or underflow conditions A.
[0067] Step S5-4: Encode the integer operation constraints and path conditions into SMT formulas and solve them using the SMT solver. Use logical reasoning to determine if there are variable assignments that satisfy all path conditions and simultaneously meet the conditions for addition overflow, subtraction underflow, or multiplication overflow. If the solver determines that the conjunction formula C∧A of path constraint C and vulnerability condition A is satisfied, it means that there is a set of inputs under the current constraints that can trigger the integer vulnerability risk.
[0068] For example, when the target variable is uint8, w=8 and M=255. If the multiplication operands x=200 and y=2, then UDiv(255,200)=1. Since y=2 is greater than 1, the multiplication overflow condition is met. For x+=5 according to the unchecked operator definition analysis, if the program path contains require(x<=250), the path constraint C and the addition overflow condition ULT(x+5,x) cannot be satisfied simultaneously. After removing this condition, the addition overflow condition is met when x takes values from 251 to 255, and the solver can return the corresponding value. Thus, the solver determines whether there are variable assignments that trigger overflow or underflow under the current path constraint by checking whether C∧A can be satisfied.
[0069] Step S5-5: Generate the vulnerability model and save the integer overflow verification results. After the solver returns a satisfactory result, read the specific values of the relevant variables from the solution model and organize them together with the function location, vulnerability type, and preconditions into counterexample information, which serves as the basis for the vulnerability report.
[0070] Taking the balance accumulation scenario as an example, we identify arithmetic expressions and their preceding security assertions, and unify arithmetic behavior and security assertions into formal integer constraints.
[0071] After recognizing the arithmetic expression, the operands and operators involved in the operation are recorded as constraint elements, and combined with safety assertions to form path conditions. Under unsigned integer semantics, addition overflow can be represented as the result of the operation being less than one of the operands. The SMT solver is called to perform satisfiability analysis. If a solution exists that satisfies the path conditions and triggers overflow, the corresponding counterexample is output.
[0072] Step S6 involves verifying access control vulnerabilities using a combination of semantic analysis and pattern matching. In this step, the intermediate representation of the vulnerability evidence chain constructed in step S3 is used as input. A joint analysis is performed on the function body, conditional statements, modifiers, inheritance context, and function metadata. First, it identifies whether there are sensitive operation nodes in the function that require permission protection. Then, it determines whether these sensitive operation nodes are protected by effective authorization constraints. If a function contains sensitive behavior but lacks effective identity verification, or uses insecure authentication methods, it is identified as an access control risk.
[0073] Step S6-1: Identify sensitive operations and high-risk contexts within functions. First, semantic information such as function meta-information, modifiers, and global state variables is read from the IR (Instructions for Reference) to determine the accessibility, function type, and role-related state of the current function. Then, pattern matching is performed on the normalized function body statements to identify sensitive operations such as low-level calls, delegatecalls, transfers, self-destruction, state writes, array or map writes, permission variable changes, initialization behaviors, and external contract calls. For example, functions that assign values to owner or admin variables in public functions, public initialize functions that reset permissions, or functions containing tx.origin authentication logic are all recorded as sensitive contexts requiring authorization constraints.
[0074] Step S6-2: Check the authorization logic and output the access control vulnerability results. After a function is identified as a sensitive function, continue to check whether it has valid authentication or role constraints, including permission checks in security assertions, permission judgments in the modifier body, and indirect authorization logic encapsulated in the called function.
[0075] Step S6-3: Associate the sensitive operations identified in step S6-1 with the authorization constraints obtained in step S6-2. If there are no valid modifiers, conditional statements, inherited authorization logic, or authorization checks in the called function on the execution path of the sensitive operation, or if the authentication depends on an insecure caller source such as tx.origin, then it is determined that there is a risk of missing access control, and the sensitive operation type, function location, missing authorization constraints, and trigger path are recorded.
[0076] In this embodiment, effective authorization constraints include comparison of _msgSender() with role variables such as owner and admin, role judgment of checkRole class, and equivalence constraints in inheritance modifiers; if the modifier is empty, only contains tautological conditions, authentication depends on tx.origin, or the above effective authorization checks are missing along the execution path for sensitive operations, then the function is marked as an access control vulnerability.
[0077] Step S7: The verification results generated in steps S4, S5, and S6 are summarized and a structured security verification report is generated. This report includes the vulnerability type, the location of the vulnerability in the function or contract, the triggering conditions, relevant constraints or counterexamples, and key semantic basis for interpreting the judgment results.
[0078] In a series of specific experiments in this embodiment, three datasets were used to verify the above method. The first dataset is the SolidiFI-benchmark injection benchmark dataset, which, after compilation, filtering, and manual verification, contains 9649 reentrant vulnerable functions, 50 files containing 1334 integer overflow functions, and 107 contract files containing access control vulnerabilities. The second dataset is the ReentrancyStudy-Data reentrant vulnerability dataset, which, after filtering, retains 730 reentrant vulnerable functions. The third dataset is a real-world smart contract dataset, collected from January 1, 2026 to January 22, 2026, containing 3135 contract files, and without any mutation enhancements.
[0079] On the aforementioned dataset, the detection performance of this invention was compared with that of commonly used tools such as Slither, Mythril, AChecker, and VeriSmart. The results are as follows: For reentrancy vulnerability detection, the F1 scores of this method on the three datasets are 0.996, 0.831 and 0.824, respectively, compared with Slither's 0.431, 0.624 and 0.143, and Mythril's 0.751, 0.408 and 0.069, respectively. For integer overflow and underflow vulnerability detection, the F1 scores of this method on the first and third datasets are 0.959 and 0.872, respectively. The comparison tools Slither and Mythril are 0.711 and 0.155, respectively. The F1 scores of Mythril and VeriSmart are 0.237 and 0.003, respectively. For access control vulnerability detection, the F1 scores of this method on the first and third datasets are 0.972 and 0.705, respectively. The comparison tools Slither and Mythril have scores of 0.170 and 0.145, respectively, while AChecker has an F1 score of 0.671 on the first dataset.
[0080] The above results demonstrate that this embodiment, through verification techniques that unify intermediate representations and vulnerability type matching, can reduce false positives and false negatives and improve overall detection effectiveness in actual testing.
[0081] Figure 2This is a structural block diagram of a multi-technology verification system for smart contracts in an embodiment of the present invention.
[0082] The multi-technology verification system for smart contracts in this embodiment includes an AST generation module 11, an AST parsing module 12, an IR generation module 13, and a vulnerability verification module 14.
[0083] The AST generation module 11 is used to compile and perform syntax analysis on the source code of smart contracts to generate an abstract syntax tree (AST). The AST parsing module 12 is used to traverse and extract semantics from the AST, obtain structured information such as global state variables, function definitions, function meta-information, modifiers and inheritance relationships, and perform statement standardization and redundancy filtering. The IR generation module 13 is used to construct an intermediate representation of the vulnerability evidence chain from the parsing results, in order to abstractly express the function body, function metadata, modifier semantics, global variables, inheritance structure, external interaction nodes, state writing nodes, arithmetic operation nodes and authorization constraint nodes, providing a unified interface for subsequent analysis. The vulnerability verification module 14 is used to perform multi-technology fusion verification on the intermediate representation of the vulnerability evidence chain, including: formal verification based on the sequential modeling of external interaction nodes and state writing nodes to detect reentrancy vulnerabilities, verification based on path constraint extraction and SMT solution to detect integer overflow and underflow vulnerabilities, and verification based on the correlation analysis of sensitive operation nodes and authorized constraint nodes to detect access control vulnerabilities.
[0084] The vulnerability verification module 14 includes a reentrancy vulnerability verification tool module, an integer overflow vulnerability verification tool module, and an access control vulnerability verification tool module, which are used for verifying reentrancy vulnerabilities, integer overflow vulnerabilities, and access control vulnerabilities, respectively.
Claims
1. A multi-technology verification method for smart contracts, characterized in that, Includes the following steps: Step S1: Select a compatible compiler version based on the version declaration in the input Solidity smart contract source code; Step S2: Compile the contract and generate an abstract syntax tree, which includes: source file node, contract definition node, function definition node, variable declaration node, modifier definition node, inheritance relationship node, function call node, assignment node, condition judgment node, and arithmetic expression node. Step S3: Traverse the abstract syntax tree, extract key semantic elements, including: function body, function meta-information, global state variables, modifiers and inheritance relationships, and perform source code fragment recovery, statement normalization, local alias expansion and inheritance modifier matching and processing to construct an intermediate representation of the vulnerability evidence chain; The intermediate representation of the vulnerability evidence chain includes a set of semantic nodes and a set of semantic relationships. The semantic nodes include at least external interaction nodes, state writing nodes, arithmetic operation nodes, authorization constraint nodes, and sensitive operation nodes. The semantic relationships include at least execution order relationships, data dependency relationships, function call relationships, and permission association relationships. Specifically, the intermediate representation of the vulnerability evidence chain is organized using a serializable evidence graph structure, including at least a set of nodes (nodes), a set of edges (edges), a set of storage paths (storage_paths), and a set of function summaries (function_summaries). Each statement is executed in order according to its normalized statement index. Adjacent statement nodes are related by a control-before directed edge, and the order of external interaction nodes and state writing nodes is determined by their respective statement indices. Variable read / write and data dependency relationships are represented by reads, writes, data-dep, and storage-dep edges. Step S4: Based on the external interaction nodes and state writing nodes in the vulnerability evidence chain intermediate representation analysis function, extract the value parameter or transfer amount source of the external call, trace the data dependency relationship between the source and the state variable, combine the internal function call relationship, security call mode filtering and effective protection mechanism judgment, construct a reentrant temporal verification model, and use the UPPAAL formal verification tool to detect whether there is a reachable path where the external interaction occurs before the relevant state update. Step S5: Based on the intermediate representation of the vulnerability evidence chain, identify arithmetic operation nodes and extract target variables, operands, operators and related path conditions. Encode addition overflow, subtraction underflow and multiplication overflow conditions into fixed-length bit vector constraints. Encode security assertions and conditional statements into path constraints. Use the SMT solver to determine whether there are feasible inputs that satisfy the path conditions and trigger overflow or underflow, and output the corresponding counterexample variable values. Step S6: Based on the intermediate representation of the vulnerability evidence chain, analyze the sensitive operation nodes in the function, and combine the function body, modifiers, inheritance context, role state variables and authorization constraints in security assertions to determine whether sensitive operations such as low-level calls, asset transfers, self-destruction, state writing, permission variable changes, initialization function calls and external contract calls are protected by effective permissions, thereby identifying access control deficiencies, invalid modifiers or insecure authentication issues. Step S7: Organize the detection results into a structured format, output the vulnerability type, the location of the function, and the triggering conditions or counterexample information, and generate a complete security verification report.
2. The method according to claim 1, characterized in that, Step S1 includes the following sub-steps: Step S1-1: Read the Solidity source file to be detected, parse the version declaration, extract the version constraints, and match the available Solidity compiler versions according to the constraint rules to determine the compatible target compilation version, thus preparing for subsequent compilation and intermediate representation generation.
3. The method according to claim 1, characterized in that, Step S3 includes the following sub-steps: Step S3-1: Traverse the contract definition nodes in the abstract syntax tree, extract the contract name and its inheritance relationship, and identify the function definition, variable declaration and modifier definition nodes inside the contract to establish the basic structure of core semantic elements such as functions, global variables and modifiers. Step S3-2 involves further parsing the function node to obtain the function name, visibility, application modifiers, and function body statements; at the same time, it extracts information such as global state variables, their types, and initial values from the contract to provide a complete context for subsequent semantic analysis. Step S3-3 involves extracting source code fragments, deleting comments, normalizing whitespace, and serializing statements in the function body, and expanding and replacing local alias variables. Finally, an intermediate representation of the vulnerability evidence chain is constructed for subsequent reentrancy verification, integer security verification, and access control verification. When merging inheritance modifiers, the modifier definitions declared by each contract and the linearized inheritance sequence generated by the compiler are saved separately, and collected sequentially from the current contract to the base contract according to this sequence. For modifiers with the same name, only the definition appearing for the first time in the sequence is retained; modifier bodies with different definitions are not concatenated. Inheritance and overriding relationships are verified by the compiler during the compilation phase. The vulnerability evidence chain includes function body statements, state variables, external calls, state writes, arithmetic operations, authorization constraints, execution order relationships, data dependencies, function call relationships, and permission association relationships. Among them, function body statements are stored in the form of a sequential list, and function meta-information records the function name, visibility, function type, and applied modifiers. External calls, state writes, arithmetic operations, authorization constraints, and sensitive operations are all stored in the form of nodes and are associated with function nodes through execution order edges, data dependency edges, permission protection edges, and modifier application edges.
4. The method according to claim 1, characterized in that, Step S4 includes the following sub-steps: Step S4-1: Traverse the set of function body statements after normalization in the intermediate representation of the vulnerability evidence chain, identify external call statements and global state variable update statements, and record their relative positions in the function execution order for subsequent behavior relationship analysis. Step S4-2: Analyze the assignment operations involving funds or state variables in the function, and combine the function parameter passing and internal function calls to trace the source of variables and their update positions, and establish the dependency relationship between state variable updates and external calls; Step S4-3: Identify safe or low-risk call patterns such as zero-value calls, self-calls, and fixed-target calls, as well as effective access control logic, and exclude functions with strict access control or safe call patterns from the potential vulnerability candidate set. Step S4-4: Based on the execution order relationship between external interaction nodes and state writing nodes, construct a function-level temporal behavior model, abstract key operations into automaton state nodes, and generate corresponding UPPAAL XML models. When an external interaction node is reachable before a relevant state writing node, or when an external interaction node does not have a corresponding state update node, a reentrant risk path is formed in the model. The key operations include the initial state, external call, state variable update, external call without a corresponding update, and unsafe state. When generating the UPPAAL XML model, create a template for each candidate function, and use start, external_call, state_update, done, and Unsafe as automaton positions. Set the variables state_updated, auth_guard, reentry_lock, balance_sufficient, and callback_can_reenter. For state update transitions, set state_updated to 1. When an external call occurs before a relevant state update, generate a position transition to Unsafe. Step S4-5: Call the formal verification tool to verify the properties of the generated automata model and check whether the execution order between state variable updates and external calls violates the safety property. If the verification fails, the function is determined to have a potential reentrancy vulnerability, and the analysis results are recorded. The property adopts the UPPAAL CTL formula A[] not P.Unsafe. When there is a migration path that satisfies state_updated == 0, callback_can_reenter == 1, reentry_lock == 0, auth_guard == 0 and balance_sufficient == 1 and reaches Unsafe, the property verification fails and the corresponding reentrancy risk evidence is output.
5. The method according to claim 1, characterized in that, Step S5 includes the following sub-steps: Step S5-1: Traverse the set of function body statements after normalization in the intermediate representation of the vulnerability evidence chain, identify statements involving integer operations, including addition, subtraction and multiplication operations, and extract key semantic information such as operators, operands and target variables. Step S5-2: Parse the security assertions or conditional statements that appear in the function, extract the logical expressions involving variable relationships, and combine them with the conditional constraints before the operation statements to construct a set of security assertions on the program path; Step S5-3: Based on the extracted operands, operators, and path constraints, map the variables to fixed-length bit vectors (BitVectors), and construct a logical constraint model representing integer arithmetic behavior and its overflow conditions. The overflow conditions include addition overflow, subtraction underflow, and multiplication overflow. The bit vector length is determined according to the variable type; uint8, uint16, uint32 up to uint256 are mapped to BitVectors of the same bit width. Integer variables whose specific bit width cannot be identified are mapped to 256 bits by default. For mapping type variables, their bit width is determined according to the mapping value type. Let the bit vector width of the target variable be w, and x and y be unsigned operands represented by this bit width, M = 2^w. 1; The conditions for determining addition overflow, subtraction underflow, and multiplication overflow are encoded as ULT(x+y,x), UGT(x+y,x), and UGT(x+y,x), respectively. y,x) and x≠0∧y≠0∧UGT(y,UDiv(M,x)); Step S5-4: Integer operation constraints and path conditions are uniformly encoded into SMT formulas and solved using the SMT solver. It is determined whether there are variable assignments that satisfy all path conditions and simultaneously meet the conditions for addition overflow, subtraction underflow, or multiplication overflow. Path conditions are extracted from the conditional expressions in the require, assert, and if statements within the function and added to the solver along with the overflow conditions. For Solidity 0.8.0 and above, ordinary arithmetic has overflow fallback semantics by default. Bit vector verification is only performed on arithmetic within the unchecked code block. Checked arithmetic auxiliary functions of SafeMath or try form are not used as vulnerability trigger points. Step S5-5: If the SMT solver returns a satisfactory solution, it indicates that there is a set of variable values that cause integer operations to trigger overflow or underflow under the current path conditions, thus determining that there is an integer security risk; at the same time, the triggering statement, function position, path conditions and counterexample variable values are recorded to form a reproducible vulnerability report.
6. The method according to claim 1, characterized in that, Step S6 includes the following sub-steps: Step S6-1: First, traverse the normalized set of function body statements in the intermediate representation of the vulnerability evidence chain to identify high-risk operations such as permission variable changes, public initialization functions, and external contract calls. Record the sensitive behavior type, the function it belongs to, the statement position, and the state variables involved as the basis for subsequent permission analysis. The sensitive operations include low-level calls, delegate calls, transfers / sends, self-destructs, array writes, state variable assignments, and privileged role address identifiers such as owner / admin. Step S6-2: Combining function modifiers, inherited modifier definitions, role state variables, and security assertion conditions, analyze whether there are access constraints based on caller identity or role control, and construct the association between sensitive operations and authorization constraints. The authorization constraint analysis not only checks the require, assert, and if statements in the function body, but also checks the function body with applied modifiers and the called internal permission verification function. When the owner or admin role variables appear in the condition and form an identity constraint with msg.sender, it is recorded as valid authorization protection. Step S6-3: Associate sensitive operations with authorization constraints. If a critical operation is not effectively protected by modifiers, conditional statements, or authorization logic in the called function, or if authentication is performed using an insecure caller source like tx.origin, then a risk of missing access control is identified.
7. A multi-technology verification system for smart contracts, used to implement the method described in any one of claims 1-6, characterized in that, include: AST generation tools, AST parsing tools, vulnerability evidence chain (IR) generation tools, and vulnerability verification tools; An AST generation tool is used to compile and perform syntactic analysis on the input smart contract source code to generate an Abstract Syntax Tree (AST), which serves as the basic representation for subsequent semantic analysis. An AST parsing tool is used to traverse and extract semantics from the abstract syntax tree, obtain structured semantic information such as global state variables, function definitions, function meta-information, modifiers, and inheritance relationships in the contract, and perform standardization, local alias expansion, and irrelevant information filtering on the statements. The vulnerability evidence chain IR generation tool is used to construct an intermediate representation of the vulnerability evidence chain based on the parsed AST, thereby providing a unified analysis interface for various verification technologies. The vulnerability evidence chain IR generation tool is also used to serialize and save the node set, edge set, storage path set and function digest set, so that the reentrancy verification, integer verification and permission verification modules can read external calls, state writes, arithmetic operations, sensitive operations and their dependencies through a unified interface. The vulnerability verification tool employs formal verification based on control flow and data flow modeling to detect reentrancy vulnerabilities, semantic verification based on constraint extraction and SMT solution to detect integer overflow and underflow vulnerabilities, and a method combining semantic analysis and pattern matching to detect access control vulnerabilities. Each vulnerability type utilizes targeted analysis strategies and is semantically supported by intermediate representations of the vulnerability evidence chain, thereby improving detection accuracy and reducing false positive rates. The vulnerability verification module includes a reentrancy vulnerability verification tool module, an integer overflow vulnerability verification tool module, and an access control vulnerability verification tool module, which are used for verifying reentrancy vulnerabilities, integer overflow vulnerabilities, and access control vulnerabilities, respectively.
