Smart contract vulnerability detection method based on multimodal selection state space fusion

Through the multi-modal selection state space fusion method, multi-dimensional information of smart contracts is extracted, contract graphs, texts and image features are generated, and feature cross-processing is used for deep learning networks, which solves the problem of low accuracy in smart contract vulnerability detection and achieves more efficient vulnerability detection.

CN120277682BActive Publication Date: 2025-08-15YANTAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510756827.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-09
Publication Date
2025-08-15
Estimated Expiration
2045-06-09

AI Technical Summary

Technical Problem

The existing smart contract vulnerability detection methods have problems such as low accuracy, relying on expert knowledge and difficulty in capturing deep semantic information.

Method used

The multimodal selection state space fusion method is adopted to obtain the abstract syntax tree, source code and syntax element types of the smart contract, generate contract graphs, intermediate representation text and image features, and use residual graph convolution networks, residual attention networks and dual-channel convolution neural networks to extract features, perform multimodal feature cross-processing and fusion, and finally vulnerability detection is performed.

Benefits of technology

It improves the accuracy and automation of smart contract vulnerability detection, enhances the processing ability of complex contracts, provides vulnerability detection basis across abstract levels, and improves the spatial semantic perception ability of smart contracts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SMS_22
    Figure SMS_22
  • Figure SMS_23
    Figure SMS_23
  • Figure SMS_37
    Figure SMS_37
Patent Text Reader

Abstract

The present invention relates to the field of electronic digital data processing technology, and specifically to a smart contract vulnerability detection method based on multimodal selection state space fusion. In order to solve the technical problem of low vulnerability detection accuracy in the prior art, the present invention first fuses the global and local features of the contract graph to obtain graph modality embedding features; and aligns the text context information of the intermediate representation text and the bytecode text to obtain text modality embedding features; and extracts spatial layout features from color images and grayscale images for splicing to obtain visual modality embedding features; then, the graph modality embedding features, text modality embedding features, and visual modality embedding features are subjected to several rounds of feature cross processing based on the selection state space to achieve intra-modal and inter-modal information interaction, and then are fused to obtain multimodal fusion features; finally, the multimodal fusion features are subjected to feature normalization and regularization, and then classified to obtain vulnerability detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic digital data processing technology, and in particular to a smart contract vulnerability detection method based on multimodal selection state space fusion. Background Art

[0002] To address the severe security challenges facing smart contracts, researchers and developers are committed to developing effective smart contract detection methods. Current methods for detecting smart contract vulnerabilities include pattern matching, symbolic execution, and fuzz testing. Pattern matching relies on pre-set rules and is relatively simple to implement, but is prone to false positives and false negatives. Symbolic execution methods detect vulnerabilities by exhaustively exploring all possible execution paths, but they are generally computationally inefficient and difficult to apply to complex contracts. Fuzz testing methods use random inputs to evaluate contract behavior, but their efficiency and coverage are still unreliable and often require manual intervention and analysis.

[0003] In recent years, deep learning, leveraging its powerful feature learning and pattern recognition capabilities, has achieved breakthroughs in various fields, giving rise to deep learning-based smart contract vulnerability detection methods. Compared to traditional methods, deep learning-based methods can automatically learn complex vulnerability patterns from data, adapt to evolving attack methods, and reduce reliance on expert knowledge. They also demonstrate significant advantages in improving detection accuracy, automation, and handling complex contracts. However, current deep learning-based detection methods, limited by their single-perspective perspective, struggle to capture the deep semantic information contained in smart contract code, resulting in relatively low accuracy in smart contract detection. Summary of the Invention

[0004] The purpose of this invention is to provide a smart contract vulnerability detection method based on multimodal selection state space fusion.

[0005] The technical solutions of the present invention are as follows:

[0006] A smart contract vulnerability detection method based on multimodal selection state space fusion includes the following operations:

[0007] S1. Obtain the abstract syntax tree of the smart contract to be inspected, simplify it, and add data flow information to obtain a contract graph; convert the abstract syntax tree of the smart contract to be inspected into a structure, obtain the sequence of operation instructions for each function in the structure, and obtain the intermediate representation text; compile the source code of the smart contract to be inspected, obtain the runtime bytecode generated by the compilation, and convert it into a sequence to obtain the bytecode text; perform color coding mapping on different syntax element types in the smart contract to be inspected, and generate a color image; map each bytecode of the smart contract to grayscale pixels, and generate a grayscale image;

[0008] S2 and the contract graph are processed by the residual graph convolutional network and the residual attention network respectively to obtain global semantic features and local semantic features, which are mapped to the same shared space to obtain the graph modality embedding features; the text context information of the intermediate representation text and the bytecode text are obtained respectively, and the features are aligned based on linear projection and batch normalization to obtain the text modality embedding features; the color image and the grayscale image are processed by the dual-channel convolutional neural network and then spliced to obtain the visual modality embedding features;

[0009] S3: The image modality embedding features, text modality embedding features, and visual modality embedding features are subjected to several rounds of feature cross processing based on the selected state space to obtain the image modality embedding cross features, text modality embedding cross features, and visual modality embedding cross features. These features are then globally fused through weighted pooling to obtain multimodal fusion features.

[0010] S4. After feature normalization and regularization, the multimodal fusion features are classified to obtain vulnerability detection results.

[0011] The operation of feature cross-processing based on the selection state space in the current round of S3 is as follows: the graph modality embedding cross-features, text modality embedding cross-features, and visual embedding cross-features output in the previous round are used as the input of the current round, and are normalized to obtain the current round graph normalized features, the current round text normalized features, and the current round visual normalized features; the current round graph normalized features, the current round text normalized features, and the current round visual normalized features are processed by multi-layer perceptron and SiLU activation function to obtain the current round graph main path features, the current round text main path features, and the current round visual main path features; the current round graph normalized features, the current round text normalized features, and the current round visual normalized features are processed by multi-layer perceptron and convolution to obtain the current round graph convolution features, the current round text convolution features, and the current round visual convolution features. The convolution features of the current round image, the convolution features of the current round text, and the convolution features of the current round vision are respectively multiplied with the convolution features of the remaining two modalities that do not contain themselves, and are processed in a cyclic selection state space to obtain the current round image selection interaction features, the current round text selection interaction features, and the current round vision selection interaction features; the current round image selection interaction features, the current round text selection interaction features, and the current round vision selection interaction features are respectively multiplied element-by-element with the current round image main path features, the current round text main path features, and the current round vision main path features, and then processed by a multi-layer perceptron, and are added element-by-element with the current round image normalization features, the current round text normalization features, and the current round vision normalization features, and are normalized to obtain the current round image modal cross features, the current round text modal cross features, and the current round vision modal cross features.

