Method for implementing security agent system for operating system
By combining the RAG large language model and knowledge graph-based local agent, intelligent security protection for the operating system is achieved, which solves the shortcomings of traditional protection mechanisms against advanced threats, constructs an adaptive closed-loop protection system, and improves detection accuracy and adaptability.
Patent Information
- Application Number
- PCT/CN2025/144815
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-21
- Filing Date
- 2025-12-23
- Publication Date
- 2026-11-26
AI Technical Summary
Traditional operating system security mechanisms are ill-equipped to deal with advanced persistent threats and zero-day attacks. Existing local agents rely on static rules and signature databases, which have limited detection effectiveness and cannot effectively address complex attack patterns.
A local agent combining the RAG large language model and knowledge graph is adopted. Through multi-task learning, the model can perform real-time security analysis and policy adjustment, and collaborate with the cloud agent for protection when needed, so as to achieve dynamic response and adaptive protection.
It improves the security detection accuracy and adaptability of the operating system, enabling it to identify complex attack patterns, dynamically adjust security strategies, build a closed-loop security protection system, and ensure the stable operation of the system in high-threat environments.
Smart Images

Figure PCTCN2025144815-APPB-I100001 
Figure PCTCN2025144815-APPB-I100002 
Figure PCTCN2025144815-APPB-I100003
Abstract
Description
An Implementation Method for an Operating System-Oriented Security Agent System Technical Field
[0001] This invention relates to the field of operating system security, and in particular to a method for implementing a security agent system for operating systems. Background Technology
[0002] In modern operating systems, with the rapid development of technology, the complexity and diversity of security threats have increased significantly. Traditional security monitoring and protection mechanisms are struggling to cope with increasingly complex attack methods and ever-changing threat scenarios. Therefore, operating system security protection urgently needs more intelligent and automated solutions to ensure system robustness and security. Technical issues
[0003] Traditional operating system security mechanisms are typically based on static rules and predefined protection policies. While these methods can handle common known threats, they often demonstrate limited capabilities against advanced persistent threats and zero-day attacks. Especially in today's network environment, attackers frequently bypass traditional protection measures to carry out malicious activities. For example, they may impersonate legitimate operations using specific malicious behavior patterns or gain critical system privileges through social engineering, thereby enabling them to steal data or perform destructive operations. Therefore, intelligent operating system security centers have become crucial for addressing these complex threats.
[0004] In recent years, the rise of large language model technology has brought new opportunities for the intelligent development of security systems. Large language models can achieve threat intelligence analysis, abnormal behavior identification, and real-time response decision-making capabilities through deep learning of massive amounts of security data. Security systems based on large language models can automatically learn attacker behavior patterns through comprehensive analysis of multi-source data, thereby identifying potential threats more quickly and accurately and taking corresponding protective measures.
[0005] As a core component of the operating system's security center, the local agent is responsible for collecting, analyzing, and responding to security data. Traditional local agents often rely on rule engines and static signature libraries, and their detection effectiveness depends heavily on the update speed of the known threat database. However, with the development of attack techniques, attackers can circumvent signature detection techniques or exploit system vulnerabilities to launch attacks. Therefore, adopting a more intelligent local agent system has become a necessary trend. Technical solutions
[0006] To address the aforementioned issues, the present invention aims to provide a method for implementing a security agent system oriented towards an operating system. This method enables higher security detection accuracy and wider adaptability through a local agent, which can also collaborate with a cloud agent for protection.
[0007] The present invention discloses an implementation method for an operating system-oriented security agent system, wherein the security agent system includes a local agent and a security knowledge base; the local agent has a multi-task learning assistance model;
[0008] The implementation method includes the following steps:
[0009] Step S1: Initialize the local Agent and mount the security knowledge base; the security knowledge base is constructed by combining the RAG large language model and knowledge graph;
[0010] Step S2: The local agent loads the multi-task learning helper model, enabling the local agent to generate and adjust security policies;
[0011] Step S3: The local agent perceives and monitors the operating system's resources and collects operating system resource data;
[0012] Step S4: The local agent calls the RAG large language model to perform a preliminary analysis of the operating system's security status based on resource data to determine whether there are any threat events; if there are threat events, further analysis is performed to obtain the analysis results of the threat events;
[0013] Step S5: The local agent uses multi-task learning to help the model generate and adjust security policies based on the analysis results of threat events and the operating system load.
[0014] A further improvement of this invention lies in the following process of combining the security knowledge base with the knowledge graph and the RAG large language model:
[0015] Step S101, Entity Identification: Extract entities from the security data; the entities include attackers, target systems, attack methods, vulnerability types, and mitigation measures; each entity is assigned a unique identifier; the security data includes security-related text data, threat intelligence, event logs, and intrusion detection rules;
[0016] Step S102, Relationship Extraction: Analyze the relationships between entities in the security data, extract the mutual connections between entities, and construct a knowledge graph based on this; the relationships between entities are abstracted in the knowledge graph as the mutual connections between entity nodes and adjacent entity nodes;
[0017] Step S103: Generate a vector representation with neighborhood information based on the constructed knowledge graph neighborhood expansion, and input the vector representation into the RAG large language model so that the RAG large language model has context matching ability when calling the security knowledge base for retrieval and parsing.
[0018] A further improvement of the present invention is that the construction process of the multi-task learning assistance model is as follows:
[0019] Step S201: Determine the multiple tasks that the multi-task learning help model solve;
[0020] The multi-task learning-assisted model is used to solve multiple tasks related to threat events; these tasks include classification, regression, and generation; the classification task classifies threat events to determine threat categories and threat levels; the regression task scores threat risks for threat events; and the generation task determines and generates corresponding security policies based on the threat risk scores.
[0021] Step S202: Prepare datasets based on the multiple tasks being solved; the datasets include classification datasets, regression datasets, and generated datasets;
[0022] Step S203: Construct the architecture of the basic pre-trained model;
[0023] The basic pre-trained model includes a shared layer and task-specific layers; the task-specific layers include a classification task output layer, a regression task output layer, and a generation task output layer; the shared layer has multiple layers and is used to extract common features of threat events; the classification task output layer uses a softmax layer to classify threat events and determine the threat category and threat level; the regression task output layer uses a linear layer to output a threat risk score; and the generation task output layer uses a decoder layer to generate security policies.
[0024] Step S204: Input the dataset into the basic pre-trained model for training to obtain a multi-task learning assistance model.
[0025] A further improvement of the present invention is that step S4 includes the following steps:
[0026] Step S41, Data Cleaning and Standardization: Perform data cleaning and standardization on the collected operating system resource data;
[0027] Step S42: The local agent calls the RAG large language model to perform a preliminary analysis of the operating system's resource data after data cleaning and standardization, in order to detect whether there are any threat events in the operating system in the form of a detection task.
[0028] Step S43: If a threat event exists, the local agent will subdivide the detection task into multiple sub-tasks to further analyze the threat event and obtain the analysis results of multiple sub-tasks.
[0029] Step S44: Based on the analysis results of multiple sub-tasks, the local Agent obtains the analysis results of threat events.
[0030] A further improvement of the present invention is that the sub-tasks include abnormal network traffic analysis, system vulnerability remediation suggestion generation, and threat tracing;
[0031] Anomaly network traffic analysis: Local agent analysis of threat events to determine if there is persistent malicious traffic or DDoS attacks;
[0032] System vulnerability remediation suggestion generation: If the threat event is a vulnerability, the local agent checks the vulnerability and generates preliminary remediation suggestions;
[0033] Threat attribution: Local agents track the origin and propagation path of threat events.
[0034] A further improvement of the present invention is that, in step S5, the local agent calculates the threat risk score of the threat event based on the analysis results of the threat event and the load of the operating system through a multi-task learning-assisted model, and selects and adjusts the security policy based on the threat risk score of the threat event;
[0035] Threat risk scoring for threat events is based on a dynamic response algorithm that assesses the risk value of the threat event; the risk value corresponds to a high-risk threat or a low-risk threat; if the risk value of the threat event corresponds to a high-risk threat, the security strategy adopted is traffic filtering or intrusion detection; if the risk value of the threat event corresponds to a low-risk threat, the security strategy adopted is alert notification or log monitoring.
[0036] A further improvement of the present invention is that the calculation formula for the threat risk score is as follows:
[0037] Threat risk score = a. Threat level score + b. Impact factor score + c. System load score;
[0038] Where, a is the weighting factor for threat level score, b is the weighting factor for impact factor score, and c is the weighting factor for system load score; threat level score is determined based on the threat category and threat level of the threat event; impact factor score is determined based on the potential impact of the threat event on the system resources and services of the operating system; and system load score is determined based on the current load of the operating system.
[0039] The dynamic response algorithm refers to setting a risk scoring threshold to distinguish the risk value of a threat event. If the threat risk score of a threat event is greater than the risk scoring threshold, the threat event corresponds to a high-risk threat; if the threat risk score of a threat event is less than or equal to the risk scoring threshold, the threat event corresponds to a low-risk threat.
[0040] A further improvement of the present invention is that the security agent system further includes a cloud agent;
[0041] In step S5, if the local agent determines that the threat event cannot be handled, the local agent will request the cloud agent to assist in the analysis.
[0042] The specific steps for cloud-based agent-assisted analysis are as follows:
[0043] Threat data upload: The local agent uploads threat event-related data to the cloud agent, which then standardizes the format of the uploaded threat event-related data.
[0044] Cloud-based agent analytics: Cloud-based agents analyze threat event-related data after it has been formatted and standardized using distributed computing resources;
[0045] Feedback on cloud threat reports: After the cloud agent completes the analysis, it generates a cloud threat report and sends the report back to the local agent.
[0046] A further improvement of the present invention is that it also includes step S6; Step S6: The local agent generates a security status summary report, which records the security status and threat events of the operating system. Beneficial effects
[0047] The beneficial effects of this invention are:
[0048] This invention utilizes a local agent powered by a large language model to achieve higher security detection accuracy and broader adaptability. The local agent can not only monitor the operating system's running status in real time but also intelligently analyze abnormal behavior to determine whether the operating system is under attack or in an abnormal state. Furthermore, the local agent can dynamically adjust security policies based on the operating system's operating status, achieving adaptive protection. Simultaneously, the local agent can also collaborate with other components of the security center to construct a closed-loop security protection system encompassing monitoring, detection, decision-making, and response, achieving comprehensive protection for the operating system's security. The best embodiment of the present invention
[0049] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0050] This invention proposes a method for implementing a security agent system oriented towards an operating system. By deploying an intelligent local agent within the operating system, the system monitors the operating system's running status in real time and performs security analysis. The local agent utilizes large language modeling technology to perform deep learning and analysis on data such as system logs and operational behaviors, enabling it to identify complex attack patterns, especially zero-day attacks and advanced persistent threats, significantly improving detection accuracy. The security agent system can automatically adjust security strategies based on real-time analysis results, ensuring effective security responses under different threat events. Furthermore, the local agent possesses adaptive capabilities, intelligently coordinating cloud-based agent computing resources for collaborative protection based on task complexity, urgency, and local computing power, ensuring efficient completion of security detection tasks even in resource-constrained environments.
[0051] This invention constructs a closed-loop security protection system encompassing monitoring, detection, and response through the collaboration of local and cloud-based agents. The security agent system not only addresses traditional known threats but also possesses the ability to automatically learn and adapt to new types of attacks, thereby achieving comprehensive intelligent security protection for the operating system. Through dynamic task allocation and resource management mechanisms, the security agent system ensures that, when facing complex attacks, it can fully utilize local resources while leveraging the support of cloud agents, ensuring the stable and secure operation of the operating system even in high-threat environments.
[0052] The security agent system includes a local agent, a security knowledge base, and a cloud agent. The local agent features a multi-task learning assistance model and comprises multiple modules.
[0053] This invention discloses a method for implementing a security agent system oriented towards an operating system, comprising the following steps:
[0054] Step S1: Initialize the local Agent and mount the security knowledge base to enable it to analyze various threat events, their attack patterns, and common vulnerabilities.
[0055] The security knowledge base combines the RAG large language model and knowledge graph to achieve more accurate contextual understanding and reasoning capabilities. It integrates entity relationship information from the knowledge graph with the generation and retrieval capabilities of the RAG large language model. By constructing a knowledge graph in the security domain and incorporating entity relationships from the knowledge graph during queries, it achieves deep semantic understanding and dynamic context matching.
[0056] The specific process is as follows:
[0057] Step S101, Entity Identification: Extract core entities in the security domain from security data. Security data includes security-related text data, threat intelligence, event logs, and intrusion detection rules. Entities include attackers, target systems, attack methods, vulnerability types, and mitigation measures. Each entity is assigned a unique identifier for easy tracking and association.
[0058] Step S102, Relationship Extraction: Analyze the relationships between entities in the security data, extract the connections between entities, and construct a knowledge graph based on these connections. In the knowledge graph, the relationships between entities are abstracted as the connections between entity nodes and their adjacent entity nodes.
[0059] The relationships between entities include:
[0060] Belongs to: A certain attack method belongs to a certain type of attack.
[0061] Includes: A vulnerability may include multiple mitigation measures.
[0062] Dependency: An operating system depends on specific security configurations.
[0063] Impact: The effect of a particular attack method on the security of the target operating system.
[0064] Step S103: Generate a vector representation with neighborhood information based on the neighborhood expansion of the knowledge graph, and input the vector representation into the retrieval module of the RAG large language model, so that the retrieval module can perform accurate context matching when calling the security knowledge base for retrieval and analysis.
[0065] By extending the neighborhood of the knowledge graph, the entity node corresponding to the queried entity and its adjacent entity nodes (neighbor nodes) can be represented as a vector representation of a context subgraph, enabling the retrieval module of the RAG large language model to have a wider range of context matching and generation capabilities.
[0066] Assuming the queried entity node v has N neighbor nodes in the knowledge graph, the following formula is used to generate a vector representation of the context subgraph of entity node v:
[0067]
[0068] E context A vector representation of the context subgraph of the queried entity;
[0069] E v The vector representation of the entity node v being queried;
[0070] The vector representation of the i-th neighbor node;
[0071] This represents the graph distance (such as the number of hops or edge weights in a knowledge graph) between the queried entity node v and its neighboring nodes, and is used to measure the relevance of neighboring nodes to the queried entity node v.
[0072] α and β are balancing factors used to control the weights of the queried entity node v and its neighboring entity nodes (neighbor nodes), generating a vector representation E with neighborhood information. context This vector represents E context It not only contains basic information about the queried entity, but also introduces a broader context through the influence of neighboring nodes. This vector represents E. context The retrieval module of the RAG large language model is fed into the database for more accurate context matching, thereby significantly improving the semantic relevance of the retrieval.
[0073] Vector representation E context After being fed into the retrieval module of the RAG large language model, the RAG large language model still needs to perform retrieval using a multi-path expansion algorithm (search algorithm). The multi-path expansion algorithm is knowledge graph-guided and is an information retrieval algorithm with contextual information association capabilities. It can search for contextual information spanning multiple entity nodes and integrate this information into a context subgraph, combining it to generate multi-level path context vector representations. These multi-level path context vector representations are then fed into the generation module of the RAG large language model to meet the needs of querying complex contexts.
[0074] Suppose we want to query the set of multi-level context paths related to an entity node v in a knowledge graph. The steps of the multi-path expansion algorithm are as follows:
[0075] 1. Initialization: Set the maximum expansion depth k and initialize the set of entity nodes for the path. That is, start from the entity node v being queried.
[0076] 2. Iterative Expansion: For each entity node in the i-th layer Search for all entity nodes adjacent to entity node u and add them to set P. i+1 It also records the path information from the queried entity node v to the entity node u.
[0077] 3. Path Selection: Filter all paths leading to the terminating entity node, retaining the set P of paths with the highest relevance based on indicators such as edge weights, path lengths, or node importance scores in the knowledge graph. k .
[0078] 4. Path Embedding: Entity nodes and relationships on the path are transformed into vector representations and combined into a multi-layered path context representation, which serves as the input to the generation module of the RAG large language model.
[0079] 5. The final context vector representation of the multi-layer path is generated using the following formula:
[0080]
[0081] in:
[0082] E path : The multi-level path context vector representation of the query.
[0083] P j : The set of path nodes in the j-th layer.
[0084] γ j Layer weight factor, used to adjust the influence of different layers (usually decreases gradually as the number of layers increases).
[0085] Step S2: The local agent loads the multi-task learning helper model, enabling the local agent to generate and adjust security policies.
[0086] In the design of the local agent, the core capability relies on multi-task learning to help fine-tune the model in multiple dimensions, especially in the collaborative optimization of key tasks such as threat category, severity assessment (threat level), and security policy generation. Multi-task fine-tuning enables the local agent to react quickly and accurately in a variety of complex security scenarios, achieving dynamic security policy adjustments and real-time protection.
[0087] The multi-task learning-assisted model building process is as follows:
[0088] Step S201: Determine the task that the multi-task learning aid model can solve;
[0089] To enhance the local agent's global understanding of security, multi-task learning helps the model solve multiple security-related tasks simultaneously. These tasks are not only interconnected but also share features, thereby improving the model's ability to respond to threat events. The following are some of the main tasks:
[0090] Classification task: This task is used to classify threat events, including threat categories (such as DDoS, malware, data breaches, etc.) and threat levels (such as high, medium, and low). Therefore, the purpose of the classification task is to help multi-task learning models identify the threat categories and threat levels of threat events, and then prioritize them in response strategies.
[0091] Regression Task: The regression task is mainly used to predict numerical indicators of threat events, such as threat risk scores. Through regression predictions, multi-task learning helps the model assign a risk score (threat risk score) to each threat event, further assisting the local agent in assessing the severity of the threat event.
[0092] Generate tasks: Generate tasks allow multi-task learning to help the model generate recommended response strategies based on the threat category and severity of threat events. These strategies may include specific measures such as isolating the target system, blocking malicious access, and performing virus scans. Generate tasks enable the local agent to provide flexible and targeted security strategies for each threat event.
[0093] Step S202: Prepare the corresponding dataset based on the multiple tasks solved.
[0094] To support multi-task learning, a dedicated dataset is needed for each task, enabling the model to share information and train efficiently across different tasks. Datasets include classification datasets, regression datasets, and generation datasets.
[0095] The classification dataset includes "threat category" and "threat level" labels for each sample (threat event), which helps the multi-task learning model determine the threat category and threat level of a threat event.
[0096] Regression dataset: Records the threat risk score for each threat event (e.g., calculated based on attack type, scope of impact, etc.), providing quantitative threat assessment for multi-task learning models.
[0097] Generate a dataset containing recommended security policies for specific threat categories, threat levels, and threat risk scores. These security policies can be described using natural language, and multi-task learning is used to train the model to generate specific security policies.
[0098] Step S203: Determine the architecture of the base pre-trained model;
[0099] In multi-task fine-tuning, in addition to the basic bottom and middle-high layers, the base pre-trained model is designed with a shared layer and a task-specific layer structure to ensure efficient information sharing among multiple tasks and improve feature extraction capabilities.
[0100] Shared layers: The first few layers of the base pre-trained model (such as the Transformer encoder layer) are used to extract general features. These layers are shared by multiple tasks, so that each task can benefit from the general features and improve the generalization ability of the feature representation.
[0101] Task-Specific Layer: Building upon the shared layer, a dedicated output layer is designed for each task, optimized to meet the specific needs of different tasks. The task-specific layer includes a classification task output layer, a regression task output layer, and a generation task output layer.
[0102] Classification task output layer: A softmax layer is used to predict threat events and determine the threat category and threat level. Threat levels include high, medium, and low.
[0103] Regression Task Output Layer: A linear layer is used to output a threat risk score, which is used to quantitatively assess the harm of threat events. The threat risk score is a quantitative value, obtained by combining threat level, impact factor, and system load.
[0104] Output layer for generating tasks: Use the decoder layer of Transformer to generate natural language response strategies, and generate specific security policies for threat events.
[0105] Step S204: Input the dataset into the basic pre-trained model for training to obtain a multi-task learning assistance model.
[0106] The dataset is input into a base pre-trained model for training, thereby fine-tuning the base pre-trained model. To improve the efficiency and effectiveness of fine-tuning, the base pre-trained model employs a strategy of freezing some layers while training others. Specifically, the low-level and shared layers of the base pre-trained model can be frozen, with a focus on training task-specific layers and some mid-to-high-level network parameters. This strategy helps preserve the general features learned in the base pre-trained model while enabling adaptive fine-tuning for specific tasks.
[0107] The loss for each task is assigned a weighting factor λ based on the task's importance. class , λ reg and λ gen These weights control the contribution of each task to the final optimization. Task parameters are updated using the following formula:
[0108]
[0109] in:
[0110] W updated : Updated model parameters; W orig η: Original model parameters; η: Learning rate;
[0111] ▽W L class 、▽ W L reg 、▽ W L gen : These represent the gradients of the loss function with respect to the model parameters for classification, regression, and generation tasks, respectively;
[0112] λ class , λ reg , λ gen : These represent the weight factors for classification, regression, and generation tasks, respectively, controlling the contribution of each task to parameter updates.
[0113] Training is complete, resulting in a multi-task learning aid model.
[0114] Step S3: The local agent perceives and monitors the operating system's resources, and collects and analyzes the operating system's resource data.
[0115] When the local agent starts, it invokes the system environment awareness module to intelligently perceive and monitor the operating system's resource status. The system environment awareness module monitors resource status based on system events and dynamically adjusts monitoring strategies based on dynamic perception algorithms.
[0116] System event-triggered monitoring includes monitoring file system events and subscribing to critical system events.
[0117] File system event monitoring: For files and disk resources, changes to files or directories can be monitored using system event monitoring tools (such as inotify on Linux). When a file or directory in the file system changes, a related event is triggered to initiate subsequent monitoring operations. For example, when a log file changes, further monitoring of disk usage or other resource status can be triggered without frequently polling the file system, avoiding unnecessary performance overhead.
[0118] Subscription to critical system events: Monitoring is dynamically initiated by subscribing to critical system events (such as high CPU or memory load). When the load approaches a preset threshold, relevant monitoring tasks are triggered to provide more timely feedback and response during periods of high load. This mechanism effectively avoids excessive monitoring when the operating system is overloaded, reducing resource waste.
[0119] The local agent uses dynamic awareness algorithms to dynamically adjust monitoring strategies based on the operating system's resource status, reducing the impact on operating system performance and providing timely security responses when needed.
[0120] The dynamic sensing algorithm is as follows: set a threshold T. threshold If the usage R(t) of a certain resource exceeds the usage threshold Tthreshold When this happens, monitoring is triggered:
[0121] if R(t) > T threshold , then trigger intensive monitoring
[0122] Meanwhile, the monitoring frequency f(t) will be dynamically adjusted according to resource usage:
[0123]
[0124] in:
[0125] R(t): The resource status of the operating system at time t.
[0126] T threshold The set usage threshold is used to determine whether monitoring needs to be triggered.
[0127] f1: Low-frequency monitoring (when resource usage is low); f2: High-frequency monitoring (when resource usage is high).
[0128] The local agent can dynamically adjust monitoring policies based on actual resource conditions, thereby reducing the impact on operating system performance and providing timely security responses when needed.
[0129] In this step, the collected operating system resource data includes system environment data, real-time data of critical resources, and system logs. Critical resources refer to CPU, memory, and disk usage, etc. System environment data refers to basic information such as operating system hardware configuration, network status, running processes, network traffic data, and static code files.
[0130] After the local agent collects system logs, it can use a log collection framework (Elastic Stack) to perform structured processing on the system logs, resulting in structured system logs that improve the efficiency and accuracy of subsequent analysis. System logs include system events, network connections, process behavior, user login records, etc.
[0131] Step S4: The local agent performs a preliminary analysis of the operating system's security status based on resource data to determine whether any threat events exist; if threat events exist, the analysis results of the threat events are further determined.
[0132] Specifically, it includes the following steps:
[0133] Step S41, Data Cleaning and Standardization: The collected operating system resource data is cleaned and standardized to ensure consistent structure and absence of redundant information. System logs are formatted, and key events (such as login failures, abnormal processes, etc.) are extracted; network traffic data is parsed into structured data format using traffic analysis tools; static code files are scanned using code scanning tools (SonarQube) to identify potential security vulnerabilities.
[0134] Step S42: The RAG Large Language Model performs a preliminary analysis to determine the presence of threat events. After data preprocessing, the local agent invokes the RAG Large Language Model to perform a preliminary analysis of the cleaned and standardized operating system resource data. Through historical threat patterns, the RAG Large Language Model detects the presence of threat events (abnormal behavior, potential malicious activity, or security vulnerabilities, etc.) in the operating system through detection tasks. This preliminary analysis helps to identify initial security risks, providing a basis for subsequent response and handling.
[0135] Step S43: If a threat event exists, the local Agent calls the task decomposition module to subdivide the detection task corresponding to the threat event into multiple sub-tasks for further analysis and confirmation of the threat event.
[0136] Based on the type and complexity of the threat and the current state of the operating system, the detection task corresponding to the threat event is subdivided into multiple sub-tasks, including: network traffic analysis, generation of system vulnerability remediation suggestions, and threat tracing.
[0137] The subtasks are assigned as follows:
[0138] Abnormal network traffic analysis: The local agent calls the traffic analysis module to further analyze whether there is continuous malicious traffic or DDoS attack.
[0139] System vulnerability remediation suggestion generation: For detected vulnerabilities, the local agent calls the static code analysis module to conduct in-depth inspection of unpatched vulnerabilities and generate preliminary remediation suggestions.
[0140] Threat Attribution: During real-time monitoring, the local agent automatically records the behavioral paths of various processes, network connections, and critical events within the operating system. This behavioral path data includes process start and termination records, user access behavior, network request chains, and other information. This data is stored in a structured manner to quickly trace the origin and propagation path of threats after detecting abnormal activity or potential threats.
[0141] The specific process of threat attribution is as follows:
[0142] Behavior path recording: During operating system operation, the local agent continuously collects and records the operating system's behavior paths, generating detailed operation logs, including file operations, port accesses, system calls, etc. This process ensures that the execution order and dependencies of each operation are completely preserved.
[0143] Source tracing analysis: Once abnormal activity or a threat event is detected, the local agent will invoke the source tracing module to perform in-depth analysis of previously recorded behavioral paths. By comparing the behavioral paths before and after the threat event, the local agent can reconstruct the attack chain and identify the initial trigger point, propagation path, and affected system components of the threat.
[0144] Threat propagation chain visualization: The local agent visualizes the threat attribution results, showing the attacker's action path and the threat's spread process within the operating system. The attribution results (information) displayed in the charts include not only the source of the attack and the affected modules, but also the attacker's actions at each node, helping administrators quickly understand the full picture of the threat event.
[0145] After analyzing each subtask, the analysis results of the subtasks are obtained.
[0146] Step S44: Based on the analysis results of the sub-tasks, the local Agent obtains the analysis results of the threat events.
[0147] If resources are scarce or the detection task is too complex, the local agent assesses the computing power requirements of the detection task in real time to determine whether it is necessary to call upon the computing resources of the cloud agent. If it is necessary to call upon the cloud agent, the local agent uploads necessary data such as system logs and static code to the cloud agent, which then performs in-depth analysis and vulnerability detection using its large language model. After the large language model analysis is completed, the cloud agent automatically generates targeted patches and feeds back the patch test results and deployment suggestions to the local agent.
[0148] Step S5: The local agent uses multi-task learning to help the model generate and adjust security policies based on the analysis results of threat events and the operating system load.
[0149] The local agent uses multi-task learning to help the model calculate a threat risk score based on the analysis results of threat events and the operating system load. It then intelligently selects and adjusts security policies based on this score. Furthermore, when the local agent is unable to handle complex threats, it requests assistance from the cloud agent for analysis and adjusts security policies based on the cloud agent's feedback.
[0150] In order to reasonably assess the risk of threat events and determine appropriate security strategies, the local agent uses multi-task learning to help the model score the threat risk of each threat event.
[0151] The formula for calculating the threat risk score is as follows:
[0152] Risk Score=a·Threat Level + b·Impact Factor + c·System Load
[0153] Risk Score: Threat risk score.
[0154] Threat Level: Based on the RAG large language model and analysis results, threat events are classified and judged (threat category: such as DDoS attack, data breach, etc.), the severity (threat level) of the threat event is determined, and a threat level score is assigned to it. Threat Level reflects the urgency of the threat event.
[0155] Impact Factor: Measures the potential impact of a threat event on the operating system's system resources and services, such as whether it will cause network outages or data loss. The Impact Factor reflects the extent of damage caused by a threat event.
[0156] System Load: Assesses the current operating system load, avoiding the execution of complex security policies when operating system resources are insufficient, and reducing the impact on system performance. System Load is evaluated by monitoring the usage of operating system resources such as CPU, memory, and network.
[0157] a, b, and c: Weighting factors that control the impact of each factor on the final threat risk score. These weighting factors can be adjusted based on actual circumstances to balance the effects of different factors.
[0158] After the threat risk score is calculated, the local agent can assign a specific risk value to each threat event and select the most appropriate security strategy based on this value.
[0159] The risk value corresponds to a high-risk threat or a low-risk threat, and it is implemented based on a dynamic response algorithm.
[0160] A dynamic response algorithm refers to a set risk scoring threshold used to distinguish whether a threat event is considered a high-risk or low-risk threat. The dynamic response algorithm is as follows:
[0161] If Risk Score > T threshold, then Trigger High-Level Defense Strategy
[0162] If Risk Score≤T threshold , then Trigger Low-Level Defense Strategy
[0163] T threshold Risk scoring threshold;
[0164] High-Level Defense Strategy: Security strategies for high-risk threats;
[0165] Low-Level Defense Strategy: A security strategy for low-risk threats.
[0166] If the threat risk score is greater than the risk score threshold, the threat event is considered a high-risk threat, and a high-risk threat security strategy is adopted; if the threat risk score is less than or equal to the risk score threshold, the threat event is considered a low-risk threat, and a low-risk threat security strategy is adopted.
[0167] The specific security strategy is as follows:
[0168] Security strategies for high-risk threats (such as severe DDoS attacks) trigger more complex and timely protection strategies, such as traffic filtering and IP blocking.
[0169] Security strategies for low-risk threats (such as minor system configuration errors) only require triggering alerts or performing lightweight resource checks.
[0170] For example: a: Classification task identifies threats as "DDoS attack" (threat category) and "high" level (threat level).
[0171] b. The regression task calculates its threat risk score, Risk Score=85 (assuming the risk score threshold is 80).
[0172] c. The dynamic response algorithm determines the risk value to be a high-risk threat (85>80).
[0173] d. Generate task output security policy: "Start traffic filtering and request assistance from the cloud agent".
[0174] Step S6: The local agent generates a security status summary report, which records the operating system's security status and threat events. Based on the RAG large language model's natural language generation function, the security status summary report concisely describes the detected threat events, their potential impact, and recommended security strategies. The report presents threat attribution information in visual charts to help administrators quickly understand the full picture of threat events and is stored in the security center for review.
[0175] The local agent uses multi-task learning to help the model calculate a threat risk score based on threat events and operating system load, and intelligently selects and adjusts security policies based on the threat risk score. Furthermore, when the local agent is unable to handle complex threats, it requests assistance from the cloud agent for analysis and adjusts security policies based on the feedback from the cloud agent.
[0176] When the local agent detects a complex threat that it cannot handle alone, it requests assistance from the cloud agent through a security broker. The cloud agent then uses its powerful computing capabilities to perform in-depth analysis of the uploaded threat data and identify complex attacks such as advanced persistent threats (APTs) or cross-system attacks.
[0177] The processing flow of the cloud-based agent is as follows:
[0178] Threat data upload: The local agent uploads relevant threat data (such as log fragments, abnormal network traffic, suspicious code files, etc.) to the cloud agent. The format of this threat data is standardized so that the cloud agent can process it quickly.
[0179] Cloud-based agent analytics: Cloud-based agents utilize large language models to efficiently analyze data through distributed computing resources, identifying threat complexity and attack chains. The powerful computing capabilities of cloud-based agents enable them to process massive amounts of data and perform deep learning to discover attack patterns that local agent detection methods cannot identify.
[0180] The specific process of cloud-based agent analysis is as follows:
[0181] 1. Advanced Threat Detection: The cloud-based agent integrates data from multiple systems to identify distributed attacks and advanced persistent threats (APTs). This step uses multi-layered, in-depth analysis to identify potential attackers, attack methods, and their correlation with other events.
[0182] 2. Threat Chain Analysis: By combining a global threat database, the cloud-based agent can identify attacker patterns, attack paths, and propagation chains. This provides rich contextual information for generating targeted security strategies, helping the local agent understand the overall attack situation.
[0183] 3. Cloud Threat Report Feedback: After analysis, the cloud agent generates a detailed cloud threat report, which includes information such as the attack chain, threat level, techniques that attackers may use, and their potential impact on the operating system. Once the cloud threat report is fed back to the local agent, the local agent can adjust its security policies based on the analysis results from the cloud agent.
[0184] Local security policy adjustments refer to the automatic adjustment of security policies by the local agent based on cloud-based threat reports from the cloud agent. For example:
[0185] Firewall rule update: Based on cloud analysis results, the firewall has been reconfigured to restrict suspicious network access.
[0186] Isolate infected nodes: If cloud-based agent analysis detects that certain nodes have been attacked, isolation operations can be triggered to prevent the threat from spreading.
[0187] Operating system security policy update: Based on the recommendations provided by the cloud agent, the local agent can update the operating system's security policy to improve protection capabilities.
[0188] The beneficial effects of this invention are:
[0189] 1. Real-time Monitoring and Global Awareness: This invention upgrades the operating system security center to a local agent, enabling it to monitor the operating system's security status in real time and perform global awareness. Compared to traditional static rule systems, the local agent can dynamically analyze the system environment, identify potential threats, and make intelligent decisions. This real-time awareness capability allows the operating system to proactively address threats and achieve active protection.
[0190] 2. Intelligent decision-making and task coordination: This invention can not only automatically identify complex attack patterns, but also flexibly coordinate the computing power of local and cloud-based large models according to the complexity and urgency of the task and local computing power conditions. This greatly improves the resource utilization efficiency of the operating system, enabling high-complexity threat detection and security protection tasks to be completed even in resource-limited local environments through intelligent supplementation of cloud resources.
[0191] 3. Highly Efficient Threat Detection and Response Mechanism: The local agent can automatically learn new threat patterns, eliminating the need for traditional manual rule updates. The security agent system possesses an adaptive threat detection and response mechanism, enabling rapid identification and handling of advanced threats, improving detection accuracy and speed. Furthermore, through cloud-based agent collaboration, this invention can address a wider variety of threat types, thereby strengthening comprehensive protection for operating system security.
[0192] 4. Dynamic Local and Cloud Resource Collaboration: The limitation of local computing power in existing technologies is one of the bottlenecks of threat detection systems. This invention overcomes this limitation by intelligently coordinating the large model capabilities of local and cloud environments. When local resources are insufficient, the security agent system can automatically transfer complex tasks to cloud agents for processing, ensuring that the operating system can maintain strong security detection and protection capabilities even under high load.
[0193] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method for implementing a security agent system oriented towards an operating system, characterized in that, The security agent system includes a local agent and a security knowledge base; the local agent has a multi-task learning assistance model; The implementation method includes the following steps: Step S1: Initialize the local Agent and mount the security knowledge base; the security knowledge base is constructed by combining the RAG large language model and knowledge graph; Step S2: The local agent loads the multi-task learning helper model, enabling the local agent to generate and adjust security policies; Step S3: The local agent perceives and monitors the operating system's resources and collects operating system resource data; Step S4: The local agent calls the RAG large language model to perform a preliminary analysis of the operating system's security status based on resource data to determine whether there are any threat events; if there are threat events, further analysis is performed to obtain the analysis results of the threat events; Step S5: The local agent uses multi-task learning to help the model generate and adjust security policies based on the analysis results of threat events and the operating system load. The process of combining the security knowledge base with knowledge graphs and the RAG large language model is as follows: Step S101, Entity Identification: Extract entities from the security data; the entities include attackers, target systems, attack methods, vulnerability types, and mitigation measures; each entity is assigned a unique identifier; the security data includes security-related text data, threat intelligence, event logs, and intrusion detection rules; Step S102, Relationship Extraction: Analyze the relationships between entities in the security data, extract the mutual connections between entities, and construct a knowledge graph based on this; the relationships between entities are abstracted in the knowledge graph as the mutual connections between entity nodes and adjacent entity nodes; Step S103: Generate a vector representation with neighborhood information based on the constructed knowledge graph neighborhood expansion, and input the vector representation into the RAG large language model so that the RAG large language model has context matching ability when calling the security knowledge base for retrieval and parsing; The construction process of the multi-task learning assistance model is as follows: Step S201: Determine the multiple tasks that the multi-task learning help model solve; The multi-task learning-assisted model is used to solve multiple tasks related to threat events; these tasks include classification, regression, and generation; the classification task classifies threat events to determine threat categories and threat levels; the regression task scores threat risks for threat events; and the generation task determines and generates corresponding security policies based on the threat risk scores. Step S202: Prepare datasets based on the multiple tasks being solved; the datasets include classification datasets, regression datasets, and generated datasets; Step S203: Construct the architecture of the basic pre-trained model; The basic pre-trained model includes a shared layer and task-specific layers; the task-specific layers include a classification task output layer, a regression task output layer, and a generation task output layer; the shared layer has multiple layers and is used to extract common features of threat events; the classification task output layer uses a softmax layer to classify threat events and determine the threat category and threat level; the regression task output layer uses a linear layer to output a threat risk score; and the generation task output layer uses a decoder layer to generate security policies. Step S204: Input the dataset into the basic pre-trained model for training to obtain a multi-task learning assistance model; In step S5, the local agent calculates the threat risk score of the threat event based on the analysis results of the threat event and the load of the operating system through a multi-task learning-assisted model, and selects and adjusts the security policy based on the threat risk score of the threat event. Threat risk scoring for threat events is based on a dynamic response algorithm that assesses the risk value of the threat event; the risk value corresponds to a high-risk threat or a low-risk threat; if the risk value of the threat event corresponds to a high-risk threat, the security strategy adopted is traffic filtering or intrusion detection; if the risk value of the threat event corresponds to a low-risk threat, the security strategy adopted is alert notification or log monitoring.
2. The method of claim 1, wherein the method further comprises: Step S4 includes the following steps: Step S41, Data Cleaning and Standardization: Perform data cleaning and standardization on the collected operating system resource data; Step S42: The local agent calls the RAG large language model to perform a preliminary analysis of the operating system's resource data after data cleaning and standardization, in order to detect whether there are any threat events in the operating system in the form of a detection task. Step S43: If a threat event exists, the local agent will subdivide the detection task into multiple sub-tasks to further analyze the threat event and obtain the analysis results of multiple sub-tasks. Step S44: Based on the analysis results of multiple sub-tasks, the local Agent obtains the analysis results of threat events.
3. The method of claim 2, wherein the method further comprises: receiving a request from the operating system to execute a security agent function; and executing the security agent function. The sub-tasks include abnormal network traffic analysis, generation of system vulnerability remediation suggestions, and threat tracing. Anomaly network traffic analysis: Local agent analysis of threat events to determine if there is persistent malicious traffic or DDoS attacks; System vulnerability remediation suggestion generation: If the threat event is a vulnerability, the local agent checks the vulnerability and generates preliminary remediation suggestions; Threat attribution: Local agents track the origin and propagation path of threat events.
4. The method of claim 1, wherein the method further comprises: receiving a request from the operating system to perform a security operation; and performing the security operation. The formula for calculating the threat risk score is as follows: Threat risk score = a. Threat level score + b. Impact factor score + c. System load score; Where, a is the weighting factor for threat level score, b is the weighting factor for impact factor score, and c is the weighting factor for system load score; threat level score is determined based on the threat category and threat level of the threat event; impact factor score is determined based on the potential impact of the threat event on the system resources and services of the operating system; and system load score is determined based on the current load of the operating system. The dynamic response algorithm refers to setting a risk scoring threshold to distinguish the risk value of a threat event. If the threat risk score of a threat event is greater than the risk scoring threshold, the threat event corresponds to a high-risk threat; if the threat risk score of a threat event is less than or equal to the risk scoring threshold, the threat event corresponds to a low-risk threat.
5. The method of claim 3, wherein the security agent system is implemented as a system service of an operating system. The security agent system also includes a cloud agent; In step S5, if the local agent determines that the threat event cannot be handled, the local agent will request the cloud agent to assist in the analysis. The specific steps for cloud-based agent-assisted analysis are as follows: Threat data upload: The local agent uploads threat event-related data to the cloud agent, and the cloud agent standardizes the format of the uploaded threat event-related data; Cloud-based agent analytics: Cloud-based agents analyze threat event-related data after it has been formatted and standardized using distributed computing resources; Feedback on cloud threat reports: After the cloud agent completes the analysis, it generates a cloud threat report and sends the report back to the local agent.
6. The method of claim 1, wherein the method further comprises: It also includes step S6; Step S6: The local agent generates a security status summary report, which records the security status and threat events of the operating system.
