The invention discloses an intelligent contract security evaluation method based on rule engine, which includes the following steps: acquiring the target intelligent contract, generating a grammar analyzer according to the language rules of the target intelligent contract, and the target intelligent contract language rules without ambiguity statements; using the grammar analyzer generated by S1 to analyze the target intelligent contract and generate a contract grammar tree; The rule base of the intelligent contract vulnerability rule engine is customized; the contract grammar tree of S2 is scanned continuously by the intelligent contract vulnerability rule engine, and the scanning results of each rule in the rule base are obtained; the standard evaluation of the rule scanning results obtained by S3 is carried out, and the final evaluation results are obtained. The invention solves the problem that the security risk of the intelligent contract is difficult to detect before it is deployed to the block chain, and realizes the detection and protection of the vulnerabilities hidden in the application of the intelligent contract to the block chain.
【技术实现步骤摘要】
一种基于规则引擎的智能合约安全评测方法
本专利技术涉及智能合约的安全评测领域,具体涉及一种基于规则引擎的智能合约安全评测方法。
技术介绍
目前现有的智能合约安全评测方法,主要包括如下几种:基于形式化验证的安全评测方法、基于符号执行与符号抽象的安全评测方法;基于机器学习与深度学习的安全评测方法;其中,基于形式化验证的方法,本质是一个基于数学模型的验证方法,其是通过将智能合约的程序源码转化成特定的数学模型,将合约代码所需要满足的要求作为性质进行证明,即通过数学语言描述合约代码,并证明其满足特定性质,该方法在具体编码实现过程中,通常需要将智能合约源码转化成某种可直接进行形式化验证的中间语言,或者进行数学建模、定义形式化规则。基于符号执行、符号抽象的方法,其基础均是构建程序的ControlFlowGraph(控制流程图)。基于控制流程图的基础上,符号执行的方法通过跟踪程序的每一个执行流程来进行检验,而符号抽象的方法,则是通过解耦合约代码的模块,对解耦后的模块进行校验分析。目前常见的应用该方法的应用及产品有Mythril、Oyenete、Securify,其存在一定的误报率、检测时间较长(单个合约30-60秒)。基于机器学习、深度学习的安全评测方法,其理论基础是基于机器学习、深度学习的代码漏洞检测模型,通过对程序代码构建数值型特征作为模型输入,来完成对模型的训练。该方法存在数据集缺失以及模型检测率不高等缺陷。智能合约是可编程的数字形式的协议,其由特定的合约语言编码而成,合约语言满足图灵完备,通过编译、部署形成可执行的程序。智能合约主要实现区块链上的数据存储、读写以及 ...
【技术保护点】
1.一种基于规则引擎的智能合约安全评测方法,其特征在于,该方法包括如下步骤:S1:获取目标智能合约,根据目标智能合约的语言规则生成语法分析器,所述的目标智能合约语言规则不带有歧义性语句。S2:使用S1生成的语法分析器分析所述的目标智能合约,生成合约语法树;并自定义智能合约漏洞规则引擎的规则库。S3:使用智能合约漏洞规则引擎不断遍历扫描S2的合约语法树,得到规则库中每条规则的扫描结果。S4:对S3获得的规则扫描结果进行标准评测,得到最终的评测结果。
【技术特征摘要】
1.一种基于规则引擎的智能合约安全评测方法,其特征在于,该方法包括如下步骤:S1:获取目标智能合约,根据目标智能合约的语言规则生成语法分析器,所述的目标智能合约语言规则不带有歧义性语句。S2:使用S1生成的语法分析器分析所述的目标智能合约,生成合约语法树;并自定义智能合约漏洞规则引擎的规则库。S3:使用智能合约漏洞规则引擎不断遍历扫描S2的合约语法树,得到规则库中每条规则的扫描结果。S4:对S3获得的规则扫描结果进行标准评测,得到最终的评测结果。2.根据权利要求1所述的基于规则引擎的智能合约安全评测方法,其特征在于,所述的S1中的语法分析器为AN...
【专利技术属性】
技术研发人员:梁秀波,邱炜伟,李启雷,李伟,尹可挺,
申请(专利权)人:杭州趣链科技有限公司,
类型:发明
国别省市:浙江,33
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。