New energy automobile CAN bus UDS diagnosis attack test method and system and medium

By developing a diagnostic attack test method for the CAN bus UDS of new energy vehicles, the security and stability issues of the UDS diagnostic protocol of the CAN bus of new energy vehicles were resolved. This method enables in-depth security testing of the UDS protocol stack, improves the flexibility of attacks and test coverage, and ensures the functional safety and data security of the vehicle.

CN121690677APending Publication Date: 2026-03-17CHINA AUTOMOTIVE ENG RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511742645.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

The security and stability of the UDS diagnostic protocol for the CAN bus in new energy vehicles are difficult to guarantee in the current technology. In particular, when faced with malicious attacks, it may lead to system crashes or data leaks. There is a lack of effective testing methods and system support.

Method used

A diagnostic attack testing method for the CAN bus UDS of new energy vehicles is adopted, which includes collecting diagnostic IDs, conducting attack tests using basic diagnostic services, collecting and tampering with DID information, and optimizing attack parameters by dynamically adjusting attack strategies and reinforcement learning to achieve deep security testing of the UDS protocol stack.

Benefits of technology

It improves the efficiency and accuracy of diagnostic ID collection, enhances the flexibility and effectiveness of attacks, enables the rapid discovery of potential vulnerabilities, improves test coverage and success rate, and ensures the functional safety and data security of vehicles in complex network environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121690677A_ABST
    Figure CN121690677A_ABST
Patent Text Reader

Abstract

The invention discloses a new energy automobile CAN bus UDS diagnosis attack test method and system and a medium, and aims to quickly discover potential security holes in the design of a diagnosis system by simulating an actual attack behavior so as to provide reference for security improvement of a vehicle diagnosis system. According to the method, the diagnosis ID is predicted, so that the possible diagnosis ID range is effectively reduced, and the diagnosis ID collection efficiency and accuracy are improved. On the basis, a dynamic attack strategy generation module is utilized, attack parameters are optimized through reinforcement learning, the sending period and data content of the message are dynamically adjusted in combination with an attack feedback result, and a more targeted attack strategy is generated, so that the attack success rate is improved. The specific test comprises diagnosis ID collection, basic service attack request, DID collection and tampering and abnormal request attack test, and the safety of the vehicle diagnosis system is comprehensively analyzed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of vehicle network attack testing, in particular to a new energy vehicle CAN bus UDS diagnosis attack testing method, system and medium. BACKGROUND

[0002] With the popularization of new energy vehicles, the development of Internet of Vehicles technology that accompanies it, vehicle network security is more and more concerned, and the safety of vehicle network system is related to the safety of life and property of users. If it is attacked maliciously, it will inevitably lead to the whole system network cannot work normally, and the enterprise customers will suffer heavy losses. In order to improve the security and stability of CAN network, it is necessary to find problems through various network attack means, and take measures to avoid risks in time.

[0003] The UDS (Unified Diagnostic Services) diagnosis protocol is a kind of automobile general diagnosis protocol defined by ISO 15765 and ISO 14229, which is located in the application layer of OSI model. It can be implemented on different automobile buses (such as CAN, LIN, Flexray, Internet and K-line). The application layer definition of UDS protocol is ISO14229-1, and most automobile manufacturers adopt UDS on CAN diagnosis protocol. SUMMARY

[0004] The present application aims to at least solve the technical problems existing in the prior art, and particularly innovatively provides a new energy vehicle CAN bus UDS diagnosis attack testing method, which comprises:

[0005] S1, collecting diagnosis ID;

[0006] S2, diagnosis basic service, using the basic diagnosis service function to attack test;

[0007] S3, DID collection, collecting DID of vehicle information stored in vehicle;

[0008] S4, DID diagnosis, attack test through read and write operation of DID of attack diagnosis service;

[0009] S5, abnormal request attack, sending normal diagnosis request message through the collected diagnosis ID, but setting very short cycle to send.

[0010] In a preferred embodiment of the present application, the collection of diagnosis ID comprises:

