WO2020253476A1 - 一种区块链中智能合约的监控方法及装置 - Google Patents
一种区块链中智能合约的监控方法及装置 Download PDFInfo
- Publication number
- WO2020253476A1 WO2020253476A1 PCT/CN2020/092174 CN2020092174W WO2020253476A1 WO 2020253476 A1 WO2020253476 A1 WO 2020253476A1 CN 2020092174 W CN2020092174 W CN 2020092174W WO 2020253476 A1 WO2020253476 A1 WO 2020253476A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- operation code
- determined
- call
- smart contract
- needs attention
- 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
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/55—Detecting local intrusion or implementing counter-measures
- G06F21/552—Detecting local intrusion or implementing counter-measures involving long-term monitoring or reporting
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
- G06F21/577—Assessing vulnerabilities and evaluating computer system security
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45587—Isolation or security of virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/03—Indexing scheme relating to G06F21/50, monitoring users, programs or devices to maintain the integrity of platforms
- G06F2221/034—Test or assess a computer or a system
Definitions
- the present invention relates to the field of Fintech, in particular to a method and device for monitoring smart contracts in a blockchain.
- Blockchain technology is no exception, but due to the security of the financial industry , Real-time requirements, but also higher requirements for technology.
- Smart contract is a computer protocol designed to spread, verify, or execute a contract in an information-based way. The execution process is agreed and confirmed on the blockchain in the form of transactions. Smart contracts allow trusted transactions without a third party, which are traceable and irreversible.
- This application provides a method and device for monitoring smart contracts in a blockchain to improve the security of smart contracts.
- An embodiment of the present invention provides a method for monitoring a smart contract in a blockchain, including: obtaining a transaction request; invoking a corresponding smart contract according to the transaction request; during the process of executing the transaction request by the smart contract, If it is determined that the called operation code is the operation code that needs attention, it is determined whether the operation code that needs attention meets the error condition of the monitoring rule; if it is, the abnormal result of the called operation code is output according to the monitoring rule; The abnormal result includes a blocking operation for the operation code.
- the transaction request is obtained; the corresponding smart contract is called according to the transaction request; in the process of the smart contract executing the transaction request, if it is determined that the called operation code is the operation code that needs attention, It is determined whether the operation code that needs attention meets the error condition of the monitoring rule; if so, the abnormal result of the called operation code is output according to the monitoring rule; the abnormal result includes the blocking of the operation code operating.
- the operation status can be checked in real time, dangerous transactions can be terminated in time, and the security of smart contracts can be effectively improved.
- the operation code that needs attention is a timestamp operation code; if it is determined that the called operation code is the operation code that needs attention, it is determined whether the operation code that needs attention meets the error of the monitoring rule
- the condition includes: if it is determined that the transaction value in the input parameter of the transaction request is greater than a preset constant value, determining that the timestamp operation code meets the error condition of the timestamp exception.
- the operation code that needs attention is the calling operation code; if it is determined that the operation code that needs attention is the operation code that needs attention, it is determined whether the operation code that needs attention meets the error condition of the monitoring rule , Including: if in the process of executing the transaction request by the smart contract, the calling operation code is the non-first calling operation code, and the calling node of the calling operation code is the first calling operation code of the transaction If the node is executed, and the transaction value in the input parameter of the calling operation code is greater than the preset constant value, it is determined that the calling operation code satisfies the error condition that the function is reentrant.
- the operation code that needs attention is a commissioned invocation operation code; if it is determined that the operation code that needs to be called is an operation code that needs attention, it is determined whether the operation code that needs attention meets the error of the monitoring rule
- the condition includes: determining whether the operating environment of the smart contract is the operating environment of the commissioned call operation code; if so, determining that the commissioned call operation code meets the error condition of the dangerous call.
- the operation code that needs attention is the calling operation code; if it is determined that the operation code that needs attention is the operation code that needs attention, it is determined whether the operation code that needs attention meets the error condition of the monitoring rule , Including: the input transaction value is greater than the first preset threshold, the upper transaction limit is greater than the second preset threshold, and the result returned by the calling operation code is insufficient gas; then it is determined that the calling operation code meets the error condition of insufficient fee .
- the method before the smart contract executes the transaction request, the method further includes: establishing a data structure storing monitoring information of the at least one operation code according to the transaction request; At least one monitoring rule corresponding to the operation code is stored in the data structure.
- the operation code that needs attention is a calculation operation code; if it is determined that the called operation code is an operation code that needs attention, it is determined whether the operation code that needs attention meets the error condition of the monitoring rule , Including: if it is determined that the output result of the calculation operation code meets the error condition of calculation overflow, determining that the calculation call operation code meets the error condition of calculation overflow.
- the method further includes: if it is determined that an error condition that satisfies the monitoring rule does not appear in the operation result of the operation code that needs attention, executing the operation of the operation code.
- the embodiment of the present invention also provides a monitoring device for smart contracts in the blockchain, including:
- the transceiver unit is used to obtain transaction requests
- the processing unit is configured to call the corresponding smart contract according to the transaction request; in the process of the smart contract executing the transaction request, if it is determined that the called operation code is the operation code that requires attention, then it is determined that the attention is required Whether the operation code meets the error condition of the monitoring rule; if so, output the abnormal result of the called operation code according to the monitoring rule; the abnormal result includes the blocking operation for the operation code.
- the operation code that needs attention is a timestamp operation code; the processing unit is specifically configured to: if it is determined that the transaction value in the input parameter of the transaction request is greater than a preset constant value, determine The timestamp operation code meets the error condition of the timestamp exception.
- the operation code that needs attention is a call operation code; the processing unit is specifically configured to: if the call operation code is a non-transaction code during the execution of the transaction request by the smart contract When the operation code is called for the first time, and the transaction value in the input parameter of the call operation code is greater than the preset constant value, it is determined that the call operation code meets the error condition that the function can be reentered.
- the operation code to be paid attention to is a commissioned call operation code; the processing unit is specifically configured to: determine whether the operating environment of the smart contract is the operating environment of the commissioned call operation code; if so , It is determined that the commissioned call operation code meets the error condition of the dangerous call.
- the operation code to be paid attention to is the calling operation code; the processing unit is specifically configured to: the input transaction value is greater than a first preset threshold, the transaction upper limit is greater than a second preset threshold, and If the result returned by the calling operation code is insufficient gas, it is determined that the calling operation code meets the error condition of insufficient gas.
- the operation code that needs attention is a calculation operation code; the processing unit is specifically configured to: if it is determined that the output result of the calculation operation code meets the error condition of calculation overflow, determine the calculation The operation code is called to satisfy the error condition of the calculation overflow.
- the processing unit is further configured to: according to the transaction request, establish a data structure for storing the monitoring information of the at least one operation code; and combine the at least one monitoring information corresponding to the at least one operation code
- the rules are stored in the data structure.
- the processing unit is further configured to: if it is determined that an error condition that satisfies the monitoring rule does not appear in the operation result of the operation code that needs attention, execute the operation of the called operation code.
- the embodiment of the present invention also provides an electronic device, including:
- At least one processor and, a memory communicatively connected with the at least one processor;
- the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the method described above.
- the embodiment of the present invention also provides a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium storing computer instructions, and the computer instructions are used to make the computer execute the method described above.
- Fig. 1 is a schematic flowchart of a method for monitoring smart contracts in a blockchain according to an embodiment of the present invention
- FIG. 2 is a schematic diagram of a virtual machine architecture of a smart contract provided by an embodiment of the present invention
- FIG. 3 is a schematic diagram of the execution result of a method for monitoring smart contracts in a blockchain according to an embodiment of the present invention
- FIG. 4 is a schematic structural diagram of a monitoring device for smart contracts in a blockchain provided by an embodiment of the present invention.
- FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
- Blockchain A chain composed of a series of blocks. In addition to recording the data of the block, each block also records the Hash value of the previous block. In this way, a chain is formed.
- a block consists of a block header and a block body.
- the block header definition includes important fields such as the block height h, the hash value prevHash of the previous block, and the block body mainly stores transaction data.
- Smart contract In the prior art smart contract, taking Ethereum as an example, when the smart contract is triggered, the execution of the smart contract can include: the smart contract party, which is the relevant participant who executes the smart contract, through the external account of the smart contract party Send messages to trigger smart contracts; smart contract resource collections are the participant resources involved in the execution of smart contracts, such as the accounts of each smart contract party, digital property owned, etc.; transactions in smart contracts mainly include data that needs to be sent; and smart contracts The events in is the description of these data. After the transaction and event information is received by the execution node of the smart contract, the resource status in the smart contract resource collection will be updated, which in turn triggers the smart contract to perform state machine judgment.
- Smart contract including current resource state judgment, next smart contract transaction execution selection, etc.; if the smart contract system determines that the trigger conditions contained in the event are met, the automatic state machine of the smart contract automatically sends out preset data resources, and includes triggers Conditional event; smart contract transaction collection, which is the next action or behavior collection of the smart contract, which controls the assets of the smart contract and responds to the received information.
- the execution of blockchain-based smart contracts can include:
- Step 1 Check the smart contracts in the block regularly, traverse the state machine, transactions and trigger conditions in each smart contract one by one; push the transactions that meet the conditions to the queue to be verified, and wait for consensus; transactions that do not meet the trigger conditions Will continue to be stored on the blockchain.
- Step 2 The transaction that enters the latest round of verification will spread to each verification node.
- the verification node first performs signature verification to ensure the validity of the transaction; the transaction that has passed the verification will enter the consensus set , After most verification nodes reach a consensus, the transaction will be successfully executed and the user will be notified.
- the execution of smart contracts by each node is independent of each other. When each node finishes executing the smart contract, they will verify whether the results are consistent with each other. After the verification is passed, the results will be returned to the user.
- Step 3 After the transaction is executed successfully, the state of the smart contract will determine the state of the smart contract. When all the transactions included in the smart contract have been executed sequentially, the state of the smart contract will be marked as complete and the state will start from the latest block. Remove the smart contract; otherwise, it will be marked as in progress, and continue to be saved in the latest block to wait for the next round of processing until the processing is completed; the entire transaction and state processing are automatically processed by the built-in smart contract system at the bottom of the blockchain Completed, the whole process is transparent and unchangeable.
- the account information of each smart contract party, the access interface, and the method of accessing each interface are stored.
- the access interface is allocated to the designated partner for authorization according to the agreement of the parties, and each smart contract party can realize the access to the data in the smart contract through the access interface.
- each smart contract party executes the smart contract, it needs to poll the smart contract through the data access interface, and determine the task to be completed based on the polling result. The execution result of the task is stored in the smart contract through the smart contract interface.
- Consensus An algorithm in which each node of the blockchain agrees on the correctness of a transaction.
- Solidity A high-level language for smart contracts that runs on the Ethereum virtual machine (EVM).
- Ethereum is a platform based on blockchain technology.
- developers can develop their own decentralized applications.
- the Ethereum platform has become the world's second largest blockchain public chain network, second only to the Bitcoin platform in scale.
- the programs developed on Ethereum are called smart contracts. Developers use a Turing-complete language, such as Solidity, to write smart contracts to complete the functions they want to achieve.
- Turing-complete language such as Solidity
- Fuzzing testing is a relatively mature security testing method, which lies between complete manual testing and fully automated testing.
- Fuzzing tools for smart contracts such as Echidna and ContractFuzzer, can simulate transaction execution to discover vulnerabilities in the design of smart contracts.
- Symbolic execution technology uses symbolic values to represent the input of the program, and converts the operation process of the program into mathematical expressions instruction by instruction, sentence by sentence, and generates a symbolic execution tree on the basis of the control flow graph, and establishes a series for each path Symbolic expression with input as a variable.
- symbolic execution tools for smart contracts that can trigger critical paths and detect security vulnerabilities.
- an embodiment of the present invention provides a method for monitoring smart contracts in a blockchain.
- the method for monitoring smart contracts in a blockchain provided by the embodiment of the present invention includes The following steps:
- Step 101 Obtain a transaction request
- a transaction can call multiple operation codes; a transaction can also call multiple smart contracts, which is not limited here.
- Step 102 According to the transaction request, call the corresponding smart contract
- Step 103 In the process of executing the transaction request by the smart contract, if it is determined that the called operation code is the operation code that needs attention, it is determined whether the operation code that needs attention meets the error condition of the monitoring rule;
- Step 104 If yes, output the abnormal result of the called operation code according to the monitoring rule, and perform a blocking operation for the operation code.
- the embodiment of the present invention in view of the shortcomings of the prior art, provides real-time protection and protection for the Ethereum virtual machine to execute the smart contract by monitoring the operation code of the smart contract in real time, detects dangerous transactions in time, blocks the execution of problematic transactions in time, and prompts the user The transaction is potentially harmful, which effectively improves the security of the smart contract.
- the embodiments of the present invention can solve the above-mentioned problems at the EVM level.
- the method for monitoring smart contracts in the blockchain provided by the embodiment of the present invention may be composed of the following functional modules, as shown in FIG. 2, including: a monitoring rule module, an operation code monitoring module, and a virtual machine execution module.
- the monitoring rule module may store error conditions corresponding to the operation codes that need attention; for example, the operation codes that need attention and the blocking conditions of dangerous transactions are determined according to the monitoring rules. Specifically, it may include: determining monitoring rules based on each type of dangerous transaction, filtering out the operation codes related to the type that need attention, defining the error conditions that need to be met and the operations that need to be performed to block the transaction.
- the monitoring rule module provides related error conditions to determine whether the called operator meets the error conditions. If the conditions are met, the monitoring rule module or virtual machine execution module can call the blocking mechanism to block the execution of the smart contract and roll back the state of the blockchain system.
- the embodiment of the present invention provides corresponding strategies for real-time monitoring.
- the embodiment of the present invention determines the monitoring rule according to the main error type that causes the transaction to fail during the execution of the transaction.
- embodiments of the present invention provide the following monitoring rules:
- the operation code that needs attention is a calculation operation code; if it is determined that the called operation code is an operation code that needs attention, it is determined whether the operation code that needs attention meets the error condition of the monitoring rule ,include:
- an overflow operation causes property damage, which is an overflow error.
- an overflow error For example, ADD, SUB, MUL, ADDMOD, MULMOD, EXP, etc. If any one of the following error conditions is met when the above operation code is executed, it proves that an overflow error has occurred: two positive numbers are added, and the result of the operation is negative;
- a negative number is subtracted from a positive number, the result of the operation is a positive number; two positive numbers are multiplied, and the result of the operation is a negative number;
- Two negative numbers perform a multiplication operation, and the result of the operation is a negative number; a positive number performs an exponential operation, and the result of the operation is a negative number.
- the operation code that needs attention is a timestamp operation code; if it is determined that the transaction value in the input parameter of the transaction request is greater than a preset constant value, it is determined that the timestamp operation code is a time-satisfaction Poke abnormal error conditions.
- the preset constant value here can be 0, of course, it can also be set according to actual needs, which is not limited here.
- Timestamp error In an application that uses the current time to generate a certain random number, the value of the random number is duplicated or leaked because the miner controls the timestamp. For example, the operation code that needs attention related to timestamp errors is timestamp TIMESTAMP. If at the beginning of a transaction execution, the parameter value passed in when calling the CALL function is greater than zero, or when the CALL function tries to send resources to other smart contracts, When the TIMESTAMP opcode appears, a time stamp error may occur.
- the call operation code is the non-first call operation code
- the call node of the call operation code is the first call of the transaction Is the execution node of the operation code
- the transaction value in the input parameter of the call operation code is greater than the preset constant value
- the called smart contract may be executed multiple times, causing repeated execution of the same operation, which may result in cost loss.
- the operation code of the function reentrant error focus is CALL.
- the execution node of the opcode for the first call of the transaction that is, the originating caller of the call chain corresponding to the transaction
- it calls itself in the call chain
- the transaction value passed during this call is not the expected value
- the preset constant value here can be 0, of course, it can also be set according to actual needs, which is not limited here.
- the operation code that needs attention is a non-first call operation code; if it is determined that the output of the call operation code that appears for the first time does not have an abnormal error, and the output of the call operation code during execution does not have an abnormal error , It is determined that the calling operation code meets the error condition of exception handling.
- a possible implementation manner if it is determined that the called operation code is a delegated invocation operation code, then determine whether the operating environment of the smart contract is the operation environment of the delegated invocation operation code; if so, determine the delegated invocation The opcode is to satisfy the error condition of the dangerous call.
- the delegateCall operator when the delegateCall operator is called, if the calling process is to obtain the called smart contract and execute it locally, some parameters of the function in the called smart contract will be passed to the caller, so that the public function in the smart contract is exposed. The attacker can use this operation to enable the owner of the smart contract to transfer resources to the attacker's account or other dangerous accounts.
- the operation code of the dangerous call error concern is DelegateCall.
- a function called by DelegateCall can fully control the original smart contract through the input parameter value (such as msg.data), then a dangerous call error will occur.
- a possible implementation manner if the called operation code is a calling operation code, and the input transaction value is greater than a first preset threshold, the transaction upper limit is greater than a second preset threshold, and the result returned by the calling operation code is The cost of gas is insufficient; it is determined that the calling operation code meets the error condition of insufficient cost.
- the sender when the sender calls the send function to transfer resources to the receiver, it will call the callback function of the receiving smart contract. Ethereum stipulates that this process can consume up to a preset resource quota such as 2300. If the callback function of the receiving smart contract requires If the calling fee is greater than the preset resource quota, an insufficient fee error will occur, resulting in additional resource loss for the sender.
- a preset resource quota such as 2300.
- the operation code that is not enough to pay attention to is the operation code Call.
- the value passed is greater than or equal to the preset constant, for example, not 0, and the upper limit of the set cost is the preset resource amount, and it can be determined that the call of the operation code Call is a send operation. If the result returned by the send operation this time is ErrOutOfGas, it is determined that the calling operation code meets the error condition of insufficient cost.
- the virtual machine execution module can insert monitoring rules and interrupt mechanisms in the appropriate position of the source code of the virtual machine to obtain the execution information of the operation code of the smart contract in real time, and dynamically monitor and capture the execution process of the transaction in real time. Dangerous operations and timely block transactions.
- the process of interpreting and executing the smart contract by the virtual machine may include the following steps:
- Step 1 Determine whether the operation code is an operation code that needs attention
- the operation code to be concerned can be a dangerous operation code or a starting operation code.
- Step 2 Determine whether to insert the currently called operation code into the data structure of the operation code according to the judgment result
- Step 3 Before each operation code is executed, analyze the storage structure of the operation code corresponding to the transaction;
- it may include, if it is determined that the called operation code is the operation code that needs attention, then determining whether the operation code that needs attention meets the error condition of the monitoring rule.
- Step 4 After traversing all the monitoring rules, if a dangerous operation is found, stop execution immediately; otherwise, go to step 5;
- Step 5 Normally execute the current operation code and return the execution result of the operation code.
- a possible implementation method If a possible vulnerability threat is found, the virtual machine immediately outputs an abnormal warning, restores the block status, and terminates the continued execution of the transaction.
- the virtual machine in the embodiment of the present invention can check the running status in real time and terminate dangerous transactions in time.
- the method further includes:
- the embodiment of the present invention provides a method for monitoring smart contracts in the blockchain. Through monitoring at the virtual machine layer, some dangerous behaviors can be diagnosed during the execution of the smart contract, and transaction execution can be blocked in time, and an alarm can be issued. , Effectively improve the security of smart contracts.
- the virtual machine in the embodiment of the present invention can effectively discover vulnerabilities in smart contracts, and can also block and alarm vulnerabilities that cannot be identified by traditional vulnerability detection tools.
- the virtual machine in the embodiment of the present invention can make up for the deficiencies of the smart contract detection tool.
- the virtual machine can also be captured and terminated in time. As shown in FIG.
- the virtual machine in the embodiment can detect potential threats that the smart contract test tool cannot detect in time, and block the execution of dangerous transactions 100%.
- the at least one monitoring rule corresponding to the at least one operation code is stored in the data structure.
- the operation code structure is a user-defined data structure.
- the operation code structure stores the operation codes that need attention during the execution process, and records the operation codes and runtime information that need attention related to the analysis of dangerous behaviors. Specifically, you can The operation code sequence of the operation code is stored for further error condition analysis.
- the operation code monitoring module includes a data structure for storage for storing operation codes.
- the selection of the stored data structure can be determined according to the monitoring rules. If the monitoring rule focuses on the opcode and its operand itself, some linear structures can be used to store the opcode. If the monitoring rules pay more attention to the relationship between opcodes, some topologies can be used to store the opcodes.
- the newly inserted operation code should be inserted into a specific position of the data structure according to the monitoring rules to realize the operation code structure.
- the data structure is a data stack, and the operation codes are stored according to the execution order of the operation codes.
- the construction of the opcode structure can be based on data structures such as stacks, queues, and trees, and the choice of implementation can depend on the complexity of the monitoring rules. For example, if you only consider the adjacency relationship between opcodes, you can choose stack or queue; a possible implementation, if the strategy focuses on more complex relationships between opcodes, you can use a tree structure.
- the establishment and operation of the operation code structure can include three parts: the initialization of the operation code structure, the storage of the operation code, and the analysis of the operation code at runtime.
- the operation code structure is first initialized.
- the embodiment of the present invention takes the data structure of the stack as an example for illustration. For example, a new operation code stack structure is established for each transaction.
- the storage process of the operation code includes: before each operation code is executed, the operation code is updated to the operation code structure. For example, the opcode is pushed into the stack structure.
- the monitoring rules and the operation code structure can be inserted into the source code of the virtual machine through the virtual machine execution module, so as to analyze the operation code structure through all the monitoring rules to achieve Effective monitoring of virtual machines executing smart contracts. For example, if the execution result of the operation code in the data structure is considered dangerous, that is, if any error condition in the monitoring rule is met, the execution process of the operation code will be interrupted.
- the monitoring rules can be stored in a new directory under the directory of the virtual machine project.
- Each monitoring rule can be encapsulated as a function with a return value of Boolean type, and the interrupt mechanism can be encapsulated as an operation that throws an exception. .
- a possible implementation manner for the execution process of the opcode structure may include:
- Step 1 If it is determined that the initial call operation code of the transaction is the call operation code CALL, a new stack named op_Stack is created and initialized, and the first operation code is pushed onto the stack;
- the initialization operation is inserted after the location of the CALL opcode.
- Step 2 If it is determined that the currently called operation code is the operation code that needs attention, the called operation code is pushed onto the stack, and all monitoring rules are traversed to test the current operation code structure to determine whether its status is safe.
- Step 3 If it is confirmed that there is no abnormal result, confirm that the current operation code is a safe operation code, execute the current operation code, and start the monitoring of the next operation code; otherwise, proceed to step 4;
- Step 4 Call the interrupt mechanism to block the execution of the transaction, and at the same time prompt the user that the transaction is potentially harmful.
- the virtual machine execution module insert the monitoring rules, interrupt mechanism and operation code structure in the appropriate position of the source code of the virtual machine to obtain the real-time execution information of the operation code of the smart contract, and to dynamically perform the transaction execution process Real-time monitoring, capturing dangerous operations and blocking transactions in time, effectively improving monitoring efficiency.
- the virtual machine provided by the embodiment of the present invention supports virtual machines written based on different languages and is suitable for multiple application scenarios. Developers of the blockchain platform can embed monitoring rules into the virtual machine provided in the embodiment of the present invention; for example, users of Ethereum can use the encapsulated virtual machine in the embodiment of the present invention to conduct transactions, and when an abnormal situation occurs Block transactions in time to avoid unnecessary losses.
- an embodiment of the present invention also provides a monitoring device for smart contracts in a blockchain, as shown in FIG. 4, including:
- the transceiver unit 401 is used to obtain a transaction request
- the processing unit 402 is configured to call the corresponding smart contract according to the transaction request; in the process of executing the transaction request by the smart contract, if it is determined that the called operation code is the operation code that needs attention, then determine the need Whether the operation code concerned meets the error condition of the monitoring rule; if so, output the abnormal result of the called operation code according to the monitoring rule; the abnormal result includes the blocking operation for the operation code.
- the operation code that needs attention is a timestamp operation code; the processing unit 402 is specifically configured to:
- the operation code that needs attention is a call operation code; the processing unit 402 is specifically configured to:
- the call operation code is a non-first call operation code, and the transaction value in the input parameter of the call operation code is greater than a preset constant value, then it is determined The described calling opcode satisfies the error condition that the function can be reentrant.
- the operation code that needs attention is a commissioned call operation code; the processing unit 402 is specifically configured to:
- the operation code that needs attention is a call operation code; the processing unit is specifically used for:
- the upper transaction limit is greater than the second preset threshold, and the result returned by the calling operation code is insufficient gas, it is determined that the calling operation code meets the error condition of insufficient fee.
- processing unit 402 is further configured to:
- the at least one monitoring rule corresponding to the at least one operation code is stored in the data structure.
- the processing unit is further configured to:
- the present invention also provides an electronic device, as shown in FIG. 5, including:
- It includes a processor 701, a memory 702, a transceiver 703, and a bus interface 704, wherein the processor 701, the memory 702 and the transceiver 703 are connected through the bus interface 704;
- the processor 701 is configured to read the program in the memory 702 and execute the following method:
- the transaction request call the corresponding smart contract; during the execution of the transaction request by the smart contract, if it is determined that the called operation code is the operation code that needs attention, it is determined whether the operation code that needs attention is satisfied The error condition of the monitoring rule; if it is, the abnormal result of the called operation code is output according to the monitoring rule; the abnormal result includes the blocking operation for the operation code.
- the operation code that needs attention is a timestamp operation code; the processor 701 is specifically configured to:
- the operation code that needs attention is a call operation code; the processor 701 is specifically configured to:
- the call operation code is a non-first call operation code, and the transaction value in the input parameter of the call operation code is greater than a preset constant value, then it is determined The described calling opcode satisfies the error condition that the function can be reentrant.
- the operation code that needs attention is a delegate call operation code; the processor 701 is specifically used for:
- the operation code that needs attention is a call operation code; the processor 701 is specifically configured to:
- the upper transaction limit is greater than the second preset threshold, and the result returned by the calling operation code is insufficient gas, it is determined that the calling operation code meets the error condition of insufficient fee.
- the processor 701 is further configured to:
- the at least one monitoring rule corresponding to the at least one operation code is stored in the data structure.
- the processor 701 is further configured to:
- These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
- the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
- These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
- the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- General Business, Economics & Management (AREA)
- Technology Law (AREA)
- Strategic Management (AREA)
- Marketing (AREA)
- Computing Systems (AREA)
- Economics (AREA)
- Development Economics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
- Debugging And Monitoring (AREA)
Abstract
一种区块链中智能合约的监控方法及装置,涉及科技金融(Fintech)领域,用以提高智能合约的安全性。所述方法包括:获取交易请求(101);根据所述交易请求,调用对应的智能合约(102);在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件(103);若是,则根据所述监控规则,输出所述调用的操作码的异常结果,并执行针对所述操作码的阻断操作(104)。
Description
相关申请的交叉引用
本申请要求在2019年06月21日提交中国专利局、申请号为201910541002.4、申请名称为“一种区块链中智能合约的监控方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本发明涉及科技金融(Fintech)领域,尤其涉及一种区块链中智能合约的监控方法及装置。
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(finteh)转变,区块链(block chain)技术也不例外,但由于金融行业的安全性、实时性要求,也对技术提出的更高的要求。
智能合约(smart contract)是一种旨在以信息化方式传播、验证或执行合同的计算机协议,其执行过程以交易的形式在区块链上共识、确认。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。
目前,区块链系统的安全性受到越来越多人的关注,在智能合约的漏洞检测上,目前还没有比较好的方案,以保证区块链系统的安全性。
发明内容
本申请提供一种区块链中智能合约的监控方法及装置,用以提高智能合约的安全性。
本发明实施例提供的一种区块链中智能合约的监控方法,包括:获取交易请求;根据所述交易请求,调用对应的智能合约;在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述 需关注的操作码是否满足监控规则的错误条件;若是,则根据所述监控规则,输出所述调用的操作码的异常结果;所述异常结果包括针对所述操作码的阻断操作。
本发明实施例中,通过获取交易请求;根据所述交易请求,调用对应的智能合约;在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件;若是,则根据所述监控规则,输出所述调用的操作码的异常结果;所述异常结果包括针对所述操作码的阻断操作。可以实时检查运行状态,及时终止危险交易,有效提高智能合约的安全性。
一种可能的实现方式,所述需关注的操作码为时间戳操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:若确定所述交易请求的输入参数中的交易值大于预设常数值,则确定所述时间戳操作码为满足时间戳异常的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:若在所述智能合约执行所述交易请求的过程中,所述调用操作码为非首次的调用操作码,所述调用操作码的调用节点为所述交易的首次调用的操作码的执行节点,且所述调用操作码的输入参数中的交易值大于预设常数值,则确定所述调用操作码满足函数可重入的错误条件。
一种可能的实现方式,所述需关注的操作码为委托调用操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:判断所述智能合约的操作环境是否为所述委托调用操作码的操作环境;若是,则确定所述委托调用操作码为满足危险调用的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:输入的交易值大于第一预设阈值,交易上限大于第 二预设阈值,且所述调用操作码返回的结果为费用gas不足;则确定所述调用操作码满足费用不足的错误条件。
一种可能的实现方式,所述在所述智能合约执行所述交易请求之前,还包括:根据所述交易请求,建立存储所述至少一个操作码的监控信息的数据结构;将所述至少一个操作码的对应的至少一个监控规则,存储至所述数据结构中。
一种可能的实现方式,所述需关注的操作码为计算操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:若确定所述计算操作码的输出结果满足计算溢出的错误条件,则确定所述计算调用操作码为满足计算溢出的错误条件。
一种可能的实现方式,所述方法还包括:若确定所述需关注的操作码的运行结果中,未出现满足监控规则的错误条件,则执行所述操作码的操作。
本发明实施例还提供一种区块链中智能合约的监控装置,包括:
收发单元,用于获取交易请求;
处理单元,用于根据所述交易请求,调用对应的智能合约;在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件;若是,则根据所述监控规则,输出所述调用的操作码的异常结果;所述异常结果包括针对所述操作码的阻断操作。
一种可能的实现方式,所述需关注的操作码为时间戳操作码;所述处理单元,具体用于:若确定所述交易请求的输入参数中的交易值大于预设常数值,则确定所述时间戳操作码为满足时间戳异常的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述处理单元,具体用于:若在所述智能合约执行所述交易请求的过程中,所述调用操作码为非首次的调用操作码,且所述调用操作码的输入参数中的交易值大于预设常数值,则确定所述调用操作码满足函数可重入的错误条件。
一种可能的实现方式,所述需关注的操作码为委托调用操作码;所述处 理单元,具体用于:判断所述智能合约的操作环境是否为所述委托调用操作码的操作环境;若是,则确定所述委托调用操作码为满足危险调用的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述处理单元,具体用于:输入的交易值大于第一预设阈值,交易上限大于第二预设阈值,且所述调用操作码返回的结果为费用gas不足,则确定所述调用操作码满足费用不足的错误条件。
一种可能的实现方式,所述需关注的操作码为计算操作码;所述处理单元,具体用于:若确定所述计算操作码的输出结果满足计算溢出的错误条件,则确定所述计算调用操作码为满足计算溢出的错误条件。
一种可能的实现方式,所述处理单元,还用于:根据所述交易请求,建立存储所述至少一个操作码的监控信息的数据结构;将所述至少一个操作码的对应的至少一个监控规则,存储至所述数据结构中。
一种可能的实现方式,所述处理单元,还用于:若确定所述需关注的操作码的运行结果中,未出现满足监控规则的错误条件,则执行所述调用的操作码的操作。
本发明实施例还提供一种电子设备,包括:
至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;
其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如上所述的方法。
本发明实施例还提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行如上所述的方法。
图1为本发明实施例提供的一种区块链中智能合约的监控方法的流程示 意图;
图2为本发明实施例提供的一种智能合约的虚拟机架构示意图;
图3为本发明实施例提供的一种区块链中智能合约的监控方法的执行结果示意图;
图4为本发明实施例提供的一种区块链中智能合约的监控装置的结构示意图;
图5为本发明实施例提供的电子设备的结构示意图。
为了便于理解,下面对本发明实施例中可能涉及的名词进行定义和解释。
区块链:是由一系列区块组成的一条链,每个块上除了记录本块的数据还会记录上一块的Hash(哈希)值,通过这种方式组成一条链。区块链的核心理念有两个,一个是密码学技术,另一个是去中心化思想,基于这两个理念做到区块链上的历史信息无法被篡改。一个区块由块头和块体组成,其中块头定义包括该区块高度h,上一个区块的Hash值prevHash等重要字段,而块体主要存储交易数据。
智能合约:现有技术的智能合约中,以以太坊为例,在触发智能合约时,智能合约的执行可以包括:智能合约方,为执行智能合约的相关参与者,通过智能合约方的外部账户发送消息,触发智能合约;智能合约资源集合,为智能合约执行涉及的参与者资源,比如各智能合约方账户、拥有的数字财产等;智能合约中的事务主要包含需要发送的数据;而智能合约中的事件则是对这些数据的描述信息。事务及事件信息被智能合约的执行节点接收后,智能合约资源集合中的资源状态会被更新,进而触发智能合约进行状态机判断。状态机,包括当前资源状态判断、下一步智能合约事务执行选择等;智能合约系统若确定事件中包含的触发条件满足时,从智能合约的自动状态机自动发出预设的数据资源,以及包括触发条件的事件;智能合约事务集合,为智能合约的下一步动作或行为集合,控制着智能合约的资产并对接收到的信息 进行回应。
具体的,基于区块链的智能合约的执行可以包括:
步骤一、定期检查区块中的智能合约,逐条遍历每个智能合约内的状态机、事务以及触发条件;将条件满足的事务推送到待验证的队列中,等待共识;未满足触发条件的事务将继续存放在区块链上。
步骤二、进入最新轮验证的事务,会扩散到每一个验证节点,与普通区块链交易或事务一样,验证节点首先进行签名验证,确保事务的有效性;验证通过的事务会进入待共识集合,等大多数验证节点达成共识后,事务会成功执行并通知用户。各节点执行智能合约是相互独立的,当各节点执行智能合约完毕时,将彼此验证结果是否一致,验证通过后,将结果返回至用户。
步骤三、事务执行成功后,智能合约的状态机会判断所属智能合约的状态,当智能合约包括的所有事务都顺序执行完后,状态机会将智能合约的状态标记为完成,并从最新的区块中移除该智能合约;反之将标记为进行中,继续保存在最新的区块中等待下一轮处理,直到处理完毕;整个事务和状态的处理都由区块链底层内置的智能合约系统自动完成,全程透明、不可攥改。
智能合约中,存储了各智能合约方的账户信息,访问接口,以及访问各接口的方法。智能合约发布时,根据各方约定将访问接口分配给指定的合作方授权使用,各智能合约方通过访问接口可实现对智能合约内数据的存取。各智能合约方执行智能合约时需要通过数据访问接口轮询智能合约,并根据轮询结果来判断所需完成的任务,任务的执行结果通过智能合约的接口保存在智能合约当中。
共识:一种区块链各节点对某个交易的正确性达成一致的算法。
Solidity:一种智能合约高级语言,运行在以太坊虚拟机(ethereum virtual machine,EVM)之上。
以太坊是一个基于区块链技术的平台,在以太坊中,开发者可以开发自己的去中心化的应用。随着人们对区块链技术不断深入的探索和认识,以太坊平台已经成为世界第二大区块链公链网络,规模仅次于比特币平台。在以 太坊上开发的程序叫做智能合约,开发者利用一种图灵完备的语言,比如Solidity来编写智能合约,完成自己想要实现的功能。近些年来,在以太坊平台日益发展的同时,针对智能合约和平台本身的攻击也越来越多,造成的财产损失十分巨大。比如2018年2月,一个新的公链代币平台美链上线,在4月某攻击者利用一个ERC-20智能合约中的溢出漏洞攻击了美链平台,成功将美链中巨量的代币转入其他的两个账户地址,最终导致美链平台在一夜之间损失64亿人民币,相当于美链全部的市值。近些年像这样的例子层出不穷,区块链系统的安全性受到越来越多人的关注,以太坊平台作为第一个区块链开发生态环境,其安全性受到社会各界人士的关注。
为了解决这些安全性的问题,目前针对智能合约的安全保障工具使用的方法主要分为两种:模糊测试技术和符号执行技术。模糊测试是一种相对成熟的安全测试方法,它介于完全的手工测试和完全的自动化测试之间。针对智能合约的模糊测试工具比如Echidna和ContractFuzzer可以通过模拟交易执行以发现智能合约在设计上存在的漏洞。符号执行技术使用符号值来表示程序的输入,并将程序的运算过程逐指令,逐语句地转换为数学表达式,在控制流图的基础上生成符号执行树,并为每一条路径建立一系列以输入为变量的符号表达式。目前有一些面向智能合约的符号执行工具,它们可以触发关键路径并检测安全漏洞。但是,上述工具往往会遗漏某些漏洞。例如,利用ContractFuzzer运行一份已知存在时间戳错误的智能合约,经过两个小时的测试,ContractFuzzer依然没有检测到该安全漏洞的存在。这说明只在智能合约的层次上关注安全问题是不全面的。
为了解决上述现有技术中的问题,本发明实施例提供了一种区块链中智能合约的监控方法,如图1所示,本发明实施例提供的区块链中智能合约的监控方法包括以下步骤:
步骤101:获取交易请求;
其中,一笔交易可以调用多个操作码;一笔交易也可以调用多个智能合约,在此不做限定。
步骤102:根据所述交易请求,调用对应的智能合约;
步骤103:在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件;
步骤104:若是,则根据所述监控规则,输出所述调用的操作码的异常结果,并执行针对所述操作码的阻断操作。
本发明实施例,针对现有技术的不足,通过实时监测智能合约的操作码,为以太坊虚拟机执行智能合约提供实时保障防护,及时发现危险交易,及时阻断问题交易的执行,并提示用户该交易存在潜在危害,有效的提高了智能合约的安全性。
本发明实施例可以通过在EVM层面解决上述问题。本发明实施例所提供的区块链中智能合约的监控方法可以由以下功能模块组成,如图2所示,包括:监控规则模块、操作码监控模块、虚拟机执行模块。其中,监控规则模块中可以存储有需关注的操作码对应的错误条件;例如,根据监控规则确定需关注的操作码和危险交易的阻断条件。具体的,可以包括:基于每种危险交易的类型确定监控规则,筛选出与该类型相关的需关注的操作码,定义其需要满足的错误条件和阻断交易需进行的操作。
针对不同的危险操作,监控规则模块提供相关的错误条件去判定调用的操作符是否满足错误条件。如果条件满足,监控规则模块或虚拟机执行模块可以调用阻断机制,对智能合约的执行进行阻断,并回滚区块链系统的状态。
针对以上安全漏洞类型,本发明实施例提供相应的策略进行实时监控。本发明实施例根据在交易的执行过程中,导致交易失败的主要错误类型,确定监控规则。针对不同的漏洞类型,本发明实施例提供如下监控规则:
一种可能的实现方式,所述需关注的操作码为计算操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:
若确定所述计算操作码的输出结果满足计算溢出的错误条件,则确定所 述计算调用操作码为满足计算溢出的错误条件。
在执行计算操作时,出现溢出操作导致财产损失,为溢出错误。例如,ADD、SUB、MUL、ADDMOD、MULMOD和EXP等。如果在执行上述操作码时,满足以下条错误条件中的任意一条,就证明发生了溢出错误:两个正数执行加法运算,运算结果为负数;
两个负数执行加法运算,运算结果为正数;一个正数减去一个负数,运算结果为负数;
一个负数减去一个正数,运算结果为正数;两个正数执行乘法运算,运算结果为负数;
两个负数执行乘法运算,运算结果为负数;一个正数执行指数运算,运算结果为负数。
一种可能的实现方式,所述需关注的操作码为时间戳操作码;若确定所述交易请求的输入参数中的交易值大于预设常数值,则确定所述时间戳操作码为满足时间戳异常的错误条件。此处的预设常数值可以为0,当然,还可以根据实际需要进行设定,在此不做限定。
时间戳错误:在采用当前时间生成某种随机数的应用中,因为矿工控制时间戳而导致随机数的数值重复或泄露。例如,与时间戳错误相关的需关注的操作码为时间戳TIMESTAMP,如果在一次交易执行的开端,调用CALL函数时传入的参数值大于零,或者CALL函数尝试向其他智能合约发送资源时,出现了时间戳TIMESTAMP操作码,就可能发生了时间戳错误。
一种可能的实现方式,若在所述智能合约执行所述交易请求的过程中,所述调用操作码为非首次的调用操作码,所述调用操作码的调用节点为所述交易的首次调用的操作码的执行节点,且所述调用操作码的输入参数中的交易值大于预设常数值,则确定所述调用操作码满足函数可重入的错误条件。此处的预设常数值可以为0,当然,还可以根据实际需要进行设定,在此不做限定。
具体的,在调用其他函数的操作完成之前,被调用智能合约可能会被多 次执行,造成同一操作的反复执行,可能导致的费用损失。
例如,函数可重入错误关注的操作码为CALL。当一个所述交易的首次调用的操作码的执行节点(即交易对应的调用链的起源调用者),在调用链中又调用了自己本身,同时这次调用过程中传递的交易值不为预设常数值,并且这次调用过程设置了足够多的费用上限,那么我们认为函数可重入错误可能出现。此处的预设常数值可以为0,当然,还可以根据实际需要进行设定,在此不做限定。
一种可能的实现方式,所述需关注的操作码为非首次的调用操作码;若确定首次出现的调用操作码的输出未存在异常错误,且执行过程中的调用操作码的输出未异常错误,则确定所述调用操作码满足异常处理的错误条件。
具体的,当一个智能合约以不同的方式调用另一个智能合约时,Solidity没有一个一致的方法来处理异常,导致调用智能合约无法获取被调用智能合约的异常信息。异常处理错误关注的操作码也只有CALL。当一个调用链里面的首次调用的调用操作码的输出结果没有输出为异常,而调用链中的任意一次调用的调用操作码的输出结果为异常,则认为存在异常处理错误,可能的原因是一些异常结果并没有传递到根调用的调用操作码上,导致执行过程中出现错误。
一种可能的实现方式,若确定所述调用的操作码为委托调用操作码,则判断所述智能合约的操作环境是否为所述委托调用操作码的操作环境;若是,则确定所述委托调用操作码为满足危险调用的错误条件。
具体的,调用delegateCall操作符时,若调用过程是获取调用的智能合约在本地执行,则被调用的智能合约中的函数的部分参数将会传递至调用方,使得智能合约中的public函数暴露,攻击者可以通过该操作,使得智能合约的拥有者向攻击者的账户或其他危险账户中传递资源。例如,危险调用错误关注的操作码是DelegateCall。当一次DelegateCall调用的函数可以通过输入的参数值(比如msg.data)完全掌控原始的智能合约,那么一次危险调用错误就会出现。
一种可能的实现方式,若所述调用的操作码为调用操作码,且输入的交易值大于第一预设阈值,交易上限大于第二预设阈值,且所述调用操作码返回的结果为费用gas不足;则确定所述调用操作码满足费用不足的错误条件。
具体的,当发送者调用send函数给接收者传递资源时,会调用接收智能合约的回调函数,以太坊中规定这个过程最多可消耗预设资源额度如2300,如果接收智能合约的回调函数需要的调用的费用大于这个预设资源额度,就会发生费用不足错误,造成发送方额外的资源损失。
例如,费用不足错误关注的操作码为调用操作码Call。当一次调用操作码Call调用的时候传递的值大于或等于预设常数,例如不为0,并且设置的费用上限是预设资源额度,可以判定这次调用操作码Call是一次传递send操作。如果这次传递send操作返回的结果是ErrOutOfGas,则确定所述调用操作码满足费用不足的错误条件。
虚拟机执行模块,可以通过在虚拟机的源代码的适当位置通过插桩,插入监控规则和中断机制,以实时获取智能合约的操作码的执行信息,对交易的执行过程进行动态实时监测,捕捉危险操作并及时阻断交易。
本发明实施例中,虚拟机对智能合约进行解释执行的过程中,可以包括以下步骤:
步骤一、判断操作码是不是需关注的操作码;
其中,需关注的操作码可以为危险操作码或起始操作码。
步骤二、根据判断结果决定是否将当前调用的操作码插入操作码的数据结构;
步骤三、在每一个操作码执行之前,对该交易对应的操作码的存储结构进行分析;
具体的,可以包括若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件。
步骤四、在遍历所有的监控规则之后,如果发现危险操作,立即停止执行;否则,执行步骤五;
步骤五、正常执行当前操作码,并返回操作码的执行结果。
一种可能的实现方式,若发现可能的漏洞威胁,虚拟机会立即输出异常警告,并对区块状态进行复原,终止交易的继续执行。本发明实施例中的虚拟机就可以实时检查运行状态,及时终止危险交易。
一种可能的实现方式,所述方法还包括:
若确定所述需关注的操作码的运行结果中,未出现满足监控规则的错误条件,则执行所述操作码的操作。
本发明实施例提供一种区块链中智能合约的监测方法,通过在虚拟机层进行监测,可以在执行智能合约的过程中实施诊断出一些危险行为,并及时阻断交易执行,并发出警报,有效提高智能合约的安全性。
本发明实施例中的虚拟机可以有效地发掘智能合约中的漏洞,对传统漏洞检测工具无法甄别出来的漏洞,也可以进行阻断和报警。本发明实施例中的虚拟机可以弥补智能合约检测工具的不足,针对难以被智能合约测试工具发现的危险交易,也可以通过虚拟机及时捕捉并终止,如图3所示,经过测试,本发明实施例中的虚拟机可以及时发现智能合约测试工具检测不到的潜在威胁,并100%阻断危险交易的执行。
一种可能的实现方式,为进一步提高监控效率,在步骤202之前,还可以包括:
根据所述交易请求,建立存储所述至少一个操作码的监控信息的数据结构;
将所述至少一个操作码的对应的至少一个监控规则,存储至所述数据结构中。
操作码结构是一种用户定义的数据结构,操作码结构存储了执行过程中涉及到的需关注的操作码,记录与危险行为分析相关的需关注的操作码和运行时信息,具体的,可以通过对操作码的操作码序列进行存储,以进行进一步的错误条件分析。
操作码监控模块包括一个用于存储的数据结构,用于存储操作码。存储 的数据结构的选择可以根据监控规则确定。如果监控规则关注操作码和它的操作数本身,可以采用一些线性结构对操作码进行存储。如果监控规则更关注操作码之间的关系,那么可以采用一些拓扑结构对操作码进行存储。新插入的操作码要根据监控规则,插入到数据结构的特定位置,以实现操作码结构。例如,数据结构为数据栈,根据操作码的执行顺序,存储操作码。
操作码结构的构建可以基于堆栈、队列、树等数据结构,实现方式的选择可以取决于监控规则的复杂性。例如,如果只考虑操作码之间的邻接关系,可以选择栈或队列;一种可能的实现方式,如果策略侧重于操作码之间更复杂的关系,则可以采用树结构。
在具体实施过程中,操作码结构的建立及操作可以包括三个部分:操作码结构的初始化、操作码的存储和操作码运行时的分析。
在每个调用过程中,首先对操作码结构进行初始化,本发明实施例以堆栈的数据结构为例进行说明,例如,为每笔交易建立一个新的操作码的栈结构。
操作码的存储过程包括:在执行每个操作码之前,将该操作码更新至操作码结构中。例如,将操作码压入所述栈结构中。
对所述操作码进行监控规则的分析,可以通过虚拟机执行模块,将监控规则和操作码结构通过插桩,插入到虚拟机的源码中,以通过所有监控规则对操作码结构进行分析,实现虚拟机执行智能合约的有效监测。例如,如果数据结构中的操作码的执行结果被认为是危险的,即满足监控规则中的任一错误条件,则所述操作码的执行过程将被中断。
在具体实施过程中,监控规则可以存储在虚拟机项目的目录下的一个新目录中,每种监控规则可以封装为一个返回值为布尔类型的函数,中断机制可以封装为一个抛出异常的操作。
一种可能的实现方式,对于操作码结构的执行过程,可以包括:
步骤一、若确定交易的初始调用的操作码为调用操作码CALL,则建立一个名为op_Stack的新栈并进行初始化,将第一个操作码压入栈中;
其中,一种可能的实现方式,初始化操作被插入到CALL操作码所在位置之后。
针对交易过程中的每个操作码,执行以下监控步骤:
步骤二、若确定当前调用的操作码为需关注的操作码,则将所述调用的操作码压入栈,遍历所有监控规则对当前操作码结构进行测试,判断其状态是否安全。
步骤三、如果确认未存在异常结果则确认当前操作码为安全操作码,执行当前的操作码,并开启执行下一操作码的监控;否则,执行步骤四;
步骤四、调用中断机制阻断交易执行,同时向用户提示该交易存在潜在危害。
通过虚拟机执行模块,在虚拟机的源代码的适当位置通过插桩,插入监控规则、中断机制和操作码结构,来获取实时的智能合约的操作码的执行信息,对交易的执行过程进行动态实时监测,捕捉危险操作并及时阻断交易,有效提高了监测效率。
本发明实施例提供的虚拟机,支持基于不同语言编写的虚拟机,适用于多种应用场景。区块链平台的开发者可以将监控规则嵌入到本发明实施例提供的虚拟机中;例如,以太坊使用者可以使用封装好的本发明实施例中的虚拟机进行交易,在发生异常情况时及时阻断交易,避免不必要的损失。
基于相同的发明构思,本发明实施例还提供了一种区块链中智能合约的监控装置,如图4所示,包括:
收发单元401,用于获取交易请求;
处理单元402,用于根据所述交易请求,调用对应的智能合约;在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件;若是,则根据所述监控规则,输出所述调用的操作码的异常结果;所述异常结果包括针对所述操作码的阻断操作。
一种可能的实现方式,所述需关注的操作码为时间戳操作码;所述处理 单元402,具体用于:
若确定所述交易请求的输入参数中的交易值大于预设常数值,则确定所述时间戳操作码为满足时间戳异常的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述处理单元402,具体用于:
若在所述智能合约执行所述交易请求的过程中,所述调用操作码为非首次的调用操作码,且所述调用操作码的输入参数中的交易值大于预设常数值,则确定所述调用操作码满足函数可重入的错误条件。
一种可能的实现方式,所述需关注的操作码为委托调用操作码;所述处理单元402,具体用于:
判断所述智能合约的操作环境是否为所述委托调用操作码的操作环境;若是,则确定所述委托调用操作码为满足危险调用的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述处理单元,具体用于:
输入的交易值大于第一预设阈值,交易上限大于第二预设阈值,且所述调用操作码返回的结果为费用gas不足,则确定所述调用操作码满足费用不足的错误条件。
一种可能的实现方式,所述处理单元402,还用于:
根据所述交易请求,建立存储所述至少一个操作码的监控信息的数据结构;
将所述至少一个操作码的对应的至少一个监控规则,存储至所述数据结构中。
一种可能的实现方式,所述处理单元,还用于:
若确定所述需关注的操作码的运行结果中,未出现满足监控规则的错误条件,则执行所述调用的操作码的操作。
基于相同的原理,本发明还提供一种电子设备,如图5所示,包括:
包括处理器701、存储器702、收发机703、总线接口704,其中处理器701、存储器702与收发机703之间通过总线接口704连接;
所述处理器701,用于读取所述存储器702中的程序,执行下列方法:
根据所述交易请求,调用对应的智能合约;在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件;若是,则根据所述监控规则,输出所述调用的操作码的异常结果;所述异常结果包括针对所述操作码的阻断操作。
一种可能的实现方式,所述需关注的操作码为时间戳操作码;所述处理器701,具体用于:
若确定所述交易请求的输入参数中的交易值大于预设常数值,则确定所述时间戳操作码为满足时间戳异常的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述处理器701,具体用于:
若在所述智能合约执行所述交易请求的过程中,所述调用操作码为非首次的调用操作码,且所述调用操作码的输入参数中的交易值大于预设常数值,则确定所述调用操作码满足函数可重入的错误条件。
一种可能的实现方式,所述需关注的操作码为委托调用操作码;所述处理器701,具体用于:
判断所述智能合约的操作环境是否为所述委托调用操作码的操作环境;若是,则确定所述委托调用操作码为满足危险调用的错误条件。
一种可能的实现方式,所述需关注的操作码为调用操作码;所述处理器701,具体用于:
输入的交易值大于第一预设阈值,交易上限大于第二预设阈值,且所述调用操作码返回的结果为费用gas不足,则确定所述调用操作码满足费用不足的错误条件。
一种可能的实现方式,所述处理器701,还用于:
根据所述交易请求,建立存储所述至少一个操作码的监控信息的数据结构;
将所述至少一个操作码的对应的至少一个监控规则,存储至所述数据结构中。
一种可能的实现方式,所述处理器701,还用于:
若确定所述需关注的操作码的运行结果中,未出现满足监控规则的错误条件,则执行所述调用的操作码的操作。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包括这些改动和变型在内。
Claims (11)
- 一种区块链中智能合约的监控方法,其特征在于,包括:获取交易请求;根据所述交易请求,调用对应的智能合约;在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件;若是,则根据所述监控规则,输出所述调用的操作码的异常结果,并执行针对所述操作码的阻断操作。
- 如权利要求1所述的方法,其特征在于,所述需关注的操作码为时间戳操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:若确定所述交易请求的输入参数中的交易值大于预设常数值,则确定所述时间戳操作码为满足时间戳异常的错误条件。
- 如权利要求1所述的方法,其特征在于,所述需关注的操作码为调用操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:若在所述智能合约执行所述交易请求的过程中,所述调用操作码为非首次的调用操作码,所述调用操作码的调用节点为所述交易的首次调用的操作码的执行节点,所述调用操作码的输入参数中的交易值大于预设常数值,则确定所述调用操作码满足函数可重入的错误条件。
- 如权利要求1所述的方法,其特征在于,所述需关注的操作码为委托调用操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:判断所述智能合约的操作环境是否为所述委托调用操作码的操作环境;若是,则确定所述委托调用操作码为满足危险调用的错误条件。
- 如权利要求1所述的方法,其特征在于,所述需关注的操作码为调用 操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:输入的交易值大于第一预设阈值,交易上限大于第二预设阈值,且所述调用操作码返回的结果为费用gas不足;则确定所述调用操作码满足费用不足的错误条件。
- 如权利要求1所述的方法,其特征在于,所述需关注的操作码为计算操作码;所述若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件,包括:若确定所述计算操作码的输出结果满足计算溢出的错误条件,则确定所述计算调用操作码为满足计算溢出的错误条件。
- 如权利要求1-6任一项所述的方法,其特征在于,所述在所述智能合约执行所述交易请求之前,还包括:根据所述交易请求,建立存储所述至少一个操作码的监控信息的数据结构;将所述至少一个操作码的对应的至少一个监控规则,存储至所述数据结构中。
- 如权利要求1-6任一项所述的方法,其特征在于,所述方法还包括:若确定所述需关注的操作码的运行结果中,未出现满足监控规则的错误条件,则执行所述操作码的操作。
- 一种区块链中智能合约的监控装置,其特征在于,包括:收发单元,用于获取交易请求;处理单元,用于根据所述交易请求,调用对应的智能合约;在所述智能合约执行所述交易请求的过程中,若确定调用的操作码为需关注的操作码,则判断所述需关注的操作码是否满足监控规则的错误条件;若是,则根据所述监控规则,输出所述调用的操作码的异常结果;所述异常结果包括针对所述操作码的阻断操作。
- 一种电子设备,其特征在于,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-8任一所述的方法。
- 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求1~8任一所述方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910541002.4A CN110263536B (zh) | 2019-06-21 | 2019-06-21 | 一种区块链中智能合约的监控方法及装置 |
| CN201910541002.4 | 2019-06-21 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020253476A1 true WO2020253476A1 (zh) | 2020-12-24 |
Family
ID=67920198
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2020/092174 Ceased WO2020253476A1 (zh) | 2019-06-21 | 2020-05-25 | 一种区块链中智能合约的监控方法及装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110263536B (zh) |
| WO (1) | WO2020253476A1 (zh) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114490321A (zh) * | 2021-12-21 | 2022-05-13 | 杭州趣链科技有限公司 | 区块链稳定性测试方法、系统和电子设备 |
| CN116933266A (zh) * | 2023-07-05 | 2023-10-24 | 浙江工业大学 | 一种跨链智能合约的污点追踪方法 |
| CN120123430A (zh) * | 2025-05-14 | 2025-06-10 | 粤港澳大湾区数字经济研究院(国际先进技术应用推进中心(深圳)) | 系统状态的加载方法、系统、设备及计算机可读存储介质 |
Families Citing this family (14)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110263536B (zh) * | 2019-06-21 | 2024-05-24 | 深圳前海微众银行股份有限公司 | 一种区块链中智能合约的监控方法及装置 |
| CN110597916B (zh) * | 2019-09-21 | 2021-03-26 | 腾讯科技(深圳)有限公司 | 基于区块链的数据处理方法、装置、存储介质及终端 |
| CN110599343B (zh) * | 2019-09-21 | 2021-04-13 | 腾讯科技(深圳)有限公司 | 合约数据处理方法、相关设备及介质 |
| CN110688677B (zh) * | 2019-09-24 | 2020-12-22 | 北京海益同展信息科技有限公司 | 用于执行智能合约的方法和装置 |
| CN110956476A (zh) * | 2019-12-17 | 2020-04-03 | 江苏扬子易联智能软件有限公司 | 一种基于区块链实现gmp/gsp自动监管的方法和平台 |
| WO2021146988A1 (en) * | 2020-01-22 | 2021-07-29 | Shanghai Wormholes Tech Ltd. | Method and apparatus for protecting smart contracts against attacks |
| CN111510348B (zh) * | 2020-04-08 | 2021-08-31 | 杭州复杂美科技有限公司 | 一种异常挖矿监控方法、设备及存储介质 |
| CN111522660B (zh) * | 2020-04-16 | 2024-05-24 | 武汉有牛科技有限公司 | 基于区块链技术的大数据监控解决方案 |
| CN112487092B (zh) * | 2020-12-03 | 2024-06-18 | 深圳前海微众银行股份有限公司 | 一种基于区块链的智能合约调用方法及装置 |
| CN112650627B (zh) * | 2020-12-28 | 2025-07-11 | 杭州趣链科技有限公司 | 智能合约的数据恢复方法、装置、终端设备及存储介质 |
| CN113051574B (zh) * | 2021-03-11 | 2023-03-21 | 哈尔滨工程大学 | 一种智能合约二进制代码的漏洞检测方法 |
| CN113867903B (zh) * | 2021-12-06 | 2022-04-01 | 深圳前海微众银行股份有限公司 | 一种区块链中智能合约的并行冲突域确定方法及装置 |
| CN114202215B (zh) * | 2021-12-15 | 2025-03-04 | 中山大学 | 智能合约交易异常维护方法、装置、设备及可读存储介质 |
| CN114297654B (zh) * | 2021-12-31 | 2024-11-22 | 北京工业大学 | 一种源代码层级的智能合约漏洞检测方法及系统 |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107886000A (zh) * | 2017-11-13 | 2018-04-06 | 华中科技大学 | 一种软件漏洞检测方法、分级响应方法及软件漏洞检测系统 |
| CN108256337A (zh) * | 2018-02-26 | 2018-07-06 | 北京阿尔山金融科技有限公司 | 智能合约漏洞检测方法、装置及电子设备 |
| CN109492402A (zh) * | 2018-10-25 | 2019-03-19 | 杭州趣链科技有限公司 | 一种基于规则引擎的智能合约安全评测方法 |
| CN109493226A (zh) * | 2018-11-21 | 2019-03-19 | 北京物资学院 | 一种基于区块链的智能合约状态监测系统及监测方法 |
| WO2019070357A1 (en) * | 2017-10-06 | 2019-04-11 | Siemens Aktiengesellschaft | METHOD AND SYSTEM FOR PLATFORM OF SECURE AND PRIVATE TERM OPERATIONS IN TRANSACTIVE MICROARRAYS |
| CN109767329A (zh) * | 2018-12-29 | 2019-05-17 | 北京金山安全软件有限公司 | 一种异常交易检测方法、装置、电子设备及存储介质 |
| CN110263536A (zh) * | 2019-06-21 | 2019-09-20 | 深圳前海微众银行股份有限公司 | 一种区块链中智能合约的监控方法及装置 |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11176519B2 (en) * | 2016-11-11 | 2021-11-16 | International Business Machines Corporation | Smart contract admission check and fault tolerance in a blockchain |
| CN109508981A (zh) * | 2017-09-15 | 2019-03-22 | 富士通株式会社 | 用于测试智能合约的方法和装置 |
| CN109240900A (zh) * | 2018-08-16 | 2019-01-18 | 北京京东尚科信息技术有限公司 | 区块链网络服务平台及其智能合约检测方法、存储介质 |
| CN109800175B (zh) * | 2019-02-20 | 2020-08-11 | 河海大学 | 一种基于代码插桩的以太坊智能合约重入漏洞检测方法 |
-
2019
- 2019-06-21 CN CN201910541002.4A patent/CN110263536B/zh active Active
-
2020
- 2020-05-25 WO PCT/CN2020/092174 patent/WO2020253476A1/zh not_active Ceased
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2019070357A1 (en) * | 2017-10-06 | 2019-04-11 | Siemens Aktiengesellschaft | METHOD AND SYSTEM FOR PLATFORM OF SECURE AND PRIVATE TERM OPERATIONS IN TRANSACTIVE MICROARRAYS |
| CN107886000A (zh) * | 2017-11-13 | 2018-04-06 | 华中科技大学 | 一种软件漏洞检测方法、分级响应方法及软件漏洞检测系统 |
| CN108256337A (zh) * | 2018-02-26 | 2018-07-06 | 北京阿尔山金融科技有限公司 | 智能合约漏洞检测方法、装置及电子设备 |
| CN109492402A (zh) * | 2018-10-25 | 2019-03-19 | 杭州趣链科技有限公司 | 一种基于规则引擎的智能合约安全评测方法 |
| CN109493226A (zh) * | 2018-11-21 | 2019-03-19 | 北京物资学院 | 一种基于区块链的智能合约状态监测系统及监测方法 |
| CN109767329A (zh) * | 2018-12-29 | 2019-05-17 | 北京金山安全软件有限公司 | 一种异常交易检测方法、装置、电子设备及存储介质 |
| CN110263536A (zh) * | 2019-06-21 | 2019-09-20 | 深圳前海微众银行股份有限公司 | 一种区块链中智能合约的监控方法及装置 |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114490321A (zh) * | 2021-12-21 | 2022-05-13 | 杭州趣链科技有限公司 | 区块链稳定性测试方法、系统和电子设备 |
| CN116933266A (zh) * | 2023-07-05 | 2023-10-24 | 浙江工业大学 | 一种跨链智能合约的污点追踪方法 |
| CN120123430A (zh) * | 2025-05-14 | 2025-06-10 | 粤港澳大湾区数字经济研究院(国际先进技术应用推进中心(深圳)) | 系统状态的加载方法、系统、设备及计算机可读存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110263536A (zh) | 2019-09-20 |
| CN110263536B (zh) | 2024-05-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2020253476A1 (zh) | 一种区块链中智能合约的监控方法及装置 | |
| CN111563742B (zh) | 智能合约交易顺序依赖漏洞变异模糊测试方法 | |
| Wang et al. | Oracle-supported dynamic exploit generation for smart contracts | |
| Torres et al. | The art of the scam: Demystifying honeypots in ethereum smart contracts | |
| CN104392175B (zh) | 一种云计算系统中云应用攻击行为处理方法、装置及系统 | |
| Nelaturu et al. | Verified development and deployment of multiple interacting smart contracts with VeriSolid | |
| WO2023035751A1 (zh) | 移动端应用的智能混淆 | |
| CN111831275B (zh) | 一种编排微场景剧本的方法、服务器、介质及计算机设备 | |
| CN113946825B (zh) | 一种内存马处理方法及系统 | |
| CN115292708A (zh) | 基于字节码的执行权限分析方法及装置 | |
| CN107239698A (zh) | 一种基于信号处理机制的反调试方法和装置 | |
| Li et al. | Protect your smart contract against unfair payment | |
| CN110138778A (zh) | 一种基于博弈论的网络攻击风险控制方法及系统 | |
| CN116150770A (zh) | 区块链的合约漏洞检测方法、装置和设备 | |
| Wu et al. | Following the “Thread”: Toward Finding Manipulatable Bottlenecks in Blockchain Clients | |
| CN117113334A (zh) | 一种操作命令的拦截方法、装置、系统及计算机存储介质 | |
| CN115292707A (zh) | 基于动态类调用序列的可信度判断方法及装置 | |
| CN115510448A (zh) | 检测erc20代币合约鉴权漏洞的方法、系统及存储介质 | |
| US9032326B2 (en) | Late instantiation of dependent objects | |
| CN118734322A (zh) | 基于多维度行为分析的软件安全风险管理方法 | |
| Prasad et al. | Detection of ethereum smart contracts vulnerabilities over Blockchain | |
| CN115994360A (zh) | 基于运行时信息的可重入漏洞检测方法及系统 | |
| CN117834263B (zh) | 一种针对区块链合约的重入攻击检测方法和装置 | |
| CN117093999A (zh) | 远程代码执行漏洞检测方法、装置、设备、介质及产品 | |
| CN118916873B (zh) | 一种基于敏感调用图的内感知软件威胁检测方法 |
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: 20825555 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: 20825555 Country of ref document: EP Kind code of ref document: A1 |