Real-time attack path prediction and proactive defense method based on the co-evolution of large language models and dynamic knowledge graphs

By collecting multi-source network security data in real time, combining it with a large language model for attack intent analysis and path deduction, and dynamically updating the knowledge graph using defense effect feedback data, the problem of the knowledge graph's inability to continuously evolve in existing technologies is solved, and the accuracy and adaptability of attack path deduction are improved.

CN123122898APending Publication Date: 2026-11-17WUHAN ZIRUI DONGCHUANG TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611265272.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-20
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing attack path deduction schemes based on large language models and knowledge graphs, the knowledge graph is only updated by new security data, and there is a one-way call relationship between the large language model and the knowledge graph. This prevents the knowledge graph from continuously evolving from defense practices, and the accuracy of attack path deduction cannot be improved.

Method used

By constructing a real-time collection of multi-source network security data, extracting entities and relationships to build an initial attack knowledge graph, combining it with a large language model to analyze attack intent and infer paths, generating proactive defense strategies, and collecting defense effect feedback data to dynamically evolve and update the knowledge graph, a collaborative evolution closed loop of the large language model and the attack knowledge graph is formed.

Benefits of technology

It enables continuous learning and evolution of the knowledge graph, improves the accuracy and adaptability of attack path inference, and can effectively cope with complex and ever-changing network attack scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123122898A_ABST
    Figure CN123122898A_ABST
Patent Text Reader

Abstract

This invention relates to the field of network security and discloses a method for real-time attack path deduction and proactive defense based on the collaborative evolution of a large language model and a dynamic knowledge graph. The method includes constructing an initial attack knowledge graph; using a large language model to parse attack events and generate tactical intent tags; performing subgraph retrieval in the knowledge graph to generate candidate paths; then using the large language model to deduce attack paths and their confidence levels; generating and executing proactive defense strategies based on the deduction results; collecting defense effect feedback data; updating the edge weights of corresponding paths in the knowledge graph by decaying them, and adding attack nodes and relation edges; and using the updated knowledge graph as the basis for the next round of deduction, forming a collaborative evolution closed loop. This invention drives the dynamic evolution of the knowledge graph through defense effect feedback, enabling the knowledge graph to continuously learn and evolve from defense practices, thus improving the accuracy of attack path deduction and the adaptability of proactive defense.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network security, and in particular to a method for real-time inference and proactive defense of attack paths based on the collaborative evolution of large language models and dynamic knowledge graphs. Background Technology

[0002] Large Language Models (LLMs), with their powerful semantic understanding and reasoning capabilities, have been increasingly adopted in the cybersecurity field in recent years to assist security analysts in analyzing attack intent, identifying tactical phases, and deducing attack paths. Meanwhile, cybersecurity knowledge graphs, as a structured knowledge representation method, can model and store network assets, security vulnerabilities, attack tools, attack techniques, and their inter-entity relationships in a graph structure, providing an effective data foundation for attack path correlation analysis and attribution reasoning. Against the backdrop of increasingly frequent complex, multi-stage attacks such as Advanced Persistent Threats (APTs), combining the semantic reasoning capabilities of LLMs with the structured correlation analysis capabilities of knowledge graphs has become an important research direction in cybersecurity. Related technical solutions attempt to use LLMs to generate attack path hypotheses, and then use knowledge graphs for verification and correction, aiming to achieve accurate characterization and early prediction of network attack behavior.

[0003] In existing technologies, such as the scheme disclosed in Chinese Patent CN120639500A, which describes a method, apparatus, device, and medium for network attack path deduction based on a large language model, a method for network attack path deduction based on a large language model is proposed. This method uses a target large language model and a beam search algorithm to generate initial network attack deduction paths and corresponding initial confidence levels. Then, it uses a target knowledge graph to verify each initial deduction path. Based on the verification results, the confidence levels are adjusted, and the path with the highest confidence level is selected as the final deduction result. In this scheme, the knowledge graph is updated incrementally by acquiring newly added multi-source security data in real time through a Kafka message queue—that is, updates are driven by newly added security data.

[0004] For example, Chinese patent CN122293392A, "A Risk Intelligent Decision-Making Optimization Method Based on Security Knowledge Graph Reasoning," discloses a method that constructs a hierarchical security knowledge graph containing behavioral and tactical relationships. It maps real-time security event sequences to initial behavioral relationships, explores paths along the graph to generate causal attack paths, and then inputs these attack paths into a path simulator. Based on reinforcement learning, it solves for and executes the optimal adversarial decision sequence. While this method involves "feeding monitoring results back to the path simulator…forming a dynamic closed-loop optimization of attack simulation and defense execution," the feedback object is the Markov decision process model in the path simulator (optimizing state transition probabilities and game parameters), not the knowledge graph itself. The fundamental flaw shared by the aforementioned existing technologies lies in the following: the attack knowledge graph serves merely as a passive, static retrieval library or an incrementally updated storage structure driven by new data; the large language model only unidirectionally calls the knowledge graph for path verification, lacking a bidirectional interaction mechanism between the two; after the attack path deduction is completed, the deduction results are not used to generate executable proactive defense strategies, and the feedback data on the effects of the defense strategies are not collected and utilized to feed back into the structure and weight updates of the knowledge graph. This prevents the knowledge graph from accumulating experience and continuously evolving from each defense practice, and the deduction accuracy cannot gradually improve with the increase of defense practices. The system remains at a "static cognition" level for a long time, making it difficult to adapt to the rapid evolution of attacker tactics. Summary of the Invention

[0005] The purpose of this invention is to propose a real-time attack path deduction and proactive defense method based on the collaborative evolution of a large language model and a dynamic knowledge graph. This method addresses the technical problems in existing attack path deduction schemes based on the collaboration of a large language model and a knowledge graph. These problems stem from the fact that the knowledge graph is only updated by newly added security data, the relationship between the large language model and the knowledge graph is one-way, and the defense effect feedback data is not used to drive the evolution of the knowledge graph. Consequently, the knowledge graph cannot continuously evolve from defense practices, and the accuracy of attack path deduction cannot improve with the accumulation of defense experience.

[0006] The method includes the following steps: S1. Collect multi-source network security data in real time, extract entities and relationships from the multi-source network security data, and construct an initial attack knowledge graph; S2. Input the real-time detected attack events into the large language model to analyze the attack intent and identify the tactical stage, and generate the attacker's current tactical intent label; S3. Based on the tactical intent tag and the attack behavior characteristics in the attack event, perform subgraph retrieval and path matching in the initial attack knowledge graph to generate a set of candidate attack paths; S4. Input the set of candidate attack paths into the large language model, combine the attacker's historical behavior sequence to perform multi-step attack path deduction, and output the deduced attack path and the corresponding path confidence. S5. Based on the inferred attack path and the path confidence level, generate an active defense strategy and distribute it to the execution node; S6. Collect defense effect feedback data after the active defense strategy is executed, generate knowledge graph update instructions based on the defense effect feedback data, and use the knowledge graph update instructions to dynamically evolve and update the initial attack knowledge graph to obtain the updated attack knowledge graph. S7. Use the updated attack knowledge graph as the initial attack knowledge graph for the next round of inference, and repeat steps S3 to S6 to form a closed loop of co-evolution between the large language model and the attack knowledge graph.

[0007] A real-time attack path prediction and proactive defense system based on the co-evolution of a large language model and a dynamic knowledge graph includes: The data acquisition module is used to collect multi-source network security data in real time. The knowledge graph construction module is used to extract entities and relationships from the multi-source network security data, construct an initial attack knowledge graph, and dynamically evolve and update the initial attack knowledge graph according to the knowledge graph update instruction. The attack intent parsing module is used to input real-time detected attack events into a large language model for attack intent parsing and tactical phase identification, and to generate the attacker's current tactical intent label. The path deduction module is used to perform subgraph retrieval and path matching in the initial attack knowledge graph based on the tactical intent label and the attack behavior characteristics in the attack event, generate a set of candidate attack paths, input the set of candidate attack paths into the large language model to perform multi-step attack path deduction, and output the deduced attack path and the corresponding path confidence. The strategy generation module is used to generate an active defense strategy based on the inferred attack path and the path confidence level. The strategy execution module is used to distribute the proactive defense strategy to the execution node for execution; The feedback loop module is used to collect defense effect feedback data after the active defense strategy is executed, generate the knowledge graph update instruction based on the defense effect feedback data, and output it to the knowledge graph construction module.

[0008] The beneficial effects provided by this invention are as follows: By constructing a complete collaborative evolution loop of "large language model deduction → active defense strategy generation and execution → defense effect feedback collection → dynamic evolution of knowledge graph (edge ​​weight decay and update, addition of attack nodes and relation edges) → the evolved knowledge graph as the basis for the next round of deduction", this invention enables the knowledge graph to continuously update its structure and weights according to the actual effect of each defense practice. The edge weights of the paths corresponding to successfully defended attack steps are decayed, and attack steps that are not successfully defended and new attack behavior features are added to the graph as new nodes and new edges. This enables the knowledge graph to continuously "learn" and "evolve", allowing subsequent deductions to fully absorb historical defense experience, significantly improve the accuracy and adaptability of attack path deduction, and effectively cope with complex and ever-changing network attack scenarios. Attached Figure Description