[0011] Before the diagnosis attack, the diagnosis ID needs to be collected, so as to facilitate correct diagnosis attack through the diagnosis ID later. The steps of the diagnosis ID collection method are as follows:

[0012] diagnostic ID verification, the valid diagnostic ID set collected , which meet the condition: passed the test, i.e. the test result is 1, and belong to the diagnostic ID range of the priority scan, set is represented as:

[0013] ;

[0014] wherein, is the diagnostic ID, which represents a unique identifier of the diagnostic vehicle status, is the test function, which represents that the response of the diagnostic ID meets the rules, i.e. is a valid ID, when , and represents an invalid ID when ;

[0015] is the diagnostic ID set of the priority scan, which is used to narrow the test range and verify the high-probability valid diagnostic ID, is represented as:

[0016] ;

[0017] wherein, is the prediction probability function, which represents the possibility of a certain diagnostic ID being valid, and the value range is , the higher the value, the greater the possibility of the ID being valid, is the probability threshold, which is used to screen the diagnostic ID of the priority scan, and only when , the diagnostic ID is added to the set of the priority scan.

[0018] In a preferred embodiment of the present application, the diagnostic basic service includes:

[0019] The diagnostic basic service is the basic design of the controller performing the diagnostic instruction, and the security protection design of the generally designed diagnostic basic service is low, and the attack success rate is high; the steps of the diagnostic basic service attack are as follows:

[0020] Step A: according to the collected diagnostic ID, access the test equipment, use the CAN signal transceiver module to receive the vehicle message, keep the vehicle powered on, and use the CAN bus signal transceiver module to send the attack request message of the diagnostic basic service 11, 19 and 14 service;

[0021] Step B: the CAN bus UDS diagnostic analysis module verifies whether the received response message meets the expected attack result, if it meets, the attack is successful.

[0022] In a preferred embodiment of the present application, the DID collection comprises:

[0023] The DID is an identification code for storing vehicle information, and an attacker can read or tamper with the content stored in the DID through the read-write service. The steps of the diagnostic DID collection are as follows:

[0024] Step A: According to the collected diagnostic ID, access the test equipment, use the CAN signal transceiver module to receive the vehicle message, keep the vehicle powered on, and use the CAN bus signal transceiver module to send the diagnostic service to collect the DID.

[0025] Step B: The CAN bus UDS diagnostic analysis module verifies whether the received response message is a positive response. If it is a positive response, the DID is valid, otherwise it is invalid.

[0026] In a preferred embodiment of the present application, the diagnostic DID comprises:

[0027] The DID is an identification code for storing vehicle information, and an attacker can mislead the user by writing a wrong DID. In the design stage, if the security protection design of this service is low, the attack success rate is high. The steps of the diagnostic DID are as follows:

[0028] Step A: According to the collected diagnostic ID, access the test equipment, use the CAN signal transceiver module to receive the vehicle message, keep the vehicle powered on, and use the CAN bus signal transceiver module to send the diagnostic 2E service to tamper with the content in the DID.

[0029] Step B: The CAN bus UDS diagnostic analysis module verifies whether the received response message is a positive response. If it is a positive response, the tampered content is valid, the attack is successful, otherwise the attack is not successful.

[0030] In a preferred embodiment of the present application, the abnormal request attack comprises:

[0031] Attack input:

[0032] Initial attack parameters , wherein, is the initial message, the sending period, is the initial message data segment;

[0033] Dynamic strategy generation:

[0034] Record attack feedback results , defined as the abnormal index of ECU response:

[0035] ;

[0036] wherein, It is the current set of attack parameters. This indicates a response delay. Indicates the percentage of error messages. Indicates the system crash trigger rate;

[0037] Update attack parameters using reinforcement learning:

[0038] ;

[0039] in, This represents the set of attack parameters optimized in the next round. The goal is to find attack parameters that maximize the value function. It is the value function of reinforcement learning, representing the attack parameters. The expected benefit of triggering the target anomaly;

[0040] Adaptive loop:

[0041] ;

