A fuzzy testing method and system based on real-time data of automobile CAN bus
Through real-time acquisition and boundary value variation algorithm, the response of the vehicle network protocol stack is sent and monitored in real-time, the problem that the existing technology cannot discover vulnerabilities in the vehicle network protocol stack in real-time, and the efficient and accurate security assessment of the vehicle network protocol stack is achieved.
Patent Information
- Application Number
- CN202411671230.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-04-08
AI Technical Summary
Existing test methods cannot detect vulnerabilities and defects in the vehicle network protocol stack in real time, and cannot simulate the real vehicle network environment, and cannot comprehensively evaluate the security of the vehicle network protocol stack.
By collecting the CAN bus message data of the car in real time, combining the boundary value mutation algorithm, the collected data is muted and a variable data set is generated, sent to the bus, and the reaction of the station network protocol stack is monitored in real time, thereby discovering vulnerabilities and defects in the vehicle network protocol stack.
Real-time security assessment of the vehicle network protocol stack is realized, the accuracy and real-timeness of the discovery of vulnerabilities and defects is improved, and the security of the vehicle network protocol stack can be more comprehensively evaluated.
Smart Images

Figure CN119788305A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of vehicle-mounted networks, and in particular to a fuzzy testing method and system based on real-time data of a vehicle CAN bus. Background Art
[0002] With the development of automobile electronics and intelligence, the number of electronic control units (ECUs) in automobiles continues to increase. These ECUs communicate and control through the vehicle network. Among them, the controller area network (CAN) bus is widely used in automobile networks due to its high reliability and real-time performance. The CAN bus protocol is an open protocol that allows different ECUs to exchange data to achieve functional control and information sharing of the vehicle. At the same time, with the increase in automobile network attacks, vehicle network security has gradually become the focus of attention. Traditional testing methods can no longer meet the testing needs of vehicle network security. Therefore, new testing methods need to be developed to discover vulnerabilities and defects in the vehicle network protocol stack.
[0003] Existing testing methods mainly include testing based on protocol parsing and testing based on fuzziness. The testing method based on protocol parsing parses the CAN bus message to verify whether it complies with the protocol specification, thereby discovering problems. However, this method relies on the integrity and accuracy of the protocol specification and cannot discover vulnerabilities that are not specified in the protocol specification. The testing method based on fuzz testing randomly or maliciously tampers with the input data, sends it to the system under test, and observes the system's response to discover system vulnerabilities and defects. This method can discover vulnerabilities that are not specified in the protocol specification, but the existing fuzz testing methods are usually based on offline data and cannot discover vulnerabilities and defects in the vehicle network protocol stack in real time.
[0004] Existing testing methods have certain limitations in discovering vulnerabilities and defects in vehicle network protocol stacks. Testing methods based on protocol parsing rely on the completeness and accuracy of protocol specifications and cannot discover vulnerabilities that are not specified in the protocol specifications. Although testing methods based on fuzz testing can discover vulnerabilities that are not specified in the protocol specifications, existing fuzz testing methods are usually based on offline data and cannot discover vulnerabilities and defects in vehicle network protocol stacks in real time. In addition, existing testing methods are usually unable to simulate the real vehicle network environment and cannot comprehensively evaluate the security of the vehicle network protocol stack. Summary of the invention
[0005] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a fuzzy testing method and system based on real-time data of automobile CAN bus.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] According to one aspect of the present invention, a fuzzy testing method based on real-time data of a car CAN bus is provided, characterized in that the method combines real-time collection of CAN bus message data with a boundary value variation algorithm, and comprises the following steps:
[0008] S1, real-time collection of CAN bus message data of the car;
[0009] S2, using the boundary value mutation algorithm to mutate the collected CAN bus message data and combine them to generate a mutation data set;
[0010] S3, sends the abnormal data set to the bus, monitors the response of the station network protocol stack in real time, and thus discovers the vulnerabilities and defects in the vehicle network protocol stack.
[0011] As a preferred technical solution, the real-time collection of the CAN bus message data of the vehicle in S1 is performed using PCAN.
[0012] As a preferred technical solution, the sampling frequency of real-time collection of the CAN bus message data of the vehicle in S1 is 500 Hz.
[0013] As a preferred technical solution, the boundary values in the boundary value mutation algorithm in S2 include the maximum value, n values before and after the maximum value, the minimum value, and n values before and after the minimum value, where n is a positive integer.
[0014] As a preferred technical solution, when the collected CAN bus message data is mutated using the boundary value mutation algorithm in S2, only the data set whose data is not 00 is subjected to boundary value mutation.
[0015] As a preferred technical solution, the specific steps of using the boundary value mutation algorithm to mutate the collected CAN bus message data in S2 are:
[0016] S21, arranging the designated CAN message ID data in a list, and numbering the n groups of data from 1 to n;
[0017] S22, traverse the list and mark the numbers with data 00;
[0018] S23, performing boundary value mutation on the data set whose data is not 00 to generate a mutated data set;
[0019] As a preferred technical solution, the specific process of boundary value mutation in S23 includes bit flipping, byte flipping, and N-bit flipping.
[0020] As a preferred technical solution, S2 specifically adopts a traversal method to combine the mutated data.
[0021] As a preferred technical solution, the response data of the real-time monitoring and collection system in S3 specifically adopts an asynchronous operation mechanism.
[0022] According to another aspect of the present invention, a fuzzy testing system based on real-time data of a car CAN bus is provided, characterized in that the system is operated by a fuzzy testing method based on real-time data of a car CAN bus as described in any one of claims 1 to 9, and the system includes a real-time data acquisition module, a data abnormality processing module and a real-time testing module;
[0023] The data acquisition module collects the CAN bus message data of the vehicle in real time;
[0024] The data mutation processing module uses a boundary value mutation algorithm to mutate the collected CAN bus message data to generate abnormal CAN message data;
[0025] The real-time test module sends abnormal CAN message data to the bus, monitors the response of the station network protocol stack in real time, and thus discovers loopholes and defects in the vehicle network protocol stack.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] 1. The present invention first collects the CAN bus message data of the car in real time; then uses the boundary value mutation algorithm to mutate the collected CAN bus message data, and combines the mutated data to generate a mutated data set; finally, the mutated data set is sent to the bus to monitor the response of the station network protocol stack in real time, so as to find loopholes and defects in the vehicle network protocol stack. The CAN bus has excellent real-time performance, and the boundary value mutation algorithm can ensure accurate testing at the critical moment of data transmission, so as to more accurately find potential problems. The invention combines the real-time collection of CAN bus message data with the boundary value mutation algorithm, and at the same time improves the real-time and accuracy of finding loopholes and defects in the vehicle network protocol stack.
[0028] 2. In the boundary value mutation algorithm of the present invention, the specified CAN message ID data is first arranged in a list, and n groups of data are numbered from 1 to n; then the list is traversed and the numbers of data with data 00 are marked; finally, the data sets with data not 00 are subjected to boundary value mutation and combined to generate the mutated data set. By using the boundary value mutation algorithm, a more realistic attack scenario can be simulated, thereby comprehensively evaluating the security of the vehicle network protocol stack.
[0029] 3. The response data of the real-time monitoring and collection system in the present invention specifically adopts an asynchronous operation mechanism, that is, the response data of the real-time monitoring and collection system is asynchronously executed in a separate thread, which does not affect the main thread composed of S1 and S2. The real-time monitoring system response is monitored asynchronously, which can ensure continuous data collection without blocking the main program flow, thereby improving the real-time nature of the response data of the monitoring and collection system. Asynchronous processing allows the system to continue to perform other tasks while waiting for a response, which can improve the efficiency of data processing and thus improve the efficiency of testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 The figure is a schematic diagram of the steps of a fuzzy testing method based on real-time data of the automobile CAN bus. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0032] Example
[0033] In this embodiment, all tests are carried out in a laboratory environment, which includes a host computer, a CAN interface card and a simulated vehicle network environment. The host computer realizes real-time data acquisition, data abnormality processing, data transmission and reception through scripts.
[0034] Existing testing methods are usually based on offline data and cannot detect vulnerabilities and defects in the vehicle network protocol stack in real time. This solution collects the CAN bus message data of the car in real time and combines the boundary value mutation algorithm to realize the real-time discovery of vulnerabilities and defects in the vehicle network protocol stack. Or randomly generating data messages in the CAN bus message data for testing has obvious limitations and cannot specifically evaluate the security of the vehicle network protocol stack.
[0035] In this embodiment, a test method based on real-time data of the automobile CAN bus is applied. The method combines the real-time collection of CAN bus message data with the boundary value variation algorithm to achieve the function of real-time discovery of loopholes and defects in the vehicle network protocol stack. The test method is as follows: Figure 1 As shown, the following steps are included:
[0036] S1. Collect the CAN bus message data of the car in real time, obtain the real-time data in the vehicle network, and provide data support for subsequent tests;
[0037] S2, using the boundary value mutation algorithm to mutate the collected CAN bus message data and combine them to generate a mutation data set;
[0038] S3, sends the abnormal data set to the bus, monitors the response of the station network protocol stack in real time, and thus discovers the vulnerabilities and defects in the vehicle network protocol stack.
[0039] In this embodiment, real-time data acquisition specifically uses PCAN to collect the CAN bus message data of the car in real time, with a sampling frequency of 500 Hz and a customizable sampling time. The collected raw data is stored in the memory for subsequent processing.
[0040] In this embodiment, the boundary value mutation algorithm is used to mutate the collected legal CAN message data. The overall logic of the algorithm is to only perform boundary value mutation on the data set whose data is not 00. The specific steps are:
[0041] a. Arrange the data with the specified CAN message ID of 0x383 in a list, as shown in Table 1, and number the 8 groups of data from 1 to 8.
[0042] b. Traverse the list and mark the data numbered 00. From Table 1, we can see that the data numbered 1, 2, 3, and 4 are all 00, so they are marked.
[0043] c. Perform boundary value mutation on the data set whose data is not 00 to generate mutated data according to the data regularity of the original data, and combine the mutated data to generate a mutated data set.
[0044] In this embodiment, the traversal method is used to combine the mutated data and generate a mutated data set. Compared with the completely random test method, the traversal method can find key security vulnerabilities faster. The traversal method provides comprehensive, systematic, and controllable test coverage in fuzz testing, which helps to improve the efficiency and effectiveness of the test.
[0045] The boundary values in this scheme include the maximum value, n values before and after the maximum value, the minimum value, and n values before and after the minimum value, where n is a positive integer.
[0046] Table 1 CAN message list
[0047]
[0048] In this embodiment, the newly generated CAN message data is sent to the bus through the CAN interface, and the response data of the collection system is monitored in real time in an asynchronous manner, thereby effectively discovering potential vulnerabilities and defects and improving the security and reliability of the system.
[0049] In this embodiment, by monitoring the system response in real time in an asynchronous manner, it is possible to ensure that data is continuously collected without blocking the main program flow, thereby improving the real-time performance of the response data of the monitoring and collection system. Asynchronous processing allows the system to continue to perform other tasks while waiting for a response, which can improve the efficiency of data processing and thus improve the efficiency of testing.
[0050] The technical solution applied in this embodiment mutates the collected legal CAN message data through a boundary value mutation algorithm and sends it to the bus in real time, thereby specifically evaluating the security of the vehicle network protocol stack.
[0051] This solution can be widely used in the fields of automotive electronics technology, computer network technology, and testing and verification technology. In the field of automotive electronics technology, this solution can detect vulnerabilities and defects in the vehicle network protocol stack in real time, effectively improve the stability and security of the automotive electronic system, and meet the high security requirements of modern cars.
[0052] The application of this solution can promote the application of computer network technology in the automotive field and promote the research and development of automotive network security. In the field of testing and verification technology, this solution provides a new testing method to discover vulnerabilities and defects in the vehicle network protocol stack. Existing testing methods have certain limitations in discovering vulnerabilities and defects in the vehicle network protocol stack. Therefore, the application of this solution can meet the demand for efficient and accurate testing methods in the field of testing and verification technology and promote the development of testing and verification technology.
[0053] In summary, this solution combines the real-time collection of CAN bus message data with the boundary value variation algorithm, and at the same time improves the real-time and accuracy of discovering vulnerabilities and defects in the vehicle network protocol stack. This solution has broad application prospects and large market demand, and is expected to play an important role in the fields of automotive electronics technology, computer network technology, and testing and verification technology.
[0054] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A fuzzy testing method based on real-time data of automobile CAN bus, characterized in that: The method combines the real-time acquisition of CAN bus message data with the boundary value variation algorithm, and includes the following steps: S1, real-time collection of CAN bus message data of the car; S2, using the boundary value mutation algorithm to mutate the collected CAN bus message data and combine them to generate a mutation data set; S3, sends the abnormal data set to the bus, monitors the response of the station network protocol stack in real time, and thus discovers the vulnerabilities and defects in the vehicle network protocol stack.
2. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 1, characterized in that: The real-time collection of the CAN bus message data of the vehicle in S1 is performed by using PCAN.
3. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 1, characterized in that: The sampling frequency of real-time acquisition of the CAN bus message data of the vehicle in S1 is 500 Hz.
4. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 1, characterized in that: The boundary values in the boundary value mutation algorithm in S2 include the maximum value, n values before and after the maximum value, the minimum value, and n values before and after the minimum value, where n is a positive integer.
5. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 1, characterized in that: When the collected CAN bus message data is mutated using the boundary value mutation algorithm in S2, only the data set whose data is not 00 is subjected to boundary value mutation.
6. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 1, characterized in that: The specific steps of using the boundary value mutation algorithm to mutate the collected CAN bus message data in S2 are: S21, arranging the designated CAN message ID data in a list, and numbering the n groups of data from 1 to n; S22, traverse the list and mark the numbers with data 00; S23, mutate the boundary values of the data sets whose data are not 00 and combine them to generate a mutated data set.
7. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 6, characterized in that: The specific process of the boundary value mutation in S23 includes bit flipping, byte flipping, and N-bit flipping.
8. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 1, characterized in that: The S2 specifically adopts a traversal method to combine the mutated data.
9. A fuzzy testing method based on real-time data of automobile CAN bus according to claim 1, characterized in that: The response data of the real-time monitoring and collection system in S3 adopts an asynchronous operation mechanism, that is, the response data of the real-time monitoring and collection system is asynchronously executed in a separate thread, which does not affect the main thread composed of S1 and S2.
10. A fuzzy testing system based on real-time data of automobile CAN bus, characterized in that: The system is operated by a fuzzy testing method based on real-time data of a car CAN bus as described in any one of claims 1 to 9, and the system includes a real-time data acquisition module, a data abnormality processing module and a real-time testing module; The data acquisition module collects the CAN bus message data of the vehicle in real time; The data mutation processing module uses a boundary value mutation algorithm to mutate the collected CAN bus message data to generate abnormal CAN message data; The real-time test module sends abnormal CAN message data to the bus, monitors the response of the station network protocol stack in real time, and thus discovers loopholes and defects in the vehicle network protocol stack.