[0012] The specific operation of cyclically selecting the state space for processing the current round image convolution features, the current round text convolution features, and the current round visual convolution features is as follows: the current round image convolution features and the current round text convolution features are processed by the selection state space respectively to obtain the current round image initial selection features and the current round text initial selection features; the current round image initial selection features and the current round text initial selection features are processed by the selection state space and then processed by the selection state space with the current round visual convolution features to obtain the current round image-text visual selection features; the current round image-text visual selection features and the current round text convolution features are processed by the selection state space and then processed by the selection state space with the current round image convolution features to obtain the current round image selection interaction features.

[0013] The operation of selecting the state space can be achieved by the following formula:

[0014] ,

[0015] ,

[0016] for t The output of the round selection state space, for t The input of the round, 、 They are t -1 round, t The potential state quantity of the round, 、 、 They are the state matrix, control matrix and output matrix respectively.

[0017] The specific operations for obtaining text modality embedding features in S2 are as follows: the intermediate representation text and bytecode text are converted into token sequences respectively to obtain intermediate representation token sequences and bytecode token sequences, which are processed by the trained BERT model respectively, and the output of the CLS tag is used to obtain intermediate representation context information and bytecode context information; the intermediate representation context information and bytecode context information are batch normalized and ReLU activation function processed respectively, and then spliced to obtain text modality embedding features.

[0018] The types of syntactic elements in the smart contract to be inspected in S1 include: brackets, keywords, operators, identifiers, currency units, and comments.

[0019] The operation of residual graph convolution network processing in S2 is implemented by the following formula:

[0020] ,

[0021] ,

[0022] 、 Respectively l Layer, l -1 layer of residual graph convolution features, For the l The weight matrix of the convolutional layer, is the adjacency matrix of the contract graph, is the degree matrix of the adjacency matrix, For the last layer L The residual graph convolution features of the layer, For sorting pooling processing, For maximum pooling processing, is the global semantic feature, Processed by the sigmoid function.

[0023] A smart contract vulnerability detection system based on multimodal selection state space fusion, used to implement the above-mentioned smart contract vulnerability detection method based on multimodal selection state space fusion, comprising:

[0024] Multiple modal data generation modules are used to obtain the abstract syntax tree of the smart contract to be inspected, simplify it, add data flow information, and obtain the contract graph; convert the abstract syntax tree of the smart contract to be inspected into a structure, obtain the sequence of operation instructions of each function in the structure, and obtain the intermediate representation text; compile the source code of the smart contract to be inspected, obtain the runtime bytecode generated by the compilation, and convert it into a sequence to obtain the bytecode text; different syntax element types in the smart contract to be inspected are subjected to color coding mapping to generate a color image; each bytecode of the smart contract to be inspected is mapped to grayscale pixels to generate a grayscale image;

[0025] The modality embedding processing module processes the contract graph through a residual graph convolutional network and a residual attention network, respectively, to obtain global semantic features and local semantic features, which are mapped to the same shared space to obtain graph modality embedding features. The module also obtains text context information of the intermediate representation text and bytecode text, performs feature alignment based on linear projection and batch normalization, and obtains text modality embedding features. The color image and grayscale image are processed by a dual-channel convolutional neural network and then spliced to obtain visual modality embedding features.

[0026] The multimodal fusion feature generation module is used for image modality embedding features, text modality embedding features, and visual modality embedding features. After several rounds of feature cross processing based on the selection state space, the image modality embedding cross features, text modality embedding cross features, and visual modality embedding cross features are obtained. After weighted pooling, they are globally fused to obtain multimodal fusion features.

[0027] The vulnerability detection result generation module is used to classify the multimodal fusion features after feature normalization and regularization to obtain the vulnerability detection results.

[0028] A smart contract vulnerability detection device based on multimodal selection state space fusion includes a processor and a memory, wherein the processor implements the above-mentioned smart contract vulnerability detection method based on multimodal selection state space fusion when executing a computer program stored in the memory.

[0029] A computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the above-mentioned smart contract vulnerability detection method based on multimodal selection state space fusion.

[0030] The beneficial effects of the present invention are:

[0031] The present invention provides a smart contract vulnerability detection method based on multimodal selection state space fusion. First, based on the abstract syntax tree, source code and syntax element type of the smart contract to be detected, a contract graph that can reflect the syntax structure and execution logic of the smart contract to be detected and can provide high information and fine-grained data, an intermediate representation text and bytecode text that can reflect the source of the underlying execution semantic information of the smart contract to be detected, and a color image and a grayscale image that can reflect the spatial distribution characteristics of the smart contract to be detected in different representation perspectives are obtained; then, the graphical structure information of the contract graph is converted into a high-dimensional graph embedding representation, and the features of the global and local scales are integrated to improve the complex structure expression ability of the smart contract to be detected, and obtain graph modal embedding features; and the text context information of the intermediate representation text reflecting the high-level logical behavior and the bytecode text of the underlying execution semantics are feature aligned to form a complementary text representation space. In this paper, a cross-level abstract vulnerability detection basis is provided to obtain text modality embedding features; and spatial layout features are extracted from color images and grayscale images through dual-channel convolutional neural network processing to capture the visual pattern information of the smart contract to be inspected from the perspective of grammatical structure and execution semantics, thereby improving the perception ability of the spatial semantics of the smart contract to be inspected and obtaining visual modality embedding features; then, the graph modality embedding features, text modality embedding features and visual modality embedding features are subjected to several rounds of feature cross-processing based on the selection state space to achieve deep transformation within the modality and information interaction between modalities, and obtain graph modality embedding cross-features, text modality embedding cross-features and visual modality embedding cross-features, which are globally fused through weighted pooling to achieve efficient integration of multimodal features and obtain multimodal fusion features; finally, the multimodal fusion features are subjected to feature normalization and regularization and then classified to obtain vulnerability detection results. DETAILED DESCRIPTION

[0032] This embodiment provides a smart contract vulnerability detection method based on multimodal selection state space fusion, including the following operations:

[0033] S1. Obtain the abstract syntax tree of the smart contract to be inspected, simplify it, and add data flow information to obtain a contract graph; convert the abstract syntax tree of the smart contract to be inspected into a structure, obtain the sequence of operation instructions for each function in the structure, and obtain the intermediate representation text; compile the source code of the smart contract to be inspected, obtain the runtime bytecode generated by the compilation, and convert it into a sequence to obtain the bytecode text; perform color coding mapping on different syntax element types in the smart contract to be inspected, and generate a color image; map each bytecode of the smart contract to grayscale pixels, and generate a grayscale image;