[0042] This is the next message sending cycle. This is the current message sending cycle. Based on feedback results Calculated periodic adjustment amount;

[0043] This is the next round of message data segments. This refers to the current message segment. Based on feedback results Calculated data segment adjustment amount;

[0044] Conditions for successful attack:

[0045] ;

[0046] It is a set of successful attacks. A threshold representing the proportion of error messages, when The attack was considered successful at that time. It is the threshold for the system crash trigger rate, when The attack was considered successful at that time. It is a logical "OR" operator, meaning that an attack is considered successful if either condition is true.

[0047] This invention also discloses an automotive CAN bus UDS diagnostic attack testing system, comprising:

[0048] CAN bus signal transceiver module, CAN bus UDS diagnostic analysis module, CAN bus UDS diagnostic attack module;

[0049] The CAN bus signal transceiver module is used to send the generated UDS diagnostic attack message;

[0050] The CAN bus UDS diagnostic analysis module is used to analyze and identify vulnerabilities in the vehicle's UDS diagnostic module and locate the attack site.

[0051] The CAN bus UDS diagnostic attack module is used to generate UDS diagnostic attack messages based on the obtained diagnostic attack content.

[0052] The present invention also discloses a computer-readable storage medium, comprising:

[0053] A memory on which computer programs are stored;

[0054] A processor is used to execute the program in the memory to implement the automotive CAN bus UDS diagnostic attack test method.

[0055] The present invention also discloses a computer system, comprising:

[0056] Memory used to store processor-executable instructions;

[0057] The processor is configured to implement the automotive CAN bus UDS diagnostic attack test method when executing the executable instructions.

[0058] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:

[0059] By introducing a machine learning-based diagnostic ID prediction algorithm, the efficiency and accuracy of diagnostic ID collection are significantly improved, avoiding the need for traversing the entire ID range in traditional methods, thus saving testing time. Simultaneously, a dynamic attack strategy generation module, combined with feedback results, adjusts attack parameters in real time, further enhancing the flexibility and effectiveness of the attack. Utilizing reinforcement learning to optimize the attack strategy enables the attack to more accurately trigger abnormal states in the target system, thereby providing a more comprehensive assessment of the vehicle diagnostic system's security. Dynamically adjusting the message sending cycle and data segment content not only enhances the intelligence of the attack strategy but also reduces the need for manual intervention. Furthermore, this invention can quickly discover potential vulnerabilities in the design of new energy vehicle systems, especially when basic service security protection is insufficient, effectively improving test coverage and success rate, and providing strong technical support for the security improvement of new energy vehicle diagnostic systems.

[0060] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0061] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0062] Figure 1 This is a flowchart of the method of the present invention.

[0063] Figure 2 This is a system schematic diagram of the present invention. Detailed Implementation

[0064] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0065] like Figure 1 and Figure 2 As shown, this invention provides a method, system, and medium for testing UDS diagnostic attacks on the CAN bus of new energy vehicles, including:

[0066] CAN bus signal transceiver module, CAN bus UDS diagnostic analysis module, CAN bus UDS diagnostic attack module;

[0067] The CAN bus signal transceiver module is used to send the generated UDS diagnostic attack message;

[0068] The CAN bus UDS diagnostic analysis module is used to analyze and identify vulnerabilities in the vehicle's UDS diagnostic module and locate the attack site.

[0069] The CAN bus UDS diagnostic attack module is used to generate UDS diagnostic attack messages based on the obtained diagnostic attack content.

[0070] 1. Collect diagnostic IDs

[0071] Test equipment access: Connect to the vehicle via the CAN signal transceiver module and receive messages while keeping the vehicle powered on.

[0072] Traverse the range of diagnostic IDs:

[0073] Send a diagnostic request message with a 10-byte data segment and a malfunctioning subfunction, based on the possible IDs within the sending range.

[0074] Observe the vehicle's message response.

[0075] Perform diagnostic ID verification and collect a set of valid diagnostic IDs. :

[0076]