[0009] Figure 1 This is a schematic diagram of the method flow of the present invention. Detailed Implementation

[0010] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0011] Example 1 Please refer to Figure 1 , Figure 1 This is a schematic diagram of the method flow of the present invention.

[0012] This invention provides a method for real-time attack path prediction and proactive defense based on the co-evolution of a large language model and a dynamic knowledge graph, comprising: Step S1: Collect multi-source network security data in real time, extract entities and relationships from the multi-source network security data, and construct an initial attack knowledge graph.

[0013] As an optional implementation, in step S1, the multi-source network security data refers to a collection of structured and unstructured data from different security data sources, including but not limited to: network traffic data (raw traffic packets and NetFlow records collected through switch port mirroring or network probes), terminal security logs (host operating system logs, EDR alarms, process creation and termination events), security device alarms (alarms generated by firewalls, intrusion detection systems, intrusion prevention systems, and web application firewalls), external threat intelligence (open source threat intelligence sources, commercial threat intelligence subscriptions), and identity authentication and access logs (VPN login records, domain controller authentication logs, and database access audit logs).

[0014] Real-time data acquisition is accomplished through a distributed data access layer. This layer is deployed across multiple acquisition nodes on the target network. Each node aggregates the raw data it collects to the central data processing cluster via a message queue (such as Apache Kafka). The acquisition nodes maintain communication with the central cluster using persistent connections and activate local cache queues to ensure no data loss in the event of network interruptions.

[0015] Entity extraction and relation extraction are fundamental steps in constructing an attack knowledge graph. Entity extraction refers to identifying and extracting discrete objects with security semantics from multi-source network security data. These include network asset entities (IP addresses, domain names, hostnames, MAC addresses), security vulnerability entities (CVE numbers, vulnerability descriptions), attacker entities (attack source IPs, attacker organization identifiers), attack tool entities (malware family names, exploit tool names), attack technology entities (ATT&CK technology IDs and names), and attack indicator entities (file hash values, domain names, IP addresses). Relationship extraction refers to identifying the semantic relationships between entities, including dependency relationships (e.g., a vulnerability depends on an open port), connectivity relationships (e.g., a network reachable path exists between two hosts), exploitation relationships (e.g., an attack tool exploits a vulnerability), and attribution relationships (e.g., an attack event belongs to a specific attacker organization).

[0016] Entity extraction employs a named entity recognition model based on a pre-trained language model (such as RoBERTa). This model takes security log text or concatenated text of structured data fields as input, generates context-sensitive feature representations through a multi-layer coding network, and provides an entity label for each labeled position in the output layer. The entity label set includes at least network asset labels, security vulnerability labels, attacker labels, attack tool labels, attack technique labels, and attack indicator labels. Relation extraction is implemented using a relation extraction model based on dependency parsing and sequence labeling, classifying and outputting the relationship type between entity pairs.

[0017] The specific process of constructing the initial attack knowledge graph is as follows: extracted entities are stored as nodes in the graph database, and extracted relationships are stored as edges between nodes. The graph database adopts an attribute graph model (such as Neo4j), where each node contains an entity identifier, entity type, and structured attribute information (such as IP address, vulnerability severity level, and malware family name), and each edge contains a relationship type, confidence attribute, and timestamp attribute. To improve the query efficiency of subsequent subgraph retrieval and path matching, a composite index is created for the node identifier field, entity type field, and relationship type field.

[0018] For example, in one specific embodiment, a data access layer deployed on an enterprise's intranet collected multi-source security data from 12 collection nodes within 5 minutes (300 seconds), including approximately 15,000 NetFlow records, approximately 8,000 Windows event logs, approximately 120 firewall alerts, and approximately 45 threat intelligence matching records. The entity extraction model identified 187 IP entities, 23 domain name entities, 16 vulnerability entities (related to CVE numbers), 8 attack tool entities, and 31 attack technique entities (corresponding to ATT&CK technology IDs) from the above data. The relationship extraction model extracted a total of 624 relationships between entities. Based on the above nodes and edges, an initial attack knowledge graph containing 187 nodes and 624 edges was constructed in the Neo4j graph database.

[0019] Step S2: Input the real-time detected attack events into the large language model for attack intent analysis and tactical phase identification, and generate the attacker's current tactical intent label.

[0020] As an optional implementation, in step S2, the real-time detected attack events refer to network security alarms that are reported in real time by security detection systems (such as intrusion detection systems, endpoint detection and response systems, and security information and event management systems) and are determined to be suspicious or malicious. Each attack event includes at least the fields for event occurrence time, source IP address, target IP address, event type, alarm level, and original alarm description.

[0021] Attack intent analysis refers to understanding the deeper purpose and attacker intent of an attack event through a large language model, rather than merely remaining at the surface semantic level of the alert. For example, an alert stating "Initiated a large number of connection requests from IP 10.0.1.100 to port 445 of IP 10.0.2.50" has a surface semantic of "port scanning," but the deeper intent might be "Reconnaissance of SMB services in preparation for a subsequent lateral movement attack." By comprehensively understanding the alert context, historical behavioral sequences, and attacker tactical patterns, a large language model can infer the attacker's true intent from the surface alert.

[0022] Tactical phase identification refers to mapping attack events to specific stages in the cyberattack lifecycle. This invention uses the MITRE ATT&CK framework as the standard for tactical phase classification. The ATT&CK framework defines the tactical phases of the entire cyberattack process, including initial access (TA0001), execution (TA0002), persistence (TA0003), privilege escalation (TA0004), evasion and defense (TA0005), credential access (TA0006), discovery (TA0007), lateral movement (TA0008), collection (TA0009), command and control (TA0011), and data penetration (TA0010). The output of tactical phase identification is one or a combination of the above tactical phases.

[0023] The specific implementation process is as follows: First, the raw alarm data of the attack event (including fields such as alarm type, source IP, target IP, port, protocol, and alarm description) is converted into natural language description text according to a preset prompt word template. The prompt word template is: "You are a network security analysis expert. The following is an attack event detected by the security system: [Raw alarm data]. Please analyze: 1) Which tactical stage in the MITRE ATT&CK framework does this event belong to; 2) What is the attacker's possible intent? Please output in JSON format, including the fields 'tactic' and 'intent'." Second, the natural language description text is input into a large language model (preferably an open-source large language model fine-tuned in the security domain, such as a model fine-tuned based on Llama-3-70B using LoRA). The large language model calls the pre-built ATT&CK tactical knowledge base for semantic matching and reasoning. The ATT&CK tactical knowledge base pre-built includes definitions of each tactical stage, typical attack techniques, common alarm patterns, and example scenarios. The large language model compares the current attack event with the tactical patterns in the knowledge base through a retrieval-enhanced generation method. Finally, the large language model outputs the tactical stage to which the attack event belongs and the attacker's intent description based on the matching results, generating a tactical intent label containing a tactical stage identifier and intent description.

[0024] For example, in one specific implementation, the security information and event management system reported an alert: "Source IP 10.0.1.100 initiated more than 200 TCP connection requests to port 445 of target IP 10.0.2.50 within 30 seconds, indicating that the target host has an EternalBlue vulnerability (MS17-010)." After converting this alert into a natural language description, it was input into a large language model. The large language model, after matching it with the ATT&CK tactical knowledge base, outputs: the tactical phase is a combination of "Discovery (TA0007)" and "Lateral Movement (TA0008)," and the attacker's intent is "to probe the SMB service availability of the target host through port scanning, assess whether there are conditions for exploiting the EternalBlue vulnerability, and prepare for subsequent lateral movement." The generated tactical intent label is "Discovery_Lateral Movement_EternalBlue Detection."

[0025] Step S3: Based on the tactical intent tag and the attack behavior characteristics in the attack event, perform subgraph retrieval and path matching in the initial attack knowledge graph to generate a set of candidate attack paths.

[0026] As an optional implementation, in step S3, the attack behavior characteristics refer to the technical details extracted from the attack event that describe the attacker's specific operations, including the protocol type used in the attack (such as TCP, UDP, SMB, RDP), the target port number (such as 445, 3389, 22), the attack tool identifier (such as Mimikatz, PsExec, CobaltStrike), the attack payload characteristics (such as specific command line parameters, PowerShell script content), and the attack rhythm (such as attack interval time, number of concurrent connections).

[0027] Subgraph retrieval refers to locating the subgraph region associated with a specific tactical phase within the initial attack knowledge graph, using tactical intent tags as the query entry point. Specifically, in the initial attack knowledge graph, the ATT&CK tactical phase is modeled as tactical nodes. Each tactical node is connected to its corresponding attack technique node (ATT&CK technique ID) through an "inclusion" relationship. The attack technique node is further connected to vulnerability nodes and attack tool nodes through an "exploitation" relationship. The subgraph retrieval process first locates the corresponding tactical node based on the tactical intent tag. Then, it expands outward from this tactical node with a preset hop radius (preferably 3 hops) to extract all nodes and edges related to that tactical phase, forming a tactic-related subgraph.

[0028] Path matching refers to retrieving all reachable paths from the source asset node in an attack event to the destination node in a tactical-related subgraph, based on connectivity and exploitation relationships within the knowledge graph. The search employs either breadth-first search or depth-first search algorithms, retaining only paths where the attack technique identifiers of nodes match the tactical intent labels.

