Multi-agent session data processing method and system for vehicle networking penetration testing
By employing a multi-agent session data processing method, the problems of automatic formation of cross-protocol attack chains and long-term interruption recovery in vehicle network penetration testing are solved, achieving test logic coherence and security boundary integrity, and ensuring the security and continuity of vehicle network penetration testing.
Patent Information
- Application Number
- CN202611677996.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-28
- Publication Date
- 2026-11-27
AI Technical Summary
Existing vehicle network penetration testing systems cannot automatically form cross-protocol attack chains in multi-protocol intelligent agent collaboration, and are prone to losing security constraints when recovering from long-cycle task interruptions, resulting in inconsistent test logic and increased security risks.
A multi-agent session data processing approach is adopted, which enables cross-protocol injection, layered compression, and task recovery through the collaborative work of a session generator, information compressor, long-term storage memory layer, and task continuation manager. This ensures that security constraints actively participate in data processing decisions, prevent prohibited operations, and maintain test continuity during interruption recovery.
In vehicle-to-everything (V2X) penetration testing, it is essential to maintain the consistency of test logic and the integrity of security boundaries, avoid amplifying security risks through cross-protocol information transmission, ensure that the security boundaries are not crossed after the task is resumed, and achieve data processing security and continuity during long-term interruption recovery.
Smart Images