[0077] These IDs satisfy the condition that the test was passed, i.e., the test result is satisfactory. It is 1, and falls within the range of diagnostic IDs prioritized for scanning;

[0078] in, It is the diagnostic ID, a unique identifier used to diagnose the vehicle's status. It is a test function, when This indicates that the response to the diagnostic ID conforms to the rules. This indicates an invalid ID;

[0079] This is a set of diagnostic IDs prioritized for scanning, used to narrow down the testing scope and prioritize verifying diagnostic IDs with a high probability of being valid. Represented as:

[0080] ;

[0081] in, It is a prediction probability function, representing the likelihood that a certain diagnostic ID is valid, and its range is... The higher the value, the greater the likelihood that the ID is valid. It is a probability threshold used to filter diagnostic IDs for priority scanning; only when... Only then is the diagnostic ID added to the priority scan set.

[0082] 2. Basic Diagnostic Services

[0083] Using the collected diagnostic IDs, attack request messages are sent to the basic services (including services 11, 19, and 14), and the CAN bus UDS diagnostic analysis module is used to verify whether the response messages match the expected attack results. If the response matches, the attack is successful. Because these basic services are poorly designed and easily exploited, the attack success rate is high.

[0084] 3. DID Collection

[0085] The system sends a diagnostic service request based on the collected diagnostic ID and receives vehicle messages using the CAN transceiver module while keeping the vehicle powered on. Subsequently, the system verifies the validity of the received response message using the CAN bus UDS diagnostic analysis module to determine whether the response is positive. If the response is positive, the DID is confirmed to be valid.

[0086] 4. Diagnosing DID

[0087] Using the collected diagnostic IDs, a request message to modify the DID content is sent using service 2E, while keeping the vehicle powered on and receiving vehicle messages. Subsequently, the received response message is verified by the CAN bus UDS diagnostic analysis module to determine if it is a positive response. If the response is positive, the attack is successful and the content has been effectively tampered with.

[0088] 5. Abnormal Request Attack

[0089] Request frequency anomaly test:

[0090] Send normal diagnostic request messages using the collected diagnostic IDs, but send them in a loop with a very short period of time.

[0091] Observe whether the ECU response is abnormal (such as crash, timeout, etc.).

[0092] 5.1 Service Function Anomaly Testing

[0093] Send messages that do not conform to the UDS diagnostic mechanism by collecting diagnostic IDs (e.g., the ID is normal but the data segment is abnormal).

[0094] Attack input:

[0095] Initial attack parameters ,in, This is the initial message, the sending period. This is the initial message data segment.

[0096] Dynamic strategy generation:

[0097] Record attack feedback results Defined as an abnormal indicator of ECU response:

[0098] ;

[0099] in, This indicates a response delay. Indicates the percentage of error messages. This indicates the system crash trigger rate.

[0100] 5.2 Attack Strategy Optimization

[0101] Update attack parameters using reinforcement learning:

[0102] ;

[0103] in, This represents the set of attack parameters optimized in the next round. The goal is to find attack parameters that maximize the value function. It is the value function of reinforcement learning, representing the attack parameters. The expected benefit of triggering the target anomaly;

[0104] Adaptive loop:

[0105] ;

[0106] This is the next round of message sending cycle. This is the current message sending cycle. Based on feedback results Calculated periodic adjustment amount;

[0107] This is the next round of message data segments. This refers to the current message segment. Based on feedback results Calculated data segment adjustment amount;

[0108] Conditions for successful attack:

[0109] ;

[0110] It is a set of successful attacks. A threshold representing the proportion of error messages, when The attack was considered successful at that time. It is the threshold for the system crash trigger rate, when The attack was considered successful at that time. The logical "OR" operator means that an attack is considered successful if either condition is true.

[0111] The beneficial effects of the above technical solution are as follows:

[0112] By designing a complete process of "diagnostic ID collection → basic service attack → DID tampering → abnormal request testing," in-depth security testing of the UDS protocol stack was achieved. By sending diagnostic request messages indicating sub-function anomalies to traverse the diagnostic ID range, combined with a priority scanning strategy, vulnerabilities in the UDS protocol implementation within the vehicle's ECU can be accurately located.

