A typical fuzz testing sample generation method
By sorting out encryption, compression and checksum algorithms in the Peach platform, test cases that can pass verification are generated, which solves the problem of discarded fuzz test data, improves test depth and coverage, and enhances vulnerability mining efficiency.
Patent Information
- Application Number
- CN202410341662.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-03-25
AI Technical Summary
When the Peach platform performs fuzz testing on encrypted, compressed or checksummed protocol data, the generated test data is discarded because it cannot pass verification or is identified, resulting in insufficient test path depth and low coverage, which affects the efficiency of vulnerability mining. .
A fuzz test sample generation method is designed. By sorting out encryption, compression and checksum algorithms, an algorithm collection library is formed, mutation rules are set in the PitFile configuration file, and the Peach fuzz test engine is used to generate data that can be decrypted, decompressed or Test cases for verification and verification, combined with Agent monitor for secondary verification and recording.
It effectively expands the Peach platform's fuzz testing capabilities for encryption, compression and checksum protocol messages, improves the depth and coverage of test paths, and enhances the effectiveness of vulnerability mining.
Smart Images

Figure CN118409951B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security, and in particular relates to a typical fuzzy test sample generation method. Background Art
[0002] With the continuous development of informatization, software development has become more complex and diversified. Behind the huge software market, software vulnerabilities have become the main threat to the current software promotion and application. Faced with the exponential growth of various software applications, how to quickly and accurately discover the vulnerabilities contained in them has become an urgent problem to be solved.
[0003] The Peach platform is a recognized vulnerability mining platform in the field of network security with outstanding scalability, flexibility and functionality, especially in protocol-based vulnerability mining. It has excellent program running status monitoring capabilities and crash point secondary confirmation and recording functions. It has developed very rapidly and is used by a large number of network security workers.
[0004] For encrypted, compressed, or checksummed protocol data, if the Peach tool performs fuzzy mutation testing directly on the encrypted, compressed, or checksummed protocol data, the mutated data will not be decrypted, decompressed, or checksummed by the target program and will be rejected or discarded. Most fuzzy test paths will be terminated at the same point due to decryption, decompression failure, or verification failure. This will result in insufficient depth of fuzzy test paths and difficulty in achieving mutation of encrypted and compressed protocol fields. In order to improve the effectiveness of fuzz testing tools in vulnerability mining for such protocols, the Peach fuzz testing tool is equipped with the ability to perform fuzz testing on protocol packets containing encrypted data, compressed data, or checksums.
[0005] The Peach platform is a recognized vulnerability mining platform in the field of network security with outstanding scalability, flexibility and functionality, especially in protocol-based vulnerability mining. It has excellent program running status monitoring capabilities and crash point secondary confirmation and recording functions. It has developed very rapidly and is used by a large number of network security workers.
[0006] As a black-box fuzz testing platform, the Peach platform generates and sends a large number of malformed data packets to the target system under test, and monitors the operating status of the target system under test in real time through a monitor. When the monitor finds that the target system under test crashes, the Peach platform records the crash information in the log and records possible security issues in the system.
[0007] It can be seen that the above prior art has the following problems:
[0008] 1. Sample data verification failed.
[0009] There are many test targets that provide various types of verification for the format. For example, network protocols usually use checksums for verification. These verification mechanisms will bring obstacles to fuzz testing. In fuzz testing, we often achieve the purpose of testing by changing the content of the data packet. When the content of the data packet changes, the test data may be directly discarded because it cannot pass the verification mechanism, which greatly affects the efficiency of the test.
[0010] 2. Encrypted data and compressed data cannot be identified.
[0011] The format of encrypted data is difficult to detect, and if the test tool does not do anything with the randomly changing data bytes in the sample, the target test program cannot recognize the data. Compressed data also has such problems.
[0012] 3. The problem of test depth of test samples.
[0013] Through the analysis of code rate, it can be found that in the process of testing encrypted, compressed or protocol data with checksum, most test paths will be terminated at the same point due to decryption, decompression failure or verification failure. If the specific function data is not encapsulated, the code depth and coverage that can be detected by almost all test samples are basically the same, and a large number of test samples lose the meaning of mutation, which affects the test effect. Summary of the invention
[0014] 1. Technical issues to be resolved
[0015] The technical problem to be solved by the present invention is: to design a typical fuzz test sample generation method to solve the problem that the fuzz test data generated by the Peach platform is discarded by the target program because it fails to pass the checksum verification and cannot be recognized by the encryption or compression algorithm, resulting in insufficient depth and low coverage of the code test path that the fuzz test sample can detect.
[0016] (II) Technical solution
[0017] In order to solve the above technical problems, the present invention provides a typical fuzzy test sample generation method, comprising the following steps:
[0018] Step 1. Sort out the three commonly used algorithms of network protocols: encryption algorithm, compression algorithm and checksum algorithm, analyze each algorithm one by one, and form a collection library of encryption, compression and checksum algorithms;
[0019] Step 2. Use the PitFile configuration file as a script file written by Peach users for different tested objects, and use the XML format to control the Peach fuzzy test engine to determine which field to mutate and the mutation rules; design the association rules between the three algorithms and the XML file and the mapping rules between the input and output of the three algorithms according to the syntax and semantic rules of the Peach test sample generation model, so as to realize the flexible calling of the three algorithms by the PitFile configuration file;
[0020] Step 3. Write corresponding codes according to the association rules and mapping rules designed in step 2, and embed the three algorithms into the Peach test sample generation model by calling the three algorithms and passing in parameters;
[0021] Step 4. Use the Peach fuzzy test engine to exhaustively enumerate all possible deformed data according to the mutation rules set in the PitFile configuration file, and on this basis, call the three algorithms mentioned above through the PitFile configuration file to encrypt, compress, or generate checksum fields for the deformed data, and derive test cases.
[0022] Preferably, the method further comprises step 5. Using a Publisher to send the test cases generated in step 4 to a specific target program, wherein the test cases can successfully pass the decryption, decompression, or checksum verification of the target program, and perform fuzzy testing on more branches of the target program.
[0023] Preferably, the method further includes step 6. Monitoring all exceptions and crash information of the target program through the Agent monitor, protecting the scene when an exception or crash occurs, and performing secondary verification by fallback. If an exception or crash occurs again during the secondary verification, the corresponding test case is recorded, and the stack information, register value and exception information are saved.
[0024] The invention also provides a fuzzy testing method implemented based on the method.
[0025] Preferably, the method comprises the following steps:
[0026] First, the protocol message of the software or device to be tested is captured by a network traffic analysis tool, and the meaning of each field of the protocol message is analyzed through protocol reverse engineering, or the meaning of each field of the protocol message is determined according to the protocol document of the software or device to be tested;
[0027] Secondly, determine whether the protocol data in the message format is encrypted, compressed or with a checksum. If the protocol data has a CRC checksum, determine the object of the CRC checksum, that is, determine the start and end positions of the data content of the CRC checksum in the protocol message;
[0028] Next, write the PitFile configuration file, determine the mutation fields of the protocol message based on the protocol analysis, set the mutation strategy, mark the start and end positions of the CRC checksum, add the algorithm rules as the CRC checksum, implement the PitFile configuration file to call the CRC checksum algorithm, generate the checksum field based on the call to the CRC checksum algorithm, and generate test cases;
[0029] Finally, start the Peach platform and use the generated test cases to perform protocol tests on the software or device under test. Check the log regularly to see if there are any crashes. Based on the test results, continuously modify the PitFile configuration file to adjust the mutation fields and mutation strategies.
[0030] The present invention also provides a system for implementing the method.
[0031] The present invention also provides a vulnerability mining platform designed based on the method.
[0032] The invention also provides a vulnerability mining method implemented based on the method.
[0033] (III) Beneficial effects
[0034] The present invention increases the ability of the Peach tool to perform fuzz testing on protocol messages containing encrypted data, compressed data or checksums on the basis of the original functions of Peach, expands the ability of the Peach platform to generate typical fuzz test samples, and effectively solves the problem of shallow code depth and low coverage that the fuzz testing platform can detect when performing fuzz testing on network protocol messages that use common encryption algorithms, compression algorithms and checksum algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is the structure diagram of the Peach platform;
[0036] Figure 2 The system structure diagram after the Peach platform is improved for the present invention;
[0037] Figure 3 This is the PitFile configuration file after the Peach platform is improved in the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0039] The present invention provides a typical fuzzy test sample generation method, which includes: sorting out the commonly used encryption algorithms, compression algorithms and checksum algorithms of network protocols; deeply analyzing the Peach test sample generation model, mutation rules, software technology architecture and coupling interface, embedding the commonly used encryption algorithms, compression algorithms and checksum algorithms of network protocols into the Peach test sample generation model, and realizing the flexible calling of the algorithm by the PitFile configuration file (configuration file of the Peach fuzzy test tool), thereby realizing the test sample generation. The specific steps are as follows:
[0040] Step 1. Sort out the three commonly used algorithms in network protocols: encryption algorithm, compression algorithm, and checksum algorithm. Analyze each algorithm one by one, collect or develop common algorithm code modules, and form a collection library of encryption, compression, and checksum algorithms.
[0041] Step 2. Use the PitFile configuration file as a script file written by Peach users for different tested objects, and use the XML format to control the Peach fuzzy test engine to determine which field to mutate and the mutation rules; according to the syntax and semantic rules of the Peach test sample generation model (i.e., the PitFile configuration file data model), design the association rules between the above three algorithms and the XML file, as well as the mapping rules between the input and output of the above three algorithms, so as to realize the flexible calling of the above three algorithms by the PitFile configuration file.
[0042] Step 3. Write the corresponding code according to the association rules and mapping rules designed in step 2, and embed the above three algorithms into the Peach test sample generation model by calling the above three algorithms and passing in parameters.
[0043] Step 4. Use the Peach fuzzy testing engine to exhaustively enumerate all possible deformed data according to the mutation rules set in the PitFile configuration file, and on this basis, flexibly call the above three algorithms through the PitFile configuration file to encrypt, compress, or generate checksum fields for the deformed data, deriving a large number of test cases.
[0044] Step 5. Use the Publisher to send the test cases generated in step 4 to a specific target program. These test cases will successfully pass the decryption, decompression, or checksum verification of the target program, and can perform fuzz testing on more branches of the target program.
[0045] Step 6. Monitor all exceptions and crashes of the target program through the Agent monitor, and protect the scene when an exception or crash occurs, and perform secondary verification through rollback. If an exception or crash occurs again during the secondary verification, record the corresponding test case and save the stack information, register value and exception information for analysis.
[0046] In combination with the above Figure 2 , Figure 3 , describing the fuzzy testing process implemented by the method for generating typical samples based on the extended Peach platform of the present invention:
[0047] First, use tools such as Wireshark (a network traffic analysis tool) to capture the protocol messages of the software or device under test, and reverse analyze the meaning of each field of the protocol message through the protocol, or determine the meaning of each field of the protocol message based on the protocol document of the software or device under test.
[0048] Secondly, determine whether the protocol data in the message format is encrypted, compressed or has a checksum. Taking the protocol data with CRC checksum as an example, it is necessary to determine the object of the CRC checksum, that is, determine the start and end positions of the data content of the CRC checksum in the protocol message.
[0049] Again, write the PitFile configuration file, determine the mutation fields of the protocol message based on the protocol analysis, set the mutation strategy, mark the start and end positions of the CRC checksum, add algorithm rules for the CRC checksum, implement the PitFile configuration file to call the CRC checksum algorithm, generate the checksum field based on the call to the CRC checksum algorithm, and generate test cases.
[0050] Finally, start the Peach platform and use the generated test cases to perform protocol tests on the software or device under test. Check the log regularly to see if there is any crash. Based on the test results, continuously modify the PitFile configuration file to adjust the mutation field and mutation strategy.
[0051] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A fuzzy testing method based on a typical fuzzy testing sample generation method, characterized in that: The typical fuzzy test sample generation method includes the following steps: Step 1. Sort out the three commonly used algorithms of network protocols: encryption algorithm, compression algorithm and checksum algorithm, analyze each algorithm one by one, and form a collection library of encryption, compression and checksum algorithms; Step 2. Use the PitFile configuration file as a script file written by Peach users for different tested objects, and use the XML format to control the Peach fuzzy test engine to determine which field to mutate and the mutation rules; design the association rules between the three algorithms and the XML file and the mapping rules between the input and output of the three algorithms according to the syntax and semantic rules of the Peach test sample generation model, so as to realize the flexible calling of the three algorithms by the PitFile configuration file; Step 3. Write corresponding codes according to the association rules and mapping rules designed in step 2, and embed the three algorithms into the Peach test sample generation model by calling the three algorithms and passing in parameters; Step 4. Use the Peach fuzzy test engine to exhaustively enumerate all possible deformed data according to the mutation rules set in the PitFile configuration file, and on this basis, call the three algorithms through the PitFile configuration file to encrypt, compress, or generate checksum fields for the deformed data, and derive test cases; The fuzz testing method includes the following steps: First, the protocol message of the software or device to be tested is captured by a network traffic analysis tool, and the meaning of each field of the protocol message is analyzed through protocol reverse engineering, or the meaning of each field of the protocol message is determined according to the protocol document of the software or device to be tested; Secondly, determine whether the protocol data in the message format is encrypted, compressed or with a checksum. If the protocol data has a CRC checksum, determine the object of the CRC checksum, that is, determine the start and end positions of the data content of the CRC checksum in the protocol message; Next, write the PitFile configuration file, determine the mutation fields of the protocol message based on the protocol analysis, set the mutation strategy, mark the start and end positions of the CRC checksum, add the algorithm rules as the CRC checksum, implement the PitFile configuration file to call the CRC checksum algorithm, generate the checksum field based on the call to the CRC checksum algorithm, and generate test cases; Finally, start the Peach platform and use the generated test cases to perform protocol tests on the software or device under test. Check the log regularly to see if there are any crashes. Based on the test results, continuously modify the PitFile configuration file to adjust the mutation fields and mutation strategies.
2. The method according to claim 1, characterized in that The method also includes step 5. Using a Publisher to send the test cases generated in step 4 to a specific target program. These test cases can successfully pass the decryption, decompression, or checksum verification of the target program, and perform fuzz testing on more branches of the target program.
3. The method according to claim 2, characterized in that It also includes step 6. Monitor all exceptions and crash information of the target program through the Agent monitor, protect the scene when an exception or crash occurs, and perform secondary verification through fallback. If an exception or crash occurs again during the secondary verification, record the corresponding test case and save the stack information, register value and exception information.
4. The method according to claim 3, characterized in that The stack information, register values and exception information are used for manual analysis.
5. The method according to claim 1, characterized in that Use the Wireshark tool to capture the protocol packets of the software or device under test.
6. A system for implementing the method according to any one of claims 1 to 5.
7. A vulnerability mining platform designed based on the method as described in any one of claims 1 to 5.
8. A vulnerability mining method implemented based on the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Network protocol fuzz testing method and framework
CN114666257A
Methods, systems, and computer readable media for automatically generating a fuzzer that implements functional and fuzz testing and testing a network device using the fuzzer
US20130340083A1
System and method for detecting vulnerability of internet of things in power systems (iotips) protocol based on fuzz testing
US20230188556A1