[0034] S2 and the contract graph are processed by the residual graph convolutional network and the residual attention network respectively to obtain global semantic features and local semantic features, which are mapped to the same shared space to obtain the graph modality embedding features; the text context information of the intermediate representation text and the bytecode text are obtained respectively, and the features are aligned based on linear projection and batch normalization to obtain the text modality embedding features; the color image and the grayscale image are processed by the dual-channel convolutional neural network and then spliced to obtain the visual modality embedding features;

[0035] S3: The image modality embedding features, text modality embedding features, and visual modality embedding features are subjected to several rounds of feature cross processing based on the selected state space to obtain the image modality embedding cross features, text modality embedding cross features, and visual modality embedding cross features. These features are then globally fused through weighted pooling to obtain multimodal fusion features.

[0036] S4. After feature normalization and regularization, the multimodal fusion features are classified to obtain vulnerability detection results.

[0037] The specific steps are detailed as follows.

[0038] S1. Obtain the abstract syntax tree of the smart contract to be inspected, simplify it, and add data flow information to obtain a contract graph; convert the abstract syntax tree of the smart contract to be inspected into a structure, obtain the sequence of operation instructions for each function in the structure, and obtain the intermediate representation text; compile the source code of the smart contract to be inspected, obtain the runtime bytecode generated by the compilation, and convert it into a sequence to obtain the bytecode text; color-code different syntax element types in the smart contract to be inspected to generate a color image; map each bytecode of the smart contract to grayscale pixels to generate a grayscale image.

[0039] Based on the abstract syntax tree, source code, and syntax element types of the smart contract to be inspected, we obtain a contract graph that can reflect the syntax structure and execution logic of the smart contract to be inspected and provide high-information and fine-grained data, as well as an intermediate representation text and bytecode text that can reflect the source of the underlying execution semantic information of the smart contract to be inspected, and color images and grayscale images that can reflect the spatial distribution characteristics of the smart contract to be inspected in different representation perspectives. By collecting multi-dimensional information representation of the smart contract to be inspected, we can extract more comprehensive information about the smart contract to be inspected.

[0040] Generate a contract graph.

[0041] The abstract syntax tree (AST) of the smart contract to be tested is obtained, simplified, and data flow information is added to produce the contract graph. Specifically, an abstract syntax tree (AST) is generated based on the lexical and grammatical rules of the Solidity source code, structuring the code into a hierarchical node tree. The AST meticulously records the structural details of the smart contract, such as variable declarations, data types, and control flow elements, providing a complete picture of the code logic. Nodes not relevant to the vulnerability are deleted from the AST. For example, deleting properties such as "initialValue," "isDeclaredConst," and "visibility" does not directly affect the vulnerability. This simplifies the AST to produce a simplified AST (see the logic execution code in Table 1 for this process). The simplified AST contains rich information about the source code, including grammatical structure, semantic details, and function calls. Data flow information is added to the simplified AST, enhancing the expressiveness of the AST by adding data flow and execution sequences, resulting in the contract graph. See the logic execution code in Table 2 for the detailed process.

[0042] Table 1 Logic code for simplified abstract syntax tree

[0043]

[0044] Table 2 Logical code for adding data flow and execution sequence to the simplified abstract syntax tree

[0045]

[0046] In Table 2, for a given simplified abstract syntax tree (S-AST) input, the simplified abstract syntax tree is first traversed to extract each node and edge, which respectively constitute the nodes and edges of the contract graph. Then, before adding the child nodes to the node set, their indexes are recorded to represent the execution order of the statements. At the same time, data flow edges are created between the node where the variable first appears and the subsequent nodes, and they are added to the edge set. Following the above steps, the generated contract graph provides a high-information and fine-grained data foundation for subsequent feature extraction.

[0047] Generates an intermediate representation text.

[0048] Convert the abstract syntax tree of the smart contract to be checked into a structure, obtain the sequence of each function operation instruction in the structure, and obtain the intermediate representation text. Specifically: through slither<contract.sol> The command parses the smart contract to be inspected. Slither internally converts the abstract syntax tree of the smart contract to a static analysis-friendly structure, and outputs structured function-level intermediate representation information. It extracts the sequence of operation instructions represented by Slither in each function to form the intermediate representation text of the smart contract to be inspected, retaining the static structural features and logical semantics of the smart contract to be inspected, making it easier to mine high-level semantic features.

[0049] Generate bytecode text.

[0050] Compile the source code of the smart contract under inspection, obtain the generated runtime bytecode, and convert it into a sequence to obtain bytecode text. Specifically, use the Solidity compiler (such as solc --bin) to compile the source code of the smart contract under inspection, obtain the generated runtime bytecode as the binary semantic modality, and then convert it into hexadecimal sequence text for subsequent deep text modeling to obtain bytecode text. Bytecode text is closer to actual runtime behavior and can reveal the execution semantics of the source code after being processed by the compiler, helping to uncover hidden security risks and the correlation between underlying execution paths.

[0051] Generate a color image.

[0052] The different types of syntax elements in the smart contract under inspection are color-coded and mapped to generate a color image. Specifically, the syntax elements in the smart contract under inspection are divided into brackets, keywords, operators, identifiers, currency units, comments, and other types (excluding the set of syntax elements of the above types). Fixed color codes are assigned to the syntax element types, resulting in a color image with grammatical differentiation capabilities. This not only preserves the structural information of the code itself, but also enhances the semantic distribution characteristics in the image, helping the visual model understand the contract structure from a spatial dimension.

[0053] Generate a grayscale image.

[0054] Each bytecode in the smart contract under inspection is mapped to a grayscale pixel to generate a grayscale image. Specifically, each bytecode value in the smart contract under inspection is mapped to a grayscale pixel to construct a grayscale image of the smart contract. The image width is set to a fixed 256 pixels, while the image height is adjusted based on the bytecode length. This strategy uses a dimension of (256, -1) to automatically expand the vertical dimension of the image. The resulting grayscale image not only depicts the byte distribution characteristics of the contract execution layer but also indirectly reflects the spatial distribution of the contract's complexity and logic density, providing visual support for the underlying semantics of the vulnerability detection model.