[0029] The generation of the candidate attack path set further includes a path filtering step: for all retrieved reachable paths, a multi-factor weighted score is applied based on path length (number of nodes), vulnerability exploitability (weighted average of CVSS scores for each vulnerability on the path), and asset criticality (importance score of the asset at the path's endpoint). The scoring formula is:

[0030] in This represents the path length (number of edges). For the first on the path The CVSS score of each vulnerability (ranging from 0 to 10). Assign a pre-defined importance score (range 0 to 1) to the endpoint asset. , , The weighting coefficients and (Preferred, , , ). Paths with scores higher than a preset threshold (preferably, the threshold is 0.6) are selected to generate a set of candidate attack paths.

[0031] For example, continuing from the previous embodiment, the tactical intent label is "Discovery_Lateral Movement_EternalBlue Detection," the source IP in the attack event is 10.0.1.100, and the target IP is 10.0.2.50. Subgraph retrieval centers on the "Lateral Movement (TA0008)" tactical node, extracting tactical-related subgraphs from the initial attack knowledge graph that include the EternalBlue vulnerability (CVE-2017-0144), the SMB protocol (port 445), and related attack tools (EternalBlue, DoublePulsar). Path matching starts from the source asset node 10.0.1.100, reaches the vulnerability node CVE-2017-0144 via SMB connectivity, then reaches the attack tool node EternalBlue via exploitation, and finally reaches the target asset node 10.0.2.50, retrieving three reachable paths. After multi-factor weighted scoring, the scores of the three paths were 0.82, 0.71 and 0.58, respectively. Two paths with scores higher than 0.6 were selected as the candidate attack path set.

[0032] Step S4: Input the set of candidate attack paths into the large language model, combine it with the attacker's historical behavior sequence to perform multi-step attack path deduction, and output the deduced attack path and the corresponding path confidence.

[0033] As an optional implementation, in step S4, each path in the candidate attack path set is essentially a static graph structure composed of nodes and edges in a knowledge graph, reflecting possible attack paths based on known vulnerabilities and connection relationships. However, the static graph structure cannot reflect the attacker's dynamic decision-making, path selection, and tactical adjustments during the actual attack process. Therefore, it is necessary to transform the static graph structure into a dynamic attack sequence, which is then deduced by a large language model based on its understanding of the attacker's behavioral patterns.

[0034] The specific process of multi-step attack path deduction is as follows: First, each path in the candidate attack path set is converted into a structured attack step sequence description according to the temporal logic of the attack steps. Each attack step description includes the step number, the current node (the position the attacker has reached), the operation performed (such as port scanning, vulnerability exploitation, privilege escalation), the tool used, the target of the operation, and the preconditions and post-effects of the step. The conversion process is automatically generated based on the edge type and attributes between nodes in the knowledge graph. For example, the "vulnerability exists" relationship from "source asset node → vulnerability node" can be converted into "step: scan and identify the EternalBlue vulnerability on the target host"; the "exploitable" relationship from "vulnerability node → attack tool node" can be converted into "step: use the EternalBlue tool to implement vulnerability exploitation".

[0035] Secondly, the attack step sequence description is concatenated with the attacker's historical behavior sequence to generate a fused contextual prompt. The attacker's historical behavior sequence refers to the sequence of attack steps previously recorded and analyzed by the system within the same attack session or under the same attacker identifier. The historical behavior sequence records the attacker's completed attack actions, reached asset nodes, and acquired privilege levels, providing crucial contextual information for deducing subsequent attack steps. The format of the fused contextual prompt is: "[Historical Behavior Review] The attacker has completed the following attack steps: [Historical Behavior Sequence]. [Current Candidate Path] Based on known vulnerabilities and network topology, the attacker's possible subsequent attack paths are: [Attack Step Sequence Description]. Based on the attacker's historical behavior patterns and ATT&CK tactical knowledge, please deduce the most likely subsequent attack steps the attacker will take and evaluate the confidence level of each deduced path." Next, the contextual clues are input into the large language model. The large language model generates subsequent attack steps and corresponding path confidence for each candidate attack path according to temporal logical reasoning. During the reasoning process, the large language model refers to typical attack chain patterns in the ATT&CK tactical knowledge base, combined with the attacker's historical behavioral preferences (such as whether the attacker tends to use specific attack tools or prefers specific lateral movement methods), and outputs a detailed description of the subsequent attack steps.

[0036] The path confidence score, ranging from 0 to 1, characterizes the reliability assessment of the inferred attack path by the large language model. The confidence score calculation comprehensively considers the following factors: the degree of matching between the inferred path and historical behavior sequences (higher matching results in higher confidence), the strength of the ATT&CK technical correlation between each attack step in the inferred path (stronger correlation results in higher confidence), the maturity of the vulnerabilities and attack conditions upon which the inferred path depends (vulnerabilities with publicly available exploit tools result in higher confidence), and the probability score output by the large language model itself. The confidence score value is generated by the large language model according to a preset scoring standard during output.

[0037] Finally, the path with the highest confidence level is selected from all the simulated attack paths as the main simulated attack path.

[0038] For example, continuing from the aforementioned embodiment, one path in the candidate attack path set is "10.0.1.100 → EternalBlue exploit → 10.0.2.50 (acquisition of privileges)". The attacker's historical behavior sequence shows that the attacker has completed a port scan of subnet 10.0.1.0 / 24 within the past 2 hours and successfully gained initial access by exploiting the MS08-067 vulnerability on another host. After concatenating the above information into a fused contextual prompt and inputting it into a large language model, the large language model deduces the following subsequent attack steps: "Step 1: Send the EternalBlue exploit payload to 10.0.2.50 via the SMB protocol (port 445); Step 2: After successful exploitation, implant the DoublePulsar backdoor on 10.0.2.50; Step 3: Establish a persistent C2 channel through the backdoor; Step 4: Continue to probe subnet 10.0.3.0 / 24 with internal network privileges." The path confidence of this deduced attack path is 0.87. Another candidate path was analyzed as having "similar steps 1-3, but step 4 involves data collection and infiltration," with a path confidence of 0.76. The path with a confidence of 0.87 was selected as the primary attack path.

[0039] Step S5: Based on the inferred attack path and the path confidence level, generate an active defense strategy and distribute it to the execution node.

[0040] As an optional implementation, in step S5, the proactive defense strategy refers to a set of security measures pre-deployed to block or interfere with the execution of one or more attack steps in the simulated attack path. Unlike traditional passive response (handling after an attack occurs), the proactive defense strategy is deployed before the attacker actually reaches that step, achieving "pre-attack" defense.

[0041] The process of generating a proactive defense strategy is as follows: First, extract the attack technology identifiers (ATT&CK technology IDs, such as T1021 for remote service and T1550 for using alternative authentication materials) and attack target identifiers (such as target IP address, target hostname, and target service port) corresponding to each attack step in the simulated attack path. Second, determine the response level of the defense strategy based on the path confidence: When the path confidence is higher than the first confidence threshold (preferably, the first confidence threshold is 0.7), it indicates that the large language model has a high reliability assessment of the simulated path, and the response level is high priority, requiring immediate deployment of defense measures; when the path confidence is between the first confidence threshold and the second confidence threshold (preferably, the second confidence threshold is 0.4), the response level is medium priority, and deployment can be moderately delayed or only lightweight defense measures can be deployed; when the path confidence is lower than the second confidence threshold, the response level is low priority, and only the simulation results are recorded for security analysts' reference, without automatically deploying defense measures. Finally, based on the response level and attack technology identifier, a pre-set defense strategy template library is matched to generate a specific proactive defense strategy.

[0042] The defense policy template library contains pre-built defense rule templates corresponding to various ATT&CK attack techniques. For example, the defense template for "T1021 - Remote Service" is "Temporarily close the corresponding remote service port on the target host, or restrict access to the port to only authorized IPs"; the defense template for "T1550 - Use Alternative Authentication Materials" is "Force reset the authentication credentials of the target account and enable multi-factor authentication"; and the defense template for "T1046 - Network Service Scan" is "Temporarily block the scanning source IP on the firewall." The defense policy template library supports custom expansion, allowing security administrators to add or modify template content according to the actual network environment and business needs.

[0043] The proactive defense strategy is a structured policy description, which includes at least the policy type (blocking rule / isolation rule / deception rule), the policy target (target IP, target port, target host), policy parameters (such as blocking duration, port range), and policy priority. After the policy is generated, it is distributed to the execution nodes (firewalls, switches, endpoint EDR proxies, cloud security groups, etc.) for execution through a standardized interface (such as a RESTful API).

[0044] For example, continuing from the previous embodiment, the confidence level of the main inferred attack path is 0.87, which is higher than the first confidence threshold of 0.7, and the response level is high priority. The attack techniques involved in the inferred path include T1046 (network service scanning), T1021 (remote service, SMB protocol) and T1550 (using alternative authentication materials). After matching the defense policy template library, the following active defense policies are generated: (1) Blocking policy: Temporarily block the source IP 10.0.1.100 from accessing port 445 of the target IP 10.0.2.50 on the firewall for a duration of 3600 seconds; (2) Isolation policy: Isolate the target host 10.0.2.50 from the current security domain, allowing only the management IP (10.0.0.1) to access via SSH (port 22) for a duration of 1800 seconds; (3) Credential protection policy: Forcefully reset the passwords of all local administrator accounts on 10.0.2.50 and enable multi-factor authentication. The above strategy is deployed to the firewall management platform and the terminal EDR management platform via RESTful API for execution.

[0045] Step S6: Collect defense effect feedback data after the active defense strategy is executed, generate knowledge graph update instructions based on the defense effect feedback data, and use the knowledge graph update instructions to dynamically evolve and update the initial attack knowledge graph to obtain the updated attack knowledge graph.

[0046] As an optional implementation, in step S6, the defense effect feedback data refers to the data reflecting the actual effect of the proactive defense strategy, which is returned by each execution node and the security monitoring system after the active defense strategy is executed. The defense effect feedback data includes: successfully blocked attack steps (i.e., records of attack behaviors that match a step in the simulated attack path and are successfully intercepted during the strategy's effective period), unblocked attack steps (i.e., records of attack behaviors that match a step in the simulated attack path and are not intercepted during the strategy's effective period, and the attacker continues to advance), and newly added attack behavior characteristics (i.e., new alarms and abnormal behaviors detected during the strategy's effective period that do not belong to the original simulated attack path but may indicate that the attacker has changed their attack route).

[0047] The knowledge graph update instruction generation process is as follows: First, the defense effectiveness feedback data is analyzed, and successfully blocked attack steps, unblocked attack steps, and newly added attack behavior features are extracted and categorized. Second, based on the successfully blocked attack steps, the edge weights of the corresponding attack paths in the initial attack knowledge graph are decayed and updated. Edge weights reflect the actual exploitability of each connection relationship on the attack path. Successfully blocked attack steps indicate that the corresponding attack techniques have been effectively defended in the current network environment, reducing the likelihood of them being successfully exploited by attackers again; therefore, the corresponding edge weights should be decayed. The decay update is calculated according to the following formula:

[0048] in For the node before the update To the node The edge weights (the initial values ​​are set based on a combination of vulnerability exploitability, historical attack success rate and expert experience, and the values ​​range from 0 to 1). The preset attenuation coefficient and (Preferred, ), The preset time decay factor and (Preferred, ), The time interval since the last update, in seconds. This formula means: the newer the defense effect (…). The smaller the value, the larger the attenuation coefficient. The larger the value, the greater the decay of the edge weight; over time ( If the attack step is not successfully blocked again, the edge weight will gradually recover (by increasing). The natural decay of the term achieves smooth recovery.

[0049] Secondly, based on the unblocked attack steps and newly added attack behavior characteristics, attack nodes and / or attack relationship edges are added to the initial attack knowledge graph. Unblocked attack steps indicate that the attacker was able to bypass existing defenses and successfully advance; the corresponding attack techniques and paths should be added to the knowledge graph to reflect the attacker's actual behavior patterns. Newly added attack behavior characteristics may indicate that the attacker used novel attack tools or techniques not yet included in the knowledge graph; these should be added as new attack technique nodes or attack tool nodes. The initial weight of the newly added nodes is a preset baseline weight. (Preferred, The initial weight of the newly added relationship edge is assigned based on the confidence level in the defense effect feedback data (the higher the confidence level, the higher the initial weight, with a value range of 0 to 1).

[0050] Finally, the operations of edge weight decay updates and adding nodes and relation edges are encapsulated into knowledge graph update instructions. These instructions are a collection of structured graph database manipulation languages ​​(such as Cypher statements), which can be executed directly on the Neo4j graph database.

[0051] For example, continuing with the aforementioned embodiments, after the proactive defense strategy is executed, the defense effect feedback data shows that: the firewall successfully blocked two connection attempts from 10.0.1.100 to 10.0.2.50:445 (the successfully blocked attack step); however, the EDR system detected abnormal PowerShell execution behavior on 10.0.2.50, and the attacker moved laterally to another host 10.0.3.10 via WMI (Windows Management Instrumentation) (the unblocked attack step); at the same time, the security monitoring system detected traces of the Mimikatz tool running on 10.0.3.10 (a newly added attack behavior feature). Based on the above feedback data, the following knowledge graph update instructions are generated: (1) The weight of the edge “10.0.1.100 → port 445 → 10.0.2.50” in the knowledge graph is reduced, and the weight is reduced from 0.85 to 0.68 after the update; (2) A new attack technology node for WMI lateral movement (ATT&CK technology ID T1047) and its corresponding relational edge are added; (3) A new Mimikatz attack tool node and its corresponding relational edge are added. After executing the above update instructions, the initial attack knowledge graph is dynamically evolved into the updated attack knowledge graph.

[0052] Step S7: Use the updated attack knowledge graph as the initial attack knowledge graph for the next round of inference, and repeat steps S3 to S6 to form a closed loop of co-evolution between the large language model and the attack knowledge graph.

[0053] As an optional implementation, in step S7, the collaborative evolution closed loop refers to a bidirectional, interactive, and continuously optimized cyclical mechanism formed between the large language model and the attack knowledge graph. In this closed loop, the attack knowledge graph provides the large language model with a structured basis for attack path reasoning (the subgraph retrieval and path matching in step S3 depend on the completeness and accuracy of the knowledge graph); the large language model performs dynamic inference based on the candidate paths provided by the knowledge graph (step S4); the inference results drive the generation and execution of proactive defense strategies (step S5); the effect of defense execution is fed back to the knowledge graph (step S6), driving the continuous evolution of the knowledge graph; the evolved knowledge graph then serves as the basis for the next round of inference, making subsequent path retrieval and matching more accurate.

[0054] Unlike traditional solutions where knowledge graphs are merely static retrieval libraries and large language models unidirectionally call upon them, the collaborative evolution closed loop of this invention enables the knowledge graph to continuously "learn" and "evolve" with each attack response. The defense experience accumulated in the attack knowledge graph (which attack steps were successfully blocked, which attack steps were not blocked, and what new attack techniques have emerged) continuously optimizes the structure and weights of the knowledge graph, thereby improving the accuracy and timeliness of subsequent large language model inferences.

[0055] The iteration cycle of the closed loop can be flexibly configured according to the security requirements of the actual deployment scenario. Preferably, for high-security scenarios (such as core financial transaction systems and critical government information infrastructure), the closed-loop iteration cycle is set to 60 to 300 seconds; for general-security scenarios, the closed-loop iteration cycle can be set to 300 to 600 seconds. An iteration cycle that is too short will increase the system's computational load, while an iteration cycle that is too long will reduce the response speed to dynamic attacks.

[0056] For example, continuing from the aforementioned embodiment, after the first round of closed-loop iteration, the updated attack knowledge graph adds nodes and edges related to WMI lateral movement (T1047) and the Mimikatz tool. Simultaneously, the edge weight of "10.0.1.100→10.0.2.50:445" decreases from 0.85 to 0.68. In the next round of closed-loop iteration (after 300 seconds), when the system detects abnormal activity from 10.0.1.100 again, the subgraph retrieval in step S3 will prioritize matching attack paths related to WMI lateral movement (because of the added nodes and edges), rather than repeatedly recommending the already effectively defended SMB EternalBlue path. Simultaneously, due to the decrease in edge weight, the score of the SMB path in the candidate path set will decrease, reducing false positives and the generation of ineffective defense strategies. Through multiple rounds of closed-loop iteration, the attack knowledge graph continues to evolve, and the inference accuracy of the large language model gradually improves, forming an adaptive security protection capability that becomes more accurate with use.

[0057] Example 2 As an optional implementation, step S1 involves constructing an initial attack knowledge graph, which specifically includes the following sub-steps: S11. Extract network entities and attack entities from the multi-source network security data. The network entities include asset nodes, vulnerability nodes, and network topology nodes. The attack entities include attacker nodes, attack tool nodes, attack technology nodes, and attack indicator nodes.

[0058] Network entities refer to physical or logical objects within a target network that can be exploited by attackers or used as targets. Asset nodes represent computing resources within the network, including servers, terminal devices, network devices (routers, switches), cloud instances, and containers. Each asset node contains an asset identifier (IP address or hostname), asset type (e.g., database server, web server, domain controller), operating system type and version, security domain, and asset importance score (ranging from 0 to 1, preset by the security administrator based on business criticality). Vulnerability nodes represent security weaknesses present on assets. Each vulnerability node includes a vulnerability ID (CVE ID), vulnerability name, CVSS score (ranging from 0 to 10), affected products and versions, vulnerability type (e.g., remote code execution, privilege escalation, information disclosure), and whether publicly exploitable exploit code exists. Network topology nodes represent the network connections between assets, including subnetting, firewall policies, routing configurations, and network reachability information.

[0059] An attack entity refers to the active element associated with an attack. The attacker node represents the source of the attack, including attacker identification (source IP address, attacker organization name, or anonymous identifier), attacker type (e.g., APT group, ransomware group, insider threat), and historical attack records. The attack tool node represents the malware or exploit tools used by the attacker, including tool name, tool type (e.g., backdoor, Trojan, ransomware, exploit framework), version number, and known Indicators of Compromise (IOCs). The attack technique node represents the specific attack methods employed by the attacker, corresponding one-to-one with the technique IDs in the MITRE ATT&CK framework, including technique ID, technique name, technique description, tactical stage, and known defenses. The attack indicator node represents atomic characteristics that can be used to detect attacks, including file hashes (MD5, SHA-1, SHA-256), malicious domain names, malicious IP addresses, malicious URLs, and specific process or service names.

[0060] S12. Extract the relationships between the network entities, between the attacking entities, and between the network entities and the attacking entities. The relationships include at least dependency relationships, connectivity relationships, exploitation relationships, and attribution relationships.

[0061] Dependency relationships describe how one entity functionally or logically depends on another entity. For example, a web application depends on a database service, or the existence of a vulnerability depends on an open port. Connectivity relationships describe the network reachability between two asset nodes, such as the communication path between two subnets connected by a switch or router. Exploitation relationships describe the likelihood of an attacking entity exploiting a network entity. For example, an attack tool can be used to exploit a vulnerability (attack tool → vulnerability), a vulnerability exists on an asset (vulnerability → asset), or an attack technique can be used to achieve a tactical objective (attack technique → tactic). Attribution relationships describe the affiliation or association between attacking entities. For example, an attack tool is used by an attacker organization (attack tool → attacker), or an attack indicator (such as a file hash) is attributed to an attack tool (attack indicator → attack tool).

[0062] The specific implementation of relation extraction is as follows: For structured data (such as NetFlow records, firewall policies, and CVE vulnerability data), relations are directly extracted using predefined field mapping rules; for unstructured data (such as threat intelligence reports and security forum posts), automatic extraction is performed using a relation extraction model based on dependency parsing and sequence labeling. The relation extraction model takes entity pairs and their context text as input and outputs relation type and relation confidence (values ​​range from 0 to 1; relations with confidence scores below 0.6 are filtered out when constructing the knowledge graph).

[0063] S13. Construct the initial attack knowledge graph using the network entity and the attack entity as nodes and the association relationship as edges.

[0064] All entities extracted in S11 are used as graph nodes, and all relationships extracted in S12 are used as graph edges. An initial attack knowledge graph is constructed in the Neo4j graph database. After construction, a consistency check is performed on the graph to ensure that there are no isolated nodes (nodes without any edges), no self-loop edges (edges whose start and end points are the same node), and no duplicate edges (multiple edges of the same type between the same pair of nodes are merged). After the consistency check passes, indexes are created on the node identifier field and the relationship type field to accelerate queries.

[0065] Example 3 As an optional implementation, step S2 involves inputting the real-time detected attack events into a large language model for attack intent analysis and tactical phase identification, specifically including the following sub-steps: S21. Convert the original alarm data of the attack event into natural language description text.

[0066] Raw alarm data typically exists in structured JSON or key-value pair format, containing fields such as alarm time, alarm type, source IP, destination IP, source port, destination port, protocol, alarm level, and alarm description. The conversion to natural language description text is achieved through a pre-defined template engine. The template is: "[Time], an [Alarm Type] alarm (Level: [Alarm Level]) was detected. Source address: [Source IP]:[Source Port] initiated [Protocol] communication to destination address: [Destination IP]:[Destination Port]. Alarm details: [Alarm Description]." The converted natural language description text retains all the key information of the original alarm while presenting it in a format that conforms to human reading habits, facilitating semantic understanding by large language models.

[0067] S22. Input the natural language description text into the large language model, and the large language model calls the preset ATT&CK tactical knowledge base to perform semantic matching and reasoning to identify the tactical stage to which the attack event belongs.

[0068] The ATT&CK Tactical Knowledge Base is a structured knowledge base that stores the definitions of all tactical phases in the MITRE ATT&CK framework, typical attack techniques corresponding to each tactical phase, typical alarm patterns for each attack technique, and typical transformation relationships between tactical phases. The knowledge base is stored in a vector database (such as FAISS or Pinecone), with each knowledge entry encoded as a vector embedding, supporting fast retrieval based on semantic similarity.

[0069] After receiving the natural language description text, the large language model first retrieves the top-K knowledge entries (K preferably 5) from the ATT&CK tactical knowledge base that are semantically most similar to the current attack event. Then, it concatenates these retrieved knowledge entries with the original natural language description text as context, forming an enhanced input prompt. Based on this enhanced input, the large language model performs inference and outputs the ATT&CK tactical phase to which the attack event most likely belongs. This semantic matching and inference process fully leverages the contextual understanding capabilities of the large language model and the domain expertise of the ATT&CK tactical knowledge base, improving the accuracy of tactical phase identification.

[0070] S23. Generate the attacker's current tactical intent tag based on the tactical phase and the context information of the attack event.

[0071] A tactical intent label is a structured label object containing three fields: Tactical Phase (taken from the output of S22), Attack Target (the target asset or data extracted from the attack event), and Intent Description (a free text description generated by a large language model based on the tactical phase and the context of the attack event). For example, for an alert about an abnormal query targeting a database server, the tactical intent label could be: Tactical Phase = "Collection (TA0009)", Attack Target = "Customer Database", Intent Description = "The attacker attempted to batch export sensitive data from the customer database via SQL injection".

[0072] Example 4 As an optional implementation, step S3 involves subgraph retrieval and path matching within the initial attack knowledge graph, specifically including the following sub-steps: S31. Using the tactical intent tag as the query entry point, locate the corresponding tactical node in the initial attack knowledge graph.

[0073] The initial attack knowledge graph pre-defines tactical nodes corresponding to the ATT&CK tactical phases. Each tactical node is uniquely identified by a tactical ID (e.g., TA0008), and its attributes include a tactical name and a tactical description. The first step in subgraph retrieval is to locate the corresponding tactical node in the knowledge graph based on the tactical phase field in the tactical intent tag.

[0074] S32. Using the source asset node in the attack event as the starting node and the target asset node associated with the tactical node as the ending node, based on the connectivity and exploitation relationships in the initial attack knowledge graph, a breadth-first search or depth-first search algorithm is used to retrieve all reachable paths from the starting node to the ending node.

[0075] A source asset node refers to the asset node corresponding to the source IP address in an attack event. If there is no corresponding asset node for the source IP address in the knowledge graph, a new asset node is created based on the IP address's geographical location information, historical behavior data, and asset fingerprint information. A destination node is the target asset node associated with a tactical node; that is, the set of asset nodes in the knowledge graph that are relevant to the current tactical phase and may become attack targets. The association between tactical nodes and target asset nodes is established through a "target" relationship, which is pre-defined by the security administrator based on the business importance of the network assets and the attacker's potential high-value targets.

[0076] The path retrieval employs a breadth-first search algorithm, starting from the initial node and expanding hop-by-hop along the connectivity and exploitation relationships in the knowledge graph until the endpoint node is reached or the preset maximum search depth is achieved (preferably, the maximum search depth is 8 hops, corresponding to the 8 tactical phases of a typical APT attack chain). All paths from the initial node to the endpoint node are recorded during the search process.

[0077] S33. All reachable paths are scored using a multi-factor weighted scoring method based on path length, vulnerability exploitability, and asset criticality. Paths with scores higher than a preset threshold are selected to generate the candidate attack path set.

[0078] The scoring principle for path length is: the shorter the path (the fewer steps the attacker needs to traverse), the higher the probability of a successful attack, and the higher the score. Vulnerability exploitability is scored based on the CVSS scores of each vulnerability along the path and the existence of publicly available exploit code. Asset criticality is scored based on the business importance of the endpoint asset. The specific calculation formula and weighting coefficients for the multi-factor weighted scoring are given in the main description of step S3.

[0079] Example 5 As an optional implementation, step S4 involves inputting the candidate attack path set into the large language model for multi-step attack path deduction, specifically including the following sub-steps: S41. Convert each path in the candidate attack path set into a structured attack step sequence description.

[0080] The path transformation process converts the graph structure paths (sequences of nodes and edges) in the knowledge graph into a linearly arranged sequence of attack steps. Each attack step is formatted as: "Step [N]: [Action] → [Target] (using [tools / techniques])". For example, a path containing "Source Asset → Vulnerable Node → Attack Tool Node → Target Asset" is transformed into: "Step 1: Scan open ports on target host 10.0.2.50 → Step 2: Exploit the EternalBlue vulnerability (CVE-2017-0144) → Step 3: Implant the DoublePulsar backdoor → Step 4: Gain system privileges on target host 10.0.2.50".

[0081] S42. The attack step sequence description is concatenated with the attacker's historical behavior sequence to generate a fused context prompt.

[0082] The attacker's historical behavior sequence is stored in a time-series database with the attacker's identifier (source IP address or attacker organization name) as the key. The historical behavior sequence records the attack steps completed by the attacker in the current and historical sessions, the asset nodes reached, the privilege levels acquired, and the attack tools used. The concatenated fusion context prompt contains both "completed historical attack steps" and "future attack steps to be deduced," enabling the large language model to deduce attacks within a complete attack context.

[0083] S43. Input the fusion context prompt into the large language model, and the large language model generates the subsequent attack steps and corresponding path confidence for each candidate attack path according to temporal logic reasoning.

[0084] During the inference process, the large language model uses typical attack chain patterns recorded in the ATT&CK tactical knowledge base as a reference, combined with the attacker's historical behavioral preferences (such as whether the attacker tends to use specific attack tools or prefers specific lateral movement methods), to generate a detailed description of subsequent attack steps in chronological order. The path confidence calculation comprehensively considers three factors: historical behavior matching degree, ATT&CK technical correlation strength, and vulnerability maturity, and outputs a value ranging from 0 to 1.

[0085] S44. Select the path with the highest confidence from all the simulated attack paths as the main simulated attack path.

[0086] Multiple simulated attack paths may originate from the same candidate path but lead to different subsequent attack targets (e.g., one leads to data leakage, while another leads to further lateral movement). The path with the highest confidence is selected as the primary simulated attack path for generating subsequent defense strategies. The remaining simulated attack paths are reserved as backup paths. When the defense strategy for the primary simulated attack path is executed and feedback indicates that the path has been successfully blocked, the backup paths can be used for supplementary simulations.

[0087] Example 6 As an optional implementation, step S5 generates an active defense strategy based on the inferred attack path and the path confidence level, specifically including the following sub-steps: S51. Extract the attack technology identifier and attack target identifier corresponding to each attack step in the deduced attack path.

[0088] The attack technique identifier is a unique identifier assigned to each attack technique within the MITRE ATT&CK framework (e.g., T1047 represents Windows Management Instrumentation, and T1021 represents Remote Services). The attack technique identifier is extracted from the attack technique nodes involved in each attack step of the deduced attack path. The attack target identifier is the identifier (IP address, hostname, or asset ID) of the target asset node for each attack step.

[0089] S52. Determine the response level of the defense strategy based on the path confidence level.

[0090] The response level is divided into three levels: high priority, medium priority, and low priority. High priority indicates that defensive measures must be deployed immediately; medium priority indicates that deployment can be moderately delayed or only lightweight defensive measures can be deployed; and low priority indicates that only the simulation results are recorded for security analysts' reference. The specific grading criteria are given in the main description of step S5.

[0091] S53. Based on the response level and the attack technology identifier, match the preset defense strategy template library to generate an active defense strategy that includes blocking rules, isolation rules and / or deception rules.

[0092] The defense policy template library is a collection of pre-configured policy rules that provide corresponding defense policy templates for each ATT&CK attack technique. For example, the defense template for T1047 (WMI Lateral Movement) is "Disable the WMI service on the terminal or restrict WMI to calls only from authorized management hosts"; the defense template for T1021 (Remote Service) is "Restrict access sources to the corresponding remote service port on the firewall". During policy generation, the corresponding defense template is found based on the attack technique identifier, the attack target identifier is filled into the template parameters, and an executable policy instruction is generated.

[0093] Example 7 As an optional implementation, the first confidence threshold is 0.7 and the second confidence threshold is 0.4; the defense strategy template library is pre-set with defense rule templates that correspond one-to-one with the ATT&CK attack technology identifier.

[0094] The aforementioned thresholds were determined based on statistical analysis of the confidence distribution of LLM projections in typical network attack scenarios. In a verification test containing 5000 labeled attack samples, the actual accuracy of projection paths with a confidence level higher than 0.7 reached 89.3%, the actual accuracy of projection paths with a confidence level between 0.4 and 0.7 was 62.1%, and the actual accuracy of projection paths with a confidence level lower than 0.4 was only 18.7%. Based on the above statistical results, setting 0.7 and 0.4 as the high-priority and medium-priority thresholds, respectively, achieves a reasonable balance between defense effectiveness and computational resource consumption.

[0095] The defense strategy template library is indexed by ATT&CK technology IDs. Each template entry includes the technology ID, technology name, recommended defense measure type (blocking / isolation / deception / monitoring), specific policy instruction template, policy execution priority suggestions, and a description of the expected effect of the policy. The template library allows security administrators to customize, expand, and adjust it according to the actual network environment.

[0096] Example 8 As an optional implementation, step S6 generates a knowledge graph update instruction based on the defense effect feedback data, which specifically includes the following sub-steps: S61. Analyze the defense effect feedback data and extract the attack steps that were successfully blocked, the attack steps that were not blocked, and the newly added attack behavior features.

[0097] The parsing of defense effectiveness feedback data is accomplished through a pre-defined data parser. The parser converts feedback data from different execution nodes (firewalls, EDR, IDS, etc.) into a standardized format, then groups and compares them according to attack step identifiers. Successfully blocked attack steps refer to records where execution nodes report successfully intercepted matching attack behaviors during the policy's effective period; unblocked attack steps refer to records where the security monitoring system detects attack behaviors matching a step in the simulated attack path during the policy's effective period but are not intercepted by any execution node; newly added attack behavior characteristics refer to new alerts and abnormal behaviors detected during the policy's effective period that do not belong to the original simulated attack path but may indicate that the attacker has changed their attack route.

[0098] S62. Based on the successfully blocked attack steps, the edge weights of the corresponding attack paths in the initial attack knowledge graph are updated by decay.

[0099] The specific calculation formula and parameters for edge weight decay update are given in the main description of step S6.

[0100] S63. Based on the unblocked attack steps and the newly added attack behavior characteristics, add attack nodes and / or attack relationship edges to the initial attack knowledge graph, and assign initial weights to the newly added nodes and relationship edges.

[0101] The type of newly added attack node depends on the unblocked attack steps and the type of newly added attack behavior characteristics. If the newly added element is an attack technique, an attack technique node is created; if the newly added element is an attack tool, an attack tool node is created; if the newly added element is an attack indicator (such as a new malicious domain name or file hash), an attack indicator node is created. The type of newly added relationship edge is determined based on the semantic relationship between the newly added node and existing nodes (such as exploitation relationship, attribution relationship, etc.).

[0102] S64. The operations of edge weight decay update and adding new nodes and relation edges are encapsulated into the knowledge graph update instruction.

[0103] The knowledge graph update instructions are written in the native operation language of graph databases (such as Neo4j's Cypher language), and include operation statements such as MATCH (matching nodes and edges to be updated), SET (setting new weight values), and CREATE (creating new nodes and edges). The update instructions undergo syntax validation and conflict detection before execution to ensure that no duplicate nodes, duplicate edges, or operations that violate graph structure constraints are generated.

[0104] Example 9 As an optional implementation, the edge weights The decay update is calculated according to the following formula:

[0105] in For the node before the update To the node edge weights, The preset attenuation coefficient and , The preset time decay factor and , The time interval since the last update, in seconds.

[0106] The design of this formula reflects the following technical considerations: when the defense effect feedback indicates that an attack step has been successfully blocked, the probability that the attack path corresponding to that attack step will be successfully exploited by the attacker again in the short term decreases, therefore the edge weights should be attenuated. The attenuation magnitude is related to two factors: one is the attenuation coefficient. Control the maximum attenuation amplitude ( The larger the value, the more severe the attenuation. Preferably... ); secondly, the time decay factor. Controlling the recovery rate of decay over time ( The larger the value, the faster the weight recovery, preferably... ).when (i.e., immediately after the blockage occurs) The attenuation is greatest when... When it increases, The edge weights gradually decrease in size and intensity, and then gradually recover. This design reflects practical experience in the field of cybersecurity: the effectiveness of defenses weakens over time (attackers may find ways to bypass them, or the temporary effects of defenses may gradually disappear), so edge weights should not decay permanently, but should gradually recover over time.

[0107] The initial weight of the newly added node is a preset baseline weight. (Preferred, The initial weight of the newly added relation edge is assigned based on the confidence level in the defense effect feedback data (the higher the confidence level, the higher the initial weight, with a value range of 0 to 1).

[0108] Example 10 This invention also provides a real-time attack path prediction and proactive defense system based on the synergistic evolution of a large language model and a dynamic knowledge graph, comprising the following modules: The data acquisition module is used to collect multi-source network security data in real time. Deployed on multiple acquisition nodes within the target network, the module acquires network traffic data, endpoint security logs, security device alarms, and external threat intelligence through methods such as port mirroring, log collection proxies, and API interfaces. After initial formatting and deduplication, the collected data is transmitted to the knowledge graph construction module via a message queue.

[0109] The knowledge graph construction module is used to extract entities and relationships from the multi-source network security data, construct an initial attack knowledge graph, and dynamically evolve and update the initial attack knowledge graph according to knowledge graph update instructions. Internally, the knowledge graph construction module integrates an entity recognition model based on a pre-trained language model and a relationship extraction model based on dependency parsing, enabling it to automatically extract network entities, attack entities, and their relationships from multi-source data. The knowledge graph construction module also includes a graph database management unit, responsible for the creation, updating, deletion, and index maintenance of nodes and edges.

[0110] The attack intent analysis module is used to input real-time detected attack events into a large language model for attack intent analysis and tactical phase identification, generating a tag for the attacker's current tactical intent. The attack intent analysis module integrates a large language model inference engine and an ATT&CK tactical knowledge base retrieval unit, capable of converting raw alarm data into natural language descriptions, identifying the tactical phase of the attack event through retrieval-enhanced generation, and generating tactical intent tags.

[0111] The path deduction module is used to perform subgraph retrieval and path matching in the initial attack knowledge graph based on the tactical intent tags and attack behavior characteristics in the attack event, generate a set of candidate attack paths, and input the set of candidate attack paths into the large language model for multi-step attack path deduction, outputting the deduced attack paths and their corresponding path confidence scores. The path deduction module integrates a graph search algorithm engine (supporting breadth-first search and depth-first search) and a large language model inference interface, enabling it to complete the entire process from subgraph retrieval to path deduction.

[0112] The strategy generation module is used to generate proactive defense strategies based on the inferred attack path and the path confidence level. The strategy generation module integrates a defense strategy template library and a strategy orchestration engine, capable of matching corresponding defense templates based on attack technique identifiers and path confidence levels to generate executable strategy instructions.

[0113] The policy execution module is used to distribute the proactive defense policy to the execution nodes for execution. The policy execution module communicates with execution nodes such as the firewall management system, the endpoint EDR management platform, and the cloud security group controller through standardized interfaces (RESTful API or gRPC), converting policy instructions into a format that each execution node can recognize and then distributing them for execution.

[0114] The feedback loop module is used to collect defense effect feedback data after the active defense strategy is executed, generate knowledge graph update instructions based on the defense effect feedback data, and output them to the knowledge graph construction module. The feedback loop module integrates a feedback data parser, an edge weight decay calculation unit, and a knowledge graph update instruction generator, enabling it to aggregate scattered defense effect data into structured update instructions.

[0115] The data flow between the modules is as follows: Data acquisition module → Knowledge graph construction module → Path inference module → Attack intent parsing module → Policy generation module → Policy execution module → Feedback loop module → (Feedback to) Knowledge graph construction module, forming a complete collaborative evolution loop.

[0116] Example 11 To verify the technical effectiveness of the method proposed in this invention, a comparative experiment was conducted in a simulated enterprise-level network environment.

[0117] 1. Experimental conditions Hardware environment: Control node: 1 server, configured with an Intel Xeon Gold 6248 processor (2.5GHz, 20 cores), 128GB DDR4 memory, 1TB NVMe SSD, and the operating system is Ubuntu 22.04 LTS; Compute nodes: 8 servers, each configured with an Intel Xeon Silver 4214 processor (2.2GHz, 12 cores), 64GB DDR4 memory, 512GB SSD, and CentOS 8 operating system; Network equipment: 2 10 Gigabit switches, 1 firewall (supporting policy API calls); Software environment: Large Language Model: A security-specific model fine-tuned based on Llama-3-70B using LoRA, deployed on 4 GPU servers (each configured with NVIDIA A100 80GB×2). Graph database: Neo4j 5.0 Enterprise, deployed on the control node; Knowledge graph construction framework: developed based on Python 3.10, integrating the Hugging Face Transformers library for entity recognition; ATT&CK Tactical Knowledge Base: Built on MITRE ATT&CK v14, it contains 14 tactical phases and approximately 600 attack techniques; Comparison Scheme 1: A "LLM generation + knowledge graph verification" system based on CN120639500A network attack path inference method, device, equipment and media based on large language model; Comparison Scheme 2: A "Knowledge Graph Reasoning + Reinforcement Learning Decision" system based on CN122293392A, which is a risk intelligent decision optimization method based on security knowledge graph reasoning; Parameter settings: Preset time window (behavior collection cycle): 300 seconds; Maximum path search depth: 8 hops; Multifactor weighted scoring weights: , , ; Candidate path scoring threshold: 0.6, first confidence threshold: 0.7, second confidence threshold: 0.4, edge weight decay coefficient. 0.7, time decay factor 0.1, Added node baseline weight 0.5; Closed-loop iteration cycle: 300 seconds; 2. Experimental subjects The experiment uses a simulated enterprise intranet environment, including the following network assets: Table 1. Description of Network Assets

[0118] The experimental dataset contains 15 days of continuous security data, including: Network traffic data (NetFlow): approximately 1.2 million records; Endpoint security log (Windows Event Log): approximately 800,000 records; Security device alerts: approximately 4,500; External threat intelligence: approximately 200; Three types of attack scenarios were artificially injected into the dataset: Scenario A (APT attack simulation): A multi-stage attack, including initial access (phishing email) → execution (macro command) → persistence (scheduled task) → privilege escalation (UAC bypass) → discovery (internal network scanning) → lateral movement (SMB / WMI) → collection (data aggregation) → data leakage (HTTPS tunnel), a total of 8 stages; Scenario B (Ransomware Attack Simulation): Includes five stages: initial access (RDP brute force) → execution (PowerShell download) → privilege escalation → lateral movement (SMB propagation) → encryption (file encryption); Scenario C (Internal Threat Simulation): Includes three phases: Credential Access (Mimikatz) → Lateral Movement (WMI) → Collection (Sensitive File Access); 3. Experimental Procedure (1) Before the test begins, use the data from the first 12 days to train the entity recognition model, relation extraction model and large language model (LoRA fine-tuning) to construct the initial attack knowledge graph.

[0119] (2) Starting at 0:00 on day 13, the method of the present invention (experimental group), control scheme 1 (control group 1) and control scheme 2 (control group 2) were run simultaneously. The three groups used the same initial knowledge graph and the same test dataset.

[0120] (3) At 10:00 on day 13, scenario A (APT attack) was injected, and the attack lasted for 4 hours; at 14:00 on day 14, scenario B (ransomware attack) was injected, and the attack lasted for 2 hours; at 22:00 on day 14, scenario C (internal threat) was injected, and the attack lasted for 1 hour.

[0121] (4) Continuously monitor and record the following evaluation indicators: Attack path prediction accuracy (the degree of matching between the predicted attack path and the actual attack path, measured by Jaccard similarity). Attack phase identification accuracy (number of correctly identified tactical phases / total number of tactical phases). Defense strategy effectiveness (number of attack steps successfully blocked / total number of attack steps). Policy response delay (the time interval from the occurrence of an attack step to the effective implementation of the corresponding defense policy); Knowledge graph evolution effectiveness (the improvement in the accuracy of subsequent inferences due to the addition of nodes and edge pairs). False alarm rate (number of defense strategies triggered incorrectly / total number of defense strategies); 4. Experimental Results Data Table 2 Experimental Results

[0122] Note: Comparison scheme 1 only simulates and demonstrates the attack path, and does not include the generation and execution of defense strategies. Therefore, the two indicators of defense strategy effectiveness and strategy response latency are not applicable (marked as "—"); Comparison scheme 2 does not include LLM attack phase identification, so the attack phase identification accuracy is not applicable (marked as "—"). 5. Experimental Data Analysis (1) Attack path deduction accuracy analysis: The attack path deduction accuracy of the method of this invention is 87.3% (measured by Jaccard similarity), which is 15.8% higher than the 71.5% of the comparison scheme 1 and 19.1% higher than the 68.2% of the comparison scheme 2. Reason for analysis: This invention uses a closed-loop mechanism of "defense effect feedback driving dynamic evolution of knowledge graph" to continuously optimize the knowledge graph after each iteration - the edge weights corresponding to the successfully blocked attack steps are reduced, and the steps that are not blocked and the new attack behaviors are supplemented as new nodes and edges. After multiple iterations, the "defense experience" accumulated in the knowledge graph makes the subsequent subgraph retrieval and path matching more accurate, while the knowledge graphs of the comparison schemes 1 and 2 are only updated by new security data and do not have the ability to evolve based on defense feedback.

[0123] (2) Analysis of the accuracy of attack phase identification: The accuracy of attack phase identification of the method of the present invention is 91.2%, which is 6.6% higher than that of the comparative scheme 1 (84.6%). Reason for analysis: In step S2, the present invention adopts a two-stage identification method of "alarm to natural language description → large language model + ATT&CK tactical knowledge base retrieval enhancement". Compared with the scheme of the comparative scheme 1 which directly uses the large language model for identification, the retrieval enhancement generation method provides the large language model with accurate tactical knowledge context, effectively reducing the misidentification caused by model illusion.

[0124] (3) Analysis of the effectiveness of the defense strategy: The defense strategy of the present invention has a blocking rate of 83.7%, which is 11.3% higher than the 72.4% of the comparative scheme 2. Reason for the analysis: The defense strategy of the comparative scheme 2 is based on the attack path deduced from the static knowledge graph and does not consider the feedback information after the defense is executed; while the present invention, through the defense effect feedback collection and knowledge graph update mechanism in step S6, enables the defense strategy generated later to "absorb" the experience of previous defense failures (the attack steps that were not blocked are added to the knowledge graph, and the corresponding defense measures are prioritized for deployment in subsequent iterations), thus realizing the continuous self-optimization of the strategy.

[0125] (4) Strategy response delay analysis: The strategy response delay of the method of the present invention is 4.2 seconds, which is 51.7% lower than that of the comparative scheme 2 (8.7 seconds). Reason for analysis: The decision optimization of the comparative scheme 2 is based on reinforcement learning, which requires multiple rounds of iterative inference to output the optimal adversarial decision sequence; while the present invention adopts the strategy generation method of "LLM inference + template matching". The LLM single inference time is about 2-3 seconds, the template matching time is about 1 second, and the total delay is controlled within 5 seconds, which is more suitable for active defense scenarios with high real-time requirements.

[0126] (5) Analysis of the effectiveness of knowledge graph evolution: In the method of this invention, after multiple rounds of closed-loop iteration, the addition of attack nodes and relation edges to the knowledge graph improves the accuracy of subsequent inferences by 12.6%. Specifically, in the third iteration of scenario A (APT attack), due to the addition of WMI lateral movement (T1047) and related nodes and edges of the Mimikatz tool in the first two rounds of defense feedback, the system can identify in advance the tactical change that the attacker may switch from SMB lateral movement to WMI lateral movement during the third round of inference, and the inference accuracy increases from 78.1% in the first round to 89.4% in the third round. In contrast, the knowledge graphs of schemes 1 and 2 are only updated by the addition of security data and do not have the ability to evolve based on defense feedback, so this indicator is 0%.

[0127] (6) False Alarm Rate Analysis: The false alarm rate of the method of this invention is 6.8%, which is 52.1% lower than that of Comparative Scheme 1 (14.2%) and 40.9% lower than that of Comparative Scheme 2 (11.5%). Reasons for this: In Comparative Scheme 1, the inference path generated by LLM is only validated once by the knowledge graph and then output, lacking a subsequent feedback correction mechanism. This leads to some low-confidence inference paths being used in defense decisions, resulting in more false alarms. In Comparative Scheme 2, the reinforcement learning decision model tries various combinations of defense actions during the exploration phase, and some ineffective combinations trigger unnecessary defense measures. This invention effectively controls the false alarm rate through a dual mechanism: "path confidence hierarchical response" (only high-confidence paths trigger high-priority defense in step S5) and "knowledge graph evolution driven by defense effect feedback" (edge ​​weight decay in step S6 gradually reduces the score of inefficient paths).

[0128] In summary, by introducing a collaborative evolution closed-loop mechanism of "defense effect feedback driving dynamic evolution of knowledge graph", this invention significantly outperforms existing technical solutions in key indicators such as attack path deduction accuracy, attack phase identification accuracy, defense strategy effectiveness, strategy response delay, and false alarm rate, verifying the effectiveness and superiority of the proposed method in real network environments.

[0129] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for real-time attack path deduction and proactive defense based on the co-evolution of a large language model and a dynamic knowledge graph, characterized in that, Includes the following steps: S1. Collect multi-source network security data in real time, extract entities and relationships from the multi-source network security data, and construct an initial attack knowledge graph; S2. Input the real-time detected attack events into the large language model to analyze the attack intent and identify the tactical stage, and generate the attacker's current tactical intent label; S3. Based on the tactical intent tag and the attack behavior characteristics in the attack event, perform subgraph retrieval and path matching in the initial attack knowledge graph to generate a set of candidate attack paths; S4. Input the set of candidate attack paths into the large language model, combine the attacker's historical behavior sequence to perform multi-step attack path deduction, and output the deduced attack path and the corresponding path confidence. S5. Based on the inferred attack path and the path confidence level, generate an active defense strategy and distribute it to the execution node; S6. Collect defense effect feedback data after the active defense strategy is executed, generate knowledge graph update instructions based on the defense effect feedback data, and use the knowledge graph update instructions to dynamically evolve and update the initial attack knowledge graph to obtain the updated attack knowledge graph. S7. Use the updated attack knowledge graph as the initial attack knowledge graph for the next round of inference, and repeat steps S3 to S6 to form a closed loop of co-evolution between the large language model and the attack knowledge graph.

2. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 1, is characterized in that... Step S1 involves constructing an initial attack knowledge graph, specifically including: S11. Extract network entities and attack entities from the multi-source network security data. The network entities include asset nodes, vulnerability nodes, and network topology nodes. The attack entities include attacker nodes, attack tool nodes, attack technology nodes, and attack indicator nodes. S12. Extract the relationships between the network entities, between the attacking entities, and between the network entities and the attacking entities. The relationships include at least dependency relationships, connectivity relationships, exploitation relationships, and attribution relationships. S13. Construct the initial attack knowledge graph using the network entity and the attack entity as nodes and the association relationship as edges.

3. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 1, is characterized in that... In step S2, the real-time detected attack events are input into a large language model for attack intent analysis and tactical phase identification, specifically including: S21. Convert the original alarm data of the attack event into natural language description text; S22. Input the natural language description text into the large language model, and the large language model calls the preset ATT&CK tactical knowledge base to perform semantic matching and reasoning to identify the tactical stage to which the attack event belongs; S23. Generate the attacker's current tactical intent tag based on the tactical phase and the context information of the attack event.

4. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 1, is characterized in that... Step S3 involves subgraph retrieval and path matching within the initial attack knowledge graph, specifically including: S31. Using the tactical intent tag as the query entry point, locate the corresponding tactical node in the initial attack knowledge graph; S32. Taking the source asset node in the attack event as the starting node and the target asset node associated with the tactical node as the ending node, based on the connectivity and exploitation relationships in the initial attack knowledge graph, a breadth-first search or depth-first search algorithm is used to retrieve all reachable paths from the starting node to the ending node. S33. All reachable paths are scored using a multi-factor weighted scoring method based on path length, vulnerability exploitability, and asset criticality. Paths with scores higher than a preset threshold are selected to generate the candidate attack path set.

5. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 1, characterized in that, Step S4 involves inputting the candidate attack path set into the large language model for multi-step attack path deduction, specifically including: S41. Convert each path in the candidate attack path set into a structured attack step sequence description; S42. The attack step sequence description is concatenated with the attacker's historical behavior sequence to generate a fused context prompt. S43. Input the fusion context prompt into the big language model, and the big language model generates the subsequent attack steps and corresponding path confidence for each candidate attack path according to temporal logic reasoning. The path confidence is a value between 0 and 1, which is used to characterize the reliability assessment of the big language model for the inferred attack path. S44. Select the path with the highest confidence from all the simulated attack paths as the main simulated attack path.

6. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 1, is characterized in that... Step S5 generates an active defense strategy based on the inferred attack path and the path confidence level, specifically including: S51. Extract the attack technology identifier and attack target identifier corresponding to each attack step in the simulated attack path; S52. Determine the response level of the defense strategy based on the path confidence. When the path confidence is higher than the first confidence threshold, the response level is high priority. When the path confidence is between the first confidence threshold and the second confidence threshold, the response level is medium priority. When the path confidence is lower than the second confidence threshold, the response level is low priority. S53. Based on the response level and the attack technology identifier, match the preset defense strategy template library to generate an active defense strategy that includes blocking rules, isolation rules and / or deception rules.

7. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 6, is characterized in that... The first confidence threshold is 0.7, and the second confidence threshold is 0.4; the defense strategy template library contains pre-set defense rule templates that correspond one-to-one with the ATT&CK attack technology identifiers.

8. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 1, is characterized in that... Step S6 generates a knowledge graph update instruction based on the defense effect feedback data, specifically including: S61. Analyze the defense effect feedback data and extract the attack steps that were successfully blocked, the attack steps that were not blocked, and the newly added attack behavior features. S62. Based on the successfully blocked attack steps, the edge weights of the corresponding attack paths in the initial attack knowledge graph are updated by decay. S63. Based on the unblocked attack steps and the newly added attack behavior characteristics, add attack nodes and / or attack relationship edges to the initial attack knowledge graph, and assign initial weights to the newly added nodes and relationship edges. S64. The operations of edge weight decay update and adding new nodes and relation edges are encapsulated into the knowledge graph update instruction.

9. The method for real-time attack path deduction and proactive defense based on the synergistic evolution of a large language model and a dynamic knowledge graph as described in claim 8, is characterized in that... The edge weight The decay update is calculated according to the following formula: ,in For the node before the update To the node edge weights, The preset attenuation coefficient and , The preset time decay factor and , The time interval is since the last update; the initial weight of the newly added node is a preset baseline weight. The initial weight of the newly added relation edge is assigned based on the confidence level in the defense effect feedback data.

10. A real-time attack path inference and proactive defense system based on the synergistic evolution of a large language model and a dynamic knowledge graph, characterized in that, include: The data acquisition module is used to collect multi-source network security data in real time. The knowledge graph construction module is used to extract entities and relationships from the multi-source network security data, construct an initial attack knowledge graph, and dynamically evolve and update the initial attack knowledge graph according to the knowledge graph update instruction. The attack intent parsing module is used to input real-time detected attack events into a large language model for attack intent parsing and tactical phase identification, and to generate the attacker's current tactical intent label. The path deduction module is used to perform subgraph retrieval and path matching in the initial attack knowledge graph based on the tactical intent label and the attack behavior characteristics in the attack event, generate a set of candidate attack paths, input the set of candidate attack paths into the large language model to perform multi-step attack path deduction, and output the deduced attack path and the corresponding path confidence. The strategy generation module is used to generate an active defense strategy based on the inferred attack path and the path confidence level. The strategy execution module is used to distribute the proactive defense strategy to the execution node for execution; The feedback loop module is used to collect defense effect feedback data after the active defense strategy is executed, generate the knowledge graph update instruction based on the defense effect feedback data, and output it to the knowledge graph construction module.

Citation Information

Patent Citations

  • Network attack path deduction method and device based on large language model, equipment and medium

    CN120639500A

  • Intelligent risk decision optimization method based on security knowledge graph reasoning

    CN122293392A