Search-based digital certificate parser difference test system and use method
Through the search-based digital certificate parser difference testing system, the difference in digital certificate parser is detected and updated, and the problem of neglecting parser detection in the prior art is solved, and the accuracy and network security of digital certificate verification are improved.
Patent Information
- Application Number
- CN202310707900.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-15
- Publication Date
- 2024-12-17
AI Technical Summary
The prior art ignores the detection of digital certificate parser, resulting in inaccuracy of digital certificate verification and affecting network security.
Using a search-based digital certificate parser difference testing system, including model building module, search module, branch module, use case generation module, standardization module and detection and update module, searching for the differences in digital certificate parser through mutation operators and fitness functions , generate and normalize digital certificates, automatically detect and update models.
The correctness detection of the digital certificate parser is realized, the detection accuracy of the digital certificate verifier is improved, and the resolution, structure and content differences of the parser are fully detected, which improves the detection efficiency.
Smart Images

Figure CN119149372A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of software security testing, and in particular relates to a search-based digital certificate parser difference testing system and a use method. Background Art
[0002] With the development of computer network technology, people's work, study and life are more and more closely connected with the Internet. The Internet uses Hypertext Transfer Protocol Secure (HTTPS) to ensure the security of data communication between people and servers, and the security core of HTTPS is the Transport Layer Security (TLS) protocol. The TLS protocol verifies the identity of the other party by verifying the X.509 digital certificate (referred to as digital certificate) during the handshake phase and decides whether to perform subsequent symmetric key generation and encrypted communication based on the identity verification result. If the digital certificate verification software system mistakenly accepts the digital certificate of a malicious server, people will interact with the malicious server without knowing it; if the digital certificate verification software system mistakenly rejects the digital certificate of a normal server, people will not be able to obtain normal network services. Therefore, the correctness of digital certificate verification is related to the security of the TLS protocol, HTTPS and the Internet.
[0003] In the prior art, Frankencert, Mucert, NEZHA, RFCcert, SADT, and Transcert focus on the detection of digital certificate verifiers, but ignore the detection of digital certificate parsers that provide input to digital certificate verifiers. The digital certificate parser parses the digital certificate encoded with distinguishing encoding rules that are easy to save or transmit into structured data that is easy to verify the digital certificate. The correctness of the digital certificate parser will affect the correctness of the input of the digital certificate verifier, and then affect the digital certificate verification result. For example, the GnuTLS software defect numbered 870 discovered by SADT is essentially caused by a digital certificate parser software defect, rather than a digital certificate verifier software defect: the digital certificate parser of GnuTLS mistakenly parses the validity period of a digital certificate "#01010101000Z" as "Oct 10 10:10:00 1900 GMT" and passes it to the digital certificate verifier of GnuTLS, which accepts this digital certificate based on the wrong input. It can be seen that the correctness of the digital certificate parser will affect the correctness of the digital certificate verification, and then affect the network security. It is necessary to detect the correctness of the digital certificate parser, and detecting the digital certificate parser helps the existing technology to more accurately detect the correctness of the digital certificate verifier. Summary of the invention
[0004] In order to solve the technical problem of detecting the correctness of a digital certificate parser, the present invention provides the following technical solution: a search-based digital certificate parser difference testing method and system, including a model building module, a search module, a branch module, a use case generation module, a normalization module, and a detection and update module:
[0005] The model building module builds an initial model according to the digital certificate structure, mutation operator, limit and fitness function;
[0006] The search module searches the model for nodes and operators that have not reached the limit and have the maximum fitness function value;
[0007] The branch module determines that if the node and operator are found, the execution continues, otherwise the execution ends;
[0008] The use case generation module generates a digital certificate based on the searched nodes and operators;
[0009] The normalization module uses the generated digital certificate as the input of the digital certificate parser and normalizes the output result of the digital certificate parser;
[0010] The detection and update module searches for differences in the normalized output results of the digital certificate parser and updates the model based on the differences found.
[0011] A method for using a search-based digital certificate parser difference testing system, characterized by comprising:
[0012] Step 1: The model building module builds the initial model according to the digital certificate structure, mutation operator, boundary and fitness function;
[0013] Step 2: The search module searches for nodes and mutation operators that have not reached the limit and have the largest fitness function value in the model;
[0014] Step 3: The branch module determines that if the node and mutation operator are found in step 2, then step 4 is executed, otherwise it ends;
[0015] Step 4: The use case generation module generates a digital certificate based on the nodes and mutation operators searched in step 2;
[0016] Step 5: The normalization module uses the digital certificate generated in step 4 as the input of the digital certificate parser and normalizes the output result of the digital certificate parser;
[0017] Step 6: The detection and update module searches for differences in the output results of the digital certificate parser normalized in step 5, updates the model based on the differences found, and goes to step 2.
[0018] Preferably, the step 1 is specifically:
[0019] According to the tree structure of the digital certificate, each node is equipped with three mutation operators: "add structure", "delete structure" and "change content", and each node and its mutation operator is equipped with a limit on the number of invalid continuous mutations, a limit on the number of total mutations, and a fitness function with an initial value of zero to establish an initial model.
[0020] Preferably, the step 2 is specifically:
[0021] In the model, a breadth-first and then depth-first search strategy is used to search for nodes and mutation operators that have not reached the limit and have the largest fitness function value. During the search process, nodes and mutation operators whose consecutive mutation invalid times limit or total mutation times limit is 0 are not selected.
[0022] Preferably, the step 5 is specifically:
[0023] The digital certificate generated by the node and mutation operator searched in step 2 in step 4 is input into the digital certificate parser to obtain the output of the digital certificate parser, and the format of the key name and value in the output result is standardized.
[0024] Preferably, the step 6 is specifically:
[0025] Based on the normalized output results of the digital certificate parser in step 5, first determine whether each digital certificate parser can parse the digital certificate and whether there is a resolvability difference based on whether there is a key-value pair. Then, use a top-down search strategy to search for differences between the digital certificate structures parsed by each digital certificate parser. At the same time, search for differences in the corresponding contents of the same structure. Finally, based on the number of resolvability differences, structural differences, and content differences obtained in the search, update the invalid number of consecutive mutations of the nodes and mutation operators searched in step 2, the total number of mutations, and the fitness function value, thereby updating the model. After the model update is completed, go to step 2.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] 1. The prior art does not clearly distinguish between digital certificate parsers and digital certificate verifiers in terms of logic and implementation. Only looking for software defects based on digital certificate verification results will ignore the software defects of the digital certificate parser, resulting in such software defects being incorrectly classified as software defects of the digital certificate verifier. The present invention correctly distinguishes the digital certificate parser from the digital certificate verifier in terms of logic and implementation, and specifically detects the differences of the digital certificate parser to discover the software defects of the digital certificate parser. Based on the present invention, using the prior art to detect the software defects of the digital verifier will be more accurate;
[0028] 2. The present invention can correctly and automatically detect the differences in the resolvability, structural and content of digital certificate parsers, and comprehensively detect the differences of various types of digital certificate parsers, which is beyond the reach of the prior art;
[0029] 3. The present invention updates the model by the number of found resolvable differences, structural and content differences to improve search efficiency, reduces invalid mutations through bounded search, and realizes efficient detection of digital certificate parsers, which is beyond the reach of existing technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0031] In the attached picture:
[0032] Figure 1 is a flow chart of the method of the present invention; DETAILED DESCRIPTION
[0033] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0034] Embodiment 1:
[0035] A search-based digital certificate parser difference testing system includes a model building module, a search module, a branch module, a case generation module, a normalization module, and a detection and update module:
[0036] The model building module builds an initial model according to the digital certificate structure, mutation operator, limit and fitness function;
[0037] The search module searches the model for nodes and operators that have not reached the limit and have the maximum fitness function value;
[0038] The branch module determines that if the node and operator are found, the execution continues, otherwise the execution ends;
[0039] The use case generation module generates a digital certificate based on the searched nodes and operators;
[0040] The normalization module uses the generated digital certificate as the input of the digital certificate parser and normalizes the output result of the digital certificate parser;
[0041] The detection and update module searches for differences in the normalized output results of the digital certificate parser and updates the model based on the differences found.
[0042] Embodiment 2:
[0043] Reference Figure 1 As shown, a search-based digital certificate parser difference testing method includes:
[0044] Step 1: The model building module builds the initial model according to the digital certificate structure, mutation operator, boundary and fitness function.
[0045] Based on the 7-layer tree structure of digital certificates specified by the Internet Engineering Task Force, which has a total of 55 nodes, nodes such as "Netscape Cert Type" are added to form a customizable digital certificate structure tree model. Each node is equipped with three mutation operators: "add structure", "delete structure" and "change content". For each node and its mutation operator, a limit on the number of invalid consecutive mutations, a limit on the number of total mutations, and a fitness function with an initial value of zero are set to establish an initial model.
[0046] Step 2: The search module searches the model for nodes and mutation operators that have not reached the limit and have the largest fitness function value.
[0047] Starting from the root node of the model, a breadth-first search is used for each layer of nodes to obtain the node with the largest fitness function value and its mutation operator that has not yet reached the limit of invalid consecutive mutation times and the limit of the total mutation times. If two or more nodes with the same maximum fitness function value and their mutation operators are encountered, they are randomly selected, and a depth-first search strategy is used along the branch where the node is located to search for the child node with the largest fitness function value and its mutation operator. This process is repeated until the node "signature" and its mutation operator "change content" at the bottom layer that have not yet reached the limit of invalid consecutive mutation times and the limit of the total mutation times and have the largest fitness function value are found.
[0048] Step 3: The branch module determines that if the node and mutation operator are found in step 2, then step 4 is executed, otherwise it ends.
[0049] The branch module determines that step 2 searches for the node "signature" and its mutation operator "change content", and goes to step 4 for execution.
[0050] Step 4: The use case generation module generates a digital certificate based on the nodes and mutation operators searched in step 2.
[0051] The use case generation module searches for the node "signature" and its mutation operator "change content" according to step 2 to generate a digital certificate object, and sets the "tbsCertificate.signature" in the object to "AlgorithmId.sha256WithRSAEncryption_oid" which is different from the signature algorithm actually used, sets valid values for the basic structure of the digital certificate object except "tbsCertificate.signature", signs and encodes the digital certificate object, and saves it as a digital certificate file.
[0052] Step 5: The normalization module uses the digital certificate generated in step 4 as the input of the digital certificate parser and normalizes the output result of the digital certificate parser.
[0053] The normalization module inputs the digital certificate file generated in step 4 into the digital certificate parsers OpenSSL and ZCertificate, obtains the outputs of the two digital certificate parsers respectively, converts the output of OpenSSL from formatted text to a text-typical key-value pair, and normalizes the name of the key "Signature Algorithm" in "tbsCertificate" and its value to "signature" and "sha256-RSA", respectively, and normalizes the name of the corresponding key in the text-typical output of ZCertificate and its value to "signature" and "sha1-RSA", respectively.
[0054] Step 6: The detection and update module searches for differences in the output results of the digital certificate parser normalized in step 5, updates the model based on the differences found, and goes to step 2.
[0055] The detection and update module is based on the output results of the digital certificate parser after normalization in step 5. First, according to the result, it is determined that both the digital certificate parsers OpenSSL and ZCertificate can parse the digital certificate, so there is no difference in resolvability. Then, a top-down search strategy is used to search for the non-existent differences between the key structures in the dictionary parsed by OpenSSL and ZCertificate. At the same time, based on the same structure "signature", it is found that the corresponding contents "sha256-RSA" and "sha1-RSA" have 1 content difference. Finally, according to the number of content differences 1 obtained by the search, the total mutation times limit of the node "signature" searched in step 2 and its mutation operator "change content" and the fitness function value obtained by dividing the total number of differences triggered by the node and its mutation operator by the total number of mutations are updated to update the model. After the model update is completed, go to step 2.
[0056] The above shows and describes the basic principles, main features and characteristics of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A search-based digital certificate parser difference testing system, characterized by: It includes model building module, search module, branch module, use case generation module, normalization module, detection and update module; The model building module builds an initial model according to the digital certificate structure, mutation operator, limit and fitness function; The search module searches the model for nodes and operators that have not reached the limit and have the maximum fitness function value; The branch module determines that if the node and operator are found, the execution continues, otherwise the execution ends; The use case generation module generates a digital certificate based on the searched nodes and operators; The normalization module uses the generated digital certificate as the input of the digital certificate parser and normalizes the output result of the digital certificate parser; The detection and update module searches for differences in the normalized output results of the digital certificate parser and updates the model based on the differences found.
2. A method for using a search-based digital certificate parser difference testing system, characterized in that: include: Step 1: The model building module builds the initial model according to the digital certificate structure, mutation operator, boundary and fitness function; Step 2: The search module searches for nodes and mutation operators that have not reached the limit and have the largest fitness function value in the model; Step 3: The branch module determines that if the node and mutation operator are found in step 2, then step 4 is executed, otherwise it ends; Step 4: The use case generation module generates a digital certificate based on the nodes and mutation operators searched in step 2; Step 5: The normalization module uses the digital certificate generated in step 4 as the input of the digital certificate parser and normalizes the output result of the digital certificate parser; Step 6: The detection and update module searches for differences in the output results of the digital certificate parser normalized in step 5, updates the model based on the differences found, and goes to step 2.
3. The method for using the search-based digital certificate parser difference testing system according to claim 2, characterized in that: The step 1 is specifically as follows: According to the tree structure of the digital certificate, each node is equipped with three mutation operators: "add structure", "delete structure" and "change content", and each node and its mutation operator is equipped with a limit on the number of invalid consecutive mutations, a limit on the number of total mutations, and a fitness function with an initial value of zero to establish an initial model.
4. The method for using the search-based digital certificate parser difference testing system according to claim 3, characterized in that: The step 2 is specifically as follows: In the model, a breadth-first and then depth-first search strategy is used to search for nodes and mutation operators that have not reached the limit and have the largest fitness function value. During the search process, nodes and mutation operators whose consecutive mutation invalid times limit or total mutation times limit is 0 are not selected.
5. The method for using the search-based digital certificate parser difference testing system according to claim 4, characterized in that: The step 5 is specifically as follows: The digital certificate generated by the node and mutation operator searched in step 2 in step 4 is input into the digital certificate parser to obtain the output of the digital certificate parser, and the format of the key name and value in the output result is standardized.
6. The method for using the search-based digital certificate parser difference testing system according to claim 5, characterized in that: The step 6 is specifically as follows: Based on the normalized digital certificate parser output results of step 5, first determine whether each digital certificate parser can parse the digital certificate and whether there is a resolvability difference based on whether there is a key-value pair. Then, use a top-down search strategy to search for differences between the digital certificate structures parsed by each digital certificate parser. At the same time, search for differences in the corresponding contents of the same structure. Finally, based on the number of resolvability differences, structural differences, and content differences obtained from the search, update the invalid number of consecutive mutations of the nodes and mutation operators searched in step 2, the total number of mutations, and the fitness function value, thereby updating the model. After the model update is completed, go to step 2.