[0055] S2 and the contract graph are processed by the residual graph convolutional network and the residual attention network respectively to obtain global semantic features and local semantic features, which are mapped to the same shared space to obtain graph modality embedding features; the text context information of the intermediate representation text and bytecode text are obtained respectively, and feature alignment is performed based on linear projection and batch normalization to obtain text modality embedding features; the color image and grayscale image are processed by a dual-channel convolutional neural network and then spliced to obtain the visual modality embedding features.

[0056] The graphical structure information of the contract graph is converted into a high-dimensional graph embedding representation, and the features of the global and local scales are integrated to improve the complex structural expression ability of the smart contract to be inspected, and obtain the graph modal embedding feature; at the same time, the text context information of the intermediate representation text reflecting the high-level logical behavior and the bytecode text of the underlying execution semantics are aligned to form a complementary text representation space, providing a basis for vulnerability detection across abstract levels, and obtaining the text modal embedding feature; and the spatial layout features are extracted from the color image and the grayscale image through a dual-channel convolutional neural network for splicing, capturing the visual pattern information of the smart contract to be inspected from the perspective of grammatical structure and execution semantics, improving the perception ability of the spatial semantics of the smart contract to be inspected, and obtaining the visual modal embedding feature.

[0057] Generate graph modality embedding features.

[0058] In order to fully obtain the global and local semantic relationships in the contract graph, in this embodiment, the contract graph is processed by the residual graph convolutional network and the residual attention network respectively to obtain global semantic features and local semantic features; the global semantic features and local semantic features are mapped to the same shared space to obtain graph modal embedding features.

[0059] Among them, the operation of residual graph convolutional network processing can be achieved by the following formula:

[0060] ,

[0061] ,

[0062] 、 Respectively l Layer, l -1 layer of residual graph convolution features, when l =0, is the node feature matrix of the contract graph, For the l The weight matrix of the convolutional layer, is the adjacency matrix of the contract graph, is the degree matrix of the adjacency matrix, For the last layer L The residual graph convolution features of the layer, For sorting pooling processing, For maximum pooling processing, is the global semantic feature, In the residual graph convolution network processing, the node features are processed by the sigmoid function. After the convolution operation, the global information of the node is retained. At the same time, the residual connection is used to enhance the features to avoid the redundant nodes in the graph affecting the global feature expression. The sorting pooling is introduced to process the graph convolution feature matrix. The top nodes are selected according to the importance of the node features. n nodes as graph-level representations, thereby extracting stable and structure-sensitive global embedding features; in order to extract the most salient features of graph embedding, we perform a maximum pooling operation on the global embedding features to obtain global semantic features.

[0063] Among them, the operation of residual attention network processing can be achieved by the following formula:

[0064]

[0065] ,

[0066] ,

[0067] 、 The contract diagrams are l Layer, l -1 layer of residual attention features, Nodes in the contract graph j In the l- Node features of layer 1, For the k The attention projection matrix of the attention head, For nodes i and nodes j In the k The attention coefficient of the attention head, K is the total number of attention heads, 、 Node i and nodes j The node characteristics of For the k The attention parameters of the attention heads, For the last layer L The residual attention features of the layer, Processed by the ELU function, for LeakyReLU Function processing, Processed by the softmax function, For sorting pooling processing, For maximum pooling processing, It is a local semantic feature.

[0068] The global semantic features and local semantic features are mapped to the same shared space. The global semantic features and local semantic features can be batch normalized and resume After the activation function is processed, splicing is performed, which can be achieved by the following formula:

[0069] ,

[0070] is the graph modality embedding feature, 、 are the weight matrices of the graph embedding projection layer at the global and local scales, For batch normalization processing, the graph structure information of the smart contract is converted into a high-dimensional graph embedding representation through the above-mentioned graph embedding extraction process, and the global and local graph features are organically integrated. This graph embedding method can more comprehensively represent the complex structure of the smart contract.

[0071] Generate text modality embedding features.

[0072] The text context information of the intermediate representation text and bytecode text is obtained respectively, and feature alignment is performed based on linear projection and batch normalization to obtain text modal embedding features. Specifically, the intermediate representation text and bytecode text are converted into token sequences respectively to obtain intermediate representation token sequences and bytecode token sequences, which are processed by the trained BERT model respectively. The output of the CLS tag is used to obtain intermediate representation context information and bytecode context information. After batch normalization and ReLU activation function processing respectively, they are spliced and the two different levels of embedding features are mapped to the shared space to achieve feature alignment, forming a unified text representation embedding and obtaining text modal embedding features. This process can fully extract rich grammatical and semantic information from the source code and bytecode, and also significantly enhances the expression and recognition capabilities of vulnerability patterns at different levels. In particular, the information provided by the multi-level text representation embedding constructs a more comprehensive feature space for vulnerability detection, while integrating high-level logical semantics and low-level execution features, providing complementary semantic information support for cross-modal interaction.

[0073] Generate visual modality embedding features.

[0074] After processing the color and grayscale images with a dual-channel convolutional neural network, they are concatenated to generate visual modality embedding features. Specifically, the color and grayscale images are each processed through multiple stages of repeated convolution, followed by batch normalization and ReLU activation, before being concatenated. This embedding maps the two features into a shared space, resulting in visual modality embedding features. In this way, the color image of the source code and the grayscale image of the bytecode each provide spatial information about the smart contract from different perspectives. Combining these two embedding perspectives enhances understanding of the contract's structure and semantics, effectively expanding the ability to perceive spatial structure.

[0075] The multi-stage repeated convolution operation can be achieved by the following formula:

[0076] ,

[0077] The output is the multi-stage repeated convolution feature of the color image and the multi-stage repeated convolution feature of the grayscale image. Represents the convolutional layer In the m Phase repetition L times, M is the total number of stages, For the m The resolution of each stage is and width is A color image or grayscale image, It is the dot product processing.

[0078] During the multi-stage repeated convolution process, follow the following steps:

[0079] ,

[0080] ,

[0081] ,

[0082] ,

[0083] The convolution scaling depth of the output is d ,width w and resolution factor r , 、 、 、 、 The convolutional layers are m The preset convolution scale, preset number of convolutions, preset first and second resolution parameters and preset image width of the stage, 、 is the output memory, the target memory, 、 Output floating point number and target floating point number.

[0084] S3, the graph modality embedding features, text modality embedding features and visual modality embedding features, after several rounds of feature cross processing based on the selection state space, obtain graph modality embedding cross features, text modality embedding cross features and visual modality embedding cross features, which are globally fused through weighted pooling to obtain multimodal fusion features.