[0113] Given the unique value of new energy vehicles, the core of these vehicles is the high-voltage power system, such as the battery pack and motor controller. If the UDS diagnostic interface is maliciously exploited, it can lead to unauthorized access to the high-voltage system. This method, through the "DID diagnostic" step, such as modifying critical DID content via service number 2E, can verify the data tamper protection capabilities of the high-voltage system ECU, preventing safety accidents such as battery overcharging and motor malfunction caused by illegal DID modification.

[0114] With the widespread support for remote diagnostics and OTA upgrades in new energy vehicles, the UDS protocol forms the basis for remote interaction. This method tests the ECU's anti-denial-of-service (DoS) capability through anomaly request attacks, ensuring that the system will not crash or enter an insecure state due to high-frequency requests during remote upgrades or diagnostics, thus guaranteeing the reliable execution of remote operations.

[0115] New energy vehicles are equipped with numerous sensors and domain controllers, such as the autonomous driving domain and the body domain. The UDS diagnostic interface may leak sensitive data such as vehicle status and user behavior. This method identifies valid DIDs through a "DID collection" step, thereby testing the ECU's access control to sensitive DIDs and preventing unauthorized reading or tampering. Simultaneously, anomaly request attacks can verify the ECU's functional safety under abnormal inputs.

[0116] With the implementation of standards such as ISO / SAE 21434 (Automotive Cybersecurity Engineering), new energy vehicles need to meet higher cybersecurity requirements. This method, through systematic attack testing, can generate a security test report that meets regulatory requirements, demonstrating the vehicle's security protection capabilities at the UDS diagnostic level and helping automakers pass compliance certification.

[0117] In summary, this invention, through a systematic UDS diagnostic attack testing method, not only achieves in-depth verification of the security of the CAN bus in new energy vehicles, but also provides quantifiable and traceable technical support for the network security protection of new energy vehicles through vulnerability location, attack path analysis, and defense strategy optimization, ultimately ensuring the functional safety and data security of vehicles in complex network environments.

[0118] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims

1. A new energy vehicle CAN bus UDS diagnostic attack test method, characterized in that, Comprise: S1, collect diagnostic ID; S2, diagnostic base service, use the base diagnostic service function to attack test; S3, DID collection, collect the DID stored in the vehicle memory of the vehicle information; S4, DID diagnosis, attack test by attacking the read and write operation of DID through the diagnostic service; S5, abnormal request attack, send normal diagnostic request message through the collected diagnostic ID, but set very short cycle to send.

2. The automotive CAN bus UDS diagnostic attack test method according to claim 1, characterized in that, The collection of diagnostic ID comprises: Before the diagnostic attack, the diagnostic ID needs to be collected, so as to facilitate the correct diagnostic attack through the diagnostic ID in the later period, the steps of the diagnostic ID collection method are as follows: Diagnostic ID verification is performed, and a valid diagnostic ID set is collected These IDs satisfy: passed the test, i.e., test result is 1, and belong to the diagnostic ID range of the priority scan, set is represented as: ; wherein, is a diagnostic ID, representing a unique identifier to diagnose a vehicle status, is a test function, representing that the response of the diagnostic ID complies with a rule, i.e. is a valid ID, when and does not comply with the rule, i.e. is an invalid ID, when ; is a set of diagnostic IDs for priority scanning, used to narrow down the test range, and to verify high-probability valid diagnostic IDs first, is represented as: ; wherein, is a prediction probability function, representing the likelihood that a certain diagnosis ID is valid, whose value range is , the higher the value, the greater the likelihood that the ID is valid, is a probability threshold, used to filter the diagnosis IDs for priority scanning, only when the diagnosis ID is added to the set of priority scanning.