Figure CN123184984A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a multi-agent session data processing method and system for penetration testing of vehicle networks. Background Technology
[0002] Vehicle-to-everything (V2X) security testing is a crucial aspect of ensuring the security of intelligent connected vehicles throughout their entire lifecycle. V2X penetration testing covers a wide range of heterogeneous protocols, including CAN / CAN FD buses, in-vehicle Ethernet, Bluetooth, WiFi, cellular (4G / 5G), OBD diagnostic interfaces, and ADB debugging interfaces. A complete vehicle security penetration test typically lasts from several days to several weeks, involving multiple testing phases such as component access control, vehicle penetration, and compliance verification. Furthermore, the testing process is frequently interrupted due to factors such as vehicle scheduling, equipment usage, and personnel shift changes. These characteristics necessitate that automated testing systems maintain the continuity of cross-protocol attack chains under conditions of parallel execution of multiple protocol agents, and maintain the continuity of test logic and the integrity of security boundaries during frequent interruptions and recoveries of long-term tasks.
[0003] Existing single-agent LLM-driven solutions invoke tools through a large language model agent chaining mechanism. All interaction history is stored in a single context window, and simple truncation or full-text summary compression is used when the context approaches the window's limit. General compression strategies fail to recognize key entities in the vehicle networking field, such as electronic control unit identifiers, bus identifiers, diagnostic service numbers, and security levels. This results in critical parameters being lost as plain text, making it impossible for subsequent attack steps to connect to the discovered vulnerability chain.
[0004] The general multi-agent collaboration scheme adopts an architecture that divides tasks into orchestration, execution, verification, and analysis. Each agent independently maintains its context and communicates via message passing. In this type of scheme, the discovery made by one protocol agent cannot be structurally transmitted to another protocol agent. Even with the intervention of an orchestration agent, cross-protocol attack chains (such as "WiFi vulnerability → vehicle shell → CAN bus injection") cannot be automatically formed in multi-agent collaboration. The discovery of cross-protocol attack chains unique to the Internet of Vehicles relies on manual judgment.
[0005] The external file memory scheme uses text files to record task progress, and reads the file to restore the context when resuming across sessions. This scheme is essentially text file persistence, lacking a structured domain entity model, compression mechanism, and security constraint management. Security constraints in vehicle-to-everything (V2X) testing (such as prohibiting injection of brake control frame 0x1A8 and prohibiting calls to diagnostic services 0x2E from the brake electronic control unit 0x7B3) cannot be effectively persisted and version-managed using text files. After task interruption and recovery, these security constraints may be lost due to context reset, posing a risk of accidental injection of brake control messages and accidental invocation of safety-critical diagnostic services.
[0006] Furthermore, the entity model of the existing memory solution is geared towards the general IT domain and cannot identify the structured relationship between entities and security constraints in the vehicle networking domain; each testing phase is an independent session, and the findings of the previous phase are not automatically passed to the next phase. The reports need to be manually sorted and injected into the test plan of the next phase, which is inefficient and prone to missing implicit relationships. Summary of the Invention
[0007] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:
[0008] According to a first aspect of the present invention, a multi-agent session data processing method for penetration testing of vehicle networks is provided, comprising:
[0009] S100, the session generator continuously captures the interaction events of each protocol agent during the penetration test, and parses the interaction events into domain entities and stores them in the multi-agent shared context pool.
[0010] S200, after detecting an update to the domain entity submitted by the first protocol agent, the session generator determines whether the domain entity meets the cross-protocol injection conditions. If it does, the session generator injects the domain entity and its updated content into the context of the second protocol agent to form a cross-protocol associated entity, enabling the second protocol agent to switch to verifying the cross-protocol attack path based on its acquired permission status. Before injecting into the context of the second protocol agent, the session generator queries the security constraint entity for prohibited diagnostic service and electronic control unit pairs. If the test action indicated by the domain entity submitted by the first protocol agent includes prohibited diagnostic service and electronic control unit pairs, the session generator prevents the domain entity from being injected into the context of the second protocol agent.
[0011] In S300, the information compressor continuously monitors the number of context window tokens and the total number of shared context pool tokens for each agent. When the triggering conditions are met, it performs hierarchical compression, preserving the original fields word by word for security constraint entities, current attack path node entities, and cross-protocol associated entities. It performs digest operations on the raw data of tool call inference processes and bus packet captures to generate compressed digests. In hierarchical compression, the electronic control units associated with security constraint entities, the domain entities corresponding to bus identifiers and diagnostic service numbers are not included in the discard layer.
[0012] S400's persistent storage memory layer stores security constraints as independent entities and triggers cross-agent injection and hierarchical compression when security constraints are added or modified.
[0013] S500: When the current penetration test task is paused due to an interrupt signal, the task continuation manager performs interrupt handling; when the task resumes, the task continuation manager performs recovery handling according to the preset execution order; among them, security constraint loading is the first step in the preset execution order, and no test actions are allowed to be executed before the security constraint loading is completed.
[0014] According to a second aspect of the present invention, a multi-agent session data processing system for vehicle network penetration testing is provided, comprising:
[0015] The session generation module is used to continuously capture the interaction events of each protocol agent during the penetration test, and parse the interaction events into domain entities and store them in the multi-agent shared context pool.
[0016] The cross-protocol injection module is used to determine whether the domain entity meets the cross-protocol injection conditions after detecting an update to the domain entity submitted by the first protocol agent. If it does, the domain entity and its updated content are injected into the context of the second protocol agent to form a cross-protocol associated entity, enabling the second protocol agent to switch to verifying the cross-protocol attack path based on its acquired permission status. Before injecting into the context of the second protocol agent, the module queries the security constraint entity for prohibited diagnostic service and electronic control unit pairs. If the test action indicated by the domain entity submitted by the first protocol agent includes prohibited diagnostic service and electronic control unit pairs, the module prevents the domain entity from being injected into the context of the second protocol agent.
[0017] The information compression module continuously monitors the number of context window tokens and the total number of tokens in the shared context pool for each agent. When the triggering conditions are met, it performs hierarchical compression, preserving the original fields of security constraint entities, current attack path node entities, and cross-protocol associated entities word by word. It also performs digest operations on the raw data of tool call inference processes and bus packet captures to generate compressed digests. In hierarchical compression, the electronic control units associated with security constraint entities, the domain entities corresponding to bus identifiers and diagnostic service numbers are not included in the discard layer.
[0018] The persistent storage module is used to persistently store security constraints as independent entities, and to trigger the cross-protocol injection module and hierarchical compression when security constraints are added or modified.
[0019] The task continuation management module is used to perform interruption handling when the current penetration testing task is paused due to an interruption signal, and to perform recovery handling according to a preset execution order when the task resumes. Among them, security constraint loading is the first step in the preset execution order, and no test actions are allowed to be executed before the security constraint loading is completed.
[0020] This invention addresses the technical problem in existing solutions where security constraints merely passively store data and fail to constrain injection and compression behavior by actively participating in data processing decisions through security constraints. In the cross-protocol injection phase, a security constraint veto mechanism prevents domain entities involving prohibited diagnostic services and electronic control units from being injected into the second protocol agent, avoiding amplification of security risks during cross-protocol information transmission. In the layered compression phase, security constraints limit compression boundaries, ensuring that domain entities associated with security constraints do not enter the discard layer, preventing the loss of security-critical information during compression and subsequent tests from mistakenly triggering security-critical functions. In the task recovery phase, security constraint loading is the first step in a preset execution order, and no test actions are allowed before loading is complete, ensuring that continued testing does not cross security boundaries. Thus, security constraints transform from passively persisted data into a source of active constraints for injection, compression, and recovery decisions, enabling multi-protocol penetration testing in the Internet of Vehicles to maintain the security and continuity of data processing during long-term interruption recovery processes.
[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A flowchart of a multi-agent session data processing method for vehicle network penetration testing provided in an embodiment of the present invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0026] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0027] First Embodiment
[0028] This invention provides a multi-agent session data processing method for vehicle-to-everything (V2X) penetration testing, applied to a multi-agent penetration testing system in a multi-protocol parallel penetration testing scenario for V2X. V2X penetration testing typically lasts from several days to several weeks, involving multiple stages such as component access, vehicle penetration, and compliance verification. During testing, interruptions are frequent due to factors such as vehicle scheduling, equipment usage, and personnel shift changes. This method performs structured parsing, layered compression, cross-agent injection, and freeze / restore processing on the multi-agent session data, maintaining test logic continuity, cross-protocol attack chain integrity, and security constraint integrity after task interruption and recovery. This method is executed collaboratively by a session generator, information compressor, long-term storage layer, and task continuation manager within the multi-agent penetration testing system.
[0029] The multi-agent penetration testing system runs within the AI automated testing engine of the intelligent vehicle-to-everything (V2X) security testbed platform. Addressing the security testing needs of the entire V2X lifecycle, it employs a multi-agent parallel architecture to drive the penetration testing process, covering various heterogeneous protocols such as CAN / CAN FD bus, in-vehicle Ethernet, Bluetooth, WiFi, cellular (4G / 5G), OBD diagnostic interface, and ADB debugging interface. The system includes a multi-agent execution layer, a session generator, an information compressor, a persistent storage memory layer, and a task continuation manager.
[0030] The multi-agent execution layer includes orchestration agents, CAN protocol agents, Bluetooth agents, WiFi agents, cellular agents, verification agents, and analysis agents. Each protocol agent is responsible for the penetration testing execution of its corresponding protocol, the orchestration agent is responsible for task allocation and skill scheduling, the verification agent is responsible for result verification, and the analysis agent is responsible for data parsing and knowledge accumulation.
[0031] The session generator, located between the multi-agent execution layer and the long-term memory layer, is responsible for maintaining the shared context state of the multi-agents and organizing the intermediate inference, tool call results, and attack path information of each protocol agent into a structured session context. Specifically, the session generator maintains a multi-agent shared context pool. When each protocol agent executes a tool call, it submits the intermediate inference process, tool call parameters, and return results to the session generator in the form of structured events. The session generator then calls a domain entity parser to convert the raw events into structured domain entities and stores them in the shared context pool. The session generator is also responsible for cross-agent state injection; that is, after detecting an update to a structured domain entity of a protocol agent, it determines whether the update is related to other protocol agents. If related, it injects the domain entity and its update content into the context of other protocol agents. Here, "tool" refers to the external program or command called by each protocol agent when performing a penetration testing task; "tool call" refers to the operation of each protocol agent executing the external program or command; "tool call parameters" refer to the parameters passed when executing the external program or command; and "tool call result" refers to the output returned by the external program or command.
[0032] The information compressor is responsible for automatically triggering compression when the data scale of the shared context pool accumulates to a threshold. It performs hierarchical summarization of historical interactions using a large language model, retaining key entities in the vehicle-to-everything (V2X) domain while discarding redundant raw logs. The information compressor monitors the number of tokens in the independent context windows of each protocol agent and the total number of tokens in the shared context pool. When the triggering conditions are met, it performs hierarchical compression and generates a compressed summary. This compressed summary is stored in the checkpoint storage area for quick recovery of recent operation states during task resumption.
[0033] The persistent storage layer is responsible for persisting key test findings, attack chains, security whitelist constraints, and cross-stage knowledge, storing them in the form of a vehicle-to-everything (V2X) attack knowledge graph. The persistent storage layer persistently stores security constraints as independent entities, each containing attributes such as version number, applicable test stage, a list of prohibited bus identifiers, prohibited diagnostic service and electronic control unit (ECU) pairs, and a list of safety-critical ECUs. The persistent storage layer also persists discovered or ongoing attack paths, stored in a graph structure, with nodes representing ECU entities, protocol entities, and vulnerability entities, and edges representing the connection relationships between attack steps. Historical findings, attack chains, and cross-stage knowledge in the persistent storage layer are not lost during a single task interruption, and are used to restore historical findings and attack logic when the task resumes.
[0034] The task continuation manager is responsible for interruption detection, context freezing, resumption loading, security constraint reloading, and cross-agent state synchronization. When the current penetration test task is paused due to an interruption signal, the task continuation manager pauses the execution of all protocol agents, captures the current running state of each protocol agent, writes the current snapshot of the shared context pool to the checkpoint storage area, writes the current version of the security constraints to the checkpoint storage area, and records the current progress of the attack path. When the task resumes, the task continuation manager reads data from the checkpoint storage area in a preset execution order and sequentially executes security constraint loading, short-term compressed memory layer loading, long-term storage memory layer loading, cross-agent state synchronization, and resumption of execution of the pending queue.
[0035] The security constraints refer to the pre-configured security boundary rules for constraining testing behavior in vehicle-to-everything (V2X) penetration testing. The security constraint entity refers to a structured data object in the long-term storage layer used to represent security constraints, including a version number, applicable testing stage, a list of prohibited injected bus identifiers, prohibited diagnostic service and electronic control unit (ECU) pairs, and a list of safety-critical ECUs. The list of prohibited injected bus identifiers includes brake control frame identifier 0x1A8 and steering control frame identifier 0x128. The prohibited diagnostic service and ECU pairs include prohibiting data write services 0x2E from being called to brake ECU 0x7B3. The list of safety-critical ECUs includes brake control ECU 0x7B3 and steering control ECU 0x712.
[0036] The short-term compressed memory layer refers to the compressed digest generated by the information compressor after performing layered compression on the shared context pool, which is stored in the checkpoint storage area and used to quickly restore the recent operation state when the task is resumed; the long-term storage memory layer persistently stores historical discoveries, attack links and cross-stage knowledge in the form of a vehicle network attack knowledge graph, which is not lost when a single task is interrupted.
[0037] The checkpoint storage area is an independent transit storage area distinct from the shared context pool and the long-term storage memory layer. When a task is interrupted, the running status of each protocol agent, the shared context pool snapshot, the most recent compressed digest, the security constraint version number, the test phase identifier, the attack path progress, and the pending queue are written to the memory all at once. When the task resumes, the memory is read in the following order: security constraint loading, short-term compressed memory layer loading, long-term storage memory layer loading, cross-agent state synchronization, and resumption of execution of the pending queue. The compressed digest is stored in the checkpoint storage area for quickly restoring recent operational states; the long-term storage memory layer persistently stores information in the form of a vehicle network attack knowledge graph, used to reconstruct historical discoveries, attack chains, and cross-phase knowledge, and is not lost with a single task interruption.
[0038] like Figure 1As shown, the method may include the following steps:
[0039] S100, the session generator continuously captures the interaction events of each protocol agent during the penetration test, and parses the interaction events into domain entities and stores them in the multi-agent shared context pool.
[0040] The interaction event refers to the data record submitted to the session generator by each protocol agent when executing a tool call, including event type, event content, event source, and event time. The event type identifies the operation category to which the tool call belongs, the event content includes the parameters and return result of the tool call, the event source is the identifier of the protocol agent that submitted the event, and the event time is the timestamp of the tool call. The penetration test refers to the process of security probing and vulnerability exploitation verification of each protocol interface, including but not limited to diagnostic service exposure surface probing, secure access bypass verification, and firmware flashing verification.
[0041] The session generator parses interactive events into domain entities using a domain entity parser. This domain entity parser incorporates vehicle-to-everything (V2X) protocol parsing rules, including Controller Area Network (CAN) and ISO-TP transmission protocol parsing rules, unified diagnostic service mapping rules, Bluetooth protocol parsing rules, and WiFi protocol parsing rules. Specifically, the CAN and ISO-TP transmission protocol parsing rules include the frame format and value range of the CAN identifier, the correspondence between the data length code and the data length, ISO-TP frame types, and the meaning of fields for each frame type. The ISO-TP frame types include single frames, first frames, consecutive frames, and flow control frames. The unified diagnostic service mapping rules include the correspondence between the unified diagnostic service number and the service name, sub-function definitions, the meaning of negative response codes, and parsing processing methods.
[0042] Specifically, the Controller Area Network (CAN) and ISO-TP transmission protocol parsing rules include: the CAN identifier standard frame is 11 bits, the extended frame is 29 bits, and the frame format is distinguished by the IDE bit; the data length code DLC = 0~8 corresponds to data lengths of 0~8 bytes respectively, and CAN... FD extended coding DLC=9~15 corresponds to 12, 16, 20, 24, 32, 48, 64, and 64 bytes respectively; the ISO-TP frame type is identified by the high 4 bits of PCI, with 0 for single frame, 1 for first frame, 2 for consecutive frames, and 3 for flow control frame; the low 4 bits of PCI for single frame are SF_DL, indicating the actual number of bytes in the subsequent data fields; the low 4 bits of PCI for first frame and the second byte form a total length of 12 bits, carrying the first 6 bytes of data; the low 4 bits of PCI for consecutive frames are sequence number SN, with SN=1 for the first consecutive frame after the first frame, increasing to 15 and then wrapping back to 0, carrying 7 bytes of data per frame; the low 4 bits of PCI for flow control frame are flow status FS, the second byte is block size BS, and the third byte is minimum interval STmin.
[0043] The unified diagnostic service mapping rules include: Service number 0x10 is for diagnostic session control, used to switch between the default session, programming session, and extended session; Service number 0x27 is for secure access, with sub-functions 0x01 requesting a seed and 0x02 sending a key; Service number 0x31 is for routine control, with sub-functions 0x01 / 0x02 / 0x03 used to start, stop, or query routines, respectively; Service number 0x2E is for data writing, requiring an extended or programming session and unlocked secure access; Service number 0x34 is for requesting a download, requiring a programming session; Negative response codes 0x13 indicate incorrect message length or format, 0x22 indicate unmet conditions, 0x31 indicate the request is out of range, 0x33 indicate secure access denied, and 0x78 indicates the request has been received and the response is suspended, indicating asynchronous processing by the electronic control unit, extending the waiting time and continuing to receive subsequent responses.
[0044] The Bluetooth protocol parsing rules include: the 16-bit short UUID of Bluetooth GATT is extended to 128 bits according to the base UUID; common standard services include 0x1800 General Access, 0x1801 General Attributes, 0x180A Device Information, and 0x180F Battery Service; common features include 0x2A00 Device Name and 0x2A19 Battery Level; Bluetooth pairing status includes not paired, pairing, paired, and bound; and the association models include Just Works, Passkey Entry, Numeric Comparison, and OOB (Out-of-Band Pairing).
[0045] The WiFi protocol parsing rules include: WiFi frame types include management frames, control frames, and data frames; management frame subtypes include association request, association response, probe request, probe response, beacon, authentication, and deauthentication; control frame types include RTS, CTS, and ACK; and data frame types include data and QoS data. WiFi encryption suites include no encryption, WEP-40, WEP-104, TKIP, CCMP, and GCMP. The EAPOL four-way handshake states include not started, received MSG1, sent MSG2, received MSG3, and handshake completed.
[0046] The domain entities include electronic control unit entities, bus message entities, diagnostic service entities, vulnerability entities, attack path entities, and security constraint entities; wherein, the electronic control unit entity is a structured data representation of the electronic control unit in the Internet of Vehicles, and its attributes include electronic control unit identifier, name, security level, vehicle model, firmware version, and protocol support list;
[0047] The bus message entity is a structured data representation of a message transmitted on the bus, and its attributes include bus identifier, message period, data length, electronic control unit to which it belongs, and safety keyframe marker;
[0048] The diagnostic service entity is a structured data representation of the diagnostic services provided by the electronic control unit, and its attributes include unified diagnostic service number, service name, electronic control unit to which it belongs, session requirements, security level requirements, and key length.
[0049] The vulnerability entity is a structured data representation of a vulnerability discovered during penetration testing. Its attributes include vulnerability type, the electronic control unit it belongs to, the protocol layer it belongs to, the score, and the attack vector.
[0050] The attack path entity is a structured data representation of a cross-protocol attack path, and its attributes include the starting protocol, a list of transit protocols, the target electronic control unit, the sequence of attack steps, and changes in security level.
[0051] The security constraint entity is a structured data representation of the security boundary of a penetration test. It is a model of the security constraints, and its attributes include a list of bus identifiers that are prohibited from injection, a list of diagnostic services and electronic control units that are prohibited from being invoked, and a list of security-critical electronic control units.
[0052] The session generator stores the interaction information of each protocol agent in a structured manner according to the above entity model. For interaction events containing original message data, the session generator parses the electronic control unit identifier, diagnostic service number and session state corresponding to the message data and stores them in the shared context pool in the form of structured domain entities, instead of storing the original message data as an independent storage object in the shared context pool.
[0053] S200, after the session generator detects that the domain entity submitted by the first protocol agent has been updated, it determines whether the domain entity meets the cross-protocol injection conditions. If it does, it injects the domain entity and its updated content into the context of the second protocol agent to form a cross-protocol associated entity, so that the second protocol agent can switch to verifying the cross-protocol attack path based on the obtained permission state.
[0054] The first protocol agent and the second protocol agent are agents responsible for different protocols in the multi-agent execution layer. The first protocol agent is the protocol agent that generates domain entity updates, and the second protocol agent is the protocol agent that is determined to have a cross-protocol association with the first protocol agent according to the protocol support list.
[0055] The cross-protocol injection conditions include at least one of the following:
[0056] (1) Cross-protocol reachability condition: The protocol support list of the electronic control unit associated with the domain entity contains the protocol that the second protocol agent is responsible for, and the protocol support list records the multiple protocols that the electronic control unit is simultaneously mounted;
[0057] (2) Attack path connection conditions: The first protocol agent obtains remote terminal access or diagnostic access to the electronic control unit, and the electronic control unit supports the protocol handled by the second protocol agent;
[0058] (3) Conditions for changing security constraints: The domain entity involves the addition or modification of security constraint entities.
[0059] Specifically, the cross-protocol injection condition is determined based on the injection correlation degree, which is the sum of the cross-protocol indication function, the connection indication function, and the security change indication function. The cross-protocol indication function is set to 1 if the protocol support list of the electronic control unit associated with the domain entity contains the protocol handled by the second protocol agent, otherwise it is set to 0. The connection indication function is set to 1 if the domain entity has acquired remote terminal permissions or diagnostic permissions and the electronic control unit supports the protocol handled by the second protocol agent, otherwise it is set to 0. The security change indication function is set to 1 if the domain entity involves the addition or modification of security constraint entities, otherwise it is set to 0. When the injection correlation degree is greater than or equal to 1, it is determined that the cross-protocol injection condition is met, and the domain entity and its updated content are injected into the context of the second protocol agent.
[0060] In another embodiment, the cross-protocol indication function, the connection indication function, and the security change indication function can be assigned weights respectively, and an injection correlation threshold greater than 1 can be set to control the injection frequency and avoid context noise.
[0061] Furthermore, before injecting the context of the second protocol agent, the system queries the security constraint entity for prohibited diagnostic service and electronic control unit pairs. If the test action indicated by the domain entity submitted by the first protocol agent includes a prohibited diagnostic service and electronic control unit pair, then the injection of that domain entity into the context of the second protocol agent is prevented, and a security alarm is generated. Because the test action indicated by that domain entity includes a prohibited diagnostic service and electronic control unit pair, if it were injected into the context of the second protocol agent, the second protocol agent would execute the corresponding verification action, potentially triggering a safety-critical operation. By preventing the injection of that domain entity, the second protocol agent does not receive the verification task, thus avoiding triggering a safety-critical operation. The security alarm information includes alarm type, alarm source, alarm object, triggering reason, triggering time, processing result, and suggested operation. The alarm type is security constraint interception, the alarm source is the identifier of the first protocol agent that submitted the domain entity, the alarm object is the identifier of the domain entity that was blocked from injection, the triggering reason is that the test action indicated by the domain entity includes a prohibited diagnostic service and electronic control unit pair, and the processing result is that the domain entity has been prevented from injecting into the second protocol agent context.
[0062] Once the second protocol agent receives the injected domain entity and its updated content, it switches the testing direction from the currently executing independent protocol test to cross-protocol attack path verification. That is, based on the permission status already obtained by the first protocol agent and the cross-protocol associated entity, it executes the verification action corresponding to the protocol that the second protocol agent is responsible for, in order to verify whether the cross-protocol attack path from the first protocol to the second protocol is valid.
[0063] Taking the first protocol agent as a WiFi protocol agent and the second protocol agent as a CAN protocol agent as an example, the WiFi protocol agent discovers that the IVI vehicle system has a debugging serial port and obtains Linux Shell privileges through the serial port, submitting the domain entity update to the session generator; the session generator parses it as "Electronic Control Unit IVI, Protocol WiFi / Bluetooth SPP, Status: Shell obtained, Available Interface: ADB"; the session generator queries the protocol support list of the electronic control unit and determines that the electronic control unit is also connected to a CAN bus gateway, and the protocol support list contains the protocols handled by the CAN protocol agent; the session generator injects the domain entity and its updated content into the context of the CAN protocol agent; after receiving the injection, the CAN protocol agent shifts from independently testing the secure access to the unified diagnostic service to verifying the cross-protocol attack path of "WiFi Shell → ADB → CAN bus", specifically executing ADB commands to check the availability of the can-utils tool to verify whether the CAN bus gateway can be accessed through ADB.
[0064] Taking a CAN protocol agent as the first protocol agent and a WiFi protocol agent as the second protocol agent as an example, the CAN protocol agent discovers that an electronic control unit enters an unauthorized diagnostic session after receiving a specific unified diagnostic service routine control request, and submits a domain entity update to the session generator. The session generator parses this as "electronic control unit 0x7E0, diagnostic service 0x31, status: unauthorized diagnostic session has been entered". The session generator queries the protocol support list of the electronic control unit and determines that the electronic control unit is also connected to a WiFi interface. The protocol support list contains the protocols that the WiFi protocol agent is responsible for. The session generator injects the domain entity and its updated content into the context of the WiFi protocol agent. After receiving the injection, the WiFi protocol agent shifts from independently testing the WiFi encryption strength to verifying the cross-protocol attack path of "WiFi remote triggering → unauthorized diagnostic session". Specifically, it performs a WiFi remote reach test to verify whether the electronic control unit can be remotely triggered to enter an unauthorized diagnostic session via WiFi.
[0065] S300, the information compressor continuously monitors the number of context window tokens and the total number of shared context pool tokens for each agent. When the triggering conditions are met, it performs hierarchical compression, retaining the original fields word by word for security constraint entities, current attack path node entities, and cross-protocol associated entities. It performs digest operations on the original data of tool call inference process and bus packet capture to generate compressed digests. The execution scope of the hierarchical compression is limited by the security constraint entities. The electronic control units, bus identifiers, and domain entities corresponding to diagnostic service numbers associated with the security constraint entities do not enter the discard layer.
[0066] In this embodiment, the information compressor performs hierarchical summarization of historical interactions using a large language model. The token is the basic unit for text processing by the large language model. The number of tokens in the context window refers to the total number of tokens currently accumulated in the context window, and the total number of tokens in the shared context pool refers to the total number of tokens currently accumulated in the shared context pool of multiple agents. The large language model is an existing large language model used to summarize the tool call inference process and the raw data captured by the bus, retaining only entity identifiers and key fields.
[0067] The triggering condition includes at least one of the following:
[0068] (1) The number of context window tokens for any agent is greater than or equal to a set proportion of the corresponding window capacity;
[0069] (2) The total number of tokens in the shared context pool is greater than or equal to the shared pool threshold;
[0070] (3) Arrange the intelligent agent to issue switching instructions for the testing phase, which includes the component access phase, the whole vehicle penetration phase and the compliance verification phase;
[0071] (4) The agent switches from the current protocol task to another protocol task;
[0072] (5) Safety constraints are added or modified.
[0073] Specifically, the set ratio can be configured to 0.6~0.8, with a default value of 0.7; the shared pool threshold can be configured to 70%~80% of the design capacity of the shared context pool.
[0074] The addition or modification of the security constraints includes the addition of a bus identifier that is prohibited from injection, such as adding a bus identifier 0x1A8 that is prohibited from injection in the brake control frame, triggering compression to ensure that the security constraint update is not overwritten by the old context.
[0075] Specifically, the layered compression process includes the following steps:
[0076] S301, Calculate the retention priority of the current domain entity according to the retention priority calculation rules.
[0077] The initial value of the current domain entity is the first domain entity selected from the multi-agent shared context pool whose state is marked as unprocessed. The state of the domain entity includes processed and unprocessed states. The processed state indicates that the domain entity has completed the retention priority calculation and compression hierarchy assignment, while the unprocessed state indicates that the domain entity has not yet completed the retention priority calculation and compression hierarchy assignment. The two states are represented by different identifiers.
[0078] Wherein, for the current domain entity e, its retention priority P(e) = w1·S(e) + w2·A(e) + w3·C(e) + w4·U(e), where S(e) is a security marking function, indicating that the domain entity is a security-constrained entity or a security-critical entity; A(e) is an attack path marking function, indicating that the domain entity is a node in the current attack path; C(e) is a cross-protocol marking function, indicating that the domain entity is a cross-protocol associated entity; U(e) is an unconfirmed marking function, indicating that the domain entity is in an unconfirmed or in-process state; each marking function takes a value of 0 or 1; the weights take values of w1=4, w2=3, w3=2, w4=1.
[0079] S302, compare the retention priority of the current domain entity with the retention threshold. If the retention priority is greater than or equal to the retention threshold, the current domain entity is assigned to the retention layer, where the original fields of the domain entities in the retention layer are retained word by word. If the retention priority is less than the retention threshold but greater than zero, the current domain entity is assigned to the summarization layer, where the domain entities in the summarization layer are summarized by the large language model. If the retention priority is zero, the current domain entity is assigned to the discard layer, where only the count and index pointer are retained. The state identifier of the current domain entity is marked as processed in the multi-agent shared context pool.
[0080] In one illustrative embodiment, the retention threshold may be 4.
[0081] S303: Determine whether there is a domain entity in the multi-agent shared context pool whose state is marked as unprocessed. If so, take the next domain entity marked as unprocessed as the current domain entity and return to execute S301; otherwise, execute S304.
[0082] S304: For domain entities in the retention layer, the original fields are retained word by word; for domain entities in the summary layer, the large language model performs a summary operation; for domain entities in the discard layer, only the count and index pointer are retained.
[0083] In the digest layer, the domain entity recognizer identifies and marks the key domain parameters that must be retained during the digest process. These key domain parameters include electronic control unit identifier, bus identifier, diagnostic service number, security level, session state, key parameters, pairing state, and attack chain node. These key domain parameters are retained in the compressed digest as entity annotations and are not covered by the natural language digest.
[0084] S305, merge the original fields retained word by word in the retention layer with the entity identifiers and key fields obtained after the summary layer to generate a compressed summary;
[0085] The compressed digest forms a short-term compressed memory layer, which is used to quickly restore the recent operation state when the task is resumed.
[0086] Furthermore, after the layered compression is completed, the compressed summary is written to the checkpoint storage area to replace the compressed domain entities in the shared context pool.
[0087] Taking the CAN protocol intelligent agent performing a unified diagnostic service secure access test as an example, the original context fragment is: "The CAN protocol intelligent agent executes cansend can0 7E0#02270000 and receives the response 7E8#06270050. This means that the electronic control unit 0x7E0 supports unified diagnostic service 0x27 secure access under extended session. The returned seed is 0x0050, with a length of 4 bytes. Next, it needs to send 0x27 0x01 to add the key. Previous tests have found that the key algorithm of this electronic control unit is simple XOR." General compression may output: "The CAN protocol intelligent agent tested the unified diagnostic service secure access of electronic control unit 0x7E0 and found that it supports the service. The key algorithm is simple XOR." The domain-aware compression of this invention outputs: "Electronic control unit entity 0x7E0: Unified diagnostic service 0x27 secure access equals support, session requirement equals extended session, seed equals 0x0050, length 4 bytes, key algorithm equals simple XOR, security level equals Level 2, next step equals sending 0x27." 0x01 Key verification, attack path node is CAN→0x7E0→0x27 Bypass in progress.
[0088] Furthermore, after the layered compression is completed, the domain entity recognizer performs entity annotation and verification on the compressed summary, specifically including:
[0089] (1) For each domain entity in the compressed digest, find the corresponding original domain entity in the uncompressed original domain entities in the shared context pool;
[0090] (2) Compare the field information of the domain entity in the compressed digest with the corresponding field information in the original domain entity one by one. The field information includes electronic control unit identifier, bus identifier, diagnostic service number and security level.
[0091] (3) If there is an inconsistency, the content of the domain entity in the compressed digest is replaced with the uncompressed original domain entity in the shared context pool, and the original domain entity is re-compressed in a hierarchical manner until the field information of all domain entities in the compressed digest is consistent with the field information of the original domain entity.
[0092] Furthermore, after the layered compression is completed, the session generator performs an attack chain topology integrity check on the compressed digest. The cross-protocol attack chain topology graph uses electronic control unit entities, diagnostic service entities, and vulnerability entities as nodes, and cross-protocol attack steps as edges, with the direction of the edges indicating the sequential connection of the attack steps. The specific steps for performing the attack chain topology integrity check include:
[0093] (1) Using the electronic control unit entity, diagnostic service entity and vulnerability entity retained in the compressed digest as nodes and the cross-protocol attack steps retained in the compressed digest as edges, reconstruct the cross-protocol attack chain topology graph;
[0094] (2) Before writing the compressed digest to the checkpoint storage area, based on the current content in the shared context pool, construct a cross-protocol attack chain topology graph before compression, with the electronic control unit entity, diagnostic service entity and vulnerability entity in the shared context pool as nodes and the cross-protocol attack steps in the shared context pool as edges.
[0095] (3) Compare the reconstructed cross-protocol attack chain topology with the cross-protocol attack chain topology before compression. If there are missing attack chain nodes or broken attack step connections in the reconstructed cross-protocol attack chain topology, the compressed digest is determined to be incomplete. The information compressor will roll back the domain entities involved in the missing nodes or broken edges in the compressed digest to the uncompressed original domain entity layer, and re-perform layered compression on the rolled-back domain entities.
[0096] Specifically, the fallback to the uncompressed original domain entity layer involves: obtaining the uncompressed original field of the domain entity from the shared context pool, and replacing the digest version of the domain entity in the compressed digest with the original field; if the domain entity has been discarded in the compressed digest, then the original field of the domain entity is added back to the compressed digest; the re-execution of hierarchical compression involves: re-executing the hierarchical compression steps S301 to S305 on the fallen domain entity. Specifically, the attack chain topology integrity verification can be achieved in the following way: taking a cross-protocol attack chain as an example, where a WiFi protocol agent obtains IVI vehicle shell access and reaches the CAN bus gateway 0x7E0 via ADB, then bypasses the 0x27 security access to reach the brake electronic control unit 0x7B3, the attack chain topology in the shared context pool before compression is “WiFi→IVI Shell→ADB→CAN gateway 0x7E0→0x27 bypass→0x7B3”, with nodes including IVI vehicle, CAN gateway 0x7E0, and brake electronic control unit 0x7B3, and edges including “WiFi→IVI Shell” and “IVI…”. Shell→ADB”, ADB→CAN gateway 0x7E0”, CAN gateway 0x7E0→0x27 bypass”, 0x27 bypass→0x7B3”; if the “ADB→CAN gateway 0x7E0” side or the CAN gateway 0x7E0 node is missing in the compressed digest, when the reconstructed attack chain topology is compared with the attack chain topology before compression, it is determined that there is a break in the connection relationship of the attack steps or a missing attack chain node. The information compressor then falls back to the uncompressed original domain entity layer to re-execute the layered compression.
[0097] Furthermore, the layered compression is performed asynchronously, without pausing the tool calls currently being executed by each agent.
[0098] S400's persistent storage memory layer stores security constraints as independent entities and triggers cross-agent injection and hierarchical compression when security constraints are added or modified.
[0099] The long-term storage memory layer persistently stores the following information in the form of a vehicle network attack knowledge graph:
[0100] (1) Security constraint information: Security constraints are persistently stored as independent entities. Different versions of security constraints are configured for different test phases. When the task is resumed, the corresponding version of security constraints is loaded according to the current test phase.
[0101] (2) Attack chain information: The discovered or ongoing attack paths are persistently stored in a graph structure. The nodes are electronic control unit entities, protocol entities and vulnerability entities, and the edges are the connection relationships of the attack steps. The connection relationships of the attack steps include "WiFi→IVI Shell", "ADB→CAN gateway 0x7E0" and "0x7E0→0x27 bypass→0x7B3 brake electronic control unit". The complete attack chain is solidified and stored at the end of the whole vehicle penetration stage for subsequent compliance reports and cross-model reference.
[0102] (3) Cross-stage knowledge: Discoveries made during the component access stage are automatically written into the long-term storage memory layer and the test stage to which the discovery belongs is marked as the component access stage; when the whole vehicle penetration stage starts, the discovery of the component access stage of this model is loaded from the long-term storage memory layer, injected into the initial context of the orchestration agent, and guided by the whole vehicle penetration stage to verify the cross-electronic control unit attack path; for example, if the component access stage discovers that "the ADB port of the T-Box is open after successful Bluetooth pairing", the whole vehicle penetration stage will automatically include "verify that WiFi remotely triggers Bluetooth pairing to indirectly obtain ADB privileges" in the test plan;
[0103] (4) Cross-task history: When testing the same vehicle model in different rounds, the historical findings in the long-term storage memory layer are loaded, and the verified safe areas and known vulnerability repair status are reused to avoid repeated detection; for example, when the same vehicle model is repaired and then regressed, the historical long-term storage memory layer is loaded, and the verified safe areas are no longer tested again, and the repair effectiveness of known vulnerabilities is directly verified.
[0104] Specifically, the long-term storage memory layer is implemented using a graph database, which can be Neo4j, JanusGraph, or RDF triples. The node types of the graph database correspond to the domain entities described in S100, specifically including:
[0105] The main attributes of the electronic control unit node include: electronic control unit node identifier, domain, list of supported protocols, bus access location, security level, and safety critical markers. The domain includes powertrain, body, chassis, and infotainment.
[0106] The main attributes of a bus message node include message identifier, bus to which it belongs, period, data length code, signal list, and sending node.
[0107] The diagnostic service node's main attributes include service number, sub-functions, accessible electronic control units, required session and security level, and protocol type, including controller area network and IP-based diagnostic communication.
[0108] Vulnerability nodes, whose main attributes include vulnerability number, type, affected electronic control unit, prerequisites, exploitation complexity, and score;
[0109] The attack path nodes have the following main attributes: path identifier, start point, end point, path node sequence, current progress, and whether remote terminal access or diagnostic access has been obtained.
[0110] The main attributes of a safety constraint node include constraint identifier, version number, applicable stage, applicable vehicle model, list of prohibited bus identifiers, prohibited diagnostic services and electronic control unit pairs, list of safety-critical electronic control units, effective time, and checksum.
[0111] The testing phase nodes mainly include phase identifier, phase number, and start and end time. The phase identifier includes component access, whole vehicle penetration, and compliance verification. The vehicle model nodes mainly include vehicle model identifier, model year, electronic and electrical architecture version, and bus topology.
[0112] The edge types and semantics of the graph database include: protocol support edges, connecting electronic control unit (ECU) nodes and protocol nodes, indicating that an ECU supports a certain protocol; vulnerability association edges, connecting ECU nodes and vulnerability nodes, indicating that an ECU has a certain vulnerability; vulnerability exploitation edges, connecting attack path nodes and vulnerability nodes, indicating that an attack path exploits a vulnerability; attack step connection edges, connecting attack path nodes, indicating the sequential connection between attack steps; security constraint edges, connecting security constraint nodes and ECU nodes, bus identifier nodes, or diagnostic service nodes, indicating that security constraints prohibit or restrict the corresponding objects; stage affiliation edges, connecting discovery nodes and testing stage nodes, indicating that a discovery belongs to a certain testing stage; and vehicle model applicability edges, connecting security constraint nodes or discovery nodes and vehicle model nodes, indicating the vehicle models to which the security constraint or discovery applies.
[0113] The query method of the long-term storage memory layer is as follows: a joint index is established with vehicle model identifier and stage identifier. First, the subgraph of the vehicle model under the stage is defined. Then, the edge type is traversed step by step. For example, the electronic control unit node finds the protocol it supports through the protocol support edge, finds the associated vulnerability through the vulnerability association edge, and traces back the complete attack link through the attack step connection edge.
[0114] S500: When the current penetration test task is paused due to an interrupt signal, the task continuation manager performs interrupt handling; when the task resumes, the task continuation manager performs recovery handling according to the preset execution order; among them, security constraint loading is the first step in the preset execution order, and no test actions are allowed to be executed before the security constraint loading is completed.
[0115] The current penetration test task refers to a vehicle network penetration test currently being executed by the multi-agent penetration test system. Its lifecycle extends from the start of the test to its completion or manual termination, including at least one of the component access phase, the whole vehicle penetration phase, and the compliance verification phase. The interrupt signal is used to suspend the execution of the current penetration test task, and the task resumption refers to restarting the execution of the current penetration test task after the interruption cause is eliminated.
[0116] The interrupt handling includes:
[0117] The task continuation manager writes the running status of each agent, the snapshot of the multi-agent shared context pool, the compressed digest generated by the information compressor through forced hierarchical compression, the security constraint version number, the test phase identifier, the attack path progress, and the pending queue into the checkpoint storage area. The snapshot of the multi-agent shared context pool refers to a one-time complete copy of all domain entities and their relationships in the multi-agent shared context pool at the time of task interruption. When the task is interrupted, regardless of whether S300 meets the triggering conditions, the information compressor forces hierarchical compression once to generate a compressed digest, and writes the compressed digest and the shared context pool snapshot into the checkpoint storage area.
[0118] The interrupt signal includes at least one of the following: a user-triggered pause command, a vehicle dispatch-triggered pause signal, the test equipment being occupied, or the current time entering a preset system maintenance period; the vehicle dispatch-triggered pause signal includes a diagnostic interface connection being disconnected for more than a set duration.
[0119] The preset execution order is as follows: loading security constraints, loading short-term compressed memory layer, loading long-term storage memory layer, cross-agent state synchronization, and resuming execution of the pending queue.
[0120] The recovery process includes:
[0121] (1) When loading security constraints, for each agent, based on the set of protocols that the agent is responsible for and the set of currently reachable electronic control units, a subset of security constraints related to the agent is selected from the full set of security constraints and loaded into the context of the agent. The list of security-critical electronic control units and global prohibitions are forcibly loaded into the context of each agent.
[0122] Specifically, the step of selecting a subset of security constraints related to the agent from the full set of security constraints involves the following: for each security constraint in the full set of security constraints, if the protocol involved in the security constraint belongs to the protocol set that the agent is responsible for, or the electronic control unit involved in the security constraint belongs to the set of electronic control units that the agent can currently reach, then the security constraint is included in the subset of security constraints of the agent; the list of security-critical electronic control units and the globally prohibited items are security constraint entity attributes pre-configured in the long-term storage memory layer.
[0123] In addition, when loading security constraints, the security constraint version number recorded in the checkpoint storage area is read first. If the identifier of the current test phase is different from the test phase identifier recorded in the checkpoint storage area, the security constraint version corresponding to the current test phase is loaded, and the differences between the two versions of security constraint content are written to the recovery log.
[0124] Therefore, loading safety constraints avoids irrelevant constraints occupying the context window, ensures that safety-critical constraints are not overlooked, and ensures that the restored test actions meet the safety boundaries of the current test phase.
[0125] (2) When the short-term compressed memory layer is loaded, the task continuation manager reads the compressed summary generated when the task was interrupted from the checkpoint storage area, injects it into the context window of each agent, and restores the recent operation state.
[0126] (3) When the long-term storage memory layer is loaded, the task continuation manager queries the historical discovery and attack links of the vehicle model and the test phase from the long-term storage memory layer, formats them into an entity list, injects the context of the orchestration agent and each protocol agent, and restores the historical discovery and attack logic.
[0127] (4) During cross-agent state synchronization, the session generator restores the multi-agent shared context pool to the snapshot when the task was interrupted. Each agent pulls the cross-protocol associated state from the shared context pool and re-establishes the cross-protocol attack chain context. For example, after the CAN protocol agent recovers, it reads the discovery that "the WiFi protocol agent has obtained the IVI Shell" from the shared context pool and automatically shifts the test focus from independent unified diagnostic service testing to verifying the cross-protocol attack path of "WiFi Shell → ADB → CAN bus".
[0128] (5) When the queue to be processed resumes execution, the orchestration agent reads the queue to be processed from the checkpoint storage area, resumes scheduling in the order of the queue, and does not repeat the steps that have been completed.
[0129] Among them, in the preset execution order, the loading of security constraints, the loading of short-term compressed memory layer, and the loading of long-term storage memory layer must be executed in sequence; cross-agent state synchronization must be executed after the long-term storage memory layer is loaded; the execution of the pending queue must be executed after the cross-agent state synchronization is completed, and tasks that do not depend on each other in the queue can be sent out in parallel;
[0130] The entire recovery process is written to the recovery log, which records the security constraint version values and version differences for subsequent auditing and backtracking.
[0131] In this embodiment, steps S100 to S500 constitute a complete data processing flow for multi-agent session data, from structured parsing, cross-protocol association, hierarchical compression, persistent storage, to interrupt recovery. This embodiment achieves efficient processing of multi-agent session data in multi-protocol penetration testing of the Internet of Vehicles through the coordinated execution of steps S100 to S500. Specifically, in step S100, the session generator continuously captures interaction events from each protocol agent during the penetration test. The domain entity parser then parses these interaction events into domain entities and stores them in a shared context pool for the multi-agents. Thus, the raw interaction data scattered across the various protocol agents is uniformly converted into structured domain entities, providing a unified data format foundation for subsequent cross-protocol association, hierarchical compression, and persistent storage.
[0132] In S200, after detecting an update to a domain entity submitted by the first protocol agent, the session generator determines whether the domain entity meets the cross-protocol injection conditions. If so, it injects the domain entity and its updated content into the context of the second protocol agent, forming a cross-protocol associated entity. This allows the second protocol agent to redirect to verifying the cross-protocol attack path based on its acquired permission status. Thus, the discovery of one protocol agent can be automatically transmitted to other protocol agents without manual intervention, and the cross-protocol attack chain is automatically formed in multi-agent collaboration.
[0133] In S300, the information compressor continuously monitors the number of context window tokens for each agent and the total number of tokens in the shared context pool. When trigger conditions are met, it performs hierarchical compression, preserving the original fields word-for-word for security constraint entities, current attack path node entities, and cross-protocol associated entities. For the raw data from tool call inference processes and bus packet captures, the large language model performs a digest operation to generate a compressed digest. Thus, the data size of the shared context pool is controlled, key parameters in the vehicular network domain are not lost during compression, and the compressed digest remains consistent with the shared context pool state at the time of task interruption.
[0134] In S400, the long-term storage memory layer persistently stores security constraints as independent entities. When security constraints are added or modified, it triggers cross-agent injection in S200 and hierarchical compression in S300. Simultaneously, it persists attack chain information, cross-stage knowledge, and cross-task history. Therefore, security constraints are not lost during a single task interruption, and attack chains and cross-stage knowledge can be reused across tasks, avoiding redundant probing.
[0135] In S500, when the current penetration test task is paused due to an interruption signal, the task continuation manager writes the running status of each agent, the shared context pool snapshot, the compressed digest, the security constraint version number, the test phase identifier, the attack path progress, and the pending queue to the checkpoint storage area. When the task resumes, these are read according to a preset execution order, with security constraint loading being the first step in the preset execution order. No test actions are allowed to be executed before the security constraints are fully loaded. Therefore, the compressed digest at task resumption is consistent with the shared context pool state at the time of task interruption. Each agent quickly restores its recent operational state and cross-protocol association state, continuing execution from the breakpoint without repeating completed steps.
[0136] The technical effects of this embodiment include at least the following:
[0137] (1) Automatic injection of cross-protocol related data replaces manual relay, improving the efficiency of cross-protocol attack chain discovery. In existing solutions, the discovery of each protocol agent requires manual sorting or arrangement of agents for relay, resulting in long data transmission links and poor timeliness. In this embodiment, through an automatic injection mechanism, the discovery of one protocol agent directly enters the context of another protocol agent, and cross-protocol related data flows efficiently among multiple agents, so the discovery of cross-protocol attack chains no longer depends on manual judgment.
[0138] (2) Domain-aware hierarchical compression retains key parameters while controlling data size, and the compressed data can still support continued reasoning. Existing solutions use simple truncation or full-text summary compression, which treats key parameters in the Internet of Vehicles domain (such as electronic control unit identifiers, bus identifiers, diagnostic service numbers, and security levels) as ordinary text and loses them, resulting in a lack of basis for subsequent reasoning. This embodiment retains security constraint entities, current attack path node entities, and cross-protocol related entities word by word through hierarchical compression. The data in the compressed summary still fully contains key domain information, and each agent can continue reasoning based on the compressed summary without having to read back the original data.
[0139] (3) When the task resumes, data is read from the checkpoint storage area in the preset execution order to avoid full reload and repeated probing. Existing solutions require repeated probing from scratch after an interruption, resulting in low recovery efficiency. In this embodiment, the checkpoint storage area mechanism writes critical state data once when interrupted, and reads it in the following order during recovery: loading of safety constraints, loading of short-term compressed memory layer, loading of long-term storage memory layer, cross-agent state synchronization, and resumption of execution of the pending queue. Each agent continues execution from the breakpoint, and completed steps are not repeated, significantly improving data processing efficiency.
[0140] (4) Persistent storage and agent-based loading of security constraints ensure the integrity of security boundaries while reducing irrelevant data from occupying the context window. Existing solutions only store security constraints in prompts, which are lost after context overflow and require reconfiguration upon recovery. This embodiment persistently stores security constraints as independent entities, and loads them during recovery by filtering according to the protocol set and currently reachable electronic control unit set of each agent. It also forcibly loads the list of safety-critical electronic control units and globally prohibited items, ensuring that security boundaries are not missed and avoiding irrelevant constraints from occupying the context window, thereby improving the data processing efficiency of the context window.
[0141] Second Embodiment
[0142] This embodiment provides a multi-agent session data processing system for vehicle network penetration testing, used to execute the method described in the first embodiment of the present invention, including:
[0143] The session generation module is used to execute S100, continuously capture the interaction events of each protocol agent during the penetration test, parse the interaction events into domain entities, and store them in the multi-agent shared context pool.
[0144] The cross-protocol injection module is used to execute S200. After detecting an update to the domain entity submitted by the first protocol agent, it determines whether the domain entity meets the cross-protocol injection conditions. If it does, the domain entity and its updated content are injected into the context of the second protocol agent to form a cross-protocol associated entity, enabling the second protocol agent to switch to verifying the cross-protocol attack path based on the acquired permission state. Before injecting the context of the second protocol agent, the module queries the security constraint entity for prohibited diagnostic service and electronic control unit pairs. If the test action indicated by the domain entity submitted by the first protocol agent includes prohibited diagnostic service and electronic control unit pairs, the module prevents the domain entity from being injected into the context of the second protocol agent.
[0145] The information compression module is used to execute S300, continuously monitor the number of context window tokens and the total number of shared context pool tokens for each agent, and perform hierarchical compression when the trigger conditions are met. It retains the original fields word by word for security constraint entities, current attack path node entities, and cross-protocol associated entities, and performs digest operations on the raw data of tool call inference process and bus packet capture to generate compressed digests. In hierarchical compression, the electronic control units associated with security constraint entities, the domain entities corresponding to bus identifiers and diagnostic service numbers are not included in the discard layer.
[0146] The persistent storage module is used to execute S400, persistently store security constraints as independent entities, and trigger the cross-protocol injection module and information compression module when security constraints are added or modified.
[0147] The task continuation management module is used to execute S500. When the current penetration test task is paused due to an interruption signal, it performs interruption handling. When the task resumes, it performs recovery handling according to the preset execution order. Among them, security constraint loading is the first step in the preset execution order, and no test actions are allowed to be executed before the security constraint loading is completed.
[0148] This invention also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in this invention.
[0149] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.
[0150] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.
[0151] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A multi-agent session data processing method for penetration testing of vehicle networks, characterized in that, include: S100, the session generator continuously captures the interaction events of each protocol agent during the penetration test, and parses the interaction events into domain entities and stores them in the multi-agent shared context pool. S200, after the session generator detects that the domain entity submitted by the first protocol agent has been updated, it determines whether the domain entity meets the cross-protocol injection conditions. If it does, it injects the domain entity and its updated content into the context of the second protocol agent to form a cross-protocol associated entity, so that the second protocol agent can turn to verify the cross-protocol attack path based on the obtained permission state. Before injecting the context of the second protocol agent, query the security constraint entity for prohibited diagnostic service and electronic control unit pairs. If the test action indicated by the domain entity submitted by the first protocol agent includes prohibited diagnostic service and electronic control unit pairs, then prevent the domain entity from injecting the context of the second protocol agent. S300, the information compressor continuously monitors the number of context window tokens and the total number of shared context pool tokens for each agent. When the triggering conditions are met, it performs hierarchical compression, retains the original fields word by word for security constraint entities, current attack path node entities and cross-protocol associated entities, and performs digest operations on the raw data of tool call inference process and bus packet capture to generate compressed digests. In layered compression, the domain entities corresponding to the electronic control units, bus identifiers, and diagnostic service numbers associated with security constraint entities are not included in the discard layer; S400, the long-term storage memory layer persistently stores security constraints as independent entities, and triggers cross-agent injection and hierarchical compression when security constraints are added or modified. S500: When the current penetration test task is paused due to an interrupt signal, the task continuation manager performs interrupt handling; when the task resumes, the task continuation manager performs recovery handling according to the preset execution order; among them, security constraint loading is the first step in the preset execution order, and no test actions are allowed to be executed before the security constraint loading is completed.
2. The method according to claim 1, characterized in that, In S200, the cross-protocol injection condition includes at least one of the following: (1) Cross-protocol reachability condition: The protocol support list of the electronic control unit associated with the domain entity contains the protocol that the second protocol agent is responsible for, and the protocol support list records the multiple protocols that the electronic control unit is simultaneously mounted; (2) Attack path connection conditions: The first protocol agent obtains remote terminal access or diagnostic access to the electronic control unit, and the electronic control unit supports the protocol handled by the second protocol agent; (3) Conditions for changing security constraints: The domain entity involves the addition or modification of security constraint entities.
3. The method according to claim 1, characterized in that, The process of performing layered compression includes the following steps: S301, Calculate the retention priority of the current domain entity according to the retention priority calculation rule; the initial value of the current domain entity is the first domain entity with an unprocessed state selected from the multi-agent shared context pool; S302, compare the retention priority of the current domain entity with the retention threshold. If the retention priority is greater than or equal to the retention threshold, the current domain entity is assigned to the retention layer. If the retention priority is less than the retention threshold but greater than zero, the current domain entity is assigned to the summary layer. If the retention priority is equal to zero, the current domain entity is assigned to the discard layer, and the state identifier of the current domain entity is marked as processed in the multi-agent shared context pool. S303, determine whether there is a domain entity in the multi-agent shared context pool whose state is marked as unprocessed. If there is, take the next domain entity whose state is marked as unprocessed as the current domain entity and return to execute S301; otherwise, execute S304. S304: For domain entities in the retention layer, the original fields are retained word by word; for domain entities in the summarization layer, the large language model performs a summarization operation; for domain entities in the discard layer, only the count and index pointer are retained. S305, merge the original fields retained word by word in the retention layer with the entity identifiers and key fields obtained after the summary layer to generate a compressed summary.
4. The method according to claim 1, characterized in that, In S500, when security constraints are loaded, for each agent, based on the set of protocols that the agent is responsible for and the set of currently reachable electronic control units, a subset of security constraints related to the agent is selected from the full set of security constraints and loaded into the agent's context. The list of safety-critical electronic control units and global prohibitions are forcibly loaded into the context of each agent.
5. The method according to claim 1, characterized in that, In S300, after layered compression, the domain entity recognizer performs entity annotation and verification on the compressed summary, specifically including: For each domain entity in the compressed digest, the corresponding original domain entity is searched in the uncompressed original domain entities in the multi-agent shared context pool; The field information of the domain entity in the compressed summary is compared one by one with the corresponding field information in the original domain entity. The field information includes electronic control unit identifier, bus identifier, diagnostic service number and security level. If any field in the field information of the domain entity in the compressed digest is inconsistent with the corresponding field in the original domain entity, then the content of the domain entity in the compressed digest is replaced with the uncompressed original domain entity in the multi-agent shared context pool, and hierarchical compression is re-executed until the field information of all domain entities in the compressed digest is consistent with the field information of the original domain entities.
6. The method according to claim 1, characterized in that, In S300, the triggering condition includes at least one of the following: The number of context window tokens for any agent is greater than or equal to a set proportion of the corresponding window capacity; The total number of tokens in the shared context pool is greater than or equal to the shared pool threshold; The orchestration agent issues switching instructions for the testing phase, which includes the component access phase, the whole vehicle penetration phase, and the compliance verification phase. The agent switches from the current protocol task to another protocol task; Safety constraints have been added or modified.
7. The method according to claim 1, characterized in that, In S300, layered compression determines the compression level of each domain entity according to the retention priority of the domain entity. The retention priority of the domain entity is calculated by weighting the following four tags: whether the domain entity is a security constraint entity or a security critical entity, whether the domain entity is a node in the current attack path, whether the domain entity is a cross-protocol associated entity, and whether the domain entity is in an unconfirmed or in-process state. Domain entities with a retention priority greater than or equal to the retention threshold enter the retention layer, where the original fields are retained word by word; domain entities with a retention priority less than the retention threshold but greater than zero enter the digest layer, where a digest operation is performed; and domain entities with a retention priority equal to zero enter the discard layer.
8. The method according to claim 1, characterized in that, In S500, when security constraints are loaded, the security constraint version number recorded in the checkpoint storage area is read first. If the test phase identifier corresponding to the current test phase is different from the test phase identifier recorded in the checkpoint storage area, the security constraint version corresponding to the current test phase is loaded, and the differences between the two versions of security constraint content are written to the recovery log.
9. The method according to claim 1, characterized in that, In S300, after layered compression is completed, the session generator performs attack chain topology integrity verification on the compressed digest: Using the electronic control unit entity, diagnostic service entity, and vulnerability entity preserved in the compressed digest as nodes, and the cross-protocol attack steps preserved in the compressed digest as edges, a cross-protocol attack chain topology is reconstructed. Before writing the compressed digest to the checkpoint storage area, based on the current content in the shared context pool, a pre-compression cross-protocol attack chain topology is constructed, with the electronic control unit entity, diagnostic service entity, and vulnerability entity in the shared context pool as nodes and the cross-protocol attack steps in the shared context pool as edges. The reconstructed cross-protocol attack chain topology is compared with the original cross-protocol attack chain topology. If there are missing attack chain nodes or broken attack step connections in the reconstructed cross-protocol attack chain topology, the information compressor will revert the domain entities involved in the missing nodes or broken edges in the compressed digest to the original uncompressed domain entity layer, and re-perform layered compression on the reverted domain entities.
10. A multi-agent session data processing system for vehicle network penetration testing, characterized in that, include: The session generation module is used to continuously capture the interaction events of each protocol agent during the penetration test, and parse the interaction events into domain entities and store them in the multi-agent shared context pool. The cross-protocol injection module is used to determine whether the domain entity meets the cross-protocol injection conditions after detecting that the domain entity submitted by the first protocol agent has been updated. If it does, the domain entity and its updated content are injected into the context of the second protocol agent to form a cross-protocol associated entity, so that the second protocol agent can turn to verify the cross-protocol attack path based on the obtained permission state. Before injecting the context of the second protocol agent, query the security constraint entity for prohibited diagnostic service and electronic control unit pairs. If the test action indicated by the domain entity submitted by the first protocol agent includes prohibited diagnostic service and electronic control unit pairs, then prevent the domain entity from injecting the context of the second protocol agent. The information compression module continuously monitors the number of context window tokens and the total number of shared context pool tokens for each agent. When the triggering conditions are met, it performs hierarchical compression, retains the original fields word by word for security constraint entities, current attack path node entities, and cross-protocol associated entities, and performs digest operations on the raw data of tool call inference process and bus packet capture to generate compressed digests. In layered compression, the domain entities corresponding to the electronic control units, bus identifiers, and diagnostic service numbers associated with security constraint entities are not included in the discard layer. The persistent storage module is used to persistently store security constraints as independent entities, and to trigger the cross-protocol injection module and hierarchical compression when security constraints are added or modified. The task continuation management module is used to perform interruption handling when the current penetration testing task is paused due to an interruption signal, and to perform recovery handling according to a preset execution order when the task resumes. Among them, security constraint loading is the first step in the preset execution order, and no test actions are allowed to be executed before the security constraint loading is completed.