[0085] The graph modality embedding features, text modality embedding features and visual modality embedding features are subjected to several rounds of feature cross-processing based on the selection state space to achieve deep transformation within the modality and information interaction between the modalities, and obtain graph modality embedding cross-features, text modality embedding cross-features and visual modality embedding cross-features. After weighted pooling, they are globally fused to achieve efficient integration of multimodal features and obtain multimodal fusion features.

[0086] In the current round, the operation steps of feature cross processing based on the selection state space are as follows.

[0087] Step 1: The image modality embedding cross features (previous round image modality embedding cross features), text modality embedding cross features (previous round text modality embedding cross features), and visual embedding cross features (previous round visual embedding cross features) output from the previous round are used as the input of the current round. They are normalized to stabilize the feature distribution and avoid interference from scale inconsistency on feature fusion, thus obtaining the current round image normalized features, current round text normalized features, and current round visual normalized features.

[0088] Step 2. The normalized features of the current round image, the normalized features of the current round text, and the normalized features of the current round vision are processed by the multi-layer perceptron and the SiLU activation function respectively to obtain the main path features of the current round image, the main path features of the current round text, and the main path features of the current round vision; the normalized features of the current round image, the normalized features of the current round text, and the normalized features of the current round vision are processed by the multi-layer perceptron and convolution respectively to obtain the convolution features of the current round image, the convolution features of the current text, and the convolution features of the current round vision; the convolution features of the current round image, the convolution features of the current round text, and the convolution features of the current round vision are respectively processed with the convolution features of the remaining two modes that do not contain themselves, and the cyclic selection state space is used to obtain the current round image selection interaction features, the current round text selection interaction features, and the current round vision selection interaction features.

[0089] Taking the current round image convolution feature as an example, the operation of cyclic selection state space processing of the current round image convolution feature, the current round text convolution feature and the current round visual convolution feature is as follows: the current round image convolution feature and the current round text convolution feature are respectively processed by the selection state space to obtain the current round image initial selection feature and the current round text initial selection feature; the current round image initial selection feature and the current round text initial selection feature are processed by the selection state space, and then processed by the selection state space with the current round visual convolution feature to obtain the current round image-text visual selection feature; the current round image-text visual selection feature and the current round text convolution feature are processed by the selection state space, and then processed by the selection state space with the current round image convolution feature to obtain the current round image selection interaction feature.

[0090] Taking the current round text convolution feature as an example, the operation of cyclic selection state space processing of the current round text convolution feature, the current round image convolution feature, and the current round visual convolution feature is as follows: the current round text convolution feature is processed by the selection state space to obtain the current round text initial selection feature; the current round text initial selection feature and the current round image convolution feature are processed by the selection state space, and then processed by the selection state space with the current round text initial selection feature to obtain the current round text semi-cyclic selection feature; the current round text semi-cyclic selection feature and the current round visual convolution feature are processed by the selection state space, and then processed by the selection state space with the current round text convolution feature to obtain the current round text selection interaction feature.

[0091] Taking the current round of visual convolution features as an example, the operation of cyclic selection state space processing of the current round of visual convolution features, the current round of text convolution features, and the current round of image convolution features is as follows: the current round of visual convolution features and the current round of text convolution features are processed by the selection state space respectively to obtain the current round of visual initial selection features and the current round of text initial selection features; the current round of visual initial selection features and the current round of text convolution features are processed by the selection state space, and then processed by the selection state space with the current round of image convolution features to obtain the current round of visual text-image selection features; the current round of visual text-image selection features and the current round of text initial selection features are processed by the selection state space, and then processed by the selection state space with the current round of visual convolution features to obtain the current round of image selection interaction features.

[0092] The operation of selecting the state space can be achieved by the following formula:

[0093] ,

[0094] ,

[0095] for t The output of the round selection state space, for t For round input, when the number of features of the initial input is greater than 1, the different initial inputs are concatenated as one input. 、 They are t -1 round, t The potential state quantity of the round, 、 、 They are the state matrix, control matrix and output matrix respectively.

[0096] Step 3. The current round image selection interaction feature, the current round text selection interaction feature, and the current round visual selection interaction feature are respectively multiplied element-by-element with the current round image main path feature, the current round text main path feature, and the current round visual main path feature, and then processed by a multi-layer perceptron. They are then added element-by-element with the current round image normalization feature, the current round text normalization feature, and the current round visual normalization feature, and normalized to obtain the current round image modal cross feature, the current round text modal cross feature, and the current round visual modal cross feature, which are used to perform the next round of feature cross processing based on the selection state space.

[0097] Repeat steps 1, 2, and 3 until the final round is reached to obtain the cross-features of graph modality embedding, text modality embedding, and visual modality embedding.

[0098] The above-mentioned several rounds of feature cross-processing based on the selection state space can enable targeted adjustments to the information of different modalities during the feature transmission process, further ensuring that attention is paid to features related to vulnerability generation. At the same time, cross-modal information exchange is achieved between different modalities through intermediate connections, promoting the interaction and complementarity of each modal feature, thereby enhancing each modality's perception of other modal information. Through residual connections, the features after modulation and interaction processing are fused with the input features, and then normalized to obtain updated modal features. In this way, the original features and new interaction information can be effectively combined, further enriching the feature representation.

[0099] Finally, the cross-features of the image modality embedding, the cross-features of the text modality embedding, and the cross-features of the visual modality embedding are globally fused through weighted pooling to ensure that the most discriminative features can be used for fusion, gradually enhance the feature fusion effect, and obtain a richer and more robust multimodal feature representation-multimodal fusion feature.

[0100] The whole process combines intra-modal deep transformation, inter-modal information interaction and weighted fusion, successfully achieving efficient integration of multimodal features.

[0101] S4. After feature normalization and regularization, the multimodal fusion features are classified to obtain vulnerability detection results.

[0102] A feature normalization operation is performed on the multimodal fusion features to achieve feature standardization. Then, regularization processing is performed to improve generalization ability and prevent overfitting. Finally, a linear classification process based on a layer of full connection is performed to map the features to a specific output space, and then a prediction result is output as to whether there are vulnerabilities in the smart contract to be tested.

[0103] The operation of obtaining the vulnerability detection result can be achieved through the following formula:

[0104] ,

[0105] For each vulnerability, the predicted probability is compared with different vulnerability probability thresholds to determine whether the corresponding vulnerability exists. is the classification weight matrix, is the bias term, is the multimodal fusion feature, For feature normalization, For regularization processing.

[0106] To verify the effectiveness of the detection method of this embodiment, the following experiments were conducted.

