Automobile CAN bus information safety testing methodTechnical Field
The invention belongs to the field of automobile safety, and particularly relates to an automobile CAN bus information safety testing method.
Background
With the rapid development of the intelligent networking automobile technology, the automobile information safety problem is increasingly highlighted. How to effectively avoid the problem of automobile information safety needs to strengthen the information safety test of automobiles, discover the existing safety problem in time and repair the safety problem. However, a mature automobile information safety test method, a test tool and a test system are not formed aiming at the information safety of the intelligent networking automobile CAN bus.
Disclosure of Invention
In view of the above, the present invention is directed to a method for testing information security of a CAN bus of an automobile, so as to solve the above-mentioned problems.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
a method for testing information safety of an automobile CAN bus comprises the following steps:
A. identifying a pin of an automobile CAN bus;
B. identifying the Baud rate of the CAN bus of the automobile;
C. reading automobile CAN bus data;
D. generating automobile CAN bus safety test data, analyzing the CAN bus data acquired in the step C, and producing a specific test data packet aiming at each path of CAN bus data;
E. sending CAN bus safety data, observing the state of the automobile, and judging whether the automobile has a safety problem or not;
F. and performing reverse analysis on the data message of the tested loophole, analyzing the meaning of the communication signal, outputting a loophole analysis report and giving a repair suggestion.
Further, the specific steps of the step a are as follows:
A1. the test vehicle was flamed out for 5 minutes;
A2. measuring resistance values between two pins in 16 pins of an On-Board Diagnostics (OBD) interface of the automobile one by using a universal meter, if the resistance values are displayed to be about 60 ohms, the two pins are one-way CAN bus of the automobile, and finding out all CAN buses of the automobile according to the operation;
A3. and respectively measuring the voltage difference of a pair of pins corresponding to the CAN bus by using an oscilloscope, and finding out all CANH and CANL.
Furthermore, in the step B, a tester connects the CAN bus test equipment to the automobile OBD interface, and selects a mode for automatically identifying the baud rate, so that the baud rate of each bus CAN be correctly identified; if the baud rate cannot be identified, traversing the common baud rate until the equipment can acquire the whole vehicle message, and indicating that the baud rate is correct.
Further, in the step C, all high, medium, and low speed CAN messages of the entire vehicle are collected by using the bus data analysis device, and the CAN bus data of each path is stored separately.
Further, in the step D, traversing all IDs within the range of 0x00-0x7FF of the high-speed CAN and the low-speed CAN by using a brute force breaking algorithm, and performing a brute force breaking test on the tested vehicle;
positioning 8 bytes of data of each effective ID by utilizing a dichotomy, reversely outputting a control instruction of the vehicle action, and decoding the ID and the corresponding bytes of the vehicle action;
a packet data packet with high priority is sent to the high-speed CAN and the low-speed CAN by using a denial of service algorithm to perform denial of service test on the vehicle bus;
and sending a data packet of a diagnostic service scanning algorithm to pins 6 and 14 of the OBD interface, and compiling a sub-service blasting algorithm aiming at the scanned service to test the encryption degree of the ECU security access algorithm.
Further, the application data packet is sent to the whole automobile through the OBD in the step E, and whether the automobile has the problems that a bus is closed due to overhigh load rate, and the power system and the comfortable entertainment system of the automobile are influenced or not is observed;
and sending the diagnosis data packet to the whole vehicle through OBD, collecting a response message of the whole vehicle, analyzing whether the vehicle has a security access 27 service loss, a security access algorithm is too weak, and a vulnerability without fingerprint verification added in programming, and observing whether the vehicle has the problems of tampering calibration, malicious programming and control action.
Compared with the prior art, the method for testing the information safety of the automobile CAN bus has the following advantages:
the automobile CAN bus information safety test method CAN realize bus bidirectional data transmission, monitor bus faults in real time, and ensure that the bus does not lose frames and bus data is stably received; the CAN bus security vulnerability CAN be tested and analyzed before the vehicle is on the market, and a repair suggestion is given, so that a good guiding function is provided for the information security test of the CAN bus; the method CAN effectively make up the technical blank in the field and promote the improvement of the information safety test level of the automobile CAN bus.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flow chart of a method for testing information security of a CAN bus of an automobile according to an embodiment of the present invention;
FIG. 2 is a block diagram of a test structure according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
As shown in fig. 1, a method for testing the information security of a CAN bus of an automobile includes the following steps:
A. identifying a pin of an automobile CAN bus;
B. identifying the Baud rate of the CAN bus of the automobile;
C. reading automobile CAN bus data;
D. generating automobile CAN bus safety test data, analyzing the CAN bus data acquired in the step C, and producing a specific test data packet aiming at each path of CAN bus data;
E. sending CAN bus safety data, observing the state of the automobile, and judging whether the automobile has a safety problem or not;
F. and performing reverse analysis on the data message of the tested loophole, analyzing the meaning of the communication signal, outputting a loophole analysis report and giving a repair suggestion.
Further, the specific steps of the step a are as follows:
A1. the test vehicle was flamed out for 5 minutes;
A2. measuring resistance values between two pins in 16 pins of an On-Board Diagnostics (OBD) interface of the automobile one by using a universal meter, if the resistance values are displayed to be about 60 ohms, the two pins are one-way CAN bus of the automobile, and finding out all CAN buses of the automobile according to the operation;
A3. and respectively measuring the voltage difference of a pair of pins corresponding to the CAN bus by using an oscilloscope, and finding out all CANH and CANL.
Furthermore, in the step B, a tester connects the CAN bus test equipment to the automobile OBD interface, and selects a mode for automatically identifying the baud rate, so that the baud rate of each bus CAN be correctly identified; if the common baud rate cannot be identified, traversing the common baud rate until the device can acquire the whole vehicle message, wherein the baud rate is correct, and the common baud rates for vehicle communication are 1Mbps, 500kbps, 250kbps, 125kbps, 100kbps and 33.33 kbps.
Further, in the step C, all high, medium, and low speed CAN messages of the entire vehicle are collected by using the bus data analysis device, and the CAN bus data of each path is stored separately.
Further, in the step D, traversing all IDs within the range of 0x00-0x7FF of the high-speed CAN and the low-speed CAN by using a brute force breaking algorithm, and performing a brute force breaking test on the tested vehicle;
positioning 8 bytes of data of each effective ID by utilizing a dichotomy, reversely outputting a control instruction of the vehicle action, and decoding the ID and the corresponding bytes of the vehicle action;
a packet data packet with high priority (the smaller the ID packet value, the higher the priority) is sent to the high-speed CAN and the low-speed CAN by using a denial of service algorithm to perform denial of service test on a vehicle bus;
and sending a data packet of a diagnostic service scanning algorithm to pins 6 and 14 of the OBD interface, and compiling a sub-service blasting algorithm aiming at the scanned service to test the encryption degree of the ECU security access algorithm. According to the national standard, the communication of the general automobile diagnosis service is carried out on the pins 6 and 14, so that the pins 6 and 14 of the OBD interface are used.
Further, the application data packet is sent to the whole automobile through the OBD in the step E, and whether the automobile has the problems that a bus is closed due to overhigh load rate, and the power system and the comfortable entertainment system of the automobile are influenced or not is observed;
and sending the diagnosis data packet to the whole vehicle through OBD, collecting a response message of the whole vehicle, analyzing whether the vehicle has a security access 27 service loss, a security access algorithm is too weak, and a vulnerability without fingerprint verification added in programming, and observing whether the vehicle has the problems of tampering calibration, malicious programming and control action.
As shown in fig. 2, the test structure of the present embodiment is: set up the OBD interface in the information security test vehicle, the OBD interface connects gradually bus data analysis equipment, USB interface and test computer, wherein, bus data analysis equipment is including CAN transceiver, CAN controller and the singlechip that connects gradually, CAN transceiver and OBD interface connection, the singlechip with be connected with the test computer through the USB interface.
The single chip microcomputer is a USB flash memory single chip microcomputer, the CAN controller is MCP2515 in model, the CAN transceiver is MCP2561 in model, a DB9 male interface is adopted as a CAN bus interface, CAN2.0A and CAN2.0B protocols are supported, and the standard is in accordance with ISO/DIS 11898.
When the equipment is connected to the vehicle bus and works normally, the CAN message on the bus CAN be received on the testing computer immediately after the baud rate is set. Similarly, after the device is connected with the tested bus, the data of different algorithms such as the fuzzy test algorithm, the denial of service algorithm, the dichotomy and the like can be sent to the tested bus by using the sending interface. The transceiving data supports any CAN2.0A/B format standard.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.