Automatic penetration test path planning method and system based on agent collaboration
By using an automated penetration testing path planning method based on intelligent agent collaboration, the problem of existing technologies being unable to identify cross-node and cross-security domain attack paths for complex heterogeneous systems is solved, enabling in-depth security assessment and adaptive path adjustment for complex heterogeneous systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING YUHONG XINAN TECHNOLOGY CO LTD
- Filing Date
- 2026-02-25
- Publication Date
- 2026-05-15
AI Technical Summary
Existing automated penetration testing techniques cannot effectively identify complex attack paths across nodes and security domains in complex heterogeneous systems, lack global attack modeling capabilities, and are difficult to meet the needs of in-depth security assessment.
An automated penetration testing path planning method based on agent collaboration is adopted. Data interaction between multiple agents is realized through a shared blackboard mechanism. The agent receives the penetration testing target range input by the user, performs information collection and matching, generates a global attack map, and provides real-time feedback on the execution results and dynamically updates the path planning.
It enables in-depth security assessment of complex heterogeneous systems, identifies attack paths across nodes and security domains, and improves the depth coverage and adaptive path adjustment capabilities of penetration testing.
Smart Images

Figure CN122053178A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cybersecurity technology, specifically to an automated penetration testing path planning method and system based on intelligent agent collaboration. Background Technology
[0002] With the rapid development of technologies such as cloud computing and the Internet of Things, network systems have evolved into complex heterogeneous systems that integrate traditional networks, cloud environments, and smart devices. To ensure business continuity and data security, penetration testing, as a proactive defense method that simulates attacker behavior, is widely used in vulnerability discovery and risk assessment of information systems.
[0003] Existing automated penetration testing techniques primarily rely on rule-based or signature-based scanning tools. These techniques typically employ port scanning, service identification, and vulnerability rule matching to detect target systems; that is, they compare and analyze known single vulnerabilities using pre-defined rule bases or vulnerability signature databases.
[0004] However, most of the existing automated tools mentioned above only focus on identifying single points of vulnerability in a single host or service, lacking the ability to uniformly model and reason about asset topology, vulnerability exploitation prerequisites, and cross-scenario relationships. This makes it impossible for them to automatically discover complex attack paths formed by combinations of multiple vulnerabilities across nodes and security domains, just like real attackers. Consequently, existing automated penetration testing struggles to cover deep attack chains and cannot meet the needs for in-depth security assessments of complex heterogeneous systems. Summary of the Invention
[0005] This application provides an automated penetration testing path planning method and system based on intelligent agent collaboration. This method enables global attacks and automated path planning for complex heterogeneous network systems, thereby meeting the practical needs of in-depth security assessment of complex heterogeneous systems.
[0006] Firstly, this application provides an automated penetration testing path planning method based on agent collaboration, applied to a penetration testing platform. The penetration testing platform includes multiple agents that interact with each other via a shared blackboard mechanism. The method includes: receiving the penetration testing target scope input by the user and initializing and starting multiple functional agents; collecting information about the target system based on the penetration testing target scope and writing the collected asset characteristic information into the shared blackboard mechanism; obtaining the testing strategy mode of the current penetration testing task; matching the asset characteristic information with a pre-set vulnerability knowledge base according to the testing strategy mode; generating vulnerability exploitation conditions based on the matching results; and writing the vulnerability exploitation conditions into the shared blackboard mechanism. The system reads asset characteristic information and vulnerability exploitation conditions from the shared blackboard mechanism, maps the asset characteristic information to nodes, and maps attack behaviors that meet the vulnerability exploitation conditions to edges. A global attack graph is constructed based on the nodes and edges. Attack paths are generated based on the global attack graph, and the attack paths are converted into attack step sequences. Attack operations are performed on the target system according to the attack step sequence, and the execution results are fed back to the shared blackboard mechanism. When the execution result is a failure, the global attack graph is updated based on the feedback failure result, and a new attack step sequence is re-planned and generated. When the execution result is a success, a penetration test report targeting the penetration test objective is generated based on the success result, and the penetration test report is displayed to the user.
[0007] By adopting the above technical solution, after receiving the penetration testing target scope input by the user, multiple functional intelligent agents are initialized and launched to collect information from the target system based on the target scope. The collected asset characteristic information can be uniformly written into the shared blackboard mechanism. By acquiring the test strategy pattern and matching the asset characteristic information with a pre-built vulnerability knowledge base according to the strategy pattern, not only can single vulnerabilities be identified, but also structured vulnerability exploitation conditions containing preconditions and post-permission states can be generated based on the matching results. After reading the asset characteristic information and vulnerability exploitation conditions from the shared blackboard mechanism, the asset characteristic information is mapped to nodes, and attack actions that meet the vulnerability exploitation conditions are... By mapping edges, a global attack graph capable of representing cross-node and cross-security domain attack possibilities is constructed, solving the problem that existing technologies cannot detect complex attack chains. After generating attack paths based on the global attack graph and converting them into attack step sequences, when attack operations are performed on the target system according to the attack step sequence, the execution results can be fed back to the shared blackboard mechanism in real time. When the execution result is a failure, the global attack graph can be dynamically updated and a new attack step sequence can be re-planned and generated based on the feedback failure result, realizing adaptive path adjustment, improving the deep coverage capability of penetration testing, and effectively meeting the actual needs of deep security assessment of complex heterogeneous systems.
[0008] Optionally, the testing strategy mode includes a rapid association mode. Based on this mode, asset characteristic information is matched with a pre-built vulnerability knowledge base. Based on the matching results, vulnerability exploitation conditions are generated and written into the shared blackboard mechanism. Specifically, this includes: real-time monitoring of the shared blackboard mechanism and acquisition of asset characteristic information; comparison of the asset characteristic information with known vulnerability characteristics in the pre-built vulnerability knowledge base; when a match is successful, retrieving the corresponding vulnerability number, vulnerability type, and applicable environment from the pre-built vulnerability knowledge base; generating structured vulnerability exploitation conditions based on the applicable environment, and writing these conditions into the shared blackboard mechanism.
[0009] By adopting the above technical solution, the shared blackboard mechanism is monitored in real time to obtain asset feature information, which changes the traditional approach of passively waiting for scan results. When comparing asset feature information with known vulnerability features in a pre-built vulnerability knowledge base, repetitive probing operations are avoided, reducing interference with the target system. After a successful comparison, the corresponding vulnerability number, vulnerability type, and applicable environment are retrieved from the pre-built vulnerability knowledge base. Based on the applicable environment, a structured vulnerability exploitation condition is generated, including the preconditions required to exploit the vulnerability and the subsequent privilege status obtained after successful exploitation. The generated vulnerability exploitation condition is written into the shared blackboard mechanism, realizing the real-time sharing of vulnerability information among multiple agents, enabling the path planning agent to make dynamic decisions based on the latest vulnerability exploitation condition.
[0010] Optionally, the testing strategy mode also includes a deep quantification mode. Based on the testing strategy mode, asset characteristic information is matched with a pre-built vulnerability knowledge base. Based on the matching results, vulnerability exploitation conditions are generated and written into a shared blackboard mechanism. Specifically, this includes: obtaining network topology and access control policy information of the target system from the shared blackboard mechanism, where the network topology and access control policy information are included in the asset characteristic information; comparing the asset characteristic information with the pre-built vulnerability knowledge base to obtain a preliminary candidate vulnerability set; performing network reachability analysis on the preliminary candidate vulnerability set based on the network topology and access control policy information, eliminating vulnerabilities that are unreachable in the current network environment to obtain a valid vulnerability set; extracting the exploitability sub-score and vulnerability exploitation code maturity of the target valid vulnerability from the pre-built vulnerability knowledge base, where the target valid vulnerability is any vulnerability in the valid vulnerability set; performing a weighted sum of the exploitability sub-score and vulnerability exploitation code maturity to obtain the success probability value of the target valid vulnerability; generating vulnerability exploitation conditions for the success probability value; and writing the vulnerability exploitation conditions corresponding to all valid vulnerabilities in the valid vulnerability set into the shared blackboard mechanism.
[0011] By adopting the above technical solution, the target system network topology information and access control policy information contained in the asset feature information are obtained from the shared blackboard mechanism. After comparing the asset feature information with the pre-built vulnerability knowledge base to obtain a preliminary candidate vulnerability set, network reachability analysis is performed on the preliminary candidate vulnerability set based on the network topology information and access control policy information. By eliminating vulnerabilities that are unreachable in the current network environment, a valid vulnerability set is obtained, effectively avoiding invalid attempts on vulnerabilities that cannot be actually exploited. The exploitability sub-score and vulnerability exploitation code maturity of any target valid vulnerability in the valid vulnerability set are extracted from the pre-built vulnerability knowledge base. The success probability value of the target valid vulnerability is obtained by weighted summing of these two indicators. By generating vulnerability exploitation conditions containing the success probability value, and writing the vulnerability exploitation conditions corresponding to all valid vulnerabilities in the valid vulnerability set into the shared blackboard mechanism, the testing efficiency is optimized while ensuring deep coverage.
[0012] Optionally, exploitability sub-scores and exploit code maturity of target effective vulnerabilities are extracted from a pre-built vulnerability knowledge base. Specifically, this includes: extracting the attack path length, attack complexity, and privilege dependency of the target effective vulnerability; performing reverse normalization on the attack path length, attack complexity, and privilege dependency to obtain path reachability coefficients, complexity breakthrough coefficients, and privilege acquisition coefficients; calculating the sum of the reciprocals of the path reachability coefficient, complexity breakthrough coefficient, and privilege acquisition coefficient, and dividing the total number by the sum of the reciprocals to obtain the harmonic mean value; using the harmonic mean value as the exploitability sub-score, with the total number of reciprocals being [not specified]. The algorithm calculates the number of coefficients after unification; extracts the applicable platform identifier string declared in the header of the exploit code for the target valid vulnerability; obtains the actual platform fingerprint string of the target system; calculates the Lewinstein distance between the applicable platform identifier string and the actual platform fingerprint string, where the Lewinstein distance is the minimum number of single-character edit operations required to convert one string to another; obtains the first length of the applicable platform identifier string and the second length of the actual platform fingerprint string, divides the Lewinstein distance by the maximum of the first and second lengths to obtain the difference ratio; and subtracts the difference ratio from 1 to determine the maturity of the exploit code.
[0013] By employing the above technical solution, the attack path length, attack complexity, and permission dependency of the target's effective vulnerability are extracted. These three indicators are then reverse-normalized to obtain the path reachability coefficient, complexity breakthrough coefficient, and permission acquisition coefficient. The sum of the reciprocals of the three coefficients is calculated, and the total number is divided by this sum to obtain the harmonic mean value as the exploitability sub-score. The applicable platform identifier string declared in the header of the target's effective vulnerability exploit code is extracted, and the actual platform fingerprint string of the target system is obtained. The platform matching degree is quantified by calculating the Levinstein distance between the two. The difference ratio is obtained by dividing the Levinstein distance by the maximum value between the first length of the applicable platform identifier string and the second length of the actual platform fingerprint string. Subtracting this difference ratio from 1 determines the maturity of the vulnerability exploit code. This effectively solves the problem that traditional techniques cannot quantify and evaluate the actual success rate of vulnerability exploit code in a specific target environment.
[0014] Optionally, asset characteristic information is mapped to nodes, and attack behaviors that meet the vulnerability exploitation conditions are mapped to edges. A global attack graph is constructed based on the nodes and edges. Specifically, this includes: parsing the asset characteristic information to identify all independent network entities within the penetration test target range; creating corresponding graph nodes for each independent network entity and assigning the IP address, device type, and current permission status of the independent network entity as node attributes to the graph nodes; obtaining source nodes and target nodes from multiple graph nodes; judging the network connectivity from the source node to the target node based on network topology information, where the source node and target node are any two graph nodes from multiple graph nodes; if there is network connectivity from the source node to the target node, searching for vulnerability exploitation conditions for the target node in the shared blackboard mechanism; if there are vulnerability exploitation conditions for the target node in the shared blackboard mechanism, constructing a directed edge from the source node to the target node, where the directed edge represents a single-step attack behavior executed on the target node; obtaining the success probability value from the vulnerability exploitation conditions of the target node and using the success probability value as the weight attribute of the directed edge; and combining all generated graph nodes and directed edges to form a global attack graph.
[0015] By employing the above technical solution, asset characteristic information is analyzed to identify all independent network entities within the target scope of the penetration test. Corresponding graph nodes are created for each independent network entity, and the IP address, device type, and current permission status of each independent network entity are assigned as node attributes. After obtaining the source and target nodes from multiple graph nodes, the network connectivity from the source node to the target node is judged based on the network topology information. Only when network connectivity exists between the source and target nodes is the shared blackboard mechanism searched for exploit conditions targeting the target node, effectively avoiding invalid modeling of unreachable network paths. When exploit conditions targeting the target node exist in the shared blackboard mechanism, a directed edge is constructed from the source node to the target node. This directed edge represents a single-step attack behavior executed on the target node, and the success probability value is obtained from the exploit conditions of the target node as the weight attribute of the directed edge. All generated graph nodes and directed edges are combined to form a global attack graph, effectively solving the problem that traditional techniques cannot discover complex attack paths across nodes and security domains.
[0016] Optionally, network connectivity from the source node to the target node is determined based on network topology information. Specifically, this includes: obtaining the source IP address of the source node and the target IP address of the target node, and extracting the open port list of the target node from the shared blackboard mechanism; determining whether the source IP address and the target IP address belong to the same logical subnet; if the source IP address and the target IP address belong to the same logical subnet, determining whether a Layer 2 isolation policy exists in the network topology information; and when no Layer 2 isolation policy exists in the network topology information, and the open port list contains the ports required for vulnerability exploitation, then connectivity between the source node and the target node is determined to exist. Network connectivity; if the source IP address and the target IP address do not belong to the same logical subnet, obtain the gateway device connecting the source node and the target node, and obtain the routing table information and access control policy list of the gateway device; determine whether there is a forwarding path from the source node to the target node in the routing table information; if there is a forwarding path from the source node to the target node in the routing table information, use the source IP address, the target IP address, and the port required for vulnerability exploitation as the five-tuple matching condition, and perform rule matching between the five-tuple matching condition and the access control policy list; if the matching result is allowed, it is determined that there is network connectivity from the source node to the target node.
[0017] By employing the above technical solution, the source IP address of the source node and the target IP address of the target node are obtained. The open port list of the target node is extracted from the shared blackboard mechanism. The system determines whether the source and target IP addresses belong to the same logical subnet. If they do, the system checks if a Layer 2 isolation policy exists in the network topology information. Network connectivity between the source and target nodes is only determined if no Layer 2 isolation policy exists and the open port list contains the ports required for exploitation. If the source and target IP addresses do not belong to the same logical subnet, the system obtains the gateway device connecting the source and target nodes and its routing table information and access control policy list. The system checks if a forwarding path from the source to the target node exists in the routing table information, ensuring the reachability of cross-network segment communication. This hierarchical judgment mechanism can accurately identify attack paths that cannot be implemented due to network isolation, unreachable routes, or firewall policy blocking.
[0018] Optionally, when the execution result is a failure, the global attack graph is updated based on the feedback failure result, and a new attack step sequence is re-planned and generated. Specifically, this includes: reading the failure status information from the execution result and determining the cause of failure based on the failure status information; locating the target directed edge that generated the execution result in the global attack graph and marking the state attribute of the target directed edge as blocked to obtain the updated global attack graph; generating a new attack step sequence based on the updated global attack graph until the new attack step sequence reaches the termination condition, stopping path planning and generating a test report of attack failure.
[0019] By adopting the above technical solution, failure status information is read from the execution results and the cause of failure is determined based on the failure status information. The real-time feedback during the attack execution process is transformed into structured information that can be used for decision-making adjustments. This allows for an accurate understanding of the specific reasons for attack failure rather than simply repeating attempts. By locating the target directed edge that produces the execution result in the global attack graph and marking the state attribute of the target directed edge as blocked, it is ensured that subsequent path planning will not select attack edges that have been proven to be ineffective. After obtaining the updated global attack graph, a new attack step sequence is generated based on the updated global attack graph. When the new attack step sequence reaches the termination condition, path planning stops and a test report of attack failure is generated. This avoids infinite loops after all feasible paths have been tried, ensuring the controllability of the testing process and the rationality of resource usage.
[0020] The second aspect of this application provides an automated penetration testing path planning system based on agent collaboration. The system is located on a penetration testing platform, which includes multiple functional agents that interact with each other via a shared blackboard mechanism. The system also includes an acquisition unit, a processing unit, a planning unit, and a result processing unit. The acquisition unit receives the penetration testing target range input by the user and initializes and starts the multiple functional agents. The processing unit collects information about the target system based on the penetration testing target range, writes the collected asset characteristic information into the shared blackboard mechanism, acquires the test strategy mode of the current penetration testing task, matches the asset characteristic information with a pre-set vulnerability knowledge base according to the test strategy mode, generates vulnerability exploitation conditions based on the matching results, and... The vulnerability exploitation conditions are written into the shared blackboard mechanism; asset characteristic information and vulnerability exploitation conditions are read from the shared blackboard mechanism, the asset characteristic information is mapped to nodes, and attack behaviors that meet the vulnerability exploitation conditions are mapped to edges, and a global attack graph is constructed based on the nodes and edges; the planning unit generates attack paths based on the global attack graph and converts the attack paths into attack step sequences; the attack operation is executed on the target system according to the attack step sequence, and the execution result is fed back to the shared blackboard mechanism; the result processing unit updates the global attack graph based on the feedback failure result when the execution result is failure and re-plans and generates a new attack step sequence; when the execution result is success, a penetration test report is generated based on the success result and the penetration test report is displayed to the user.
[0021] In a third aspect, this application provides an electronic device including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory, causing the electronic device to perform any of the methods described above in this application.
[0022] In a fourth aspect, this application provides a computer-readable storage medium storing instructions that, when executed, perform any of the methods described above in this application.
[0023] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. After receiving the target scope of the penetration test from the user, multiple functional agents are initialized and launched to collect information about the target system based on the target scope. The collected asset characteristic information is uniformly written into the shared blackboard mechanism. By acquiring the test strategy pattern and matching the asset characteristic information with the pre-set vulnerability knowledge base according to the strategy pattern, it can not only identify single vulnerabilities, but also generate structured vulnerability exploitation conditions containing preconditions and post-permission states based on the matching results. After reading the asset characteristic information and vulnerability exploitation conditions from the shared blackboard mechanism, the asset characteristic information is mapped as nodes, and the attack behaviors that meet the vulnerability exploitation conditions are mapped as edges. This allows for the construction of a global attack graph capable of representing the possibility of cross-node and cross-security domain attacks, solving the problem that existing technologies cannot detect complex attack chains. After generating attack paths based on the global attack graph and converting them into attack step sequences, when attack operations are performed on the target system according to the attack step sequence, the execution results can be fed back to the shared blackboard mechanism in real time. When the execution result is a failure, the global attack graph can be dynamically updated and a new attack step sequence can be re-planned and generated based on the feedback failure result, realizing adaptive path adjustment, improving the deep coverage capability of penetration testing, and effectively meeting the actual needs of deep security assessment of complex heterogeneous systems. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating an automated penetration testing path planning method based on intelligent agent collaboration provided in an embodiment of this application. Figure 2 This is a first structural schematic diagram of an automated penetration testing path planning method based on intelligent agent collaboration provided in an embodiment of this application; Figure 3 This is a second structural schematic diagram of an automated penetration testing path planning method based on intelligent agent collaboration provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.
[0025] Explanation of reference numerals in the attached drawings: 400, electronic device; 401, processor; 402, memory; 403, user interface; 404, network interface; 405, communication bus. Detailed Implementation
[0026] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0027] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.
[0028] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0029] Therefore, how to address the lack of global attack modeling capabilities and the inability to detect complex attack chains in existing automated penetration testing technologies is a pressing issue. This application provides an automated penetration testing path planning method based on agent collaboration, applied in a penetration testing platform. The platform includes a main control scheduling module and multiple functional agents. These agents interact with each other via a shared blackboard mechanism. The functional agents include a perception agent group, a knowledge expert agent, a path planning agent, an execution agent, and an auditing and reporting agent. This penetration testing platform provides security testing services for business systems. Figure 1 This is a flowchart illustrating an automated penetration testing path planning method based on agent collaboration provided in an embodiment of this application. (Refer to...) Figure 1 The method includes the following steps S101-S108.
[0030] S101: Receives the target scope of the penetration test from the user and initializes and starts up multiple functional agents.
[0031] In step S101 above, the main control scheduling module receives the penetration testing target scope input by the user and initializes and starts multiple functional agents, including a group of perception agents, a knowledge expert agent, a path planning agent, an execution agent, and an auditing and reporting agent. This decomposes the traditionally complex penetration testing process, which relies on human experts, into multiple clearly defined automated modules. By establishing clear task boundaries and an agent collaboration framework, it achieves a shift from human-led to multi-agent collaborative automated execution.
[0032] The main control module receives the penetration testing target scope input by the user through a web management interface or a RESTful API interface. The target scope can include a single IP address, a consecutive range of IP addresses, a list of CIDR-formatted network addresses or domain names. It also receives test authorization documents and test policy parameters. Upon receiving the target information, the main control module performs multi-level verification of the input, including address format validity checks, authorization scope consistency verification, and comparison with a blacklist database, ensuring that it will not affect unauthorized targets or critical infrastructure. After successful verification, the main control module generates a unique task identifier and writes the penetration testing target scope, task identifier, start timestamp, and test depth level into the global task configuration area of the shared blackboard mechanism. This configuration area serves as a unified data source for all agents to obtain the task context. Subsequently, the main control module activates various functional agents sequentially according to the startup order and dependencies defined in the agent configuration list. When the perception agent group starts, it automatically selects the appropriate sub-type agent based on the target environment characteristics, including network perception agents, IoT perception agents, and cloud environment perception agents. Each sub-type agent reads the target scope from the shared blackboard mechanism and registers its corresponding working status. After startup, the knowledge expert agent loads a pre-built vulnerability knowledge base index and subscribes to asset characteristic information update events in the shared blackboard mechanism. The path planning agent initializes the graph computation engine and prepares the data structure for building the attack graph. The execution agent loads the vulnerability exploitation toolchain and establishes an interface with the external penetration testing framework. The auditing and reporting agent creates a logger and initializes the report template engine.
[0033] For example, taking a penetration test of a smart park system as an example, the user input includes the internal network segment 172.16.0.0 / 16 and the external network smart access control device IP 203.0.113.88. After the main control module verifies and authorizes, it writes these two targets into the shared blackboard mechanism. After the network sensing agent subscribes to the internal network target, it prepares to perform a subnet scan, and after the IoT sensing agent obtains the access control device IP, it prepares to perform protocol fingerprint recognition. Through this initialization mechanism, a basic architecture for multi-agent parallel operation is established.
[0034] Figure 2This demonstration showcases the complete workflow of an automated penetration testing system based on multi-agent collaboration, from the user initiating a test request to the final generation of a test report. It involves the coordinated operation and data interaction of multiple functional agent modules. The user terminal submits a test task to the main control and scheduling module, which triggers the perception agent and knowledge expert agent to work in parallel, respectively collecting target asset information and loading attack technique knowledge. The data converges to the shared blackboard mechanism module. The path planning agent reads data from the shared blackboard mechanism to construct a global attack graph and generate an attack step sequence. The execution agent executes the attack operations sequentially and feeds the results back to the shared blackboard mechanism. The execution result is determined by a diamond-shaped decision box. Successful executions flow to the audit and reporting agent to generate a penetration test report; unsuccessful executions flow back to the path planning agent to trigger a replanning mechanism, updating the attack graph and generating a new attack sequence to form a closed-loop iteration. During the replanning process, the path planning agent performs termination condition checks. When a threshold is reached, the test stops and a failure report is generated. The audit and reporting agent pushes the report to the penetration test report generation module for formatted output and user display.
[0035] S102: Collect information about the target system based on the penetration test target scope, and write the collected asset characteristic information into the shared blackboard mechanism.
[0036] In S102 above, the perceptual intelligent agent swarm collects information about the target system based on the penetration test target scope and writes the collected asset feature information into the shared blackboard mechanism. Through the distributed parallel collection mechanism, it comprehensively perceives heterogeneous targets such as traditional networks, cloud computing environments, and IoT devices, transforming scattered asset information into structured feature descriptions, providing a unified data foundation for subsequent vulnerability correlation analysis and attack path construction.
[0037] After reading the penetration test target range from the global task configuration area of the shared blackboard mechanism, the perception agent swarm automatically determines the target environment type based on the characteristics of the target IP address range, port response mode, and protocol type, and dynamically selects the appropriate dedicated perception agent to execute the data collection task. The network perception agent performs TCP / UDP port scanning for traditional network environments, identifying open port lists by sending probe packets in a specific format, matching service fingerprints on response packets to determine the running application type and version number, and obtaining network topology information through TTL value analysis, route tracing, and ARP table probing. The IoT perception agent performs protocol identification for IoT devices accessible from the external network, determining the communication protocol type used by the device by sending protocol handshake requests to common IoT ports, matching HTTP response headers, SNMP OIDs, or Modbus function codes using a device fingerprint database to identify the device manufacturer and model, and attempting to detect weak passwords using a default credential list. The cloud environment perception agent performs metadata queries for cloud platform resources, obtaining virtual machine instance information, container configuration parameters, and access control policies by calling API interfaces provided by the cloud service provider, and analyzing IAM role permission boundaries and security group rules to determine access relationships between resources. Each sensing agent performs a structured transformation on the collected raw data according to a predefined asset feature template. This template includes standard fields such as IP address, hostname, list of open ports, service type, application version, operating system fingerprint, device type, and current permission status. After the transformation is complete, the sensing agent calls the write interface of the shared blackboard mechanism to write the asset feature information in JSON format to the corresponding asset information storage area and triggers a data update event to notify other agents that have subscribed to the event.
[0038] For example, taking a penetration test of a mixed environment in an industrial park as an example, the network sensing agent scanned the internal network segment 10.50.0.0 / 24 and found that host 10.50.0.15 had ports 22, 80, and 3306 open. Service fingerprinting confirmed that it was running OpenSSH 7.4, Apache 2.4.6, and MySQL 5.7, and this information was written to the shared blackboard mechanism. The IoT sensing agent performed protocol probing on the external network device 198.51.100.42, identifying it as a smart camera of a certain brand with the default password admin / admin, and similarly wrote the device characteristics to the shared blackboard mechanism. Through this distributed collection mechanism, unified perception of multiple types of assets across network boundaries and security domains was achieved, providing a complete target environment profile for vulnerability correlation analysis by the knowledge expert agent.
[0039] S103: Obtain the test strategy mode of the current penetration testing task, match the asset characteristic information with the pre-set vulnerability knowledge base according to the test strategy mode, generate vulnerability exploitation conditions based on the matching results, and write the vulnerability exploitation conditions into the shared blackboard mechanism.
[0040] In step S103 above, the knowledge expert agent acquires the current penetration testing task, analyzes it to determine the testing strategy pattern, matches asset characteristic information with a pre-built vulnerability knowledge base based on the testing strategy pattern, and generates vulnerability exploitation conditions based on the matching results, writing them into the shared blackboard mechanism. This transforms the scattered asset information acquired during the perception phase into executable vulnerability exploitation conditions. By establishing a mapping between asset characteristics and vulnerability knowledge, it avoids the inaccurate exploitation condition judgment problem caused by the separation of vulnerability information and asset information in traditional tools.
[0041] The knowledge expert agent reads the test strategy parameters of the current penetration testing task from the global task configuration area of the shared blackboard mechanism, including information such as the test time window, target asset priority, and accuracy requirements. Based on these parameters, it automatically determines whether to use the rapid association mode or the deep quantization mode. When the test task is in the preliminary scanning stage or the time window is limited, the knowledge expert agent selects the rapid association mode. The rapid association mode quickly retrieves the CVE number in the pre-set vulnerability knowledge base based on the service type and application version fields in the asset feature information, using a hash index or inverted index. During matching, only the application name and major version number are compared, generating basic vulnerability exploitation conditions including vulnerability number, CVSS score, and exploitation complexity. When the test task targets core business assets or requires high-precision verification, the knowledge expert agent switches to the deep quantization mode. The deep quantization mode not only compares the precise match of the application version number, but also performs multi-dimensional verification by combining contextual information such as operating system type, patch installation status, and network configuration. By querying the precondition fields in the vulnerability knowledge base, it determines whether the vulnerability is truly exploitable, calculates the actual probability of successful exploitation considering environmental factors, and generates complete vulnerability exploitation conditions including detailed exploitation path, required privilege level, and expected execution result. After matching is completed, the knowledge expert agent encapsulates the generated vulnerability exploitation conditions in a standard format. This format includes fields such as target asset identifier, vulnerability number, vulnerability type, exploitation tool name, list of prerequisites, and success probability value. These vulnerability exploitation conditions are stored in the vulnerability information area through the write interface of the shared blackboard mechanism, and a data update event is triggered for the path planning agent to subscribe to and use.
[0042] Furthermore, when the testing strategy mode is the rapid association mode, the asset characteristic information is matched with the pre-built vulnerability knowledge base according to the testing strategy mode. Based on the matching result, vulnerability exploitation conditions are generated and written into the shared blackboard mechanism. Specifically, this includes: real-time monitoring of the shared blackboard mechanism and obtaining asset characteristic information; comparing the asset characteristic information with known vulnerability characteristics in the pre-built vulnerability knowledge base; when the comparison is successful, retrieving the corresponding vulnerability number, vulnerability type, and applicable environment from the pre-built vulnerability knowledge base; generating structured vulnerability exploitation conditions based on the applicable environment, and writing the vulnerability exploitation conditions into the shared blackboard mechanism.
[0043] Specifically, the knowledge expert agent listens for data update events in the shared blackboard mechanism in real time through an event subscription mechanism. When the perception agent group writes newly collected asset feature information into the asset information storage area of the shared blackboard mechanism, the write operation triggers a pre-registered message notification. Upon receiving the notification, the knowledge expert agent immediately reads the corresponding asset feature information from the shared blackboard mechanism. This information exists in the form of a structured JSON object, containing key fields such as the target IP address, open port list, service type identifier, application name, and version number. To ensure processing efficiency, the knowledge expert agent maintains a memory-based asset feature cache queue. Newly acquired asset feature information is added to the tail of the queue, and the processing thread retrieves items to be processed sequentially from the head of the queue according to the first-in, first-out principle.
[0044] After acquiring asset characteristic information, the knowledge expert agent initiates a comparison process with a pre-built vulnerability knowledge base. This pre-built vulnerability knowledge base is loaded into memory during system initialization and has a multi-level index structure, including a hash index based on application name and an inverted index based on service type. During the comparison, the knowledge expert agent extracts the application name field from the asset characteristic information, such as "Apache" or "OpenSSH," and quickly locates the set of all vulnerability entries related to that application in the vulnerability knowledge base using the hash index. Subsequently, it extracts the application version number field and performs major version number parsing. In the fast association mode, only the major and minor version numbers are compared, ignoring revision and build versions. This coarse-grained matching strategy significantly reduces the computational complexity of the comparison. When the asset characteristics indicate that the target is running Apache 2.4.6, the knowledge expert agent retrieves a list of all vulnerabilities affecting the Apache 2.4.x series through a version range query, without needing to precisely match to the specific version 2.4.6.
[0045] When a potential vulnerability is successfully identified through comparison, the knowledge expert agent retrieves the corresponding detailed information from a pre-built vulnerability knowledge base. This retrieval operation directly accesses the complete record through the primary key index of the vulnerability entry, obtaining core fields such as vulnerability number, vulnerability type, and applicable environment. The vulnerability number uses the standard CVE format, such as CVE-2017-5638, to uniquely identify the vulnerability. The vulnerability type field describes the attack vector and impact category of the vulnerability, including predefined type tags such as remote code execution, SQL injection, and privilege escalation. The applicable environment field records the necessary conditions for the successful exploitation of the vulnerability in a structured manner, including operating system type requirements, service configuration status requirements, and network access permission requirements.
[0046] Based on the retrieved vulnerability application environment information, the knowledge expert agent executes the process of generating vulnerability exploitation conditions. This process converts the declarative environment descriptions stored in the vulnerability knowledge base into structured vulnerability exploitation condition objects. These objects contain two core components: a precondition list and post-exploitation permission states. The precondition list enumerates all prerequisites required to exploit the vulnerability, organized as key-value pairs, including network connectivity requirements, target port open status, service running status, and authentication credential requirements. When dealing with the Apache Struts vulnerability, the precondition list includes "network_reachable:true" indicating network reachability, "port_80_open:true" indicating the HTTP port must be open, and "content_type_parsing:enabled" indicating the target application must have specific functional modules enabled. The post-exploitation permission states describe the system access levels an attacker will gain after successfully exploiting the vulnerability, including operating system user permissions, database access permissions, or application control permissions. This information provides a basis for determining permission transfer relationships in subsequent attack path planning.
[0047] After generating the exploit conditions, the knowledge expert agent calls the standard write interface of the shared blackboard mechanism to serialize the generated exploit condition object into JSON format and write it to the vulnerability information storage area of the shared blackboard mechanism. The write operation carries metadata tags, including a generation timestamp, associated asset identifier, and matching pattern identifier. This metadata facilitates subsequent data tracing and credibility assessment by the agent. After the write is complete, the knowledge expert agent triggers a vulnerability information update event, notifying path planning agents that have subscribed to the event that new exploit conditions are available.
[0048] Furthermore, when the testing strategy mode is deep quantification mode, the asset characteristic information is matched with a pre-built vulnerability knowledge base according to the testing strategy mode. Based on the matching results, vulnerability exploitation conditions are generated and written into the shared blackboard mechanism. Specifically, this includes: obtaining the target system's network topology and access control policy information from the shared blackboard mechanism, where the network topology and access control policy information are included in the asset characteristic information; comparing the asset characteristic information with the pre-built vulnerability knowledge base to obtain a preliminary candidate vulnerability set; performing network reachability analysis on the preliminary candidate vulnerability set based on the network topology and access control policy information, eliminating vulnerabilities that are unreachable in the current network environment to obtain a valid vulnerability set; extracting the exploitability sub-score and vulnerability exploitation code maturity of the target valid vulnerability from the pre-built vulnerability knowledge base, where the target valid vulnerability is any vulnerability in the valid vulnerability set; performing a weighted sum of the exploitability sub-score and vulnerability exploitation code maturity to obtain the success probability value of the target valid vulnerability; generating vulnerability exploitation conditions for the success probability value; and writing the vulnerability exploitation conditions corresponding to all valid vulnerabilities in the valid vulnerability set into the shared blackboard mechanism.
[0049] Specifically, the knowledge expert agent acquires network topology and access control policy information of the target system from the shared blackboard mechanism. This information, as an extension of asset characteristic information, is written into the system by the perception agent during the acquisition phase. The network topology information is represented as graph data, containing fields such as node identifiers, node IP addresses, network segment identifiers, inter-node connections, and gateway device information. This graph structure reflects the physical and logical connections between hosts within the target system and with external networks. Access control policy information includes firewall rule sets, access control lists, and security group configurations. These policies are organized as rule lists, with each rule containing elements such as source address range, destination address range, protocol type, port range, and action type. The knowledge expert agent constructs a security context model of the target environment by parsing this structured information.
[0050] After acquiring the environmental context information, the knowledge expert agent compares the asset characteristic information with a pre-built vulnerability knowledge base to obtain a preliminary set of candidate vulnerabilities. Unlike the rapid association mode, the deep quantification mode employs a precise matching strategy, comparing not only the application name and major version number, but also the minor version number, revision number, and specific compilation flags or patch status. The comparison engine extracts the complete version string from the asset characteristic information, parses the version number components at each level using regular expressions, and performs precise range judgments against the affected version ranges recorded in the vulnerability knowledge base. When the asset characteristics indicate that the target is running MySQL 5.7.28, the comparison engine not only queries for vulnerabilities affecting MySQL 5.7.x, but also verifies whether 5.7.28 falls within the specific affected version range recorded for each vulnerability entry. For example, a vulnerability affecting versions 5.7.0 to 5.7.27 will not be included in the candidate set. Furthermore, the comparison process also checks auxiliary information such as the operating system type and service configuration parameters in the asset characteristics to ensure that the platform compatibility requirements of the vulnerabilities are met. After precise comparison, the knowledge expert agent generates a preliminary set of candidate vulnerabilities, which contains all vulnerability entries that meet the conditions in terms of version matching and platform compatibility.
[0051] Based on network topology and access control policy information, the knowledge expert agent performs network reachability analysis on the initial candidate vulnerability set. This analysis simulates the feasibility of a network path when an attacker launches an attack from a currently controlled node or test starting point to the target asset. The knowledge expert agent reads the current attacker's privilege status from the shared blackboard mechanism, determines the set of nodes that can serve as the attack starting point, and for each candidate vulnerability, extracts the network protocol type and target port number required for exploitation; for example, an SQL injection vulnerability requires access to port 3306 via TCP. The reachability analysis engine executes a path search algorithm in the network topology graph to determine if a path satisfying the protocol and port requirements exists from the starting node to the target node. Simultaneously, it checks whether each gateway node or border firewall along the path has deployed access control policies to block this traffic. The analysis process verifies each firewall rule by simulating a five-tuple matching process. When the source address, target address, protocol type, source port, and target port all satisfy a certain denial rule, the path is determined to be unreachable. After accessibility analysis, the knowledge expert agent eliminates all vulnerabilities that cannot be actually used due to network isolation or access control policies, resulting in a set of effective vulnerabilities. Each vulnerability in this set is not only technically exploitable, but also can indeed reach the target from the attack point in the current network environment.
[0052] For each target vulnerability in the valid vulnerability set, the knowledge expert agent extracts two quantitative indicators from a pre-built vulnerability knowledge base: an exploitability sub-score and exploit code maturity. The exploitability sub-score comes from the exploitability measurement dimension of the CVSS scoring system. This score comprehensively considers factors such as attack vector, attack complexity, required privilege level, and user interaction requirements, and ranges from 0 to 10, with higher values indicating easier vulnerability exploitation. Exploit code maturity reflects the completeness of publicly available exploit tools or code. This indicator is extracted from the exploit code field of the vulnerability knowledge base and is divided into different levels based on the existence of mature automated exploit tools, proof-of-concept code, or only theoretical analysis. Typically, fully automated tools are assigned a value of 1.0, manual exploit scripts are assigned 0.7, and only theoretical descriptions are assigned 0.3.
[0053] The knowledge expert agent calculates the success probability of a target vulnerability by weighted summing of the exploitability sub-score and the vulnerability exploitation code maturity. This calculation uses a normalized weighting formula, normalizing the exploitability sub-score by dividing it by 10, and then linearly combining it with the vulnerability exploitation code maturity according to preset weighting coefficients. These weighting coefficients are configured based on the testing scenario and risk appetite; in the standard configuration, the exploitability weight is set to 0.6, and the code maturity weight is set to 0.4. The calculation formula is: success probability = 0.6 multiplied by the exploitability sub-score divided by 10 plus 0.4 multiplied by the vulnerability exploitation code maturity. The calculated success probability value ranges from 0 to 1, providing a quantitative basis for the subsequent path planning agent to assign edge weights to the attack graph. The knowledge expert agent generates a structured object containing the vulnerability exploitation conditions, which adds extended fields such as the success probability field, network reachability verification identifier, and environmental constraint descriptions to the basic fields generated by the rapid association mode. The exploit conditions corresponding to all valid vulnerabilities in the valid vulnerability set are written in batches to the vulnerability information storage area of the shared blackboard mechanism. Each record is associated with the corresponding target asset identifier and vulnerability number, which facilitates the path planning agent to perform related queries.
[0054] Furthermore, this section explains in detail how the knowledge expert agent extracts the exploitability sub-score and exploit code maturity of a target valid vulnerability from a pre-built vulnerability knowledge base. Specifically, this includes: extracting the attack path length, attack complexity, and permission dependency of the target valid vulnerability; performing inverse normalization on the attack path length, attack complexity, and permission dependency to obtain the path reachability coefficient, complexity breakthrough coefficient, and permission acquisition coefficient; calculating the sum of the reciprocals of the path reachability coefficient, complexity breakthrough coefficient, and permission acquisition coefficient, and dividing the total number by the sum of the reciprocals to obtain the harmonic mean value, which is then used as the exploitability sub-score. The number represents the number of coefficients after inverse normalization; the applicable platform identifier string declared in the header of the exploit code for the target valid vulnerability is extracted; the actual platform fingerprint string of the target system is obtained; the Lewinstein distance between the applicable platform identifier string and the actual platform fingerprint string is calculated, where the Lewinstein distance is the minimum number of single-character edit operations required to convert one string to another; the first length of the applicable platform identifier string and the second length of the actual platform fingerprint string are obtained, and the Lewinstein distance is divided by the maximum value between the first and second lengths to obtain the difference ratio; 1 minus the difference ratio is used to determine the maturity of the exploit code.
[0055] Specifically, a target valid vulnerability is selected from the set of valid vulnerabilities. Taking the calculation of the target valid vulnerability as an example, the knowledge expert agent extracts three key features of the target valid vulnerability from a pre-built vulnerability knowledge base: attack path length, attack complexity, and privilege dependency. Attack path length represents the number of intermediate steps required from the attack starting point to successfully exploiting the vulnerability. The number of steps is obtained by parsing the attack vector field of the vulnerability knowledge base. For example, a remote code execution vulnerability can be triggered with only one HTTP request, so the path length is 1. A privilege escalation vulnerability requires first obtaining ordinary user privileges and then escalating to administrator privileges through a local vulnerability, so the path length is 2. Attack complexity reflects the degree of technical obstacles that need to be overcome to successfully exploit the vulnerability. This indicator is read from the complexity rating field of the vulnerability knowledge base, usually divided into three levels: low, medium, and high, mapped to values of 1, 5, and 9, respectively. Low complexity means that vulnerability exploitation does not require special conditions or timing requirements; medium complexity means that specific system configuration or user interaction is required; and high complexity means that multiple protection mechanisms need to be bypassed or the execution timing needs to be precisely controlled. The permission dependency level describes the level of prior privileges required to exploit the vulnerability. This value is extracted from the permission requirements field in the vulnerability knowledge base. The permission dependency level is 0 for unauthorized access vulnerabilities, 3 for vulnerabilities requiring ordinary user privileges, and 8 for vulnerabilities requiring administrator privileges. The higher the value, the higher the exploitation threshold.
[0056] The knowledge expert agent performs inverse normalization on attack path length, attack complexity, and permission dependency. This process aims to convert the original values into coefficients with uniform dimensions, ensuring that larger original values correspond to smaller coefficients to conform to exploitability semantics. Inverse normalization is achieved using a combination of reciprocal mapping and interval shifting. For attack path length, the knowledge expert agent calculates the path reachability coefficient as the preset maximum path length minus the actual path length plus 1, divided by the preset maximum path length. The preset maximum path length is set based on the complexity of the test environment, with a typical value of 5. When the attack path length for a vulnerability is 2, the path reachability coefficient is calculated as 5 minus 2 plus 1, resulting in 4 divided by 5, which equals 0.8.
[0057] For attack complexity, the knowledge expert agent calculates the complexity breakthrough coefficient by subtracting the actual complexity plus 1 from the preset maximum complexity, divided by the preset maximum complexity. The preset maximum complexity is set to 10. When the attack complexity is 5, the complexity breakthrough coefficient is calculated as 10 - 5 + 1 = 6, divided by 10, which equals 0.6. For permission dependency, the knowledge expert agent calculates the permission acquisition coefficient by subtracting the actual permission dependency plus 1 from the preset maximum permission level, divided by the preset maximum permission level. The preset maximum permission level is set to 10. When the permission dependency is 3, the permission acquisition coefficient is calculated as 10 - 3 + 1 = 8, divided by 10, which equals 0.8. After reverse normalization, all coefficients are mapped to the range of 0 to 1, with larger original obstacles corresponding to smaller coefficients, accurately reflecting the negative impact of exploitation difficulty on exploitability.
[0058] The harmonic mean of the path reachability coefficient, complexity breakthrough coefficient, and access acquisition coefficient is used as the availability sub-score for the knowledge expert agent. The harmonic mean, rather than the arithmetic mean, is chosen because it is more sensitive to minima. When any dimension's coefficient approaches zero, it significantly reduces the overall score, preventing a fatal flaw in a particular dimension from being masked by the arithmetic mean. During the calculation, the knowledge expert agent counts the number of coefficients after inverse normalization (3 in this example). The reciprocals of the three coefficients are calculated: 1 divided by 0.8 equals 1.25, 1 divided by 0.6 approximately equals 1.67, and 1 divided by 0.8 equals 1.25. The sum of these reciprocals is 1.25 + 1.67 + 1.25 = 4.17. Dividing the total number of coefficients (3) by the sum of the reciprocals (4.17) yields a harmonic mean of approximately 0.719, which is the availability sub-score. By using harmonic mean calculation, when the coefficient of a certain dimension is significantly lower than that of other dimensions, the overall exploitability score will be significantly reduced. For example, even if the path reachability coefficient and the privilege acquisition coefficient are both high, if the complexity breakthrough coefficient is 0.2, the harmonic mean value will drop to below 0.4, which accurately reflects the actual difficulty of exploiting the vulnerability.
[0059] The knowledge expert agent extracts the applicable platform identifier string declared in the header of the exploit code for a valid vulnerability. This string is typically located in the metadata area of the exploit script or module stored in the vulnerability knowledge base, and is represented as a combination of operating system type, version number, and architecture type, such as "Linux_Ubuntu_18.04_x64". Simultaneously, it obtains the actual platform fingerprint string of the target system from the asset characteristic information of the shared blackboard mechanism. This string is obtained by the perception agent during the information collection phase using operating system fingerprinting technology, and its format is consistent with the applicable platform identifier string for comparison; for example, the target system actually runs "Linux_Ubuntu_18.04_x86_64".
[0060] The knowledge expert agent calculates the Levinstein distance between the applicable platform identifier string and the actual platform fingerprint string. The Levinstein distance measures the minimum number of single-character edit operations required to transform one string into another. Edit operations include inserting, deleting, or replacing a character. The calculation process uses a dynamic programming algorithm. The knowledge expert agent constructs a two-dimensional matrix with the number of rows equal to the length of the applicable platform identifier string plus one, and the number of columns equal to the length of the actual platform fingerprint string plus one. Matrix elements represent the minimum edit distance between corresponding substrings. During initialization, the first row and first column are assigned row and column indices, respectively. Then, the matrix is filled row by row using a state transition equation. For matrix position (i, j), if the two strings have the same character at positions i-1 and j-1, the value at that position is equal to the value at the top-left position (i-1, j-1); otherwise, the minimum value of the three values at the left (i, j-1), top (i-1, j), and top-left (i-1, j-1) is added to 1. The bottom-right element of the matrix is the final Levinstein distance.
[0061] The knowledge expert agent obtains the first length of the applicable platform identifier string and the second length of the actual platform fingerprint string. The number of characters is directly obtained using a string length method; for example, the first length of "Linux_Ubuntu_18.04_x64" is 24, and the second length of "Linux_Ubuntu_18.04_x86_64" is 27. The knowledge expert agent compares the first and second lengths and takes the larger value as the normalization benchmark. For example, the maximum value is 27, and the Levinstein distance is 3. Dividing the Levinstein distance 3 by the maximum value 27 yields a difference ratio of approximately 0.111. This difference ratio reflects the relative degree of difference between the two platform identifier strings; a larger value indicates a higher degree of platform mismatch. The knowledge expert agent subtracts the difference ratio from 1 to determine the maturity of the exploit code. This calculation formula ensures that the maturity is 1 when the platform is a perfect match, and the greater the platform difference, the lower the maturity. In the above embodiment, the maturity of the exploit code is calculated as 1 minus 0.111, approximately equal to 0.889. This value indicates that although there are slight differences between the target platform architecture identifier and the exploit code declaration, the overall compatibility is still high, and the probability that the exploit code can run on the target system is approximately 88.9%. This maturity metric method based on string edit distance avoids the accuracy loss caused by simple Boolean matching and can identify partial compatibility between different versions of the same operating system series.
[0062] S104: Read asset characteristic information and vulnerability exploitation conditions from the shared blackboard mechanism, map the asset characteristic information to nodes, map attack behaviors that meet the vulnerability exploitation conditions to edges, and construct a global attack graph based on the nodes and edges.
[0063] In S104 above, the path planning agent reads asset characteristic information and vulnerability exploitation conditions from the shared blackboard mechanism. This aims to integrate system state data collected by the perception agent with attack feasibility analysis results generated by the knowledge expert agent. The reading operation employs a selective subscription mechanism; the path planning agent registers access requests to the asset characteristic information storage area and vulnerability information storage area with the shared blackboard mechanism, and retrieves all written data entries in the current blackboard in batches through the query interface. When reading asset characteristic information, the path planning agent parses fields such as asset identifier, IP address, operating system type, running service list, and open ports for each record. This information fully describes the attribute characteristics of each attack node in the target system. Simultaneously, when reading vulnerability exploitation conditions, the path planning agent obtains fields such as target asset identifier, vulnerability number, success probability value, precondition description, and post-attack effect associated with each vulnerability record. These entries clarify the possible attack transfer relationships between nodes and their constraints.
[0064] Furthermore, asset characteristic information is mapped to nodes, and attack behaviors that meet the vulnerability exploitation conditions are mapped to edges. A global attack graph is constructed based on the nodes and edges. Specifically, this includes: parsing the asset characteristic information to identify all independent network entities within the penetration test target range; creating corresponding graph nodes for each independent network entity and assigning the IP address, device type, and current permission status of the independent network entity as node attributes to the graph nodes; obtaining source nodes and target nodes from multiple graph nodes; judging the network connectivity from the source node to the target node based on network topology information, where the source node and target node are any two graph nodes from multiple graph nodes; if there is network connectivity from the source node to the target node, searching for vulnerability exploitation conditions targeting the target node in the shared blackboard mechanism; if there are vulnerability exploitation conditions targeting the target node in the shared blackboard mechanism, constructing a directed edge from the source node to the target node, where the directed edge represents a single-step attack behavior executed on the target node; obtaining the success probability value from the vulnerability exploitation conditions of the target node and using the success probability value as the weight attribute of the directed edge; and combining all generated graph nodes and directed edges to form a global attack graph.
[0065] Specifically, the path planning agent parses asset feature information to identify all independent network entities within the penetration test target area. The parsing process extracts records one by one from the asset feature information set read from the shared blackboard mechanism, analyzing the asset identifier field to determine whether different records describe the same physical or logical entity. The parsing engine checks the IP address field of each asset feature information; when the IP addresses are identical and the device fingerprint or operating system type is consistent, it is determined to be the same independent network entity, and only one graph node is created to avoid duplicate modeling. For devices with multiple network interfaces, the parsing engine determines the node's unique identifier based on the primary IP address or management IP address, recording other interface addresses as auxiliary attributes of the node. When asset feature information shows that a server has both an internal network address (192.168.1.10) and an external network address (203.0.113.50), the parsing engine uses the internal network address as the node identifier and stores the external network address in the node's network interface list attribute. Through this parsing mechanism, the path planning agent can accurately identify each independent attack target in the target environment, providing an accurate entity list for subsequent graph node creation.
[0066] The path planning agent creates corresponding graph nodes for each independent network entity, assigning the IP address, device type, and current permission status of the independent network entity as node attributes. Graph nodes are implemented using an object data structure. Each node object contains attribute fields such as node identifier, IP address, device type, operating system information, running service list, open port set, and current permission status. The node identifier uses a globally unique UUID generation mechanism to ensure no identifier conflicts occur in a distributed environment. The IP address attribute is directly copied from the corresponding field of the asset feature information. The device type attribute is mapped from the device fingerprint string extracted from the asset feature information, and possible values include type tags such as "server," "workstation," "IoT device," and "network device." The current permission status attribute records the access level that the test system has obtained on this node. Initially, the permission status of all nodes is set to "unauthorized." When the executing agent successfully exploits a vulnerability to gain permission, this attribute value is updated through feedback information from the shared blackboard mechanism, and possible values include "unauthorized," "ordinary user," and "administrator." Once a node object is created, it is added to the node set of the attack graph. This set is organized using a hash table data structure, with the node identifier as the key and the node object as the value, supporting fast lookup and update operations.
[0067] The path planning agent retrieves source and target nodes from multiple graph nodes for pairwise analysis, determining network connectivity from the source to the target node based on network topology information. This determination process simulates packet forwarding behavior in a real network environment, accurately identifying whether attack traffic originating from the source node can actually reach the target node by verifying constraints across multiple dimensions, including IP layer routing reachability, data link layer isolation strategies, and application layer port availability. This avoids including physically or logically unreachable attacks in the attack graph, preventing subsequent path planning failures. If network connectivity exists between the source and target nodes, the path planning agent searches the shared blackboard mechanism for exploit conditions targeting the target node. This search is performed by querying the vulnerability information storage area, with the query condition being a match between the target asset identifier field in the exploit condition record and the asset identifier associated with the target node. The query engine returns a set of all exploit condition records that meet the conditions, which may contain multiple different vulnerability entries targeting the same target node. For each vulnerability exploitation condition record, the path planning agent further verifies its precondition field. The precondition describes the attacker's state requirements for successfully exploiting the vulnerability, such as constraints like "requires an attack from a specific source IP" or "requires prior acquisition of ordinary user credentials from the target system." If the precondition is empty or matches the current state of the source node, the exploitation condition is deemed usable; otherwise, it is filtered out. The set of usable exploitation conditions obtained after filtering constitutes the list of vulnerabilities that can be actually executed by attacking the target node from the source node.
[0068] If exploitable vulnerabilities exist for the target node within the shared blackboard mechanism, the path planning agent constructs directed edges from the source node to the target node for each exploitable vulnerability. These directed edges are represented using an edge object data structure, with each edge object containing fields such as a source node reference, a target node reference, a vulnerability number, an attack behavior description, and a weight attribute. The source and target node references store the identifiers of the corresponding graph node objects, establishing the association between the edge and the node. The vulnerability number field records the specific vulnerability identifier used by the attack behavior, such as a CVE number, facilitating accurate invocation of the corresponding exploit module when generating the attack step sequence. The attack behavior description field describes the attack operation represented by the edge in natural language, such as "using an Apache directory traversal vulnerability to obtain file read permissions" or "extracting database credentials through an SQL injection vulnerability." This description information will be used for audit log recording and test report generation. The directionality of the directed edges explicitly expresses the causal relationship of the attack; that is, the attacker must first control the source node before launching the attack behavior against the target node. This characteristic ensures that the generated attack path conforms to the actual attack sequence constraints.
[0069] The path planning agent obtains the success probability value from the exploit conditions of the target node and uses this success probability value as the weight attribute of the directed edges. The success probability value is directly read from the corresponding field of the exploit condition object. This value is calculated by the knowledge expert agent in deep quantization mode and is a floating-point number between 0 and 1. The weight attribute assignment operation is completed by calling the attribute setting method of the edge object, storing the success probability value in the weight field of the edge object. This weight attribute plays a crucial role in the subsequent attack path planning stage. The path search algorithm evaluates the overall success probability of a path by comparing the product or negative logarithm sum of the edge weights on different paths, and prioritizes the path with a high success probability for execution. When the success probability value of an edge is 0.9, it means that the attack step has a 90% probability of successful execution under ideal conditions, while an edge with a success probability value of 0.3 means that the attack step has a high risk of failure and will be given lower priority in path planning or only used when there are no other alternative paths.
[0070] The path planning agent combines all generated graph nodes and directed edges to form a global attack graph. This attack graph is implemented using a hybrid storage structure of adjacency lists and adjacency matrices. The node set is organized in the form of a hash table for fast lookup, while the edge set is stored in the outgoing edge list attribute of each node object in the form of an adjacency list for easy traversal of successor nodes. Simultaneously, a sparse matrix-like global adjacency matrix is maintained to quickly determine whether a direct connection exists between any two nodes. The attack graph object also contains metadata attributes, recording information such as the graph construction timestamp, the total number of nodes, the total number of edges, and the current testing phase. The completed global attack graph is stored in the internal state of the path planning agent and incrementally updated each time the agent reports new execution results. Update operations include modifying the current permission status of nodes, adding newly discovered nodes and edges, and deleting edges that were proven unusable due to execution failure.
[0071] For example, taking a penetration test targeting the internal network of a financial institution as an example, the path planning agent reads four asset characteristic information from the shared blackboard mechanism, describing the external web server 203.0.113.10, the DMZ application server 172.20.10.30, the internal database server 192.168.1.20, and the internal file server 192.168.1.30, respectively. The parsing engine identifies four independent network entities and creates a graph node for each entity. The device type attribute of the web server node is "server," and its current permission status is "unauthorized." The initial permission status of the other nodes is also "unauthorized." The path planning agent uses the test starting point as the source node and the web server node as the target node to perform connectivity judgment. By verifying that the test starting point can directly access the external network address, network connectivity is determined. A directory traversal vulnerability (CVE-2021-41773) targeting the web server was discovered during a search of the vulnerability information storage area. This vulnerability has no preconditions and a success probability of 0.95. The path planning agent constructed a directed edge from the test starting point to the web server node, with an edge weight of 0.95. Further analysis was conducted with the web server node as the source node and the application server node as the target node. Network topology information showed that the DMZ was isolated from the external network, but the web server could access the DMZ through configured routing rules, indicating network connectivity. A Java deserialization vulnerability targeting the application server was found, requiring an attack to originate from a compromised web server with a success probability of 0.89. A directed edge was constructed from the web server node to the application server node. After a complete double-layer traversal, the attack graph contained 5 nodes and 8 directed edges. This graph clearly showed multiple potential attack paths from the external network test starting point, through the web server and application server, to the internal network database server, providing a complete search space for subsequent path planning algorithms. Figure 3 As shown.
[0072] Furthermore, the network connectivity from the source node to the target node is determined based on network topology information. Specifically, this includes: obtaining the source IP address of the source node and the target IP address of the target node, and extracting the open port list of the target node from the shared blackboard mechanism; determining whether the source IP address and the target IP address belong to the same logical subnet; if the source IP address and the target IP address belong to the same logical subnet, then determining whether a Layer 2 isolation policy exists in the network topology information; when no Layer 2 isolation policy exists in the network topology information, and the open port list contains the ports required for vulnerability exploitation, then it is determined that there is connectivity from the source node to the target node. Network connectivity; if the source IP address and the target IP address do not belong to the same logical subnet, obtain the gateway device connecting the source node and the target node, and obtain the routing table information and access control policy list of the gateway device; determine whether there is a forwarding path from the source node to the target node in the routing table information; if there is a forwarding path from the source node to the target node in the routing table information, use the source IP address, the target IP address, and the port required for vulnerability exploitation as the five-tuple matching condition, and perform rule matching between the five-tuple matching condition and the access control policy list; if the matching result is allowed, it is determined that there is network connectivity from the source node to the target node.
[0073] Specifically, the path planning agent obtains the source IP address of the source node and the target IP address of the target node, and extracts the list of open ports of the target node from the shared blackboard mechanism. The IP address acquisition operation is achieved by reading the IP address attribute field of the node object. This field is extracted and assigned a value from the asset characteristic information during the node creation phase, and is stored in standard IPv4 dotted decimal format or IPv6 colon-separated format. The source IP address of the source node represents the originating address of the attack traffic, and the target IP address of the target node represents the destination address of the attack traffic. These two addresses constitute the basic parameters for network connectivity judgment. The list of open ports is obtained by querying the asset characteristic information storage area of the shared blackboard mechanism. The query condition is a match between the asset identifier and the identifier associated with the target node. The returned asset characteristic information record contains a port scan result field, which stores all open TCP or UDP port numbers in the form of an integer array. For example, [22, 80, 443, 3306] indicates that the target node has opened SSH, HTTP, HTTPS, and MySQL service ports.
[0074] The path planning agent determines whether the source IP address and the destination IP address belong to the same logical subnet. This determination is achieved using a bitwise AND operation of the subnet mask. The agent reads the subnet mask configuration of the network segment to which the source and destination nodes belong from the network topology information, performs a bitwise AND operation between the source IP address and the subnet mask to obtain the source network address, and performs a bitwise AND operation between the destination IP address and the subnet mask to obtain the destination network address. The two network addresses are then compared to see if they are identical. When the source IP address is 192.168.1.10, the destination IP address is 192.168.1.20, and the subnet mask is 255.255.255.0, the calculated source network address is 192.168.1.0, and the destination network address is also 192.168.1.0, thus determining that they belong to the same logical subnet. This determination results in whether to use Layer 2 connectivity verification or Layer 3 routing verification in the subsequent processing branch.
[0075] If the source IP address and the target IP address belong to the same logical subnet, the path planning agent determines whether a Layer 2 isolation policy exists in the network topology information. This determination is achieved by querying the VLAN configuration and port isolation rules in the network topology information. The network topology information includes a list of switch devices, and each switch device object records its port-VLAN mapping relationship and port isolation configuration. The path planning agent looks up the corresponding VLAN number based on the access port identifiers of the source and target nodes. When the two nodes are in different VLANs and the switch is not configured with inter-VLAN routing, a Layer 2 isolation policy is determined to exist. The path planning agent also checks whether private VLANs or port protection functions are enabled; these functions isolate communication between ports within the same VLAN. When a Layer 2 isolation policy does not exist in the network topology information, and the open port list contains the port required for vulnerability exploitation, network connectivity between the source and target nodes is determined. The port required for vulnerability exploitation is extracted from the currently processed vulnerability exploitation condition object, which contains an exploit port field recording the target port number that needs to be accessed to trigger the vulnerability. For example, the exploit port for a web application vulnerability is 80. The path planning agent traverses the list of open ports, checking if an element exists that matches the port to be exploited. If it does, the port availability condition is met. When the source node 192.168.1.10 is directly connected to the target node 192.168.1.20 via a Layer 2 switch, both are in the same VLAN and have no port isolation, and the target node has port 80 open, and the current exploit requires access to port 80, the path planning agent comprehensively determines that there is network connectivity between the source node and the target node, allowing the construction of the corresponding directed edge.
[0076] If the source IP address and the destination IP address do not belong to the same logical subnet, the path planning agent obtains the gateway device connecting the source node and the destination node. This acquisition process is based on the router or Layer 3 switch device information in the network topology information. The network topology information organizes network devices and their connections in a graph structure, with each subnet node associated with a default gateway device identifier. The path planning agent extracts the default gateway device object from the topology information of the subnet to which the source node belongs. This object contains attributes such as device identifier, management IP address, routing table information, and access control policy list. When the source node is located in the 192.168.1.0 / 24 subnet and the destination node is located in the 172.20.10.0 / 24 subnet, the path planning agent obtains the gateway devices for both subnets. If they are different interfaces of the same physical device, the device is used directly. If they are different devices, an intermediate routing device connecting the two gateways needs to be searched in the network topology graph. Obtaining the routing table information and access control policy list of the gateway device is achieved by reading the corresponding attributes of the gateway device object. The routing table information is organized in the form of an array of routing entries. Each routing entry contains fields such as the destination network, subnet mask, next-hop address, and outgoing interface. The access control policy list is organized in the form of an array of firewall rules. Each rule contains elements such as the source address range, destination address range, protocol type, port range, and action type.
[0077] The path planning agent determines whether a forwarding path from the source node to the destination node exists in the routing table. This determination uses the longest prefix matching algorithm. The agent performs a bitwise AND operation between the destination IP address and the destination network of each routing entry in the routing table, finding the routing entry with the longest mask length that matches successfully. The next-hop address of this entry is the destination for the data packet. When a matching routing entry exists, the agent recursively checks the routing table of the next-hop device until the next-hop address is in the same subnet as the destination node or the maximum hop count limit is reached. If the entire path tracing process successfully reaches the destination subnet, a forwarding path from the source node to the destination node is determined to exist in the routing table. If the gateway device's routing table contains a routing entry for the destination network 172.20.10.0 / 24, the next hop points to the core router, and the core router's routing table contains directly connected routes to this network, a complete forwarding path is determined to exist.
[0078] If a forwarding path from the source node to the destination node exists in the routing table, the path planning agent uses the source IP address, destination IP address, and the port required for exploitation as five-tuple matching conditions. It then performs rule matching against the access control policy list. The five-tuple contains five elements: source IP address, destination IP address, protocol type, source port, and destination port. The protocol type and destination port are extracted from the exploitation condition object, and the source port is typically set as a wildcard to represent any port. The rule matching process verifies each rule in the access control policy list according to its priority. For each rule, the path planning agent checks whether each element of the five-tuple falls within the rule's defined range. The source IP address needs to match the rule's source address range field, which may be a single IP address, an IP address range, or a network address with a mask. The destination IP address needs to match the rule's destination address range field. The protocol type needs to be equal to the rule's protocol type field or the rule specifies any protocol. The destination port needs to fall within the rule's port range or the rule specifies any port. When all elements of a quintuple satisfy the matching condition of a rule, the action type field of that rule is checked. If the matching result is "allow," it is determined that there is network connectivity between the source node and the target node, and subsequent rule matching is terminated. If the matching result is "deny," it is determined that there is no network connectivity, and no directed edge is generated for that node pair. If no match is found after traversing all rules, the connectivity judgment result is determined according to the default action of the access control policy; firewalls typically use a default denial policy.
[0079] S105: Generate attack paths based on the global attack graph and convert the attack paths into a sequence of attack steps.
[0080] In step S105 above, the path planning agent identifies attack start-point nodes and target nodes from the global attack graph, determining the boundaries of the search space for subsequent path searching. Attack start-point nodes are selected from the set of nodes in the graph, with selection criteria including that the node's current permission status is not "unauthorized" or the node is identified as the initial location of the test system. These nodes represent network locations currently controlled or directly accessible by the attacker, constituting the source node set for path searching. Target node determination depends on test task configuration parameters. During the task deployment phase, the user inputs the target asset identifier or target network segment information through the control terminal. The path planning agent matches these inputs with the IP addresses or asset identifiers of the graph nodes to identify the set of destination nodes to be reached. When the test objective is "to obtain administrator privileges for the internal network database server," the path planning agent searches the graph for nodes with matching IP addresses and device types of database servers as target nodes. After clarifying the start and end points, the objective of the path search algorithm is concretized as finding a connected path from any node in the start-point set to any node in the target set within the directed graph.
[0081] The path planning agent employs either an improved Dijkstra's algorithm or an A algorithm to search for the optimal attack path in the attack graph. Algorithm selection is based on graph size and performance requirements. When the number of graph nodes is less than 100, the standard Dijkstra's algorithm is used to guarantee finding the global optimum. When the number of nodes exceeds 100, the A algorithm is used to accelerate the search process through heuristic functions. In the Dijkstra's algorithm implementation, the path planning agent maintains a priority queue to store nodes to be expanded. Each queue element contains a node reference, the cumulative cost from the starting point to that node, and a pointer to the predecessor node. During initialization, all starting nodes are added to the queue, the cumulative cost is set to 0, and the predecessor node is set to null. During algorithm iteration, the node with the minimum cumulative cost is selected from the queue as the current node. All directed edges originating from the current node are traversed. For each target node connected by an edge, the new cost to reach that target node through the current node is calculated. The new cost equals the cumulative cost of the current node plus the negative logarithm of the edge weight. The negative logarithm transformation is used to convert the product of success probabilities into logarithmic addition for easier comparison, while ensuring that higher probabilities correspond to lower costs, which aligns with the optimization objective. If the new cost is less than the original accumulated cost of the target node, then update the accumulated cost and predecessor node pointer of the target node, and add the target node back to the priority queue. When the node popped from the queue is a node in the target node set, the algorithm terminates and constructs the complete path by backtracking the predecessor node pointer.
[0082] The path planning agent reconstructs the complete attack path from the starting point to the target node by backtracking the predecessor node pointer sequence. The backtracking process begins with the target node found when the algorithm terminates. It reads the predecessor node pointer of this target node to obtain the second-to-last node on the path, continues reading the predecessor pointer of the second-to-last node to obtain the third-to-last node, and repeats this process until it reaches the starting node where the predecessor pointer is null. The resulting node sequence is arranged in reverse chronological order. The path planning agent reverses this sequence to obtain the forward node sequence from the starting point to the target. This node sequence forms the skeleton structure of the attack path, with each adjacent node pair implicitly containing a directed edge representing an attack action. The path planning agent traverses the adjacent node pairs in the node sequence, searches for the directed edge object connecting the node pair from the edge set of the attack graph, extracts information such as the vulnerability number, attack action description, and weight attribute of the edge object, and combines this information with the node sequence to form a complete attack path data structure. The attack path data structure is organized in the form of an ordered list. The list elements are path step objects. Each step object contains fields such as source node identifier, target node identifier, vulnerability number used, attack behavior description, and expected success probability. This structured representation not only preserves the graph topology of the path, but also facilitates its subsequent conversion into a linear execution sequence.
[0083] The path planning agent converts the attack path into a sequence of attack steps to suit the execution agent's calling interface. The conversion process iterates through each step object in the attack path data structure, generating an execution instruction for each step. The execution instructions use a structured command format, including fields such as instruction type, target address, vulnerability identifier, exploit parameters, and timeout settings. The instruction type field is determined by querying the vulnerability knowledge base for the corresponding exploit module type based on the vulnerability number in the step object; possible values include categories such as "remote code execution," "privilege escalation," and "credential theft." The target address field is extracted from the IP address attribute associated with the target node identifier of the step object. The exploit parameters field contains specific configuration parameters required for vulnerability exploitation, such as the target port number, payload type, and callback address. These parameters are read from the vulnerability exploitation condition object or dynamically generated based on the current test environment. The timeout setting field is configured according to the expected execution time of the attack, typically set to 2 to 3 times the average execution time of the exploit code to avoid false positives due to network latency or slow target system response. The generated execution instructions are organized into a linear array according to the chronological order of the steps in the attack path, forming the attack step sequence. The sequence is written to the task queue storage area of the shared blackboard mechanism. The executing agent obtains the sequence of steps to be executed through polling or subscription and executes them in sequence.
[0084] The path planning agent calculates the overall success probability and performs a feasibility assessment while generating the attack step sequence. The overall success probability is obtained by multiplying the expected success probabilities of all steps in the path; this value reflects the theoretical probability of successfully executing all steps of the path. When the path contains 5 steps with success probabilities of 0.95, 0.89, 0.88, 0.82, and 0.79 respectively, the overall success probability is calculated as the product of these five values, approximately 0.48, indicating that the probability of successfully executing the path is approximately 48%. The path planning agent compares the overall success probability with a preset feasibility threshold, which is read from the test strategy parameters and typically ranges from 0.3 to 0.5. If the overall success probability is lower than the feasibility threshold, the path planning agent marks the path as a low-feasibility path. If other alternative paths exist, it prioritizes the alternative with the higher success probability; if no other alternative paths exist, it still outputs the path but adds risk warning information to the step sequence for the tester's decision.
[0085] Furthermore, the path planning agent supports generating multiple alternative attack paths to address the failure of the main path. Alternative path generation is achieved by incorporating the k-shortest path algorithm into the graph search algorithm. This algorithm, after finding the first optimal path, continues searching for suboptimal paths until k distinct paths are generated or the search space is exhausted. The generated alternative paths are sorted in descending order of overall success probability. The path planning agent assigns a priority number to each path, with priority 1 representing the optimal path, priority 2 representing the suboptimal alternative, and so on. The attack step sequences corresponding to all paths are simultaneously written to a shared blackboard mechanism, but only the priority 1 step sequence is marked as active for immediate execution by the executing agent; the remaining alternative sequences are marked as standby. When the executing agent reports a failure in a step of the main path, the path planning agent activates a priority 2 alternative sequence, and the executing agent automatically switches to the alternative to continue testing. This mechanism significantly improves the robustness and continuity of the testing process.
[0086] S106: Perform attack operations on the target system according to the attack step sequence, and feed back the execution results to the shared blackboard mechanism.
[0087] In S106 above, the executing agent reads the attack step sequence marked as active from the task queue storage area of the shared blackboard mechanism. The read operation is implemented through a query interface, with the query conditions being that the status identifier field of the step sequence equals "active" and the execution status field equals "pending execution". The shared blackboard mechanism returns a step sequence object that meets the conditions, which contains multiple execution instructions arranged in sequence. The executing agent loads the step sequence into the local task buffer and initializes the execution context object to record temporary data and status information during execution. The execution context object contains fields such as the current step index, acquired access credentials, established network connection handles, and intermediate result caches, which may be referenced or reused in subsequent step executions.
[0088] The execution agent processes each instruction sequentially according to the order of instructions in the step sequence. For the currently pending instruction, the execution agent parses each field of the instruction object to determine the specific execution method. The instruction type field determines the type of exploit module to be invoked. The execution agent maintains a module registry, which maps instruction type enumeration values to the corresponding module loading path or interface call address. When the instruction type is "Remote Code Execution," the execution agent loads the RCE exploit module, which encapsulates the general exploit logic for common remote code execution vulnerabilities. The target address field is extracted from the instruction object. The execution agent verifies the validity of the address format and parses it into a standard combination of IP address and port number. The exploit parameter field contains detailed configurations required for module execution. The execution agent parses the parameter string into a set of key-value pairs. Common parameters include target port, payload content, callback address, encoding method, etc. Based on the vulnerability identifier field, the execution agent queries the vulnerability knowledge base for detailed exploit code or command templates for calling external tools. It then performs variable substitution and parameter binding with the retrieved exploit code and parsed parameters to generate a complete, executable exploit script or tool call command.
[0089] The execution agent monitors the vulnerability by exploiting the script's execution results and performing status checks. These checks are based on the script's exit code, keyword matching in standard output, and verification of the target system's response characteristics. If the script's exit code is 0 and the standard output contains success indicators such as "exploit successful" or "shell obtained," the execution agent initially determines that the step was successful. If the script's exit code is non-zero or the standard output contains failure indicators such as "connection refused" or "authentication failed," the execution agent determines that the step failed and extracts the failure reason description from the error stream. If the script execution time exceeds the timeout setting without returning a result, the execution agent forcibly terminates the container process and determines that the step execution timed out.
[0090] The executing agent encapsulates the execution results into structured feedback objects and writes them to the shared blackboard mechanism. The feedback object includes fields such as step identifier, execution status, timestamp, detailed result description, and newly acquired asset information. The step identifier is a unique identifier associated with the original execution instruction, facilitating the path planning agent and auditing agent to trace the source of feedback. The execution status field uses enumerated values, with possible values including "success," "failure," "timeout," and "abnormal," providing a clear status signal for the path planning agent's decision-making. The timestamp field records the precise moment the step execution was completed, used for performance analysis and time-series correlation. The detailed result description field records the complete output of the script, the results of secondary verification, and the basis for the executing agent's judgment in text form, providing detailed information for manual review and problem investigation. The newly acquired asset information field records new resources discovered after successful step execution, such as administrator credentials obtained through privilege escalation, configuration file paths discovered through file reading, and new hosts discovered through intranet scanning. This information is added to the asset feature information storage area of the shared blackboard mechanism as an incremental update of the environment awareness. After completing the entire step sequence, the executing agent generates a sequence-level execution summary and writes it to the shared blackboard mechanism. The execution summary includes statistical information such as sequence identifier, total number of steps, number of successful steps, number of failed steps, total execution time, and final achievement status. The final achievement status field indicates whether the sequence execution achieved the test objective. This field is set to "Objective Achieved" when all steps were executed successfully and the target node of the last step matches the path planning objective. The execution summary also includes key milestone records, marking strategically significant steps in the sequence, such as the time points and related steps of events like the first breach of a firewall boundary, the first acquisition of internal network access, and the first access to core data assets. This summary information provides a structured data source for the audit and reporting agent to generate penetration test reports.
[0091] S107: When the execution result is a failure, the global attack graph is updated based on the feedback failure result, and a new attack step sequence is re-planned and generated.
[0092] In S107 above, when the execution result is a failure, the global attack graph is updated based on the feedback failure result, and a new attack step sequence is re-planned and generated. Specifically, this includes: reading the failure status information from the execution result and determining the cause of failure based on the failure status information; locating the target directed edge that generated the execution result in the global attack graph and marking the state attribute of the target directed edge as blocked to obtain the updated global attack graph; generating a new attack step sequence based on the updated global attack graph, until the new attack step sequence reaches the termination condition, stopping path planning and generating a test report of attack failure.
[0093] Specifically, the path planning agent listens for feedback objects written by the executing agent in the shared blackboard mechanism through a subscription mechanism. The subscription configuration specifies that it should focus on feedback events with the execution status field set to "failure." When a new feedback object matching the condition is added to the shared blackboard mechanism, the subscription module immediately triggers a callback function to notify the path planning agent. The path planning agent reads the step identifier field from the feedback object. This identifier uniquely corresponds to a specific instruction in the currently executed attack step sequence, allowing for precise location of the specific step in the sequence where the failure occurred. The path planning agent further reads the detailed result description field of the feedback object. This field contains complete failure information recorded by the executing agent, which may include descriptive text such as "Target port 3306 unreachable," "Authentication failed, invalid credentials," "Exploit code execution timed out and did not return a shell," or "Target system has installed security patches, vulnerability does not exist." The path planning agent performs text parsing and pattern matching on the detailed result description, identifying key failure features and establishing a structured representation of the failure reasons.
[0094] The path planning agent determines the type of failure reason based on failure feature words. The failure reason classification adopts a predefined category system, including types such as network unreachable, service not open, authentication failure, vulnerability not existing, insufficient permissions, and timeout exception. When the detailed result description contains keywords such as "connection refused" or "no route to host," the failure reason type is determined to be network unreachable. When the description contains "authentication failed" or "invalidcredentials," the failure reason type is determined to be authentication failure. When the description contains "patched" or "notvulnerable," the failure reason type is determined to be vulnerability not existing. Different failure reason types correspond to different graph update strategies. Network unreachable indicates that the target node is currently inaccessible, requiring the entire node to be marked as unreachable. Authentication failure indicates that the preconditions of the attack edge are not met, requiring the edge to be marked as conditionally failed. Vulnerability not existing indicates that the vulnerability information relied upon by the attack edge is incorrect, requiring the edge to be marked as permanently blocked. The path planning agent selects the corresponding update strategy based on the failure reason type and extracts the target node and directed edge information associated with the failure.
[0095] The path planning agent locates the target directed edge that produces the execution result in the global attack graph. The location process involves searching the edge set of the graph using the source node identifier and target node identifier of the failed step. The attack graph uses an adjacency list or adjacency matrix storage structure, and the edge object contains fields such as source node reference, target node reference, vulnerability identifier, attack behavior description, and state attributes. The path planning agent traverses all directed edges originating from the source node, matching edge objects whose target node identifier and vulnerability identifier match those of the failed step; these edge objects are the target directed edges. When the failed step is an attack on application server node 172.20.10.30 from web server node 203.0.113.10 using a Java deserialization vulnerability, the path planning agent searches the graph for a directed edge with source node 203.0.113.10, target node 172.20.10.30, and vulnerability identifier "Java-Deserialization". After locating the target directed edge, the path planning agent reads the current state attribute value of the edge. The state attribute is represented by an enumeration type, with the initial value being "available". Other possible values include state flags such as "blocked", "condition failed", and "temporarily unreachable".
[0096] The path planning agent updates the state attributes of the target directed edges based on the failure reason type. When the failure reason is "network unreachable" or "vulnerability does not exist," the state attribute is updated to "blocked," indicating that the attack path cannot be implemented in the current test environment, and subsequent path search algorithms should completely exclude this edge. When the failure reason is "authentication failure" or "insufficient permissions," the state attribute is updated to "condition failure," indicating that the attack path is theoretically feasible but currently lacks the necessary preconditions. If subsequent steps can obtain the required credentials or permissions, this edge may still be reactivated. When the failure reason is "timeout exception," the state attribute is updated to "temporarily unreachable," indicating that the target system may be overloaded or under maintenance. This edge is not considered in the current planning cycle but is not permanently excluded. The path planning agent persists the state attribute update operations to the attack graph's storage structure and marks the updated graph as the new version, incrementing the version number to trace the graph's evolution history. The update operation also triggers a recalculation of the graph's validity. The path planning agent counts the number of edges with the state attribute "available" in the graph. If the number of available edges drops to less than 20% of the initial number, the system determines that the test environment may have extensive protection measures or configuration anomalies, and generates a high-priority environment anomaly alarm.
[0097] The path planning agent re-executes the path search algorithm based on the updated global attack graph to generate a new sequence of attack steps. The re-search process reuses the Dijkstra's algorithm or A* algorithm framework, but adds state attribute filtering conditions during the edge traversal phase. When expanding the neighbor nodes of the current node, the algorithm only considers directed edges with the state attribute "available," skipping edges with the state attributes "blocked" or "temporarily unreachable," ensuring that the new path does not contain confirmed failed attack steps. For edges with the state attribute "condition failed," the path planning agent checks whether the execution context has obtained the preconditions required by the edge. For example, if the edge requires administrator credentials, the path planning agent queries the newly acquired asset information uploaded by the executing agent in the shared blackboard mechanism. If it contains administrator credentials, the edge is temporarily activated and included in the search scope; otherwise, the edge is skipped. The re-searched path will inevitably differ in topology from the previously failed path, possibly by bypassing failed nodes and choosing other intermediate steps, or by using different exploit methods to reach the same target node. The path planning agent converts the new path into a sequence of attack steps and writes it into the shared blackboard mechanism. The execution agent automatically reads the new sequence and begins execution.
[0098] Furthermore, the path planning agent determines whether to continue the test or abandon it during the replanning process based on whether the termination conditions are met. Termination conditions include multiple criteria, such as the maximum number of replanning attempts, exhaustion of available paths, and exceeding test time limits. Path planning stops and a test report of attack failure is generated until a new attack sequence reaches the termination conditions. Specifically, this includes: parsing the attribute information of the penetration test target scope to determine the business sensitivity level and time constraint level of the current penetration test task; matching the target termination policy mode from a pre-set policy library based on the business sensitivity level and time constraint level. The target termination policy mode includes a global timeout threshold, a maximum retry threshold, and a priority sequence of path search results; obtaining the cumulative execution time of the current penetration test task, the number of replanning attempts, and the path search results based on the updated global attack graph; and setting the maximum retry threshold to a security-first mode if the target termination policy mode is security-priority mode. The first priority is set as the global timeout threshold, the second priority as the global timeout threshold, and the third priority as the path search result. If the target termination policy mode is time-priority mode, the global timeout threshold is set as the first priority, the maximum retry threshold is set as the second priority, and the path search result is set as the third priority. If the target termination policy mode is deep coverage mode, the path search result is set as the first priority, the global timeout threshold is set as the second priority, and the maximum retry threshold is set as the third priority. When any termination condition in the priority sequence is triggered, path planning stops, and the specific type of the termination condition is written as the failure reason into the shared blackboard mechanism to generate an attack failure test report.
[0099] Specifically, the path planning agent reads the penetration testing target scope object from the task configuration storage area of the shared blackboard mechanism. This object contains metadata information and constraint parameters for the test task. The metadata information includes a business sensitivity level field and a time constraint level field. These two fields are set by the user or the task scheduling system based on the characteristics of the target system during the task release phase. The business sensitivity level field is represented by an enumeration value, with possible values including four levels: "core production system," "important business system," "general business system," and "test environment system." This field reflects the business importance and test fault tolerance of the target system. The time constraint level field is also represented by an enumeration value, including three levels: "urgent task," "regular task," and "long-term task." This field reflects the timeliness requirements and available time window of the test task. The path planning agent parses the values of these two fields, mapping the business sensitivity level to a security risk weight coefficient. A weight coefficient of 1.0 for the core production system indicates the highest risk, while a weight coefficient of 0.3 for the test environment system indicates a lower risk. The time constraint level is mapped to a time pressure coefficient. An urgent task has a coefficient of 2.0, indicating that it needs to be completed quickly, while a long-term task has a coefficient of 0.5, indicating that it can be fully explored.
[0100] The path planning agent matches a target termination policy pattern from a pre-defined policy library based on a combination of business sensitivity level and time constraint level. The pre-defined policy library is stored using a decision matrix data structure. When the business sensitivity level is a core production system and the time constraint level is an urgent task, the decision matrix returns a security-first mode. This mode emphasizes avoiding excessive interference with the production system and quickly terminating the test after an attack path is blocked. When the business sensitivity level is a general business system and the time constraint level is an urgent task, the decision matrix returns a time-priority mode. This mode emphasizes completing the test and outputting conclusions within a limited time, allowing for moderate retries but strictly controlling the total duration. When the business sensitivity level is a test environment system and the time constraint level is a long-term task, the decision matrix returns a deep coverage mode. This mode emphasizes exhausting all possible attack paths to discover potential security vulnerabilities, allowing for longer test times and more retries. The path planning agent reads the target termination policy pattern object based on the matching result. This object contains three core configuration parameters: a global timeout threshold, a maximum retry threshold, and a decision priority sequence. The global timeout threshold in the target termination strategy mode object defines the maximum allowed runtime of the entire penetration testing task, expressed in seconds. The global timeout threshold is typically set to 3400 seconds (1 hour) for security-first mode, 1800 seconds (30 minutes) for time-priority mode, and 28800 seconds (8 hours) for deep coverage mode. The maximum retry threshold defines the upper limit on the number of different attack paths allowed to be attempted for the same target node. The maximum retry threshold is set to 3 times for security-first mode, 5 times for time-priority mode, and 15 times for deep coverage mode. The priority sequence is an ordered array where each element is an enumeration of termination condition types, including "global timeout," "maximum retry," and "path exhaustion." The array's order determines which condition is used as the primary termination reason when multiple termination conditions are met simultaneously.
[0101] The path planning agent acquires real-time execution status data of the current penetration testing task for termination condition determination. The cumulative execution time is calculated by recording the difference between the task start timestamp and the current timestamp. The task start timestamp is written to the task state storage area of the shared blackboard mechanism during the test initialization phase. The path planning agent reads the start timestamp from this storage area and compares it with the current system time, calculating the duration in seconds. The number of replanning attempts is maintained using a local counter, set to 0 during task initialization and incremented by 1 whenever the agent reports a failure triggering a replanning process. The path search result reflects the return status of the path search algorithm on the updated global attack graph. When the search algorithm successfully finds a connected path from the starting point to the target node, the path search result is "Available Path". When the search algorithm has traversed all reachable nodes without finding a connected path, the path search result is "Path Exhausted". The path planning agent organizes these three status data into an execution state snapshot object, which serves as the input parameter for the termination condition determination function.
[0102] The path planning agent sets the priority sequence based on the target termination policy mode. When the target termination policy mode is security-first, the priority sequence is configured with the maximum retry threshold as the first priority, the global timeout threshold as the second priority, and the path search result as the third priority. The logic behind this priority configuration is that in security-first mode, repeated attack attempts on the target system should be minimized. When the number of replanning attempts reaches the maximum retry threshold, the test is immediately terminated, even if the time limit has not been reached, to avoid frequent attacks triggering the target system's intrusion detection system or causing service performance degradation. When the target termination policy mode is time-priority, the priority sequence is configured with the global timeout threshold as the first priority, the maximum retry threshold as the second priority, and the path search result as the third priority. This configuration emphasizes completing the test within the specified time. When the cumulative execution time reaches the global timeout threshold, the test is immediately terminated and the obtained partial results are output, even if the maximum number of retries has not been reached or there are still unexplored paths, ensuring that the test task does not exceed the time budget and affect subsequent work arrangements. When the target termination strategy mode is deep coverage mode, the priority sequence is configured as follows: path search results as the first priority, global timeout threshold as the second priority, and maximum retry threshold as the third priority. This configuration prioritizes the completeness of path exploration, and termination is only triggered when all possible paths in the attack graph have failed, i.e., the path search results are "path exhausted". If the path is not exhausted, exploration continues even if the execution time is long or the number of retries is high, maximizing the coverage of the test.
[0103] The path planning agent executes termination condition determination logic after each replanning process. This logic checks each termination condition sequentially according to its priority sequence. The determination process starts with the first element of the priority sequence, reads the termination condition type corresponding to that element, and calls the appropriate determination function based on the type. When the termination condition type is maximum retries, the determination function compares the number of replanning operations performed in the execution state snapshot object with the maximum retry threshold in the target termination policy pattern object. If the number of replanning operations performed is greater than or equal to the maximum retry threshold, the determination function returns a true value, indicating that the condition is met. During the traversal of the priority sequence, once a determination function returns a true value, the path planning agent immediately stops subsequent determinations and records the termination reason triggered by that termination condition type, ceasing further path planning. When a termination condition is detected, the path planning agent stops path planning and generates a failure reason record. The stopping operation includes a series of cleanup actions such as canceling the currently executing path search algorithm, clearing the pending attack step sequence in the task queue, and sending a stop command to the executing agent. The path planning agent constructs a failure reason object, which includes fields such as termination condition type, trigger timestamp, execution status snapshot, and decision basis description. The termination condition type field is populated with an enumeration of specific trigger judgment types, such as "maximum retries," "global timeout," or "path exhaustion." The trigger timestamp records the precise moment the judgment logic was executed, used to calculate the total test duration with the task start timestamp. The execution status snapshot field embeds data such as the cumulative execution duration at the termination judgment time, the number of replanning attempts, and path search results, providing contextual information for audit analysis. The decision basis description field automatically generates descriptive text based on the termination condition type; for example, when the termination condition type is maximum retries, it describes it as "Three different attack paths have been tried without success, reaching the maximum retry limit in security priority mode." The path planning agent writes the failure reason object to the test result storage area of the shared blackboard mechanism and sets the test status field to "Terminated - Failed."
[0104] The audit and reporting agent subscribes to change events in the test status field of the shared blackboard mechanism. When a test status update to "Terminated - Failed" is detected, the test report generation process is automatically triggered. The audit and reporting agent reads the failure reason object from the test result storage area and summarizes the historical execution records throughout the entire test process, including details of all attempted attack paths, the execution result of each path, the characteristics of the protection measures encountered, the security boundaries successfully breached, and the test objectives that were ultimately not achieved. The audit and reporting agent selects the corresponding report template based on the termination condition type. The report template in the security-first mode emphasizes the control effect of rapid termination on business operations, the report template in the time-first mode highlights the test coverage within a limited time, and the report template in the deep coverage mode lists in detail all explored attack vectors and protection verification results. The report content includes structured sections such as a test summary, target system protection capability assessment, potential risk points discovered, protection measures that were not breached, and security hardening recommendations. The generated test report is output in PDF or HTML format and stored in the specified report archive path, and relevant security personnel are notified via email or push notification.
[0105] S108: When the execution result is successful, generate a penetration test report targeting the penetration test objective based on the success result, and display the penetration test report to the user.
[0106] In S108 above, the audit and reporting agent subscribes to change events in the test status field of the shared blackboard mechanism. When a test status update to "Completed - Successful" is detected, the report generation process is automatically triggered. The audit and reporting agent reads a successful result object from the test result storage area of the shared blackboard mechanism. This object contains the complete sequence of the final successful attack path, the execution log of each attack step, the vulnerability identifier successfully exploited, and a list of breached security boundaries. The audit and reporting agent maps the successful attack path back to the set of nodes and edges in the global attack graph, extracting the host information corresponding to each node and the attack technology details corresponding to each edge. The audit and reporting agent generates a penetration test report based on a pre-set report template. The report includes an execution summary section that summarizes the test objectives and key nodes of the successful path; a vulnerability details section that lists the CVE number, CVSS score, and attack vector description of each exploited vulnerability; an attack path visualization section that renders the successful path in the attack graph as a flowchart; and a protection recommendation section that proposes corresponding remediation measures and configuration hardening schemes for each breach. The audit and reporting agent generates reports and stores them in PDF format to a specified archive path. At the same time, it renders an HTML version of the report in the report display module of the user interface. Users can view the detailed steps of the attack path through interactive charts and download the complete report document.
[0107] This application also provides an automated penetration testing path planning system based on agent collaboration. The system is located on a penetration testing platform, which includes multiple functional agents. These agents interact with each other via a shared blackboard mechanism. The system also includes an acquisition unit, a processing unit, a planning unit, and a result processing unit. The acquisition unit receives the penetration testing target range input by the user and initializes and starts up multiple functional agents; The processing unit collects information about the target system based on the penetration test target scope, and writes the collected asset feature information into the shared blackboard mechanism; it obtains the test strategy mode of the current penetration test task, matches the asset feature information with the pre-set vulnerability knowledge base according to the test strategy mode, generates vulnerability exploitation conditions based on the matching results, and writes the vulnerability exploitation conditions into the shared blackboard mechanism; it reads the asset feature information and vulnerability exploitation conditions from the shared blackboard mechanism, maps the asset feature information to nodes, maps the attack behaviors that meet the vulnerability exploitation conditions to edges, and constructs a global attack graph based on the nodes and edges; The planning unit generates attack paths based on the global attack graph, converts the attack paths into a sequence of attack steps, executes attack operations on the target system according to the sequence of attack steps, and feeds back the execution results to the shared blackboard mechanism. The result processing unit updates the global attack graph and re-plans and generates a new attack step sequence when the execution result is a failure; when the execution result is a success, it generates a penetration test report targeting the penetration test scope and displays the penetration test report to the user.
[0108] In one possible implementation, the processing unit is used to monitor the shared blackboard mechanism in real time and obtain asset characteristic information; compare the asset characteristic information with known vulnerability characteristics in a pre-set vulnerability knowledge base; when the comparison is successful, retrieve the corresponding vulnerability number, vulnerability type and vulnerability applicable environment from the pre-set vulnerability knowledge base; generate structured vulnerability exploitation conditions based on the vulnerability applicable environment, and write the vulnerability exploitation conditions into the shared blackboard mechanism.
[0109] In one possible implementation, the acquisition unit is used to acquire network topology information and access control policy information of the target system from the shared blackboard mechanism, wherein the network topology information and access control policy information are included in the asset feature information; the processing unit is used to compare the asset feature information with a pre-set vulnerability knowledge base to obtain a preliminary candidate vulnerability set; based on the network topology information and access control policy information, perform network reachability analysis on the preliminary candidate vulnerability set, eliminate vulnerabilities that are unreachable in the current network environment, and obtain a valid vulnerability set; extract the exploitability sub-score and vulnerability exploitation code maturity of the target valid vulnerability from the pre-set vulnerability knowledge base, wherein the target valid vulnerability is any vulnerability in the valid vulnerability set; perform a weighted summation of the exploitability sub-score and vulnerability exploitation code maturity to obtain the success probability value of the target valid vulnerability; generate vulnerability exploitation conditions for the success probability value, and write the vulnerability exploitation conditions corresponding to all valid vulnerabilities in the valid vulnerability set into the shared blackboard mechanism.
[0110] In one possible implementation, the processing unit is used to extract the attack path length, attack complexity, and permission dependency of the target valid vulnerability; perform reverse normalization on the attack path length, attack complexity, and permission dependency to obtain the path reachability coefficient, complexity breakthrough coefficient, and permission acquisition coefficient; calculate the sum of the reciprocals of the path reachability coefficient, complexity breakthrough coefficient, and permission acquisition coefficient, and divide the total number by the sum of the reciprocals to obtain the harmonic mean value, which is used as the exploitability sub-score, and the total number is the number of coefficients after reverse normalization; extract the applicable platform identifier string declared in the exploit code header of the target valid vulnerability; the acquisition unit is used to acquire the actual platform fingerprint string of the target system; the processing unit is used to calculate the Lewinstein distance between the applicable platform identifier string and the actual platform fingerprint string, where the Lewinstein distance is the minimum number of single-character editing operations required to convert one string to another; acquire the first length of the applicable platform identifier string and the second length of the actual platform fingerprint string, divide the Lewinstein distance by the maximum of the first length and the second length to obtain the difference ratio; and subtract the difference ratio from 1 to determine the vulnerability exploit code maturity.
[0111] In one possible implementation, the processing unit is used to parse asset characteristic information, identify all independent network entities within the target scope of the penetration test, create corresponding graph nodes for each independent network entity, and assign the IP address, device type, and current permission status of the independent network entity as node attributes to the graph node; the acquisition unit is used to acquire source nodes and target nodes from multiple graph nodes, and judge the network connectivity from the source node to the target node based on the network topology information, where the source node and target node are any two graph nodes from multiple graph nodes; if there is network connectivity from the source node to the target node, the processing unit is used to search whether there are vulnerability exploitation conditions for the target node in the shared blackboard mechanism; if there are vulnerability exploitation conditions for the target node in the shared blackboard mechanism, a directed edge from the source node to the target node is constructed, where the directed edge represents a single-step attack behavior executed on the target node; the success probability value is obtained from the vulnerability exploitation conditions of the target node, and the success probability value is used as the weight attribute of the directed edge; all generated graph nodes and directed edges are combined to form a global attack graph.
[0112] In one possible implementation, the acquisition unit is used to acquire the source IP address of the source node and the target IP address of the target node, and extract the open port list of the target node from the shared blackboard mechanism; the processing unit is used to determine whether the source IP address and the target IP address belong to the same logical subnet; if the source IP address and the target IP address belong to the same logical subnet, then it is determined whether there is a Layer 2 isolation policy in the network topology information; when there is no Layer 2 isolation policy in the network topology information, and the open port list contains the ports required for vulnerability exploitation, then it is determined that there is network connectivity between the source node and the target node; if the source IP address and the target IP address do not belong to the same logical subnet, then the gateway device connecting the source node and the target node is acquired, and the routing table information and access control policy list of the gateway device are acquired; it is determined whether there is a forwarding path from the source node to the target node in the routing table information; if there is a forwarding path from the source node to the target node in the routing table information, then the source IP address, the target IP address, and the ports required for vulnerability exploitation are used as five-tuple matching conditions, and the five-tuple matching conditions are matched with the access control policy list; if the matching result is allowed, then it is determined that there is network connectivity between the source node and the target node.
[0113] In one possible implementation, the result processing unit is used to read failure status information from the execution result, determine the cause of failure based on the failure status information, locate the target directed edge that generated the execution result in the global attack graph, mark the state attribute of the target directed edge as blocked, so as to obtain an updated global attack graph, generate a new attack step sequence based on the updated global attack graph, until the new attack step sequence reaches the termination condition, stop path planning and generate a test report of attack failure.
[0114] It should be noted that the system provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0115] This application also discloses an electronic device. (See reference...) Figure 4 , Figure 4 This application provides a schematic diagram of the structure of an electronic device. The electronic device 400 may include: at least one processor 401, at least one network interface 404, a user interface 403, a memory 402, and at least one communication bus 405.
[0116] The communication bus 405 is used to enable communication between these components.
[0117] The user interface 403 may include a display screen and a camera. Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.
[0118] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0119] The processor 401 may include one or more processing cores. The processor 401 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 402, and by calling data stored in memory 402. Optionally, the processor 401 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 401 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and application requests; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 401 and may be implemented as a separate chip.
[0120] The memory 402 may include random access memory (RAM) or read-only memory. Optionally, the memory 402 may include a non-transitory computer-readable storage medium. The memory 402 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 402 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described above, etc. The data storage area may store data involved in the various method embodiments described above. Optionally, the memory 402 may also be at least one storage device located remotely from the aforementioned processor 401.
[0121] like Figure 4 As shown, the memory 402, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for automated penetration testing path planning based on intelligent agent collaboration.
[0122] exist Figure 4In the electronic device 400 shown, the user interface 403 is mainly used to provide an input interface for the user and obtain the user input data; while the processor 401 can be used to call the application program stored in the memory 402 that is based on intelligent agent collaboration for automated penetration testing path planning. When executed by one or more processors, the electronic device performs one or more of the methods described in the above embodiments.
[0123] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0124] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0125] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some service interfaces; indirect couplings or communication connections between devices or units may be electrical or other forms.
[0126] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0127] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0128] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.
[0129] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of other embodiments of this disclosure upon considering the specification and the disclosure of practical truths. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure.
Claims
1. An automated penetration testing path planning method based on agent collaboration, characterized in that, Applied to a penetration testing platform, the penetration testing platform includes multiple agents, and the multiple agents interact with each other through a shared blackboard mechanism. The method includes: Receive the penetration test target range input by the user, and initialize and start multiple functional agents; Information is collected from the target system based on the penetration test target scope, and the collected asset characteristic information is written into the shared blackboard mechanism; Obtain the test strategy mode of the current penetration test task, match the asset feature information with the pre-set vulnerability knowledge base according to the test strategy mode, generate vulnerability exploitation conditions according to the matching results, and write the vulnerability exploitation conditions into the shared blackboard mechanism; The asset feature information and the vulnerability exploitation conditions are read from the shared blackboard mechanism, the asset feature information is mapped to nodes, and the attack behaviors that meet the vulnerability exploitation conditions are mapped to edges. A global attack graph is constructed based on the nodes and edges. An attack path is generated based on the global attack graph, and the attack path is converted into a sequence of attack steps. The attack operation is performed on the target system according to the attack step sequence, and the execution result is fed back to the shared blackboard mechanism; When the execution result is a failure, the global attack graph is updated based on the feedback failure result, and a new attack step sequence is re-planned and generated. When the execution result is successful, a penetration test report is generated based on the success result for the penetration test target scope, and the penetration test report is displayed to the user.
2. The method according to claim 1, characterized in that, The testing strategy mode includes a rapid association mode, which matches the asset feature information with a pre-built vulnerability knowledge base according to the testing strategy mode, generates vulnerability exploitation conditions based on the matching results, and writes the vulnerability exploitation conditions into the shared blackboard mechanism. Specifically, this includes: Real-time monitoring of the shared blackboard mechanism and acquisition of asset characteristic information; The asset feature information is compared with the known vulnerability features in the pre-built vulnerability knowledge base; When the comparison is successful, the corresponding vulnerability number, vulnerability type and applicable environment are retrieved from the pre-set vulnerability knowledge base; Based on the applicable environment of the vulnerability, structured vulnerability exploitation conditions are generated, and the vulnerability exploitation conditions are written into the shared blackboard mechanism.
3. The method according to claim 1, characterized in that, The testing strategy mode also includes a deep quantification mode, which matches the asset feature information with a pre-built vulnerability knowledge base according to the testing strategy mode, generates vulnerability exploitation conditions based on the matching results, and writes the vulnerability exploitation conditions into the shared blackboard mechanism, specifically including: The network topology information and access control policy information of the target system are obtained from the shared blackboard mechanism, wherein the network topology information and the access control policy information are included in the asset feature information; The asset feature information is compared with the pre-set vulnerability knowledge base to obtain a preliminary set of candidate vulnerabilities; Based on the network topology information and the access control policy information, network reachability analysis is performed on the preliminary candidate vulnerability set to eliminate vulnerabilities that are unreachable in the current network environment, thereby obtaining a valid vulnerability set. The exploitability score and exploit code maturity of the target effective vulnerability are extracted from the pre-set vulnerability knowledge base, wherein the target effective vulnerability is any vulnerability in the set of effective vulnerabilities. The success probability value of the target effective vulnerability is obtained by weighted summing of the exploitability score and the vulnerability exploit code maturity. The vulnerability exploitation conditions that generate the success probability value are written into the shared blackboard mechanism, along with the vulnerability exploitation conditions corresponding to all valid vulnerabilities in the valid vulnerability set.
4. The method according to claim 3, characterized in that, The extraction of the exploitability sub-score and exploit code maturity of the target effective vulnerability from the pre-set vulnerability knowledge base specifically includes: Extract the attack path length, attack complexity, and permission dependency of the target's valid vulnerability; The attack path length, the attack complexity, and the permission dependency are respectively subjected to reverse normalization to obtain the path reachability coefficient, the complexity breakthrough coefficient, and the permission acquisition coefficient. Calculate the sum of the reciprocals of the path reachability coefficient, the complexity breakthrough coefficient, and the permission acquisition coefficient, and divide the total number by the sum of the reciprocals to obtain the harmonic mean value. Use the harmonic mean value as the availability sub-score, and the total number is the number of coefficients after inverse normalization. Extract the applicable platform identifier string declared in the header of the exploit code for the target valid vulnerability; Obtain the actual platform fingerprint string of the target system; Calculate the Lewinstein distance between the applicable platform identifier string and the actual platform fingerprint string, where the Lewinstein distance is the minimum number of single-character edit operations required to convert one string to another. Obtain the first length of the applicable platform identifier string and the second length of the actual platform fingerprint string, and divide the Lewinstein distance by the maximum value of the first length and the second length to obtain the difference ratio. The maturity of the exploit code is determined by subtracting the difference ratio from 1.
5. The method according to claim 3, characterized in that, The asset feature information is mapped to nodes, and attack behaviors that meet the vulnerability exploitation conditions are mapped to edges. A global attack graph is constructed based on the nodes and edges, specifically including: The asset feature information is parsed to identify all independent network entities within the target range of the penetration test. Corresponding graph nodes are created for each independent network entity, and the IP address, device type, and current permission status of the independent network entity are assigned as node attributes to the graph nodes. The source node and the target node are obtained from the plurality of graph nodes, and the network connectivity from the source node to the target node is determined based on the network topology information. The source node and the target node are any two graph nodes from the plurality of graph nodes. If there is network connectivity between the source node and the target node, then search the shared blackboard mechanism for any exploit conditions targeting the target node. If there are exploit conditions for the target node in the shared blackboard mechanism, then a directed edge is constructed from the source node to the target node, and the directed edge represents a single-step attack behavior performed on the target node. Obtain the success probability value from the vulnerability exploitation conditions of the target node, and use the success probability value as the weight attribute of the directed edge; All generated graph nodes and directed edges are combined to form the global attack graph.
6. The method according to claim 5, characterized in that, The determination of network connectivity from the source node to the target node based on the network topology information specifically includes: Obtain the source IP address of the source node and the target IP address of the target node, and extract the list of open ports of the target node from the shared blackboard mechanism; Determine whether the source IP address and the target IP address belong to the same logical subnet; If the source IP address and the target IP address belong to the same logical subnet, then determine whether there is a Layer 2 isolation strategy in the network topology information; If the Layer 2 isolation strategy is not present in the network topology information, and the list of open ports contains the ports required for vulnerability exploitation, then it is determined that there is network connectivity between the source node and the target node. If the source IP address and the target IP address do not belong to the same logical subnet, then obtain the gateway device connecting the source node and the target node, and obtain the routing table information and access control policy list of the gateway device; Determine whether a forwarding path from the source node to the target node exists in the routing table information; If the routing table information contains a forwarding path from the source node to the target node, then the source IP address, the target IP address, and the port required for the vulnerability exploit are used as the five-tuple matching conditions, and the five-tuple matching conditions are matched with the access control policy list. If the matching result is allowed, it is determined that there is network connectivity between the source node and the target node.
7. The method according to claim 5, characterized in that, When the execution result is a failure, the global attack graph is updated based on the feedback failure result, and a new attack step sequence is re-planned and generated, specifically including: Read the failure status information from the execution result, and determine the cause of failure based on the failure status information; Locate the target directed edge that produces the execution result in the global attack graph, and mark the state attribute of the target directed edge as blocked to obtain the updated global attack graph. The new attack step sequence is generated based on the updated global attack graph until the new attack step sequence reaches the termination condition, at which point path planning stops and a test report of attack failure is generated.
8. An automated penetration testing path planning system based on agent collaboration, characterized in that, The system is located within a penetration testing platform, which includes multiple functional agents that interact with each other via a shared blackboard mechanism. The system also includes an acquisition unit, a processing unit, a planning unit, and a result processing unit. The acquisition unit receives the penetration testing target range input by the user and initializes and starts up multiple functional agents. The processing unit collects information about the target system based on the penetration test target scope, writes the collected asset feature information into the shared blackboard mechanism, obtains the test strategy mode of the current penetration test task, matches the asset feature information with a pre-set vulnerability knowledge base according to the test strategy mode, generates vulnerability exploitation conditions based on the matching results, and writes the vulnerability exploitation conditions into the shared blackboard mechanism. The asset feature information and the vulnerability exploitation conditions are read from the shared blackboard mechanism, the asset feature information is mapped to nodes, and the attack behaviors that meet the vulnerability exploitation conditions are mapped to edges. A global attack graph is constructed based on the nodes and edges. The planning unit generates attack paths based on the global attack graph, converts the attack paths into a sequence of attack steps, executes attack operations on the target system according to the sequence of attack steps, and feeds back the execution results to the shared blackboard mechanism. When the execution result is a failure, the result processing unit updates the global attack map based on the feedback failure result and re-plans and generates a new attack step sequence; when the execution result is a success, it generates a penetration test report targeting the penetration test scope based on the success result and displays the penetration test report to the user.
9. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-7.