[0107] Experimental Purpose. To thoroughly evaluate the effectiveness and innovativeness of this embodiment's method, the experiment explored the following three core research questions: RQ1: How effective is this embodiment's method at detecting four typical smart contract vulnerabilities, including reentrancy, timestamp dependency, integer overflow, and delegate call? How does its performance compare to existing detection methods? RQ2: Does the multimodal learning strategy significantly improve key performance indicators such as model accuracy, recall, and F1 score in the smart contract vulnerability detection task?

[0108] Dataset Description. The dataset primarily originates from blockchain platforms (over 96%), GitHub open-source code repositories, and professional contract analysis blogs, ensuring high representativeness and authenticity. Specifically, the dataset contains 42,910 smart contract samples, each with both source code and bytecode representations. Among these, 680 contracts harbor reentrancy vulnerabilities, 2,242 contracts harbor timestamp dependency vulnerabilities, approximately 1,368 contracts harbor integer overflow / underflow vulnerabilities, and 136 contracts harbor delegate call vulnerabilities. All samples are labeled with vulnerability types, providing a standardized data foundation for training and evaluating detection models. During the data partitioning phase, a stratified random sampling strategy was used, dividing the dataset into training, validation, and test sets in a 3:1:1 ratio to ensure consistent sample distribution within each subset. To ensure the reliability and stability of the experimental results, each experiment was repeated five times, and the mean of the five experimental results was used as the final performance evaluation metric.

[0109] Evaluation indicators. The experiment selected four indicators: accuracy (ACC), recall (RE), precision (PRE), and F1 score (F1) to comprehensively evaluate the performance of the detection method. The ACC indicator represents the proportion of correctly predicted samples in the total number of samples, reflecting the overall prediction accuracy of the detection method. The RE indicator measures the ratio of the number of correctly identified positive samples to the total number of actual positive samples, reflecting the detection method's ability to capture positive samples. The PRE indicator calculates the proportion of samples predicted to be positive that are actually positive, evaluating the reliability of the detection method's prediction of positive results. The F1 indicator, as the harmonic mean of precision and recall, balances the recall and precision of the detection method in positive class identification, avoiding evaluation bias caused by a single indicator.

[0110] Parameter setting. The method of this embodiment is implemented based on the PyTorch deep learning framework. All experiments were run on a high-performance workstation configured with a 3.3 GHz Intel Core i9 processor, an NVIDIA GeForce RTX 2080 Ti graphics processor and 64GB of memory. The training uses the cross-entropy loss function as the optimization objective, combined with the Adam optimization algorithm and the learning rate scheduling strategy, and gradually optimizes the model performance by calculating the prediction results through forward propagation and updating the network parameters through backpropagation. In the hyperparameter tuning link, a grid search strategy is used to systematically explore the optimal parameter combination. Specifically, the learning rate is adjusted in the range of {0.0001, 0.0005, 0.001, 0.002}, the hidden layer dimension is searched in the interval of {64, 128, 256, 512}, and the batch size is set to {16, 32, 64, 128} for the experiment.

[0111] Existing detection methods for comparison. In the experiment, the method of this embodiment is compared with traditional smart contract vulnerability detection tools. The selected comparison tools cover different detection paradigms: (1) Oyente, as an early smart contract analysis tool, pioneered automated detection; (2) SmartCheck, a static analysis tool based on abstract syntax trees; (3) Osiris, a dynamic detection solution using symbolic execution technology; (4) Mythril, a hybrid detection framework that integrates symbolic execution and taint analysis; (5) Slither, a static analysis tool based on a rule engine; (6) sFuzz, a dynamic detection tool based on fuzz testing; (7) ConFuzzius, a detection tool using a hybrid fuzz testing strategy.

[0112] Response to RQ1. The method of this embodiment is compared with the existing six detection methods on the dataset for different vulnerability detection results, see Tables 3, 4, 5, and 6. From the data in Tables 3, 4, 5, and 6, we can see that in terms of reentrancy vulnerability detection, the rule-based SmartCheck and Slither have an accuracy rate of only 44.32% and 69.38%, respectively. Oyente and Osiris, which rely on bytecode analysis, have an accuracy rate of 65.57% and 51.87%, respectively. sFuzz and ConFuzzius, which use fuzz testing technology, have an accuracy rate of 60.42% and 78.02%, respectively. In comparison, the method of this embodiment demonstrates significant technical advantages. In the detection of four types of vulnerabilities, including reentrancy, timestamp dependency, integer overflow / underflow, and delegate call, the accuracy of the method of this embodiment is improved by 17.98%, 25.63%, 17.96%, and 11.71% respectively compared with the existing detection methods, achieving the best performance in all evaluation indicators.

[0113] Table 3 Comparison of the method in this embodiment and the existing method in reentrancy vulnerability detection

[0114]

[0115] Table 4 Comparison of the method in this embodiment and the existing method in timestamp vulnerability detection

[0116]

[0117] Table 5 Comparison of the method of this embodiment and the existing method in integer overflow / underflow vulnerability detection

[0118]

[0119] Table 6 Comparison of the method in this embodiment and the existing method in delegated call vulnerability detection

[0120]

[0121] At the same time, the experiment further compared and analyzed the method of this embodiment with current mainstream deep learning detection tools. The comparison objects included representative models such as Vanille-RNN, Rechecker, DR-GCN, TMP, DA-GNN, AME, CBGRU, VulnSense and TMF-Net. The experimental results are shown in Tables 3, 4, 5 and 6. The method of this embodiment shows significant advantages in comparison with other existing multimodal methods. It has achieved performance breakthroughs in all four types of vulnerability detection tasks. This is due to the multi-dimensional data representation system and adaptive cross-modal fusion mechanism constructed by the method of this embodiment, which can comprehensively capture the information of smart contracts and accurately model the complex interactive relationship between modalities, thereby achieving a significant improvement in detection accuracy, verifying the advantages of the method of this embodiment in multimodal information processing.

