WO2021114093A1 - 一种基于深度学习的智能合约漏洞检测方法 - Google Patents
一种基于深度学习的智能合约漏洞检测方法 Download PDFInfo
- Publication number
- WO2021114093A1 WO2021114093A1 PCT/CN2019/124326 CN2019124326W WO2021114093A1 WO 2021114093 A1 WO2021114093 A1 WO 2021114093A1 CN 2019124326 W CN2019124326 W CN 2019124326W WO 2021114093 A1 WO2021114093 A1 WO 2021114093A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- smart contract
- code
- vulnerabilities
- training
- neural network
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
Definitions
- the invention belongs to the field of block chains and relates to a method for detecting smart contract vulnerabilities based on deep learning.
- Smart contract is one of the core technologies of blockchain, a consensus rule in multi-party participation scenarios, and the center of value transmission.
- the essence of a smart contract is a piece of code running in the blockchain network, which completes the business logic assigned by the user. Taking the token of the Ethereum system as an example, its business logic is token issuance and transaction.
- smart contracts were designed into a model that cannot be modified once deployed. This design may be to improve the credibility of smart contracts.
- the loss to the user is huge and irreversible.
- the current mainstream smart contract vulnerability detection is divided into three categories.
- the first category is the matching of feature codes
- the second category is the automated detection based on morphological verification
- the third category is the automated detection based on symbolic execution and symbol abstraction.
- Feature code matching some abstraction of malicious code, similar to static code detection, through sampling into a semantic match, and then to match its static source code.
- the advantage of this detection method is that it is very fast, because it matches a string of the original code.
- the second is that it can quickly respond to new vulnerabilities, because most of this detection method is developed in the form of plug-ins. For example, if a new vulnerability occurs, then you can quickly submit some new matching patterns.
- an OPCODE When testing the code, through source code or compilation, an OPCODE can be formed and input to the automated analysis engine. After input to the engine, it will be converted into a CFG (ControlFlowGraph control flow chart),
- CFG will package the logic in the contract code into blocks, and when the logic is forked, it will be forked.
- CFG Builder mainly forms a very large and complete CFG for the smart contract code of OPCODE. After the CFG is generated, there are the following two analysis methods:
- Oyente's logic is that after the CFG build is formed, it first passes EXPLORER verification and verifies every process in the code. Next is CodeAnalysis, which converts the EXPLORER path just output and performs some vulnerability verification. Currently only three verifications are provided: TOD, Timestamp dependency, and Mishandled exceptions. Finally, the system uses Microsoft's Z3 to ensure the false positive rate and false negative rate Bit-Vector Solver's open source verifier, and then a package of the overall architecture.
- Securify provides another method. Smart contract code is easy to decouple. For example, some structures and modules that are relatively fixed and decoupled such as Transfer. Therefore, it is not necessary to verify the logic of the entire smart contract, but can decouple the smart contract.
- the various modules of the system are checked and analyzed to improve the degree of automation.
- Securify converts Contract Bytecode into a custom semantic language, and then verifies it through a custom semantic language verification module (similar to pattern matching, converts some vulnerabilities into a verification language pattern matching framework, and then verifies its semantics Correct) and generate a safety report.
- the false negative rate is high. Some functions, features, etc. in the smart contract are still subject to a lot of variability, so the false negative rate will be relatively high.
- Oyente's false negative rate is very high.
- Oyente coverage rate is only 20%, and the remaining 80% of the code cannot be verified.
- the present invention proposes a smart contract vulnerability detection method based on deep learning.
- the method performs vulnerability detection through the deep learning method, realizes automation and improves efficiency.
- the technical solution of the present invention to solve the above problems is: a method for detecting smart contract vulnerabilities based on deep learning, which is special in that it includes the following steps:
- the required detection code is processed and input to the trained neural network for detection, and the result is obtained.
- step 1) the learning and training stage specifically includes the following steps:
- Aiming at smart contract vulnerabilities use this as a key point to analyze the data flow of the smart contract code, and extract function calls from the contract code.
- Data flow analysis is a technology used at compile time. It collects semantic information from smart contract code and uses algebraic methods to determine the definition and use of variables at compile time. Then extract one or more smart contract code fragments from the function call, and the code fragments are semantically related.
- Training is performed by setting different number of tokens (tokens), batch size (batchsize), iteration period (epochs), dropout method, etc. At the same time, use different data sets and set different hidden layers to train the BLSTM neural network and perform tuning at the same time.
- step 2) detection stage specifically includes the following steps:
- the prior art needs to manually define loopholes, and can only identify and analyze the set loopholes.
- the loophole detection method of the present invention performs loophole detection through a deep learning method, which realizes automation and improves efficiency.
- Figure 1 is based on the deep learning smart contract vulnerability detection method and system architecture diagram
- Figure 2 is a diagram of the BLSTM neural network architecture.
- a smart contract vulnerability detection method based on deep learning including the following steps:
- Aiming at the main smart contract vulnerabilities such as integer overflow, external calls, sensitive behaviors, abnormalities, logical sequences, etc., use this as a key point to analyze the data flow of the smart contract code, and extract function calls from the contract code.
- Data flow analysis is a technology used at compile time. It collects semantic information from smart contract code and uses algebraic methods to determine the definition and use of variables at compile time. Then extract one or more smart contract code fragments from the function call, and the code fragments are semantically related.
- the required detection code is processed and input to the trained neural network for detection, and the result is obtained, which specifically includes:
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Description
Claims (3)
- 一种基于深度学习的智能合约漏洞检测方法,其特征在于,包括以下步骤:1)学习训练阶段:针对智能合约代码进行处理,选择合适的神经网络进行训练;2)检测阶段:将需要检测代码进行处理,输入到训练好的神经网络进行检测,得出结果。
- 根据权利要求1所述的一种基于深度学习的智能合约漏洞检测方法,其特征在于:所述步骤1)学习训练阶段,具体包括以下步骤:1.1)针对智能合约漏洞,以此为关键点对智能合约代码进行数据流分析,从合约代码中提取函数调用;1.2)将多个代码分片组合成一个程序分片,然后将每个程序分片标记为真实数据,有漏洞的标为“1”,没有漏洞的标为“0”,作为基本事实;1.3)将程序分片转化为特定的符号表示,以用来保存训练智能合约代码的语义信息;同时建立符号表,并构建一个编码器,编码器的编码方法传入一行符号,返回一个整数列表,使这些符号转化为向量;1.4)将向量和标注好的基本事实输入到BLSTM神经网络。
- 根据权利要求2所述的一种基于深度学习的智能合约漏洞检测方法,其特征在于:所述步骤2)检测阶段,具体包括以下步骤:2.1)将待检测的智能合约代码进行数据流分析,从合约代码中提取函数调用,然后从函数调用中提取一个或多个智能合约代码分片;2.2)将多个代码分片组合成一个程序分片;2.3)将程序分片转化为特定的符号表示,以用来保存训练智能合约代码的语义信息,然后将这些符号表示转化为向量;2.4)使用训练好的BLSTM神经网络进行检测,并得出结果。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2019/124326 WO2021114093A1 (zh) | 2019-12-10 | 2019-12-10 | 一种基于深度学习的智能合约漏洞检测方法 |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2019/124326 WO2021114093A1 (zh) | 2019-12-10 | 2019-12-10 | 一种基于深度学习的智能合约漏洞检测方法 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2021114093A1 true WO2021114093A1 (zh) | 2021-06-17 |
Family
ID=76329194
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/124326 Ceased WO2021114093A1 (zh) | 2019-12-10 | 2019-12-10 | 一种基于深度学习的智能合约漏洞检测方法 |
Country Status (1)
| Country | Link |
|---|---|
| WO (1) | WO2021114093A1 (zh) |
Cited By (22)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113609488A (zh) * | 2021-07-19 | 2021-11-05 | 华东师范大学 | 基于自监督学习及多通道超图神经网络的漏洞检测方法与系统 |
| CN113672515A (zh) * | 2021-08-26 | 2021-11-19 | 北京航空航天大学 | 一种基于符号执行的wasm智能合约漏洞检测方法 |
| CN113886836A (zh) * | 2021-10-19 | 2022-01-04 | 中山大学 | 一种智能合约漏洞的检测方法及相关设备 |
| CN113904844A (zh) * | 2021-10-08 | 2022-01-07 | 浙江工商大学 | 基于跨模态教师-学生网络的智能合约漏洞检测方法 |
| CN114048464A (zh) * | 2022-01-12 | 2022-02-15 | 北京大学 | 基于深度学习的以太坊智能合约安全漏洞检测方法及系统 |
| CN114065219A (zh) * | 2021-11-25 | 2022-02-18 | 扬州大学 | 一种基于孪生网络的智能合约重入漏洞检测方法 |
| CN114201754A (zh) * | 2021-12-06 | 2022-03-18 | 海南师范大学 | 一种基于符号抽象分析的智能合约安全审计方法 |
| CN114817932A (zh) * | 2022-04-26 | 2022-07-29 | 河海大学 | 基于预训练模型的以太坊智能合约漏洞检测方法及系统 |
| CN115174279A (zh) * | 2022-09-09 | 2022-10-11 | 南方科技大学 | 一种以太坊智能合约漏洞实时检测方法、终端及存储介质 |
| CN115391541A (zh) * | 2022-09-06 | 2022-11-25 | 厦门慢雾科技有限公司 | 智能合约代码自动审查方法、存储介质和电子设备 |
| CN115729741A (zh) * | 2022-11-24 | 2023-03-03 | 南通大学 | 一种融合多维度特征的自动定位安全补丁方法 |
| CN116010958A (zh) * | 2022-10-13 | 2023-04-25 | 中国南方电网有限责任公司超高压输电公司 | 一种漏洞分析方法、装置、介质及设备 |
| CN116069937A (zh) * | 2023-03-06 | 2023-05-05 | 湖南天河国云科技有限公司 | 基于神经网络的智能合约分类方法、装置和计算机设备 |
| CN116127466A (zh) * | 2022-12-19 | 2023-05-16 | 杭州电子科技大学 | 一种基于元操作的智能合约漏洞检测方法和系统 |
| CN116340951A (zh) * | 2023-03-17 | 2023-06-27 | 电子科技大学 | 一种基于自监督学习的智能合约漏洞检测方法 |
| CN116340952A (zh) * | 2023-03-17 | 2023-06-27 | 电子科技大学 | 一种基于操作码程序依赖图的智能合约漏洞检测方法 |
| CN116366322A (zh) * | 2023-03-23 | 2023-06-30 | 华东师范大学 | 基于路径剖析及代码插桩的智能合约威胁检测与防护方法 |
| CN116595530A (zh) * | 2022-12-08 | 2023-08-15 | 北京工业大学 | 一种结合对抗迁移学习和多任务学习的智能合约漏洞检测方法 |
| CN117272312A (zh) * | 2023-08-31 | 2023-12-22 | 电子科技大学 | 一种基于强化学习的可解释性智能合约漏洞检测及定位方法 |
| CN118941294A (zh) * | 2024-10-12 | 2024-11-12 | 北京网智天元大数据科技有限公司 | 一种基于深度学习大模型的智能合约风险检测方法及系统 |
| CN119577788A (zh) * | 2024-12-10 | 2025-03-07 | 无锡市区块链高等研究中心 | 基于神经网络的智能合约漏洞检测工具评估方法及系统 |
| CN119720224A (zh) * | 2025-02-26 | 2025-03-28 | 湖南工商大学 | 一种基于区块链的智能合约漏洞分析方法 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160057159A1 (en) * | 2014-08-22 | 2016-02-25 | Syracuse University | Semantics-aware android malware classification |
| CN107885999A (zh) * | 2017-11-08 | 2018-04-06 | 华中科技大学 | 一种基于深度学习的漏洞检测方法及系统 |
| CN109657473A (zh) * | 2018-11-12 | 2019-04-19 | 华中科技大学 | 一种基于深度特征的细粒度漏洞检测方法 |
| CN109933991A (zh) * | 2019-03-20 | 2019-06-25 | 杭州拜思科技有限公司 | 一种智能合约漏洞检测的方法、装置 |
| CN110543419A (zh) * | 2019-08-28 | 2019-12-06 | 杭州趣链科技有限公司 | 一种基于深度学习技术的智能合约代码漏洞检测方法 |
-
2019
- 2019-12-10 WO PCT/CN2019/124326 patent/WO2021114093A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160057159A1 (en) * | 2014-08-22 | 2016-02-25 | Syracuse University | Semantics-aware android malware classification |
| CN107885999A (zh) * | 2017-11-08 | 2018-04-06 | 华中科技大学 | 一种基于深度学习的漏洞检测方法及系统 |
| CN109657473A (zh) * | 2018-11-12 | 2019-04-19 | 华中科技大学 | 一种基于深度特征的细粒度漏洞检测方法 |
| CN109933991A (zh) * | 2019-03-20 | 2019-06-25 | 杭州拜思科技有限公司 | 一种智能合约漏洞检测的方法、装置 |
| CN110543419A (zh) * | 2019-08-28 | 2019-12-06 | 杭州趣链科技有限公司 | 一种基于深度学习技术的智能合约代码漏洞检测方法 |
Cited By (27)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113609488B (zh) * | 2021-07-19 | 2022-07-08 | 华东师范大学 | 基于自监督学习及多通道超图神经网络的漏洞检测方法与系统 |
| CN113609488A (zh) * | 2021-07-19 | 2021-11-05 | 华东师范大学 | 基于自监督学习及多通道超图神经网络的漏洞检测方法与系统 |
| CN113672515A (zh) * | 2021-08-26 | 2021-11-19 | 北京航空航天大学 | 一种基于符号执行的wasm智能合约漏洞检测方法 |
| CN113904844A (zh) * | 2021-10-08 | 2022-01-07 | 浙江工商大学 | 基于跨模态教师-学生网络的智能合约漏洞检测方法 |
| CN113904844B (zh) * | 2021-10-08 | 2023-09-12 | 浙江工商大学 | 基于跨模态教师-学生网络的智能合约漏洞检测方法 |
| CN113886836A (zh) * | 2021-10-19 | 2022-01-04 | 中山大学 | 一种智能合约漏洞的检测方法及相关设备 |
| CN114065219A (zh) * | 2021-11-25 | 2022-02-18 | 扬州大学 | 一种基于孪生网络的智能合约重入漏洞检测方法 |
| CN114201754A (zh) * | 2021-12-06 | 2022-03-18 | 海南师范大学 | 一种基于符号抽象分析的智能合约安全审计方法 |
| CN114048464B (zh) * | 2022-01-12 | 2022-03-15 | 北京大学 | 基于深度学习的以太坊智能合约安全漏洞检测方法及系统 |
| CN114048464A (zh) * | 2022-01-12 | 2022-02-15 | 北京大学 | 基于深度学习的以太坊智能合约安全漏洞检测方法及系统 |
| CN114817932A (zh) * | 2022-04-26 | 2022-07-29 | 河海大学 | 基于预训练模型的以太坊智能合约漏洞检测方法及系统 |
| CN115391541A (zh) * | 2022-09-06 | 2022-11-25 | 厦门慢雾科技有限公司 | 智能合约代码自动审查方法、存储介质和电子设备 |
| CN115174279A (zh) * | 2022-09-09 | 2022-10-11 | 南方科技大学 | 一种以太坊智能合约漏洞实时检测方法、终端及存储介质 |
| CN116010958A (zh) * | 2022-10-13 | 2023-04-25 | 中国南方电网有限责任公司超高压输电公司 | 一种漏洞分析方法、装置、介质及设备 |
| CN115729741A (zh) * | 2022-11-24 | 2023-03-03 | 南通大学 | 一种融合多维度特征的自动定位安全补丁方法 |
| CN115729741B (zh) * | 2022-11-24 | 2026-04-21 | 南通大学 | 一种融合多维度特征的自动定位安全补丁方法 |
| CN116595530A (zh) * | 2022-12-08 | 2023-08-15 | 北京工业大学 | 一种结合对抗迁移学习和多任务学习的智能合约漏洞检测方法 |
| CN116127466A (zh) * | 2022-12-19 | 2023-05-16 | 杭州电子科技大学 | 一种基于元操作的智能合约漏洞检测方法和系统 |
| CN116069937A (zh) * | 2023-03-06 | 2023-05-05 | 湖南天河国云科技有限公司 | 基于神经网络的智能合约分类方法、装置和计算机设备 |
| CN116340951A (zh) * | 2023-03-17 | 2023-06-27 | 电子科技大学 | 一种基于自监督学习的智能合约漏洞检测方法 |
| CN116340952A (zh) * | 2023-03-17 | 2023-06-27 | 电子科技大学 | 一种基于操作码程序依赖图的智能合约漏洞检测方法 |
| CN116366322A (zh) * | 2023-03-23 | 2023-06-30 | 华东师范大学 | 基于路径剖析及代码插桩的智能合约威胁检测与防护方法 |
| CN117272312A (zh) * | 2023-08-31 | 2023-12-22 | 电子科技大学 | 一种基于强化学习的可解释性智能合约漏洞检测及定位方法 |
| CN118941294A (zh) * | 2024-10-12 | 2024-11-12 | 北京网智天元大数据科技有限公司 | 一种基于深度学习大模型的智能合约风险检测方法及系统 |
| CN119577788A (zh) * | 2024-12-10 | 2025-03-07 | 无锡市区块链高等研究中心 | 基于神经网络的智能合约漏洞检测工具评估方法及系统 |
| CN119720224A (zh) * | 2025-02-26 | 2025-03-28 | 湖南工商大学 | 一种基于区块链的智能合约漏洞分析方法 |
| CN119720224B (zh) * | 2025-02-26 | 2025-05-13 | 湖南工商大学 | 一种基于区块链的智能合约漏洞分析方法 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2021114093A1 (zh) | 一种基于深度学习的智能合约漏洞检测方法 | |
| Liao et al. | Soliaudit: Smart contract vulnerability assessment based on machine learning and fuzz testing | |
| Zhang et al. | Ethploit: From fuzzing to efficient exploit generation against smart contracts | |
| Huang | Hunting the ethereum smart contract: Color-inspired inspection of potential attacks | |
| Boi et al. | Smart contract vulnerability detection: The role of large language model (llm) | |
| Sun et al. | Mutation testing for integer overflow in ethereum smart contracts | |
| CN111159012A (zh) | 一种基于深度学习的智能合约漏洞检测方法 | |
| Shakya et al. | Smartmixmodel: machine learning-based vulnerability detection of solidity smart contracts | |
| Saha et al. | Empowering hardware security with llm: The development of a vulnerable hardware database | |
| Li et al. | Stateguard: Detecting state derailment defects in decentralized exchange smart contract | |
| Li et al. | Defitail: Defi protocol inspection through cross-contract execution analysis | |
| Li et al. | Interaction-aware vulnerability detection in smart contract bytecodes | |
| CN117667676A (zh) | 基于aigc的区块链智能合约ide验证测试方法和系统 | |
| Maturi et al. | Enhancing Smart Contract Security with Explainable AI: A Framework for Re-entrancy Vulnerability Detection and Explanation | |
| CN118114256A (zh) | 基于可疑代码路径导向的合约漏洞检测方法及系统 | |
| Jin et al. | LLM-BSCVM: LLM-Based Blockchain Smart Contract Vulnerability Management Framework | |
| Wu et al. | Dappfl: Just-in-time fault localization for decentralized applications in web3 | |
| Jain et al. | Two timin’: Repairing smart contracts with a two-layered approach | |
| CN120086857A (zh) | 电力终端软件的漏洞检测方法、电子设备和存储介质 | |
| Feng et al. | A smart contract vulnerability detection model based on multi-type features and pre-training techniques | |
| Chu et al. | SGDL: Smart contract vulnerability generation via deep learning | |
| CN112581140B (zh) | 一种智能合约验证方法、计算机存储介质 | |
| CN116204877A (zh) | 一种基于图对比学习的代码漏洞检测方法 | |
| Zhao et al. | The security paradox of smart contracts: Blind spots and prospects of current detection strategies | |
| Bhande et al. | Verification and Validation Techniques of Crypto-Currency Smart Contracts within Flutter App |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19955948 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19955948 Country of ref document: EP Kind code of ref document: A1 |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 110123) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19955948 Country of ref document: EP Kind code of ref document: A1 |