3. The automotive CAN bus UDS diagnostic attack test method according to claim 1, characterized in that, The diagnostic base service comprises: The diagnostic base service is the basic design of the controller to execute the diagnostic instruction, and the security protection design of the general designed diagnostic base service is low, and the attack success rate is large; the steps of the diagnostic base service attack are as follows: Step A: according to the collected diagnostic ID, access the test equipment, use the CAN signal transceiver module to receive the whole vehicle message, keep the vehicle power on state, and use the CAN bus signal transceiver module to send the diagnostic base service 11, 19 and 14 service attack request message; Step B: CAN bus UDS diagnostic analysis module verifies whether the received response message conforms to the expected attack result, if it conforms, the attack is successful.

4. The method of claim 1, wherein the method further comprises: The DID collection comprises: DID is an identification code for storing vehicle information, and the attacker can read or tamper with the content stored in DID through the read and write service, the steps of the diagnostic DID collection are as follows: Step A: according to the collected diagnostic ID, access the test equipment, use the CAN signal transceiver module to receive the whole vehicle message, keep the vehicle power on state, and use the CAN bus signal transceiver module to send the diagnostic service to collect DID; Step B: CAN bus UDS diagnostic analysis module verifies whether the received response message is a positive response, if it is a positive response, the DID is valid, otherwise it is invalid.

5. The method for UDS diagnostic attack test of automobile CAN bus according to claim 1, characterized in that, The diagnostic DID comprises: DID is an identification code for storing vehicle information, and the attacker can mislead the user by writing incorrect DID, in the design stage, if the security protection design of this service is low, the attack success rate is large, the steps of the diagnostic DID are as follows: Step A: according to the collected diagnostic ID, access the test equipment, use the CAN signal transceiver module to receive the whole vehicle message, keep the vehicle power on state, and use the CAN bus signal transceiver module to send the diagnostic 2E service to tamper with the content in DID; Step B: CAN bus UDS diagnostic analysis module verifies whether the received response message is a positive response, if it is a positive response, the tampered content is written validly, the attack is successful, otherwise the attack is not successful.

6. The method for UDS diagnostic attack test of automobile CAN bus according to claim 1, characterized in that, The abnormal request attack comprises: Attack input: Initial attack parameters , wherein is an initial message, a sending period, is an initial message data segment; Dynamic strategy generation: Recording attack feedback results defined as an abnormal index of ECU response: ; wherein, is the current attack parameter set, denotes the response delay, denotes the error message proportion, denotes the system crash trigger rate; Use reinforcement learning to update attack parameters: ; where, represents the set of attack parameters after the next round of optimization, is the attack parameter that maximizes the value function, is the value function of reinforcement learning, representing the expected return of triggering the target anomaly under the attack parameter . Adaptive cycle: ; is the next round of message sending period, is the current message sending period, is the period adjustment amount calculated based on the feedback result ​ is the next round of packet data segment, is the current packet data segment, is the data segment adjustment amount calculated based on the feedback result ​ Attack success determination condition: ; is a set of attack successes, is a threshold of the error message ratio, when is considered an attack success, is a threshold of the system crash trigger rate, when is considered an attack success, is a logical "or" operator, indicating that any condition is considered an attack success.

7. A UDS diagnostic attack test system for automotive CAN bus characterized in that, Comprise: CAN bus signal transceiver module, CAN bus UDS diagnostic analysis module, CAN bus UDS diagnostic attack module; The CAN bus signal transceiver module is used for sending the generated UDS diagnostic attack message; The CAN bus UDS diagnosis analysis module is used for analyzing and deriving the vulnerabilities existing in the vehicle UDS diagnosis module, and locating the position of the attack. The CAN bus UDS diagnosis attack module is used for manufacturing UDS diagnosis attack messages according to the derived diagnosis attack content.

8. A computer-readable storage medium, characterized in that, Comprise: A memory having a computer program stored thereon; A processor for executing the program in the memory to implement the automobile CAN bus UDS diagnosis attack test method of any one of claims 1 to 6.

9. A computer system, characterized by Comprise: A memory for storing processor executable instructions; Wherein, the processor is configured to execute the executable instructions to implement the automobile CAN bus UDS diagnosis attack test method of any one of claims 1 to 6.