CAN bus attack type determination method, processor and computer device
By detecting the number of abnormalities in CAN messages, the attack types on the CAN bus are accurately analyzed, which solves the problem of not being able to identify specific attack types in the prior art, and improves the efficiency and effectiveness of security detection.
Patent Information
- Application Number
- CN202311764184.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2043-12-20
AI Technical Summary
The existing technology cannot effectively analyze the specific types of attacks on the CAN bus, making it difficult for security personnel to formulate targeted response strategies.
By obtaining multiple CAN messages within the preset time period, the number of abnormalities is detected, including the number of whitelist detection abnormalities, the number of abnormalities detected during the message cycle, the number of abnormalities detected by the message length detection, and the number of abnormalities detected by the load rate detection, and the number of abnormalities detected by the attack based on these results. Types, including fuzzy attacks, denial of service attacks, replay attacks, message jamming attacks, and injection attacks.
Accurate analysis of CAN bus attack types is achieved, helping security personnel to quickly formulate targeted response strategies, and improving the efficiency and effectiveness of security detection.
Smart Images

Figure CN117544410B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of vehicle network security detection, and specifically to a method for determining a CAN bus attack type, a processor, and a computer device. Background Art
[0002] At present, cars have achieved extensive automation and are equipped with a series of sensors and computing systems. There are more than 100 car controllers, and this number is expected to increase in the future. These car controllers are distributed around the car and communicate with each other through in-vehicle communication networks such as Controller Area Network (CAN). As the most common in-vehicle communication protocol in vehicle applications, CAN has the advantages of low cost, no electrical interference, self-diagnosis and error correction. Although CAN has many advantages, the increasing communication between and within vehicles makes CAN vulnerable to network attacks. Therefore, the existing technology usually detects attacks on the CAN bus by deploying an intrusion detection engine on the car controller. However, the existing CAN bus attack detection method cannot analyze the specific attack type, making it difficult for security personnel to make a more effective and quick response strategy for the specific attack type. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method, processor and computer device for determining the type of CAN bus attack, so as to solve the problem that the CAN bus attack detection method in the prior art cannot analyze the specific attack type.
[0004] In order to achieve the above-mentioned purpose, the first aspect of the embodiment of the present application provides a method for determining a CAN bus attack type, comprising:
[0005] Get multiple CAN messages within a preset time period;
[0006] Detect multiple CAN messages to obtain abnormal quantity detection results, where the abnormal quantity detection results include the abnormal quantity of whitelist detection, the abnormal quantity of message period detection, the abnormal quantity of message length detection, and the abnormal quantity of load rate detection;
[0007] The type of attack suffered by the CAN bus within a preset time period is determined based on the abnormal quantity detection results.
[0008] In an embodiment of the present application, the type of attack suffered by the CAN bus within a preset time period is determined based on the result of the abnormality number detection, including: when the number of whitelist detection abnormalities is greater than or equal to the first whitelist abnormality number threshold, the number of message period detection abnormalities is greater than or equal to the second message period abnormality number threshold, the number of message length detection abnormalities is greater than or equal to the second message length abnormality number threshold and the number of load rate detection abnormalities is greater than or equal to the first load rate abnormality number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a fuzzy attack.
[0009] In an embodiment of the present application, the type of attack suffered by the CAN bus within a preset time period is determined based on the result of the abnormality number detection, including: when the number of whitelist detection abnormalities is less than or equal to the third whitelist abnormality number threshold, the number of message period detection abnormalities is greater than or equal to the second message period abnormality number threshold, the number of message length detection abnormalities is less than or equal to the third message length abnormality number threshold and the number of load rate detection abnormalities is less than or equal to the second load rate abnormality number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a replay attack.
[0010] In an embodiment of the present application, the type of attack suffered by the CAN bus within a preset time period is determined based on the result of the abnormality number detection, including: when the number of whitelist detection abnormalities is greater than or equal to the first whitelist abnormality number threshold, the number of message period detection abnormalities is less than or equal to the third message period abnormality number threshold, the number of message length detection abnormalities is less than or equal to the third message length abnormality number threshold and the number of load rate detection abnormalities is greater than or equal to the first load rate abnormality number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a denial of service attack.
[0011] In an embodiment of the present application, the type of attack suffered by the CAN bus within a preset time period is determined based on the result of the abnormality number detection, including: when the number of whitelist detection abnormalities is less than or equal to the third whitelist abnormality number threshold, the number of message period detection abnormalities is less than or equal to the second message period abnormality number threshold, the number of message length detection abnormalities is less than or equal to the third message length abnormality number threshold, and the number of load rate detection abnormalities is less than or equal to the third load rate abnormality number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a message interference attack.
[0012] In an embodiment of the present application, the type of attack suffered by the CAN bus within a preset time period is determined based on the result of the abnormality number detection, including: when the number of whitelist detection abnormalities is less than or equal to the second whitelist abnormality number threshold, the number of message period detection abnormalities is less than or equal to the second message period abnormality number threshold, the number of message length detection abnormalities is less than or equal to the second message length abnormality number threshold and the number of load rate detection abnormalities is less than or equal to the third load rate abnormality number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is an injection attack.
[0013] A second aspect of an embodiment of the present application provides a device for determining a CAN bus attack type, comprising: a CAN message acquisition module, used to acquire multiple CAN messages within a preset time period; a detection result acquisition module, used to detect multiple CAN messages to obtain an abnormal number detection result, wherein the abnormal number detection result includes an abnormal number of whitelist detection, an abnormal number of message period detection, an abnormal number of message length detection, and an abnormal number of load rate detection; an attack type discrimination module, used to determine the type of attack suffered by the CAN bus within a preset time period according to the abnormal number detection result.
[0014] A third aspect of an embodiment of the present application provides a processor configured to execute the above-mentioned method for determining the type of CAN bus attack.
[0015] A fourth aspect of an embodiment of the present application provides a computer device, including a device or a processor for determining a CAN bus attack type.
[0016] A fifth aspect of an embodiment of the present application provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned method for determining the type of CAN bus attack.
[0017] The above technical solution obtains multiple CAN messages within a preset time period, and then detects multiple CAN messages to obtain an abnormal number detection result. The abnormal number detection result includes the abnormal number of whitelist detection, the abnormal number of message cycle detection, the abnormal number of message length detection, and the abnormal number of load rate detection. The type of attack suffered by the CAN bus within the preset time period can be determined according to the abnormal number detection result. The present application determines the type of attack suffered by the CAN bus within the preset time period according to the abnormal number of whitelist detection, the abnormal number of message cycle detection, the abnormal number of message length detection, and the abnormal number of load rate detection. The specific attack type can be analyzed, and the obtained detection result is relatively accurate, so that security personnel can effectively and quickly make response strategies for specific attack types.
[0018] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0020] Figure 1 A flowchart of a method for determining a CAN bus attack type according to an embodiment of the present application is schematically shown;
[0021] Figure 2 A flowchart for determining a fuzzy attack according to a specific embodiment of the present application is schematically shown;
[0022] Figure 3 A flowchart for determining a replay attack according to a specific embodiment of the present application is schematically shown;
[0023] Figure 4 A flowchart for determining a denial of service attack according to a specific embodiment of the present application is schematically shown;
[0024] Figure 5 A flowchart for determining a message interference attack according to a specific embodiment of the present application is schematically shown;
[0025] Figure 6 A flowchart for determining an injection attack according to a specific embodiment of the present application is schematically shown;
[0026] Figure 7 The structure diagram of a device for determining a CAN bus attack type according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0028] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0029] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0030] Figure 1 The flowchart of a method for determining a CAN bus attack type according to an embodiment of the present application is schematically shown. Figure 1 As shown, the embodiment of the present application provides a method for determining the type of CAN bus attack, and the determination method is applied to a processor as an example for explanation. The determination method may include the following steps:
[0031] Step S101: Acquire multiple CAN messages within a preset time period.
[0032] Step S102: Detect multiple CAN messages to obtain abnormal number detection results, wherein the abnormal number detection results include the abnormal number of whitelist detection, the abnormal number of message period detection, the abnormal number of message length detection and the abnormal number of load rate detection.
[0033] Step S103: Determine the attack type suffered by the CAN bus within a preset time period according to the abnormal quantity detection result.
[0034] Common CAN bus attack types in vehicles include fuzzy attacks, denial of service attacks, replay attacks, message jamming attacks, and injection attacks. Although existing technologies can detect anomalies in CAN messages, they are often unable to analyze specific attack types. For example, if the intrusion detection system detects that the CAN message identifier is not in the whitelist, it will report an alarm log that the identifier is not in the whitelist. For another example, when an abnormality is detected in the cycle of any CAN message, an alarm log of abnormal message cycle will be reported. These alarm logs do not include specific attack types, which makes it impossible for security personnel to effectively and quickly formulate response strategies for specific attack types.
[0035] To solve this problem, in an embodiment of the present application, first, the processor can obtain multiple CAN messages within a preset time period through a CAN message transceiver unit and a CAN message processing unit. The CAN message transceiver unit can convert CAN messages into high and low levels and send them to the CAN bus, or read the high and low levels on the CAN bus and convert them into CAN messages. The CAN message processing unit can be used to route and assemble CAN messages.
[0036] The processor includes a whitelist detection unit, a message cycle detection unit, a message length detection unit and a load rate detection unit. Each vehicle model has a corresponding CAN communication matrix, which is used to illustrate the CAN identifiers on the CAN bus and the information carried by each CAN identifier. Among them, the information carried by each CAN identifier includes information such as vehicle speed and door status. Through the whitelist detection unit, the processor can determine whether the CAN identifier corresponding to the CAN message is in the CAN communication matrix. If the corresponding CAN identifier is not in the CAN communication matrix, it can be determined that the CAN message is abnormal. Every time an abnormal CAN message is detected, the number of whitelist detection anomalies counted by the counter in the whitelist detection unit increases once.
[0037] In addition, the CAN communication matrix also stipulates that the CAN message identified by each CAN identifier is a periodic CAN message or an event CAN message, and stipulates the corresponding theoretical cycle value for the periodic CAN message. Thus, the message cycle detection unit can determine whether the actual cycle value of the periodic CAN message is consistent with the theoretical cycle value. If they are inconsistent, it can be determined that the message cycle of the periodic CAN message is abnormal. Each time a message cycle abnormality of a periodic CAN message is detected, the number of message cycle detection abnormalities counted by the counter in the message cycle detection unit increases once.
[0038] Similarly, the CAN communication matrix specifies the length of the message data field identified by each CAN identifier, and the CAN message will strictly follow this length value. Therefore, through the message length detection unit, it can be determined whether the data field length of the CAN message is consistent with the message data field length specified by the CAN communication matrix. If not, it can be determined that the message length of the CAN message is abnormal. Each time the message length of the CAN message is detected to be abnormal, the number of abnormal message length detections counted by the counter in the message length detection unit increases once.
[0039] The load rate can be used to monitor the traffic volume on the CAN bus. The load rate detection unit can monitor the load rate on the CAN bus. Each time it is detected that the load rate is greater than a preset load rate threshold, the number of load rate detection anomalies counted by the counter in the load rate detection unit increases once.
[0040] Thus, the processor can obtain the abnormal number detection result, that is, the whitelist detection abnormal number, the message cycle detection abnormal number, the message length detection abnormal number and the load rate detection abnormal number, so that the processor can determine the attack type suffered by the CAN bus within the preset time period according to the whitelist detection abnormal number, the message cycle detection abnormal number, the message length detection abnormal number, the load rate detection abnormal number and the preset abnormal number threshold. The preset abnormal number threshold is determined according to the actual situation, including the first whitelist abnormal number threshold, the second whitelist abnormal number threshold, the third whitelist abnormal number threshold, the first message cycle abnormal number threshold, the second message cycle abnormal number threshold, the third message cycle abnormal number threshold, the first message length abnormal number threshold, the second message length abnormal number threshold, the third message length abnormal number threshold, the first load rate abnormal number threshold, the second load rate abnormal number threshold and the third load rate abnormal number threshold. Among them, the second whitelist abnormal number threshold is greater than the third whitelist abnormal number threshold and less than the first whitelist abnormal number threshold. The second message cycle abnormal number threshold is greater than the third message cycle abnormal number threshold and less than the first message cycle abnormal number threshold. The second message length abnormality threshold is greater than the third message length abnormality threshold and less than the first message length abnormality threshold. The second load rate abnormality threshold is greater than the third load rate abnormality threshold and less than the first load rate abnormality threshold.
[0041] In addition, the aforementioned method for determining the attack type of the CAN bus can be compiled into a static library, which provides an algorithm call interface. Through the algorithm call interface, the static library can be referenced and finally compiled and burned into the vehicle gateway device. After the vehicle gateway device is started, the attack type of the CAN bus can be detected.
[0042] The above technical solution obtains multiple CAN messages within a preset time period, and then detects multiple CAN messages to obtain an abnormal number detection result. The abnormal number detection result includes the abnormal number of whitelist detection, the abnormal number of message cycle detection, the abnormal number of message length detection, and the abnormal number of load rate detection. The type of attack suffered by the CAN bus within the preset time period can be determined according to the abnormal number detection result. The present application determines the type of attack suffered by the CAN bus within the preset time period according to the abnormal number of whitelist detection, the abnormal number of message cycle detection, the abnormal number of message length detection, and the abnormal number of load rate detection. The specific attack type can be analyzed, and the obtained detection result is relatively accurate, so that security personnel can effectively and quickly make response strategies for specific attack types.
[0043] In an embodiment of the present application, determining the type of attack suffered by the CAN bus within a preset time period based on the results of the anomaly quantity detection may include: when the number of whitelist detection anomalies is greater than or equal to a first whitelist anomaly quantity threshold, the number of message period detection anomalies is greater than or equal to a second message period anomaly quantity threshold, the number of message length detection anomalies is greater than or equal to the second message length anomaly quantity threshold, and the number of load rate detection anomalies is greater than or equal to the first load rate anomaly quantity threshold, determining that the type of attack suffered by the CAN bus within the preset time period is a fuzzy attack.
[0044] In the embodiment of the present application, since the CAN communication matrix of each car manufacturer is confidential, fuzzy attacks are often used to reverse the CAN communication matrix. The attacker uses a CAN transceiver tool to access the car CAN bus through the car's on-board diagnostic system interface, and then sends a randomly constructed CAN message. When constructing the CAN message, its identifier, data field length, and message content are randomly generated. The attacker determines whether the attack is successful by observing the state and behavior of the vehicle. In one example, if the headlights are found to be on during the sending of the randomly constructed CAN message, then the randomly constructed CAN messages sent during this period include CAN messages that turn on the headlights. The attacker only needs to screen the randomly constructed CAN messages that have been sent again to reverse the CAN message information of the headlights.
[0045] Since the identifier, data field length, and message content are all randomly generated, fuzzy attacks will construct a large number of CAN messages whose identifiers are not in the whitelist, so the number of whitelist detection anomalies will be large. Of course, it is also possible to construct a small number of CAN messages whose identifiers are in the whitelist. At this time, the data field length of the CAN message may also be inconsistent with the provisions of the CAN communication matrix. In addition, if the CAN message is a periodic CAN message, it will also affect the actual period value of the normal CAN message. Sending a large number of CAN messages will also increase the traffic on the CAN bus, so the load rate may be continuously higher than the preset load rate threshold for a period of time. In this way, fuzzy attacks may cause a large number of whitelist detection anomalies, message period detection anomalies, message length detection anomalies, and load rate detection anomalies.
[0046] Therefore, when the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold, the number of message period detection anomalies is greater than or equal to the second message period anomaly number threshold, the number of message length detection anomalies is greater than or equal to the second message length anomaly number threshold, and the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold, the processor can determine that the type of attack suffered by the CAN bus within the preset time period is a fuzzy attack. The first whitelist anomaly number threshold, the second message period anomaly number threshold, the second message length anomaly number threshold, and the first load rate anomaly number threshold are all set according to actual conditions. For more common attacks, a higher threshold will be set, such as the threshold corresponding to the number of whitelist detection anomalies, and for attacks that are not easy to occur, a lower threshold will be set, such as the threshold corresponding to the number of load rate detection anomalies.
[0047] Figure 2 A flowchart for determining a fuzzy attack according to a specific embodiment of the present application is schematically shown. Figure 2 As shown, determining a fuzzy attack may include:
[0048] S201: Determine whether the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold. If yes, proceed to S202, if not, determine it as other attack types.
[0049] S202: Determine whether the number of abnormalities detected in the message period is greater than or equal to the second message period abnormality number threshold. If yes, proceed to S203, if not, determine that it is another attack type.
[0050] S203: Determine whether the number of abnormalities in the message length detection is greater than or equal to the second message length abnormality number threshold. If yes, proceed to S204, if not, determine that it is another attack type.
[0051] S204: Determine whether the number of load rate detection anomalies is greater than or equal to a first load rate anomaly number threshold. If so, determine it as a fuzzy attack; if not, determine it as another attack type.
[0052] It should be noted that the judgment process of the processor is not limited by the aforementioned steps. In a specific embodiment of the present application, the processor can determine whether the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold, whether the number of message period detection anomalies is greater than or equal to the second message period anomaly number threshold, whether the number of message length detection anomalies is greater than or equal to the second message length anomaly number threshold, and whether the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold. If all of the conditions are met, it is determined to be a fuzzy attack. If any one of the conditions is not met, it is determined to be other attack types.
[0053] In an embodiment of the present application, determining the type of attack suffered by the CAN bus within a preset time period based on the result of the anomaly number detection may include: when the number of whitelist detection anomalies is less than or equal to a third whitelist anomaly number threshold, the number of message period detection anomalies is greater than or equal to the second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to the second load rate anomaly number threshold, determining that the type of attack suffered by the CAN bus within the preset time period is a replay attack.
[0054] In the embodiment of the present application, since in the replay attack, the attacker enters the actual CAN message on the CAN bus, these CAN messages conform to the CAN communication matrix, and therefore will not trigger the whitelist detection alarm and the message length detection alarm. There may be periodic CAN messages in the entered CAN messages, and replaying such messages to the CAN bus will cause the actual cycle value to be abnormal, and will inevitably cause the load rate of the CAN bus to increase, but because the more CAN messages entered will cause the reverse to be more difficult, the duration of the replay attack is usually shorter. Therefore, in the case where the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold, the number of message cycle detection anomalies is greater than or equal to the second message cycle anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the load rate detection anomaly number is less than or equal to the second load rate anomaly number threshold, the processor can determine that the attack type suffered by the CAN bus in the preset time period is a replay attack. The third whitelist anomaly number threshold, the second message cycle anomaly number threshold, the third message length anomaly number threshold, and the second load rate anomaly number threshold are all determined according to actual conditions.
[0055] Figure 3 A flowchart for determining a replay attack according to a specific embodiment of the present application is schematically shown. Figure 3 As shown, determining a replay attack may include:
[0056] S301: Determine whether the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold. If yes, proceed to S302, if not, determine it as other attack types.
[0057] S302: Determine whether the number of abnormalities detected in the message period is greater than or equal to the second message period abnormality number threshold. If yes, proceed to S303, if not, determine that it is another attack type.
[0058] S303: Determine whether the number of abnormalities in the message length detection is less than or equal to the third message length abnormality number threshold. If yes, proceed to S304, if not, determine that it is another attack type.
[0059] S304: Determine whether the load rate detection anomaly number is less than or equal to the second load rate anomaly number threshold. If so, determine it as a replay attack, if not, determine it as other attack types.
[0060] It should be noted that the judgment process of the processor is not limited by the aforementioned steps. In a specific embodiment of the present application, the processor can determine whether the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold, whether the number of message period detection anomalies is greater than or equal to the second message period anomaly number threshold, whether the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and whether the number of load rate detection anomalies is less than or equal to the second load rate anomaly number threshold. If all of the conditions are met, it is determined to be a replay attack. If any one of the conditions is not met, it is determined to be other attack types.
[0061] In an embodiment of the present application, determining the type of attack suffered by the CAN bus within a preset time period based on the result of the anomaly number detection may include: when the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to the third message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold and the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold, determining that the type of attack suffered by the CAN bus within the preset time period is a denial of service attack.
[0062] In the embodiment of the present application, the denial of service attack is mainly to make the microcontroller on the CAN bus unable to send and receive CAN messages by sending CAN messages to the CAN bus at high frequency. Due to the arbitration mechanism of the CAN protocol, if two microcontrollers send CAN messages to the CAN bus at the same time, the CAN message with a higher CAN identification priority will be sent first, and the CAN message with a lower priority will be arbitrated and sent again when the CAN bus is idle. Therefore, in order to arbitrate all CAN messages on the CAN bus, the attacker often sends the highest priority CAN message with a CAN identification of 0x00, which will not be in the whitelist. When sending CAN messages to the CAN bus at high frequency, the load rate of the CAN bus will be in a fully loaded state. However, the data field length of the CAN message sent at this time is consistent with the message data field length specified by the CAN communication matrix, and there is no abnormality in the actual cycle value of the CAN message. Therefore, when the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to the third message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a denial of service attack.
[0063] Figure 4 A flowchart for determining a denial of service attack according to a specific embodiment of the present application is schematically shown. Figure 4 As shown, determining a denial of service attack may include:
[0064] S401: Determine whether the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold. If yes, proceed to S402, if not, determine it as other attack types.
[0065] S402: Determine whether the number of abnormalities detected in the message period is less than or equal to the third message period abnormality number threshold. If yes, proceed to S403, if not, determine that it is another attack type.
[0066] S403: Determine whether the number of abnormalities in the message length detection is less than or equal to the third message length abnormality number threshold. If yes, proceed to S404, if not, determine that it is another attack type.
[0067] S404: Determine whether the load rate detection anomaly number is greater than or equal to the first load rate anomaly number threshold. If so, determine it as a denial of service attack, if not, determine it as other attack types.
[0068] It should be noted that the judgment process of the processor is not limited by the aforementioned steps. In a specific embodiment of the present application, the processor can determine whether the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold, whether the number of message period detection anomalies is less than or equal to the third message period anomaly number threshold, whether the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and whether the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold. If all of the conditions are met, it is determined to be a denial of service attack. If any one of the conditions is not met, it is determined to be other attack types.
[0069] In an embodiment of the present application, determining the type of attack suffered by the CAN bus within a preset time period based on the results of the anomaly quantity detection may include: when the number of whitelist detection anomalies is less than or equal to a third whitelist anomaly quantity threshold, the number of message period detection anomalies is less than or equal to a second message period anomaly quantity threshold, the number of message length detection anomalies is less than or equal to a third message length anomaly quantity threshold, and the number of load rate detection anomalies is less than or equal to a third load rate anomaly quantity threshold, determining that the type of attack suffered by the CAN bus within the preset time period is a message interference attack.
[0070] In the embodiment of the present application, the message interference attack refers to the attacker interfering with the CAN message on the CAN bus through the interference instrument, causing the CAN message to be deformed during the transmission process, thereby causing the target microcontroller to reject the deformed CAN message. Due to the attack mode of the message interference attack, the message interference attack has an impact on the data field length of the CAN message, thereby causing a large number of abnormalities in the message length detection. In addition, the message interference attack can only affect the CAN message being transmitted on the CAN bus, and there is a certain probability of success. If the interference is a periodic CAN message, when the interference is successful, the failure of the periodic CAN message will cause the actual cycle value to be abnormal. Therefore, when the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to the second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to the third load rate anomaly number threshold, the processor can determine that the attack type suffered by the CAN bus within the preset time period is a message interference attack.
[0071] Figure 5 A flowchart for determining a message interference attack according to a specific embodiment of the present application is schematically shown. Figure 5 As shown, determining a message jamming attack may include:
[0072] S501: Determine whether the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold. If yes, proceed to S502, if not, determine it as other attack types.
[0073] S502: Determine whether the number of abnormalities detected in the message period is less than or equal to the second message period abnormality number threshold. If yes, proceed to S503, if not, determine that it is another attack type.
[0074] S503: Determine whether the number of abnormalities in the message length detection is less than or equal to the third message length abnormality number threshold. If yes, proceed to S504, if not, determine that it is another attack type.
[0075] S504: Determine whether the load rate detection anomaly number is less than or equal to a third load rate anomaly number threshold. If so, determine it as a message interference attack; if not, determine it as other attack types.
[0076] It should be noted that the judgment process of the processor is not limited by the aforementioned steps. In a specific embodiment of the present application, the processor can determine whether the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold, whether the message period detection anomaly number is less than or equal to the second message period anomaly number threshold, whether the message length detection anomaly number is less than or equal to the third message length anomaly number threshold, and whether the load rate detection anomaly number is less than or equal to the third load rate anomaly number threshold. If the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold, the message period detection anomaly number is less than or equal to the second message period anomaly number threshold, the message length detection anomaly number is less than or equal to the third message length anomaly number threshold, and the load rate detection anomaly number is less than or equal to the third load rate anomaly number threshold, it is determined that the current attack type suffered by the CAN bus is a message interference attack. If any one of the conditions is not met, it is determined that the current attack type suffered by the CAN bus is other attack types.
[0077] In an embodiment of the present application, determining the type of attack suffered by the CAN bus within a preset time period based on the result of the anomaly number detection may include: when the number of whitelist detection anomalies is less than or equal to the second whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to the second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the second message length anomaly number threshold and the number of load rate detection anomalies is less than or equal to the third load rate anomaly number threshold, determining that the type of attack suffered by the CAN bus within the preset time period is an injection attack.
[0078] In the embodiment of the present application, the injection attack is to achieve the purpose by injecting a single CAN message into the CAN bus through the CAN message transceiver. Usually, the attacker has identified the function of some CAN messages through fuzzy attack or replay attack, and needs to send a single CAN message to determine the function of some CAN messages. Therefore, the injection attack usually does not cause the load rate of the CAN bus to exceed the preset load rate threshold. In the determination process, abnormal CAN messages may be injected, and a large number of CAN messages whose identifiers are not in the white list may be constructed at this time, and the data domain length of the CAN message may also be abnormal. Even if a normal CAN message is injected, the actual cycle value of the CAN message will be abnormal. Thus, when the number of whitelist detection anomalies is less than or equal to the second whitelist anomaly number threshold, the number of message cycle detection anomalies is less than or equal to the second message cycle anomaly number threshold, the number of message length detection anomalies is less than or equal to the second message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to the third load rate anomaly number threshold, the processor can determine that the attack type suffered by the CAN bus within the preset time period is an injection attack.
[0079] Figure 6A flowchart for determining an injection attack according to a specific embodiment of the present application is schematically shown. Figure 6 As shown, determining an injection attack may include:
[0080] S601: Determine whether the number of whitelist detection anomalies is less than or equal to the second whitelist anomaly number threshold. If yes, proceed to S602; if no, determine that it is another attack type.
[0081] S602: Determine whether the number of abnormalities detected in the message period is less than or equal to the second message period abnormality number threshold. If yes, proceed to S603, if not, determine that it is another attack type.
[0082] S603: Determine whether the number of abnormalities in the message length detection is less than or equal to the second message length abnormality number threshold. If yes, proceed to S604, if not, determine that it is another attack type.
[0083] S604: Determine whether the load rate detection anomaly number is less than or equal to a third load rate anomaly number threshold. If so, determine it as an injection attack; if not, determine it as another attack type.
[0084] It should be noted that the judgment process of the processor is not limited by the aforementioned steps. In a specific embodiment of the present application, the processor can determine whether the number of whitelist detection anomalies is less than or equal to the second whitelist anomaly number threshold, whether the number of message period detection anomalies is less than or equal to the second message period anomaly number threshold, whether the number of message length detection anomalies is less than or equal to the second message length anomaly number threshold, and whether the number of load rate detection anomalies is less than or equal to the third load rate anomaly number threshold. If all of them are met, the processor can determine that the current attack type suffered by the CAN bus is an injection attack. If any one of the conditions is not met, it is determined that the current attack type suffered by the CAN bus is other attack types.
[0085] In summary, the technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:
[0086] By obtaining the abnormal number of detection results, the types of attacks on the CAN bus are analyzed, including fuzzy attacks, denial of service attacks, replay attacks, message jamming attacks, and injection attacks. Compared with the existing technology, the attack type determination is more specific and vivid, which can help security personnel understand the attacks occurring in the car more specifically, so that security personnel can implement response strategies more effectively and quickly.
[0087] An embodiment of the present application also provides a processor configured to execute the above-mentioned method for determining the type of CAN bus attack.
[0088] Figure 7The structure diagram of a device for determining a CAN bus attack type according to an embodiment of the present application is schematically shown. Figure 7 As shown, the embodiment of the present application also provides a device for determining a CAN bus attack type, which may include:
[0089] A CAN message acquisition module 710 is used to acquire multiple CAN messages within a preset time period;
[0090] The detection result acquisition module 720 is used to detect multiple CAN messages to obtain abnormal number detection results, wherein the abnormal number detection results include the abnormal number of whitelist detection, the abnormal number of message period detection, the abnormal number of message length detection, and the abnormal number of load rate detection;
[0091] The attack type identification module 730 is used to determine the attack type suffered by the CAN bus within a preset time period according to the abnormal quantity detection result.
[0092] The above technical solution obtains multiple CAN messages within a preset time period, and then detects multiple CAN messages to obtain an abnormal number detection result. The abnormal number detection result includes the abnormal number of whitelist detection, the abnormal number of message cycle detection, the abnormal number of message length detection, and the abnormal number of load rate detection. The type of attack suffered by the CAN bus within the preset time period can be determined according to the abnormal number detection result. The present application determines the type of attack suffered by the CAN bus within the preset time period according to the abnormal number of whitelist detection, the abnormal number of message cycle detection, the abnormal number of message length detection, and the abnormal number of load rate detection. The specific attack type can be analyzed, and the obtained detection result is relatively accurate, so that security personnel can effectively and quickly make response strategies for specific attack types.
[0093] In one embodiment, the attack type identification module 730 is also used to determine that the type of attack suffered by the CAN bus within a preset time period is a fuzzy attack when the number of whitelist detection anomalies is greater than or equal to a first whitelist anomaly number threshold, the number of message period detection anomalies is greater than or equal to a second message period anomaly number threshold, the number of message length detection anomalies is greater than or equal to a second message length anomaly number threshold, and the number of load rate detection anomalies is greater than or equal to a first load rate anomaly number threshold.
[0094] In one embodiment, the attack type identification module 730 is also used to determine that the type of attack suffered by the CAN bus within a preset time period is a replay attack when the number of whitelist detection anomalies is less than or equal to a third whitelist anomaly number threshold, the number of message period detection anomalies is greater than or equal to a second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to a third message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to a second load rate anomaly number threshold.
[0095] In one embodiment, the attack type identification module 730 is also used to determine that the type of attack suffered by the CAN bus within a preset time period is a denial of service attack when the number of whitelist detection anomalies is greater than or equal to a first whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to a third message period anomaly number threshold, the number of message length detection anomalies is less than or equal to a third message length anomaly number threshold, and the number of load rate detection anomalies is greater than or equal to a first load rate anomaly number threshold.
[0096] In one embodiment, the attack type identification module 730 is also used to determine that the type of attack suffered by the CAN bus within a preset time period is a message interference attack when the number of whitelist detection anomalies is less than or equal to a third whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to a second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to a third message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to a third load rate anomaly number threshold.
[0097] In one embodiment, the attack type identification module 730 is also used to determine that the type of attack suffered by the CAN bus within a preset time period is an injection attack when the number of whitelist detection anomalies is less than or equal to a second whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to a second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to a second message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to a third load rate anomaly number threshold.
[0098] An embodiment of the present application also provides a computer device, which may include a CAN bus attack type determination device or a processor.
[0099] An embodiment of the present application also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned method for determining the type of CAN bus attack.
[0100] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0101] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0102] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0103] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0104] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0105] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0106] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0107] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0108] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for determining the type of CAN bus attack, characterized in that: include: Get multiple CAN messages within a preset time period; Detecting the multiple CAN messages to obtain an abnormal number detection result, wherein the abnormal number detection result includes an abnormal number of whitelist detection, an abnormal number of message period detection, an abnormal number of message length detection, and an abnormal number of load rate detection; Determine the attack type suffered by the CAN bus within the preset time period according to the abnormal quantity detection result; Wherein, determining the attack type suffered by the CAN bus within the preset time period according to the abnormal quantity detection result includes: In the case where the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold, the number of message period detection anomalies is greater than or equal to the second message period anomaly number threshold, the number of message length detection anomalies is greater than or equal to the second message length anomaly number threshold, and the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a fuzzy attack; In the case where the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold, the number of message period detection anomalies is greater than or equal to the second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to the second load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a replay attack; In the case where the number of whitelist detection anomalies is greater than or equal to the first whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to the third message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a denial of service attack; In the case where the number of whitelist detection anomalies is less than or equal to a third whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to a second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to a third message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to a third load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is a message interference attack; and When the number of whitelist detection anomalies is less than or equal to the second whitelist anomaly number threshold, the number of message period detection anomalies is less than or equal to the second message period anomaly number threshold, the number of message length detection anomalies is less than or equal to the second message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to the third load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus within the preset time period is an injection attack.
2. A device for determining a CAN bus attack type, characterized in that: include: A CAN message acquisition module is used to acquire multiple CAN messages within a preset time period; A detection result acquisition module, used to detect the multiple CAN messages to obtain an abnormal number detection result, wherein the abnormal number detection result includes an abnormal number of whitelist detection, an abnormal number of message period detection, an abnormal number of message length detection, and an abnormal number of load rate detection; An attack type discrimination module is used to determine the type of attack suffered by the CAN bus within the preset time period according to the abnormal number detection result, wherein the determination of the type of attack suffered by the CAN bus within the preset time period according to the abnormal number detection result includes: when the number of abnormalities detected by the whitelist is greater than or equal to the first whitelist abnormal number threshold, the number of abnormalities detected by the message period is greater than or equal to the second message period abnormal number threshold, the number of abnormalities detected by the message length is greater than or equal to the second message length abnormal number threshold, and the number of abnormalities detected by the load rate is greater than or equal to the first load rate abnormal number threshold, determining that the type of attack suffered by the CAN bus within the preset time period is a fuzzy attack; when the number of abnormalities detected by the whitelist is less than or equal to the third whitelist abnormal number threshold, the number of abnormalities detected by the message period is greater than or equal to the second message period abnormal number threshold, the number of abnormalities detected by the message length is less than or equal to the third message length abnormal number threshold, and the number of abnormalities detected by the load rate is less than or equal to the second load rate abnormal number threshold, determining that the type of attack suffered by the CAN bus within the preset time period is a replay attack; when the number of abnormalities detected by the whitelist is greater than or equal to the first whitelist abnormal number threshold, the message When the number of cycle detection anomalies is less than or equal to the third message cycle anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the number of load rate detection anomalies is greater than or equal to the first load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus in the preset time period is a denial of service attack; when the number of whitelist detection anomalies is less than or equal to the third whitelist anomaly number threshold, the number of message cycle detection anomalies is less than or equal to the second message cycle anomaly number threshold, the number of message length detection anomalies is less than or equal to the third message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to the third load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus in the preset time period is a message interference attack; and when the number of whitelist detection anomalies is less than or equal to the second whitelist anomaly number threshold, the number of message cycle detection anomalies is less than or equal to the second message cycle anomaly number threshold, the number of message length detection anomalies is less than or equal to the second message length anomaly number threshold, and the number of load rate detection anomalies is less than or equal to the third load rate anomaly number threshold, it is determined that the type of attack suffered by the CAN bus in the preset time period is an injection attack.
3. A computer device, characterized in that: It comprises a device for determining a CAN bus attack type according to claim 2.
4. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores instructions, which are used to enable a machine to execute the method for determining the CAN bus attack type according to claim 1.
Citation Information
Patent Citations
Auxiliary method, device and system for vehicle network intrusion detection
CN109033829A
Intrusion detection method and device, storage medium and electronic equipment
CN113259351A
CAN bus intrusion detection method and device
CN114157492A
Message intrusion detection method and device, electronic equipment and storage medium
CN115603975A
Vehicle-mounted CAN bus intrusion detection method and system based on deep neural network
CN116668099A