[0122] Response to RQ2. This embodiment utilizes a contract graph (graph modality), bytecode text and intermediate representation text (text modality), and dual-view code images (color and grayscale images) to construct a multi-source heterogeneous data representation system. To quantify the benefits of multimodal fusion on vulnerability detection performance, a single-modality control experiment was conducted. The results are summarized in Table 7. The data in Table 7 show significant differences in the detection performance of each single modality in the smart contract vulnerability detection task. The graph modality, leveraging the deep modeling capabilities of graph neural networks for code structure, accurately captures key logical features such as function call relationships and data flow dependencies, achieving the highest accuracy rate of 82.33%. The text modality, leveraging natural language processing technology to analyze code semantics, achieved a detection accuracy rate of 82.3%. However, due to its limited ability to represent code structural features, its performance remains to be improved. The visual modality's detection accuracy rate of 79.1% is lower than the other two. This is primarily due to information loss in the code images when mapping program grammatical structure and contextual logical relationships, resulting in the ineffective representation of some key detection elements. Comparative analysis shows that the method of this embodiment significantly outperforms the single-modal model in all-dimensional evaluation indicators such as accuracy, recall, precision, and F1 score. Taking the F1 score as an example, the method of this embodiment improved from the highest single-modal value of 76.67% to 91.94%, achieving a leap in performance. This result fully verifies that the collaborative integration of multimodal information can effectively expand the model's contextual perception capabilities, significantly enhance the model's generalization performance and prediction accuracy in vulnerability detection tasks, and highlight the technical advantages of multimodal learning in the field of smart contract security analysis.

[0123] Table 7 Performance comparison of different single-modality and multi-modal fusion

[0124]

[0125] This embodiment further provides a smart contract vulnerability detection system based on multimodal selection state space fusion, which is used to implement the above-mentioned smart contract vulnerability detection method based on multimodal selection state space fusion, including:

[0126] Multiple modal data generation modules are used to obtain the abstract syntax tree of the smart contract to be inspected, simplify it, add data flow information, and obtain the contract graph; convert the abstract syntax tree of the smart contract to be inspected into a structure, obtain the sequence of operation instructions of each function in the structure, and obtain the intermediate representation text; compile the source code of the smart contract to be inspected, obtain the runtime bytecode generated by the compilation, and convert it into a sequence to obtain the bytecode text; different syntax element types in the smart contract to be inspected are subjected to color coding mapping to generate a color image; each bytecode of the smart contract to be inspected is mapped to grayscale pixels to generate a grayscale image;

[0127] The modality embedding processing module processes the contract graph through a residual graph convolutional network and a residual attention network, respectively, to obtain global semantic features and local semantic features, which are mapped to the same shared space to obtain graph modality embedding features. The module also obtains text context information of the intermediate representation text and bytecode text, performs feature alignment based on linear projection and batch normalization, and obtains text modality embedding features. The color image and grayscale image are processed by a dual-channel convolutional neural network and then spliced to obtain visual modality embedding features.

[0128] The multimodal fusion feature generation module is used for image modality embedding features, text modality embedding features, and visual modality embedding features. After several rounds of feature cross processing based on the selection state space, the image modality embedding cross features, text modality embedding cross features, and visual modality embedding cross features are obtained. After weighted pooling, they are globally fused to obtain multimodal fusion features.

[0129] The vulnerability detection result generation module is used to classify the multimodal fusion features after feature normalization and regularization to obtain the vulnerability detection results.

[0130] This embodiment also provides a smart contract vulnerability detection device based on multimodal selection state space fusion, including a processor and a memory, wherein the processor implements the above-mentioned smart contract vulnerability detection method based on multimodal selection state space fusion when executing a computer program stored in the memory.

[0131] This embodiment also provides a computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, it implements the above-mentioned smart contract vulnerability detection method based on multimodal selection state space fusion.

[0132] This embodiment provides a smart contract vulnerability detection method based on multimodal selection state space fusion. First, based on the abstract syntax tree, source code and syntax element type of the smart contract to be detected, a contract graph that can reflect the syntax structure and execution logic of the smart contract to be detected and can provide high information and fine-grained data, and an intermediate representation text and bytecode text that can reflect the source of the underlying execution semantic information of the smart contract to be detected, as well as a color image and grayscale image that can reflect the spatial distribution characteristics of the smart contract to be detected in different representation perspectives are obtained; then, the graphical structure information of the contract graph is converted into a high-dimensional graph embedding representation, and the features of the global and local scales are integrated to improve the complex structure expression ability of the smart contract to be detected, and obtain the graph modal embedding feature; and the text context information of the intermediate representation text reflecting the high-level logical behavior and the bytecode text of the underlying execution semantics are feature aligned to form a complementary text representation space. In this paper, a cross-level abstract vulnerability detection basis is provided to obtain text modality embedding features; and spatial layout features are extracted from color images and grayscale images through dual-channel convolutional neural network processing to capture the visual pattern information of the smart contract to be inspected from the perspective of grammatical structure and execution semantics, thereby improving the perception ability of the spatial semantics of the smart contract to be inspected and obtaining visual modality embedding features; then, the graph modality embedding features, text modality embedding features and visual modality embedding features are subjected to several rounds of feature cross-processing based on the selection state space to achieve deep transformation within the modality and information interaction between modalities, and obtain graph modality embedding cross-features, text modality embedding cross-features and visual modality embedding cross-features, which are globally fused through weighted pooling to achieve efficient integration of multimodal features and obtain multimodal fusion features; finally, the multimodal fusion features are subjected to feature normalization and regularization and then classified to obtain vulnerability detection results.

Claims

1. A smart contract vulnerability detection method based on multimodal selection state space fusion, characterized in that: The following operations are included: S1. Obtain the abstract syntax tree of the smart contract to be inspected, simplify it, and add data flow information to obtain the contract graph; Convert the abstract syntax tree of the smart contract to be inspected into a structure, obtain the sequence of each function operation instruction in the structure, and obtain the intermediate representation text; Compile the source code of the smart contract to be inspected, obtain the runtime bytecode generated by the compilation, convert it into a sequence, and obtain the bytecode text; Different types of syntax elements in the smart contract to be inspected are color-coded and mapped to generate a color image; Map each bytecode of the smart contract to be inspected into grayscale pixels to generate a grayscale image; S2 and the contract graph are processed by the residual graph convolutional network and the residual attention network respectively to obtain global semantic features and local semantic features, which are mapped to the same shared space to obtain graph modality embedding features; The text context information of the intermediate representation text and bytecode text is obtained respectively, and feature alignment is performed based on linear projection and batch normalization to obtain text modality embedding features; After being processed by a dual-channel convolutional neural network, the color image and the grayscale image are spliced to obtain the visual modality embedding features; S3: The image modality embedding features, text modality embedding features, and visual modality embedding features are subjected to several rounds of feature cross processing based on the selected state space to obtain the image modality embedding cross features, text modality embedding cross features, and visual modality embedding cross features. These features are then globally fused through weighted pooling to obtain multimodal fusion features. The feature cross processing operation based on the selection state space in the current round includes: the current round image convolution feature, the current round text convolution feature, and the current round visual convolution feature are respectively combined with the convolution features of the remaining two modes that do not contain themselves, and are processed in a cyclic selection state space to obtain the current round image selection interaction feature, the current round text selection interaction feature, and the current round visual selection interaction feature; S4. After feature normalization and regularization, the multimodal fusion features are classified to obtain vulnerability detection results.

