Vulnerability testing method and vulnerability testing device for browser
Through the deep learning network model, the samples of the browser vulnerability syntax library are preprocessed and trained, and exception samples are generated and detected, which solves the problems of redundancy in test code and low detection efficiency in traditional methods, and realizes more efficient browser vulnerability detection .
Patent Information
- Application Number
- CN202110340809.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-30
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-03-30
AI Technical Summary
Traditional browser vulnerability detection methods have problems such as redundancy in testing code and low detection efficiency. Samples generated by random strategies are easy to repeat, and the probability of correct syntax is high, making it difficult to detect browser vulnerabilities.
The deep learning network model is used to preprocess and train the sample syntax data selected from the vulnerability syntax library, generate the initial samples to be tested, and form abnormal samples through model prediction and assembly processing, input to the browser for analysis and monitoring, and detect faults When confirming the sample is an exception and save the log.
It improves the efficiency of browser vulnerability detection, reduces test code redundancy, increases the probability of vulnerability detection, and improves detection depth and accuracy.
Smart Images

Figure CN115146272B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information security, and in particular to a vulnerability testing method for a browser and a vulnerability testing device thereof. Background Art
[0002] With the development of network technology, more and more people learn about the world through the Internet. The most common tool for people to enter the Internet world is the browser, so the security of the browser is very important. In the process of traditional browser vulnerability detection, it is usually preferred to construct an HTML (hypertext markup language) file with a syntax template. The random strategy generates a sample set by adding, deleting, modifying, etc. according to the syntax template. This large number of random operations makes the generated samples have the following deficiencies in the process of browser vulnerability detection:
[0003] Test code redundancy: Based on random seeds and grammar rule templates; random testing easily results in the generation of a large amount of duplicate code, reducing detection efficiency.
[0004] For example, traditional test code uses a large JavaScript syntax library, such as the following 6 lines of code:
[0005] Var1 = var1.add(1+2);
[0006] Var2=var2.sub(obj.err.a-77623);
[0007] Var3=new array(1,2,3,4,5,6,7);
[0008] var var_rand1=var_dataview1[4];
[0009] let var_rand2=var_string1;
[0010] var var_rand3=var_arraybuf4[-1079235270];
[0011] Then randomly select test code from this grammar library. For example, randomly select the following:
[0012] Var1 = var1.add(1+2);
[0013] Var1 = var1.add(1+2);
[0014] Var1 = var1.add(1+2);
[0015] However, the above three lines of code are repeated, which causes test code redundancy and reduces detection efficiency. In addition, in the above grammar library, the probability of correct grammar is relatively high. When testing the browser with correct grammar, the browser will not crash, and it is not easy to find vulnerabilities, which also reduces detection efficiency. Summary of the invention
[0016] A technical problem solved by the present disclosure is to provide a vulnerability testing method for a browser to improve detection efficiency.
[0017] According to one aspect of the present disclosure, a vulnerability testing method for a browser is provided, comprising: selecting sample grammar data from a vulnerability grammar library, preprocessing the sample grammar data to obtain a set of data to be trained; training the set of data to be trained using a deep learning network model to obtain an initial set of samples to be tested, the initial set of samples to be tested comprising an initial plurality of first samples to be tested; performing model prediction and assembly processing on at least a portion of the plurality of first samples to be tested in the initial set of samples to be tested to form a second sample to be tested; inputting the second sample to be tested into a browser so that the browser parses the second sample to be tested, and monitoring the running status of the browser; and determining that the second sample to be tested is an abnormal sample when a failure in the operation of the browser is detected, generating abnormal log data, and saving the abnormal sample and the abnormal log data.
[0018] In some embodiments, the step of preprocessing the sample grammatical data includes: parsing the sample grammatical data and retaining a fixed label format of the sample grammatical data; organizing the functions and variables in the sample grammatical data into a first data set based on words, and deduplicating the functions and variables in the first data set; organizing the equal signs, brackets and punctuation marks in the sample grammatical data into a second data set based on characters, and deduplicating the equal signs, brackets and punctuation marks in the second data set; and merging the first data set after deduplication processing and the second data set after deduplication processing, and vectorizing the merged data set to generate a data set to be trained.
[0019] In some embodiments, the step of deduplicating variables in the first data set includes: obtaining multiple variables with the same name from the first data set; if the multiple variables include variables of the same type, deduplicating the variables of the same type; and if the multiple variables include variables of different types, renaming the variables of different types respectively to distinguish the variables of different types.
[0020] In some embodiments, the step of training the data set to be trained using a deep learning network model includes: importing the data set to be trained into a gated recurrent unit of the deep learning network model; and training the data set to be trained to obtain an initial sample set to be tested when the value of the neural network loss function is less than a predetermined value.
[0021] In some embodiments, the predetermined value ranges from 0.05 to 0.1.
[0022] In some embodiments, the step of performing model prediction and assembly processing on at least a portion of the multiple first samples to be tested in the initial sample set to be tested includes: predicting a starting sentence with a variable of the first sample to be tested as a starting character as a prediction starting point; taking the starting sentence as a starting point, selecting several lines of statements from the initial sample set to be tested in sequence, adding a trial rule module and / or a capture rule module to each line of statement; and taking the several lines of statements as a unit, assembling labels for the unit to form a second sample to be tested.
[0023] According to another aspect of the present disclosure, a vulnerability testing device for a browser is provided, comprising: a preprocessing unit, configured to select sample grammar data from a vulnerability grammar library, and preprocess the sample grammar data to obtain a set of data to be trained; a training unit, configured to train the set of data to be trained using a deep learning network model to obtain an initial set of samples to be tested, wherein the initial set of samples to be tested includes an initial plurality of first samples to be tested; a prediction and assembly unit, configured to perform model prediction and assembly processing on at least a portion of the plurality of first samples to be tested in the initial set of samples to be tested to form a second sample to be tested; a monitoring unit, configured to input the second sample to be tested into a browser so that the browser parses the second sample to be tested, and monitor the running status of the browser; and a determination unit, configured to determine that the second sample to be tested is an abnormal sample when a failure in the operation of the browser is detected, generate abnormal log data, and save the abnormal sample and the abnormal log data.
[0024] In some embodiments, the preprocessing unit is used to parse the sample grammatical data and retain the fixed label format of the sample grammatical data, organize the functions and variables in the sample grammatical data into a first data set based on words, and deduplicate the functions and variables in the first data set, organize the equal signs, brackets and punctuation marks in the sample grammatical data into a second data set based on characters, and deduplicate the equal signs, brackets and punctuation marks in the second data set, merge the deduplicated first data set and the deduplicated second data set, and vectorize the merged data set to generate a data set to be trained.
[0025] In some embodiments, the preprocessing unit is used to obtain multiple variables with the same name from the first data set, if the multiple variables include variables of the same type, then perform deduplication processing on the variables of the same type, and if the multiple variables include variables of different types, then rename the variables of different types to distinguish the variables of different types.
[0026] In some embodiments, the training unit is used to import the data set to be trained into the gated recurrent unit of the deep learning network model, and train the data set to be trained to obtain an initial sample set to be tested when the value of the neural network loss function is less than a predetermined value.
[0027] In some embodiments, the predetermined value ranges from 0.05 to 0.1.
[0028] In some embodiments, the prediction assembly unit is used to predict a starting sentence using a variable of the first sample to be tested as a starting character as a prediction starting point, and using the starting sentence as a starting point to select several lines of statements from the initial sample set to be tested in sequence, adding a trial rule module and / or a capture rule module to each line of statement, and using the several lines of statements as a unit, assembling labels for the unit to form a second sample to be tested.
[0029] According to another aspect of the present disclosure, a vulnerability testing device for a browser is provided, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the aforementioned method based on instructions stored in the memory.
[0030] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.
[0031] In the above vulnerability testing method, sample grammar data is selected from the vulnerability grammar library, and the sample grammar data is preprocessed to obtain a set of data to be trained; the set of data to be trained is trained using a deep learning network model to obtain an initial set of samples to be tested, and the initial set of samples to be tested includes an initial plurality of first samples to be tested; at least a portion of the plurality of first samples to be tested in the initial set of samples to be tested is subjected to model prediction and assembly processing to form a second sample to be tested; the second sample to be tested is input into the browser so that the browser can parse the second sample to be tested, and the running status of the browser is monitored; and when a failure in the operation of the browser is detected, the second sample to be tested is determined to be an abnormal sample, abnormal log data is generated, and the abnormal sample and the abnormal log data are saved. This method implements vulnerability testing of the browser. Since the method obtains samples from the vulnerability grammar library and trains the samples to obtain new samples that may have vulnerabilities, such samples are used for vulnerability testing of the browser, which can improve the vulnerability detection efficiency of the browser.
[0032] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0034] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
[0035] Figure 1 is a flow chart illustrating a vulnerability testing method for a browser according to some embodiments of the present disclosure;
[0036] Figure 2 is a flow chart showing a vulnerability testing method for a browser according to other embodiments of the present disclosure;
[0037] Figure 3 is a schematic diagram showing the structure of a vulnerability testing device for a browser according to some embodiments of the present disclosure;
[0038] Figure 4 is a schematic diagram showing a structure of a vulnerability testing device for a browser according to other embodiments of the present disclosure;
[0039] Figure 5 is a schematic diagram showing the structure of a vulnerability testing device for a browser according to some other embodiments of the present disclosure. DETAILED DESCRIPTION
[0040] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0041] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0042] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0043] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0044] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0045] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0046] Figure 1 is a flow chart showing a vulnerability testing method for a browser according to some embodiments of the present disclosure. Figure 1 As shown, the method includes steps S102 to S110.
[0047] In step S102, sample grammar data is selected from the vulnerability grammar library, and the sample grammar data is preprocessed to obtain a data set to be trained.
[0048] In some embodiments, the step of preprocessing the sample grammatical data includes: parsing the sample grammatical data and retaining the fixed label format of the sample grammatical data; grouping the functions and variables in the sample grammatical data into a first data set based on words, and performing deduplication processing on the functions and variables in the first data set; grouping the equal signs, brackets, and punctuation marks in the sample grammatical data into a second data set based on characters, and performing deduplication processing on the equal signs, brackets, and punctuation marks in the second data set; and merging the first data set after deduplication processing and the second data set after deduplication processing, and performing vectorization processing on the merged data set to generate a data set to be trained. In this embodiment, the accuracy rate in the subsequent training process can be improved by deduplication processing.
[0049] In some embodiments, a fixed label format may include: a label and / or<script>。可选地,固定标签格式还可以包括:<title>标签和 / 或<head>标签。
[0050] 在一些实施例中,上面所述的函数可以包括:函数名、函数方法和函数参数等。
[0051] 在一些实施例中,对第一数据集合中的变量进行去重处理的步骤包括:从第一数据集合中获取具有相同名称的多个变量;若该多个变量包括相同类型的变量,则对该相同类型的变量进行去重处理;以及若该多个变量包括不同类型的变量,则对该不同类型的变量分别重新命名以区分不同类型的变量。
[0052] 即,对于上述具有相同名称的多个变量,若某些变量的类型相同,则去重,保留这些类型相同的变量中的一个即可,若某些变量的类型不同,则将这些不同类型的变量分别重新命名,例如修改为变量_1,变量_2,以此类推,从而可以区分不同类型的变量。这样即实现了去重操作,又防止由于将不同类型的变量也去重而造成数据丢失。
[0053] 在步骤S104,利用深度学习网络模型对待训练数据集合进行训练以获得初始待测样本集。该初始待测样本集包括初始的多个第一待测样本。第一待测样本为初始的待测试样本。
[0054] 在一些实施例中,该步骤S104包括:将待训练数据集合导入深度学习网络模型的门控循环单元;以及在神经网络损失函数的数值小于预定数值的情况下对待训练数据集合进行训练以获得初始待测样本集。例如,预定数值的范围可以为0.05至0.1。例如,预定数值可以为0.1。当然,本领域技术人员能够理解,该预定数值仅是示例性的,本公开的实施例还可以采用其他数值范围的预定数值,因此,本公开并不仅限于此。在该实施例中,通过该训练过程产生的初始待测样本集具有很高的测试使用价值。
[0055] 这里,深度学习网络模型可以使用本领域技术人员已知的循环神经网络(Recurrent Neural Network,简称为RNN)模型。RNN算法已经被应用到文本预测等领域,这里用来浏览器的漏洞模糊测试(fuzz)具有明显优势。在上述步骤中,将批次处理的字符流数据集合导入门控循环单元中,在训练后,以神经网络损失函数数值小于0.1作为训练目标进行训练,可以产生具有很高的测试使用价值的初始待测样本集。
[0056] 在步骤S106,对初始待测样本集中的多个第一待测样本的至少一部分进行模型预测和组装处理以形成第二待测样本。这里,第二待测样本即为用于浏览器的漏洞模糊测试的完整的待测试样本。
[0057] 在一些实施例中,该步骤S106包括:以第一待测样本的某个变量为起始字符作为预测起点预测起始语句;以起始语句为起点,从初始待测样本集中依次选取若干行语句,每行语句添加尝试规则模块(即try{}模块)和 / 或捕捉规则模块(即catch()模块);以及以该若干行语句为一个单元,对该单元组装标签(例如<html>标签、<head>标签、<script>标签或<body>标签等),以形成第二待测样本。这里,在待测样本中增添try{}catch()规则,可以避免某行解析失败后此样本被丢弃,从而可以充分高效率的利用训练后的待测样本。
[0058] 例如,如下面几行语句:
[0059] Line1.try{var_arraybuf1.length=1;}catch(e){}
[0060] Line2.try{var_dataview2.length=8;}catch(e){}
[0061] Line3.try{var_arraybuf2.__proto__=2.3023e-320;}catch(e){}
[0062] Line4.try{var_int2=var_int3.supportedLocalesOf(var_date1
[55073] );}catch(e){}
[0063] 如果不添加try{}catch(),比如Line2是一个错误语法,那么浏览器解析到第二行就停止了解析,此样本就被丢弃,不再解析Line3和Line4。而添加try{}catch()后,如果Line2是一个错误语法,浏览器会放弃Line2,继续尝试解析Line3和Line4。此样本会被继续解析直到所有语法结束。因此,将待测样本增添try{}catch()规则,可以避免某行解析失败后此样本被丢弃的问题。
[0064] 在步骤S108,将第二待测样本输入到浏览器以便浏览器解析第二待测样本,并监控浏览器的运行状态。
[0065] 例如,可以使用python脚本监控维持浏览器运行,并将待测样本自动投喂给浏览器。这里,python脚本可以采用github平台上已知的脚本,该脚本可以维持浏览器运行状态。
[0066] 在步骤S110,在检测到浏览器运行出现故障的情况下确定第二待测样本为异常样本,产生异常日志数据,并保存该异常样本和该异常日志数据。
[0067] 例如,使用CERT / CC(Computer Emergency Response Team / CoordinationCenter,美国计算机紧急事件响应小组协调中心)Basic Fuzzing Framework(基本模糊框架,简称为BFF)框架中的msec.py脚本可以记录浏览器崩溃的现象以及崩溃时CPU(centralprocessing unit,中央处理器)的各个寄存器的状态(这些现象和状态可以作为异常日志数据)。并将此状态和造成浏览器崩溃的poc(Proof of Concept,概念验证)代码一同保存到crashed文件夹下。为了方便查看,命名规则可以为:1.html、1.log;2.html、2.log以此类推;其中html保存了JavaScript代码(可以作为异常样本),log文件保存了此时造成浏览器崩溃的cpu的寄存器状态(可以作为异常日志数据)。
[0068] 在一些实施例中,还可以将上述测试结果返回给客户端。
[0069] 至此,提供了根据本公开一些实施例的用于浏览器的漏洞测试方法。该漏洞测试方法包括:从漏洞语法库中选取样本语法数据,对样本语法数据进行预处理以获得待训练数据集合;利用深度学习网络模型对待训练数据集合进行训练以获得初始待测样本集,所述初始待测样本集包括初始的多个第一待测样本;对初始待测样本集中的多个第一待测样本的至少一部分进行模型预测和组装处理以形成第二待测样本;将第二待测样本输入到浏览器以便浏览器解析第二待测样本,并监控浏览器的运行状态;以及在检测到浏览器运行出现故障(例如崩溃)的情况下确定第二待测样本为异常样本,产生异常日志数据,并保存异常样本和异常日志数据。该方法实现了对浏览器的漏洞测试。由于该方法中从漏洞语法库中获得样本并对样本进行训练从而获得可能有漏洞的新样本,将这样的样本用于浏览器的漏洞测试,可以提高浏览器的漏洞检测效率。
[0070] 在一些实施例中,若检测到浏览器崩溃则记录,可以初步分析造成浏览器崩溃的原因。例如,由于保存了异常样本和该异常日志数据,可以使用浏览器重新打开crashed文件夹下的html文件,进行详细的分析,分析造成浏览器崩溃的原因,并分析此崩溃漏洞是否造成堆溢出、是否造成代码可执行等问题。
[0071] 本公开的发明人发现,现有技术中还存在样本深度不足、语法环境聚合性差和语法规则聚合性差的问题。这里,样本深度取决于语法库的语法数量,如果语法库的语法数量比较少,那么测试深度就不足。语法环境聚合性差:生成的样本中,语法环境上下文关系取决于语法规则模板,不能形成有效的语法关系组合。语法规则聚合性差:基于随机种子和语法规则模板,模糊测试大概率产生的变量、属性、函数关系、参数等不能形成正确的对应关系,导致浏览器解析停止,降低检测效率。
[0072] 而本公开实施例的上述方法中,使用RNN算法预测可以提高javascript语法规则的准确性,并且使用大量的已知漏洞的样本进行训练,参考训练条件的损失函数值较小(例如,神经网络损失函数数值小于0.1),所以训练出来的样本出现测试代码冗余、样本深度不足、语法环境聚合性差和语法规则聚合性差的情况概率较低,因此上述方法可以尽可能地解决现有技术的上述问题。再者,训练是基于漏洞库样本执行的,使用含有漏洞的样本训练预测出来的样本模型进行漏洞模糊测试,可以加大发现浏览器漏洞的概率。
[0073] 图2是示出根据本公开另一些实施例的用于浏览器的漏洞测试方法的流程图。
[0074] 首先,进行样本预处理。
[0075] 例如,如图2所示,选取公开漏洞库的poc样本数据作为训练模板。例如,4000个poc样本数据为一组。解析样本时,将html样本固定标签格式保留,例如保留<html>、<title>、<head>和<script>等标签。
[0076] 如图2所示,可以将js(即JavaScript)语法的变量、函数名、函数方法和函数参数等以单词为单元组成第一数据集,并进行去重处理。将等号、括号和标点符号等按照字符组成第二数据集,并进行去重处理。
[0077] 然后,如图2所示,将第一数据集和第二数据集并入数据集中并进行向量化处理,以获得待训练数据集合,也可以称为字符序列。
[0078] 在一些实施例中,可以使用one-hot(独热编码)编码方式进行向量化处理。例如:
[0079] 第一数据集:array1[]={var_1,var_2,var_3,var_4},
[0080] 第二数据集:array2[]={‘=’,’(’,’)’},
[0081] 合并起来得到:array[]={var_1,var_2,var_3,var_4,‘=’,’(’,’)’},
[0082] 向量化数组=one-hot(array)。
[0083] 这里,采用one-hot编码,可以提高后续预测过程中的正确性。
[0084] 接下来,如图2所示,采用已知的循环神经网络算法RNN进行模型训练以获得初始待测样本集。例如,将批次处理的字符流数据集合导入GRU(gated recurrent unit,门控循环单元)门控中。训练后,在神经网络损失函数数值小于0.1的情况下训练完成目标。这样产生的目标样本(即初始待测样本集)具有很高的测试使用价值。
[0085] 接下来,如图2所示,对初始待测样本集中的多个第一待测样本的至少一部分进行模型预测和组装处理以形成第二待测样本。
[0086] 例如,以第一待测样本的某个变量"var1=”(当然,也可以是其他变量)为起始字符作为预测起点来预测起始语句;以起始语句为起点,从初始待测样本集中依次选取若干行(例如1000行)语句,每行语句添加try{}catch()模块,以确保每行语句都可被浏览器执行;以及以该若干行语句为一个单元,对该单元组装<html>标签,以形成完整的第二待测样本。当然,也可以组装<head>标签、<script>标签或<body>标签。
[0087] 接下来,如图2所示,使用python脚本监控维持浏览器运行,并将第二待测样本自动投喂给浏览器。若正常则浏览器放行,若检测到浏览器崩溃则记录初步分析造成浏览器崩溃的原因,并保存此异常样本。
[0088] 至此,提供了根据本公开另一些实施例的用于浏览器的漏洞测试方法。在该方法中,收集大量已知浏览器的漏洞poc样本数据放入数据集合中作为训练源,将训练源导入深度学习机器中,使用循环神经网络算法以及GRU门控单元训练后,产生语法功能复杂的初始待测样本集,并将初始待测样本增添try{}catch()规则以避免某行解析失败后此样本被丢弃的命运,从而充分高效率的利用了训练后的待测样本,利用<html>等标签组装网页模型,并编写python后台检测模块,将待测样本投喂给浏览器,检测完毕后保留异常日志数据以及异常样本文件,生成初步的分析报告,并向客户端返回结果。该方法可以尽可能地解决现有技术中浏览器漏洞检测过程中生成的测试代码冗余、样本深度不足、语法环境聚合性差、语法规则聚合性差等问题,从而提升了浏览器漏洞模糊测试技术。而且上述方法解决了现有技术中单纯依靠随机模糊测试的盲目性、检测深度不够和代码覆盖率较低的问题。
[0089] 图3是示出根据本公开一些实施例的用于浏览器的漏洞测试装置的结构示意图。如图3所示,该漏洞测试装置包括预处理单元302、训练单元304、预测组装单元306、监控单元308和确定单元310。
[0090] 预处理单元302用于从漏洞语法库中选取样本语法数据,对样本语法数据进行预处理以获得待训练数据集合。
[0091] 在一些实施例中,预处理单元302可以用于解析样本语法数据,并保留样本语法数据的固定标签格式,将样本语法数据中的函数和变量以单词为单元组成第一数据集合,并对第一数据集合中的函数和变量进行去重处理,将样本语法数据中的等号、括号和标点符号按照字符组成第二数据集合,并对第二数据集合中的等号、括号和标点符号进行去重处理,以及将去重处理后的第一数据集合和去重处理后的第二数据集合合并,并对合并后的数据集合进行向量化处理以生成待训练数据集合。
[0092] 在一些实施例中,预处理单元302可以用于从第一数据集合中获取具有相同名称的多个变量。若该多个变量包括相同类型的变量,则对相同类型的变量进行去重处理,以及若该多个变量包括不同类型的变量,则对不同类型的变量分别重新命名以区分该不同类型的变量。
[0093] 训练单元304用于利用深度学习网络模型对待训练数据集合进行训练以获得初始待测样本集,该初始待测样本集包括初始的多个第一待测样本。
[0094] 在一些实施例中,训练单元304可以用于将待训练数据集合导入深度学习网络模型的门控循环单元,在神经网络损失函数的数值小于预定数值的情况下对待训练数据集合进行训练以获得初始待测样本集。例如,预定数值的范围为0.05至0.1。
[0095] 预测组装单元306用于对初始待测样本集中的多个第一待测样本的至少一部分进行模型预测和组装处理以形成第二待测样本。
[0096] 在一些实施例中,预测组装单元306可以用于以第一待测样本的某个变量为起始字符作为预测起点预测起始语句,以起始语句为起点,从初始待测样本集中依次选取若干行语句,每行语句添加尝试规则模块和 / 或捕捉规则模块,以及以该若干行语句为一个单元,对该单元组装标签,以形成第二待测样本。
[0097] 监控单元308用于将第二待测样本输入到浏览器以便浏览器解析第二待测样本,并监控浏览器的运行状态。
[0098] 确定单元310用于在检测到浏览器运行出现故障的情况下确定第二待测样本为异常样本,产生异常日志数据,并保存异常样本和异常日志数据。
[0099] 至此,提供了根据本公开一些实施例的用于浏览器的漏洞测试装置。该漏洞测试装置实现了对浏览器的漏洞测试。由于该漏洞测试装置中从漏洞语法库中获得样本并对样本进行训练从而获得可能有漏洞的新样本,将这样的样本用于浏览器的漏洞测试,可以提高浏览器的漏洞检测效率。
[0100] 图4是示出根据本公开另一些实施例的用于浏览器的漏洞测试装置的结构示意图。该漏洞测试装置包括存储器410和处理器420。其中:
[0101] 存储器410可以是磁盘、闪存或其它任何非易失性存储介质。存储器用于存储图1和 / 或图2所对应实施例中的指令。
[0102] 处理器420耦接至存储器410,可以作为一个或多个集成电路来实施,例如微处理器或微控制器。该处理器420用于执行存储器中存储的指令,通过从漏洞语法库中获得样本并对样本进行训练从而获得可能有漏洞的新样本,将这样的样本用于浏览器的漏洞测试,可以提高浏览器的漏洞检测效率。
[0103] 在一些实施例中,还可以如图5所示,漏洞测试装置500包括存储器510和处理器520。处理器520通过BUS总线530耦合至存储器510。该漏洞测试装置500还可以通过存储接口540连接至外部存储装置550以便调用外部数据,还可以通过网络接口560连接至网络或者另外一台计算机系统(未标出),此处不再进行详细介绍。
[0104] 在该实施例中,通过存储器存储数据指令,再通过处理器处理上述指令,通过从漏洞语法库中获得样本并对样本进行训练从而获得可能有漏洞的新样本,将这样的样本用于浏览器的漏洞测试,可以提高浏览器的漏洞检测效率。
[0105] 在一些实施例中,本公开还提供了一种计算机可读存储介质,其上存储有计算机程序指令,该指令被处理器执行时实现图1和 / 或图2所对应实施例中的方法的步骤。本领域内的技术人员应明白,本公开的实施例可提供为方法、装置、或计算机程序产品。因此,本公开可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可用非瞬时性存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
[0106] 本公开是参照根据本公开实施例的方法、设备(系统)和计算机程序产品的流程图和 / 或方框图来描述的。应理解可由计算机程序指令实现流程图和 / 或方框图中的每一流程和 / 或方框以及流程图和 / 或方框图中的流程和 / 或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能的装置。
[0107] 这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能。
[0108] 这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能的步骤。
[0109] 至此,已经详细描述了本公开。为了避免遮蔽本公开的构思,没有描述本领域所公知的一些细节。本领域技术人员根据上面的描述,完全可以明白如何实施这里公开的技术方案。
[0110] 虽然已经通过示例对本公开的一些特定实施例进行了详细说明,但是本领域的技术人员应该理解,以上示例仅是为了进行说明,而不是为了限制本公开的范围。本领域的技术人员应该理解,可在不脱离本公开的范围和精神的情况下,对以上实施例进行修改。本公开的范围由所附权利要求来限定。< / script>
Claims
1. A vulnerability testing method for browsers, include: Selecting sample grammar data from a vulnerability grammar library, and preprocessing the sample grammar data to obtain a data set to be trained; Using a deep learning network model to train the data set to be trained to obtain an initial sample set to be tested, wherein the initial sample set to be tested includes an initial plurality of first samples to be tested; Performing model prediction and assembly processing on at least a portion of the plurality of first samples to be tested in the initial set of samples to be tested to form a second sample to be tested; Inputting the second sample to be tested into a browser so that the browser parses the second sample to be tested, and monitoring the running status of the browser; as well as In the case where a failure occurs in the operation of the browser, determining that the second sample to be tested is an abnormal sample, generating abnormal log data, and saving the abnormal sample and the abnormal log data; Among them, the step of preprocessing the sample grammatical data includes: parsing the sample grammatical data and retaining the fixed label format of the sample grammatical data; forming a first data set with words as units for functions and variables in the sample grammatical data, and performing deduplication processing on the functions and variables in the first data set; forming a second data set with characters for equal signs, brackets and punctuation marks in the sample grammatical data, and performing deduplication processing on the equal signs, brackets and punctuation marks in the second data set; and merging the first data set after deduplication processing and the second data set after deduplication processing, and performing vectorization processing on the merged data set to generate a data set to be trained; The steps of performing model prediction and assembly processing on at least a part of the multiple first samples to be tested in the initial sample set to be tested include: predicting a starting sentence with a variable of the first sample to be tested as a starting character as a prediction starting point; taking the starting sentence as a starting point, selecting several lines of statements from the initial sample set to be tested in sequence, adding a trial rule module and / or a capture rule module to each line of statement; and taking the several lines of statements as a unit, assembling labels for the unit to form a second sample to be tested.
2. The vulnerability testing method according to claim 1, in, The step of performing deduplication processing on the variables in the first data set includes: Acquire multiple variables with the same name from the first data set; If the multiple variables include variables of the same type, performing deduplication processing on the variables of the same type; and If the multiple variables include variables of different types, the variables of different types are renamed respectively to distinguish the variables of different types.
3. The vulnerability testing method according to claim 1, in, The step of training the to-be-trained data set using a deep learning network model includes: Importing the to-be-trained data set into the gated recurrent unit of the deep learning network model; and When the value of the neural network loss function is less than a predetermined value, the to-be-trained data set is trained to obtain an initial to-be-tested sample set.
4. The vulnerability testing method according to claim 3, in, The predetermined value ranges from 0.05 to 0.
1.
5. A vulnerability testing device for a browser, include: A preprocessing unit, used for selecting sample grammar data from the vulnerability grammar library, and preprocessing the sample grammar data to obtain a data set to be trained; A training unit, configured to train the to-be-trained data set using a deep learning network model to obtain an initial to-be-tested sample set, wherein the initial to-be-tested sample set includes an initial plurality of first to-be-tested samples; A prediction and assembly unit, configured to perform model prediction and assembly processing on at least a portion of the plurality of first samples to be tested in the initial set of samples to be tested to form a second sample to be tested; A monitoring unit, configured to input the second sample to be tested into a browser so that the browser can parse the second sample to be tested, and monitor the running state of the browser; as well as A determination unit, configured to determine that the second sample to be tested is an abnormal sample when a failure in the operation of the browser is detected, generate abnormal log data, and save the abnormal sample and the abnormal log data; The preprocessing unit is used to parse the sample grammatical data and retain the fixed label format of the sample grammatical data, organize the functions and variables in the sample grammatical data into a first data set based on words, and perform deduplication processing on the functions and variables in the first data set, organize the equal signs, brackets and punctuation marks in the sample grammatical data into a second data set based on characters, and perform deduplication processing on the equal signs, brackets and punctuation marks in the second data set, and merge the first data set after deduplication processing and the second data set after deduplication processing, and perform vectorization processing on the merged data set to generate a data set to be trained; The prediction assembly unit is used to predict a starting sentence using a variable of the first sample to be tested as a starting character as a prediction starting point, and to select several lines of statements from the initial sample set to be tested in sequence using the starting sentence as a starting point, and to add a trial rule module and / or a capture rule module to each line of statement, and to use the several lines of statements as a unit and to assemble a label for the unit to form a second sample to be tested.
6. The vulnerability testing device according to claim 5, in, The preprocessing unit is used to obtain multiple variables with the same name from the first data set, and if the multiple variables include variables of the same type, deduplicate the variables of the same type; and if the multiple variables include variables of different types, rename the variables of different types respectively to distinguish the variables of different types.
7. The vulnerability testing device according to claim 5, in, The training unit is used to import the data set to be trained into the gated loop unit of the deep learning network model, and train the data set to be trained to obtain an initial sample set to be tested when the value of the neural network loss function is less than a predetermined value.
8. The vulnerability testing device according to claim 7, in, The predetermined value ranges from 0.05 to 0.
1.
9. A vulnerability testing device for a browser, include: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the method according to any one of claims 1 to 4 based on instructions stored in the memory.
10. A computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method according to any one of claims 1 to 4.