2. The smart contract vulnerability detection method based on multimodal selection state space fusion according to claim 1 is characterized in that: In S3, the current round of feature cross processing based on the selected state space is specifically as follows: The image modality embedding cross features, text modality embedding cross features, and visual embedding cross features output in the previous round are used as the input of the current round and are normalized to obtain the current round image normalized features, current round text normalized features, and current round visual normalized features; The normalized features of the current wheel image, the normalized features of the current wheel text, and the normalized features of the current wheel vision are processed by the multi-layer perceptron and the SiLU activation function respectively to obtain the main path features of the current wheel image, the main path features of the current wheel text, and the main path features of the current wheel vision; The current round image normalization feature, the current round text normalization feature, and the current round visual normalization feature are processed by a multi-layer perceptron and convolution respectively to obtain the current round image convolution feature, the current round text convolution feature, and the current round visual convolution feature; The current round image convolution feature, the current round text convolution feature, and the current round visual convolution feature are respectively combined with the convolution features of the remaining two modes that do not contain themselves, and are processed in a cyclic selection state space to obtain the current round image selection interaction feature, the current round text selection interaction feature, and the current round visual selection interaction feature; The current round image selection interaction feature, the current round text selection interaction feature, and the current round vision selection interaction feature are respectively multiplied element-by-element with the current round image main path feature, the current round text main path feature, and the current round vision main path feature, and then processed by a multi-layer perceptron. They are then added element-by-element with the current round image normalization feature, the current round text normalization feature, and the current round vision normalization feature, and normalized to obtain the current round image modal cross feature, the current round text modal cross feature, and the current round vision modal cross feature.

3. The smart contract vulnerability detection method based on multimodal selection state space fusion according to claim 2 is characterized in that: The specific operations of the current round of graph convolution features, the current round of text convolution features, and the current round of visual convolution features after cyclic selection state space processing are as follows: The convolution features of the current round image and the convolution features of the current round text are processed in the selection state space to obtain the initial selection features of the current round image and the initial selection features of the current round text; After the initial selection features of the current round image and the initial selection features of the current round text are processed in the selection state space, they are processed with the current round visual convolution features in the selection state space to obtain the current round image and text visual selection features; The current round image-text visual selection feature and the current round text convolution feature are processed in the selection state space, and then processed in the selection state space with the current round image convolution feature to obtain the current round image selection interaction feature.

4. The smart contract vulnerability detection method based on multimodal selection state space fusion according to claim 3 is characterized in that: The operation of selecting the state space is achieved through the following formula: , , for t The output of the round selection state space, for t The input of the round, 、 They are t -1 round, t The potential state quantity of the round, 、 、 They are the state matrix, control matrix and output matrix respectively.

5. The smart contract vulnerability detection method based on multimodal selection state space fusion according to claim 1 is characterized in that: The specific operations for obtaining text modality embedding features in S2 are: Convert the intermediate representation text and bytecode text into token sequences respectively, obtaining intermediate representation token sequences and bytecode token sequences, respectively, which are processed by the trained BERT model, and the output of the CLS tag is used to obtain the intermediate representation context information and bytecode context information; The intermediate representation context information and bytecode context information are batch normalized and ReLU activated respectively, and then concatenated to obtain the text modality embedding features.

6. The smart contract vulnerability detection method based on multimodal selection state space fusion according to claim 1 is characterized in that: The types of syntactic elements in the smart contract to be inspected in S1 include: brackets, keywords, operators, identifiers, currency units, and comments.

7. The smart contract vulnerability detection method based on multimodal selection state space fusion according to claim 1 is characterized in that: The operation of residual graph convolution network processing in S2 is implemented by the following formula: , , 、 Respectively l Layer, l -1 layer of residual graph convolution features, For the l The weight matrix of the convolutional layer, is the adjacency matrix of the contract graph, is the degree matrix of the adjacency matrix, For the last layer L The residual graph convolution features of the layer, For sorting pooling processing, For maximum pooling processing, is the global semantic feature, Processed by the sigmoid function.

8. A smart contract vulnerability detection system based on multimodal selection state space fusion, used to implement the smart contract vulnerability detection method based on multimodal selection state space fusion according to claim 1, characterized in that: include: Multiple modal data generation modules are used to obtain the abstract syntax tree of the smart contract to be inspected. After simplification, data flow information is added to obtain the contract graph; Convert the abstract syntax tree of the smart contract to be inspected into a structure, obtain the sequence of each function operation instruction in the structure, and obtain the intermediate representation text; compile the source code of the smart contract to be inspected, obtain the runtime bytecode generated by the compilation, and convert it into a sequence to obtain the bytecode text; Different types of syntax elements in the smart contract to be inspected are color-coded and mapped to generate a color image; Map each bytecode of the smart contract to be inspected into grayscale pixels to generate a grayscale image; The modality embedding processing module is used to process the contract graph through the residual graph convolutional network and the residual attention network respectively to obtain global semantic features and local semantic features, which are mapped to the same shared space to obtain graph modality embedding features; The text context information of the intermediate representation text and bytecode text is obtained respectively, and feature alignment is performed based on linear projection and batch normalization to obtain text modality embedding features; After being processed by a dual-channel convolutional neural network, the color image and the grayscale image are spliced to obtain the visual modality embedding features; The multimodal fusion feature generation module is used for image modality embedding features, text modality embedding features, and visual modality embedding features. After several rounds of feature cross processing based on the selection state space, the image modality embedding cross features, text modality embedding cross features, and visual modality embedding cross features are obtained. After weighted pooling, they are globally fused to obtain multimodal fusion features. The vulnerability detection result generation module is used to classify the multimodal fusion features after feature normalization and regularization to obtain the vulnerability detection results.

9. A smart contract vulnerability detection device based on multimodal selection state space fusion, characterized in that: The system comprises a processor and a memory, wherein when the processor executes the computer program stored in the memory, the method for detecting smart contract vulnerabilities based on multimodal selection state space fusion according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that Used to store a computer program, wherein when the computer program is executed by a processor, it implements the smart contract vulnerability detection method based on multimodal selection state space fusion as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Transformer-based Ponare fraud detection method under comparison of multiple views

    CN117408698A

  • Data governance and security for digital assests

    US20230328104A1