Relationship triple extraction method for network security knowledge graph construction
Through the joint model based on parameter sharing and the relational triple extraction method of the multi-head attention mechanism, the shortcomings of traditional network security protection methods in complex network attacks and information extraction efficiency are solved, and an efficient and accurate network security knowledge graph is constructed. Improved network security defense capabilities.
Patent Information
- Application Number
- CN202410743298.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-09-24
AI Technical Summary
Traditional network security protection methods are difficult to deal with complex and diversified network attacks, especially in terms of new threat identification and complex correlation analysis, and traditional information extraction methods have limitations in efficiency, accuracy and scalability. It is difficult to meet current network security needs.
A joint model based on parameter sharing is used to extract relational triples, combined with a multi-head attention mechanism and a graph convolution network. Through deep learning and intelligent analysis of network security data, a network security knowledge graph is constructed to improve the extraction performance of entity relationships and Accuracy.
It has significantly improved the extraction efficiency of network security data and the accuracy of extracted relationships, improved network security defense capabilities and deterrence capabilities, and can more effectively manage and analyze entity relationships in complex texts.
Smart Images

Figure CN118690839A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of network security technology, and specifically relates to a relationship triple extraction method for constructing a network security knowledge graph. Background Art
[0002] Cyberspace security is facing unprecedented challenges. On the one hand, cyber attacks are characterized by diverse means and high concealment, and the frequency of attacks is on the rise. In addition to the huge threat to personal information security, key information of enterprises and government agencies has also become the focus of attacks, resulting in significant economic losses. On the other hand, the modern network environment has bred a huge amount of diverse network security data, including but not limited to log files, various threat reports, vulnerability details, and malware samples, but these valuable data resources are often in a scattered and disordered state, lacking effective integration and utilization.
[0003] Traditional network security protection methods, such as firewalls and intrusion detection systems, have been widely used and have played a positive role to a certain extent. However, in response to the increasingly large and unpredictable network attack activities and the complex and diverse and endless viruses and vulnerabilities, the ability to identify new unknown threats and complex correlation analysis is insufficient, and it is difficult to fully respond to the current trend of diversification and complexity of network attack methods. Therefore, it is urgent to seek more advanced methods and technologies to conduct in-depth mining, effective integration and intelligent analysis of massive and heterogeneous network security data, effectively respond to and resolve various network threats, and comprehensively improve the security protection level of cyberspace.
[0004] With its unique technical advantages, knowledge graphs have spanned all walks of life and have effectively promoted the intelligent upgrade of the industry. The huge potential and value it contains have been enthusiastically sought after by the industry and academia. In view of this background, in order to promote the development of network security solutions towards a higher level of intelligence, the emerging field of network security knowledge graphs was born in response to the needs of the times, facilitating in-depth analysis and accurate judgment of network attack and defense situations. This paper will focus on the key technologies involved in building a network security knowledge graph.
[0005] Faced with the challenges brought by the rapid growth of Cyber Threat Intelligence (CTI) data, traditional information extraction methods have shown certain limitations in terms of efficiency, accuracy, intelligence and scalability, and it is difficult to meet the current needs for improving network security and preventing various network threats and attacks. In order to help network security experts formulate more solid security strategies based on reliable intelligence and enhance network security defense and deterrence capabilities, this invention focuses on building a CTI knowledge graph based on relationship triples, each of which consists of a core relationship and two associated entities. The key lies in improving the extraction efficiency of these ever-expanding CTI data. Summary of the invention
[0006] The purpose of the present invention is to provide a relationship triple extraction method for network security knowledge graph construction, so as to reduce the manual consumption of network security knowledge graph construction, comprehensively manage and deeply analyze network security text information from multiple dimensions, which is more efficient and accurate than traditional methods and can improve the performance of extracting entity relationships in complex texts.
[0007] To achieve the above object, the technical solution adopted by the present invention is:
[0008] A method for extracting relational triples for constructing a network security knowledge graph, the method comprising:
[0009] Obtain cybersecurity-related literature based on cybersecurity-related websites and screen the obtained cybersecurity-related literature;
[0010] Calling annotation tools to annotate entities and relationships in the screened cybersecurity related literature;
[0011] A joint model based on parameter sharing is established to learn the sentences in the annotated cybersecurity-related literature to complete the named entity recognition and relationship extraction of the sentences; the joint model based on parameter sharing includes a sharing layer and a specific task layer, the sharing layer includes a word embedding layer, a feature extraction layer and a multi-head attention layer, the specific task layer includes two parallel branches, one branch is a named entity recognition layer, and the other branch is a relationship extraction layer, the output of the feature extraction layer and the output of the multi-head attention layer are connected and used as the input of the named entity recognition layer and the relationship extraction layer respectively;
[0012] For each extracted relationship, search for candidate relationships in the existing network security knowledge graph, calculate the relationship matching score between each candidate relationship and the extracted relationship, and replace the extracted relationship with the candidate relationship with the highest relationship matching score to obtain the final relationship triple;
[0013] The loss function is calculated based on the final relation triplet of the sentence, as well as the entities and relations annotated in the sentence, and the joint model based on parameter sharing is trained according to the loss value;
[0014] The trained parameter-sharing-based joint model and the existing network security knowledge graph are used to extract relation triplets from sentences in the processed documents, and the extracted relation triplets are stored in the graph database Neo4j.
[0015] Several optional methods are also provided below, but they are not intended to be additional limitations on the above-mentioned overall solution, but are merely further supplements or preferences. Under the premise that there are no technical or logical contradictions, each optional method can be combined with the above-mentioned overall solution separately, and multiple optional methods can also be combined.
[0016] Preferably, the screening of the acquired network security related documents includes:
[0017] Document length statistics: count the total number of words in each document;
[0018] Keyword identification: Use text analysis tools to count the number of times a keyword appears in a preset keyword list in each document;
[0019] Calculate density: Divide the number of times a keyword appears by the total number of words in the document to get the keyword density;
[0020] Final screening: retain documents with a keyword density of more than 5% and a length of more than 200 words.
[0021] Preferably, the categories of the entities include: response teams, websites, applications, companies, attack techniques, protection techniques, infected files, security products, attack actions, APT organizations, malware, and vulnerabilities;
[0022] The categories of relationships described include: presence, repair, confrontation, initiation, use, vulnerability, inclusion, and belonging;
[0023] The entity relationship matching criteria are: the relationship from the website to the vulnerability is existence, the relationship from the response team to the vulnerability is repair, the relationship from the response team to the protection technology is use, the relationship from the response team to the company is belong to, the relationship from the APT organization to the security product is confrontation, the relationship from the APT organization to the attack action is initiation, the relationship from the APT organization to the attack technology is use, the relationship from the application to the vulnerability is vulnerable, the relationship from the malware to the infected file is inclusion, the relationship from the company to the protection technology is use, the relationship from the company to the security product is belong to, and the relationship from the security product to the protection technology is use.
[0024] Preferably, for each extracted relationship, searching for candidate relationships in an existing network security knowledge graph includes:
[0025] Get the subject and object corresponding to the extracted relationship;
[0026] Input the subject into an existing network security knowledge graph, filter the relationship triples of the same subject, and use the relationships in all the filtered relationship triples as the first candidate relationship set;
[0027] Input the object into an existing network security knowledge graph, filter the relationship triples of the same object, and use the relationships in all the filtered relationship triples as the second candidate relationship set;
[0028] The first candidate relationship set and the second candidate relationship set are combined to obtain a candidate relationship set corresponding to the extracted relationship.
[0029] Preferably, calculating the relationship matching score between each candidate relationship and the extracted relationship includes:
[0030] Obtain the subject and object corresponding to the extracted relationship, and combine the subject and object with the candidate relationship into a preliminary relationship triple;
[0031] Extract the embedding of the subject, the embedding of the candidate relation, and the embedding of the object in the preliminary relation triple, and concatenate the three embeddings as the triple embedding;
[0032] The triples are embedded into the feedforward neural network and the relation matching score output by the feedforward neural network is obtained. The relation matching score is used as the relation matching score between the candidate relation and the extracted relation.
[0033] Preferably, the embedding of the subject and the embedding of the object are extracted through the RoBERTa model, and the embedding of the candidate relationship is captured by learning the existing network security knowledge graph through a graph convolutional network.
[0034] The present invention provides a method for extracting relation triples for network security knowledge graph construction, which has the following beneficial effects compared with the prior art:
[0035] (1) A joint model based on parameter sharing is established, and joint extraction is used to extract relation triplets from labeled data. The extraction of relation triplets significantly surpasses the current cutting-edge similar technologies, and its F1 value in the task of extracting relation triplets has been significantly improved, which strongly verifies the effectiveness and superiority of this technology in processing CTI data and improves the extraction efficiency of network security data.
[0036] (2) In order to calculate the relationship matching score, a technology based on GCN (graph convolutional network) is used. Through the graph convolution operation, GCN can propagate and aggregate feature information between nodes in the graph, which means that the representation of each node is not only based on its own attributes, but also integrates the features of its neighboring nodes. This is particularly useful for relationship matching because it allows the model to comprehensively consider the features of all related entities of an entity to determine the matching degree.
[0037] (3) Introducing a multi-head attention mechanism into the joint model based on parameter sharing, processing different feature subspaces in parallel, capturing richer contextual information; enhancing the expressiveness of the model and understanding complex semantics; improving learning stability and robustness; dispersing the focus of attention and reducing the risk of overfitting; and ultimately improving the accuracy and efficiency of sequence labeling and relationship extraction.
[0038] (4) Relation triple import is specially designed for storing and processing graph data, and is very suitable for the representation and query of knowledge graphs. It supports precise query and provides a powerful query interface. Users can perform refined queries based on entity ID, entity attributes, relationship type and other information to quickly locate specific information related to network security, such as detailed descriptions of specific vulnerabilities, scope of impact, solutions, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flowchart of a method for extracting relational triples for constructing a network security knowledge graph according to the present invention;
[0040] Figure 2 is a distribution diagram of entities in the documents screened in this embodiment;
[0041] Figure 3 This is a structural diagram of the joint model based on parameter sharing in this embodiment. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0044] In order to overcome the defects of the prior art, this embodiment provides a relationship triple extraction method for network security knowledge graph construction, such as Figure 1 As shown, the following steps are included:
[0045] Step 1: Obtain network security related literature based on websites related to the network security field, and screen the obtained network security related literature.
[0046] We collected 1,250 cybersecurity-related reports and articles from several mainstream cybersecurity-related websites, such as the National Vulnerability Database, the National Internet Emergency Center, the Micro-Step Online Cyber Threat Discovery and Response Experts, and the Tianan Threat Intelligence Center, as well as other similar reference materials. The data sources are shown in Table 1.
[0047] Table 1 Websites related to network security
[0048]
[0049]
[0050] Since there are documents unrelated to network security in these reports, this embodiment screens the documents based on the following two dimensions after collecting them:
[0051] (1) Considering that APT and ransomware reports need to describe the attack in detail, it is reasonable to set a minimum word limit. Generally speaking, if the report is less than 200 words, it may be difficult to include comprehensive analysis details. Therefore, a minimum of 200 words can be set as the minimum standard for screening, and the minimum standard can be adjusted according to actual needs.
[0052] (2) Cyber threat intelligence contains a large number of cybersecurity terms. Predetermine a list of keywords that are highly relevant to APT and ransomware, such as "APT", "ransomware", "hash value", "cryptocurrency payment", "C2 server", "MAC address", etc. Based on the previous information, a keyword density between 2% and 8% is generally considered reasonable. For APT and ransomware reports, you may want to lean towards the higher end, such as setting a keyword density of more than 5% as a screening criterion. This is because these reports tend to go deep into technical details and use professional terms frequently.
[0053] Therefore, the specific screening steps provided in this embodiment are as follows:
[0054] A. Document length statistics: count the total number of words in each document;
[0055] B. Keyword identification: Use text analysis tools to count the number of times a keyword appears in a preset keyword list in each document;
[0056] C. Calculate density: Divide the number of times a keyword appears by the total number of words in the document to get the keyword density;
[0057] D. Final screening: retain documents with a keyword density of more than 5% and a length of more than 200 words.
[0058] Through the above screening process, it is possible to effectively identify reports and articles related to APT and ransomware that are rich in information. In this embodiment, of the 1,250 documents collected, 876 APT (advanced persistent threat) and ransomware reports were retained after screening, and irrelevant URL links, IP addresses, hashes and other information were removed through regular expressions.
[0059] Step 2: Call the annotation tool to annotate the entities and relationships in the screened network security related literature.
[0060] This embodiment calls the YEDDA tool proposed by Yang et al. as a labeling tool, and labels the entities and relationships in the APT and ransomware reports after screening. With the help of the tool, the labeling work can be greatly simplified and standardized, improving the efficiency and consistency of labeling. Finally, the labeling of 1,820 entities and 967 pairs of relationships was completed. These entities include response teams (CERT, Computer Emergency Response Team or Computer Security Incident Response Team, which refers to the Computer Emergency Response Team or Computer Security Incident Response Team. It is an organization or team responsible for responding to and handling network security incidents, such as hacker attacks, virus outbreaks, data leaks, etc.), APT organizations, malware, attack actions, security products and other key information. The distribution of entities in the selected literature in this embodiment is shown in the attached figure. Figure 2 The bar chart in the figure shows this vividly.
[0061] This embodiment divides all entities into 12 categories based on the CTI corpus, namely: response team (CERT), website, application, company, attack technology, protection technology, infected file, security product, attack action, APT organization, malware and vulnerability, which can be expanded later.
[0062] In addition, these relations are divided into 8 types: exist, repair, confront, initiate, use, vulnerable, contain, belong to. Entity 1 (subject) and entity 2 (object) represent entity roles, and the direction is from entity 1 to entity 2. Table 2 lists the main criteria for matching possible entity relations. Using this relation triple standard, manual annotation work can be greatly simplified and standardized, improving annotation efficiency and consistency.
[0063] Table 2 Entity relationship matching criteria
[0064] Entity 1 Name Entity 2 Name relation website Vulnerabilities exist Response Team Vulnerabilities repair Response Team Protection technology use Response Team company belong APT Groups Safety Products confrontation APT Groups Attack Initiate APT Groups Attack Techniques use application Vulnerabilities Vulnerable Malware Infected files Include company Protection technology use company Safety Products belong Safety Products Protection technology use
[0065] Step 3: Establish a joint model based on parameter sharing to learn the sentences in the annotated cybersecurity-related literature and complete the named entity recognition and relationship extraction of the sentences.
[0066] Joint Extraction is a natural language processing (NLP) strategy that enhances the performance and efficiency of the model by processing multiple related annotation tasks simultaneously under a unified model framework. This method is particularly suitable for scenarios where there are dependencies between labels or contextual information is critical to all tasks, such as identifying named entities (such as names, places), relationship extraction (such as person-position relationships), and event detection in information extraction.
[0067] like Figure 3 As shown, the joint model based on parameter sharing of this embodiment includes a shared layer and a specific task layer. The shared layer includes a word embedding layer, a feature extraction layer and a multi-head attention layer. The specific task layer includes two parallel branches, one branch is a named entity recognition layer, and the other branch is a relationship extraction layer.
[0068] In a specific example, the word embedding layer can use the RoBERTa layer to generate the vector representation of the input word; the feature extraction layer can use the BiGRU (Bidirectional Gated Recurrent Unit) layer. BiGRU can capture the contextual information of the text sequence (all word vectors constitute the entire sequence, which can be regarded as the entire sentence) in time sequence, considering not only the previous information of each word, but also the subsequent information, which is crucial for understanding the relationship and dependency between words. It controls the forgetting and updating of information through the gating mechanism, which helps to learn long-term dependencies; the multi-head attention layer uses the multi-head attention mechanism to distribute the feature vectors to different attention heads after equal-length cutting. Multiple attention heads work in parallel to capture the dependencies between different representation dimensions and enhance the model's sensitivity to complex contexts. This layer helps the model to focus on different parts of the input sequence more flexibly and improve the ability to identify key information; the named entity recognition layer can use a CRF (conditional random field) layer to predict the entity label at each position in the input sequence; the relationship extraction layer includes one or more fully connected layers or convolutional layers to extract features between entity pairs and predict the type of relationship between them. For example, this embodiment can gradually learn and extract higher-level feature representations by stacking 5 fully connected layers and using the ReLU activation function after each layer. Finally, through multiple output nodes, the softmax activation function is used to predict the type of relationship between entity pairs.
[0069] In addition, this embodiment connects the output of the feature extraction layer and the output of the multi-head attention layer and uses them as the input of the named entity recognition layer and the relationship extraction layer respectively. The output of the feature extraction layer and the output of the multi-head attention layer can be combined to form a comprehensive feature vector, which not only contains the overall context information of the sequence, but also highlights the important parts through the attention mechanism. This comprehensive feature vector is then used for the extraction of entities and relationships (before entering the specific task layer, it may also pass through a linear transformation or other forms of transformation to adapt to the input requirements of the specific task layer, such as mapping to a specific label space).
[0070] This embodiment builds a joint model based on parameter sharing based on the joint extraction technology, which has the following advantages:
[0071] Shared Representation Learning: The model can share low-level feature representations between different tasks, which helps capture common patterns across tasks, reduce the risk of overfitting, and improve the generalization ability of the model.
[0072] Better use of context: Since the model considers all relevant tasks simultaneously, it can better understand and exploit contextual dependencies between different annotations. For example, the recognition of an entity may depend on its relationship with other entities or the type of event it is in.
[0073] Reduced error propagation: Compared with the cascaded multi-stage processing method, the joint method can reduce the problem of errors from the previous stage propagating to subsequent stages, because the decisions of all tasks are made simultaneously and can directly influence and correct each other.
[0074] Optimizing Collaboration: The joint model allows the optimization process to take into account the objectives of all tasks, making it possible to find a global optimal solution rather than the local optimum of a single task.
[0075] Step 4: For each extracted relationship, search for candidate relationships in the existing network security knowledge graph, calculate the relationship matching score between each candidate relationship and the extracted relationship, and replace the extracted relationship with the candidate relationship with the highest relationship matching score to obtain the final relationship triple.
[0076] In the relationship matching step, candidate relationships are retrieved from the existing cybersecurity knowledge graph extracted from a specific task or a specific domain and compared with the relationships extracted in step 3, aiming to use the rich structured information in the graph to verify, supplement or correct the extracted relationships, thereby improving the accuracy and completeness of relationship identification. Calculating the relationship matching score can help the system determine which relationships in the knowledge graph are closest to the extracted relationships, based on the semantic similarity between them, which may involve techniques such as word embedding, ontology matching, or pattern-based similarity measurement.
[0077] Step 4.1, obtain the subject and object corresponding to the relationship extracted in step 3;
[0078] Step 4.2: Input the subject into the existing network security knowledge graph, filter the relationship triples of the same subject, and use the relationships in all the filtered relationship triples as the first candidate relationship set;
[0079] Step 4.3: Input the object into the existing network security knowledge graph, filter the relationship triples of the same object, and use the relationships in all the filtered relationship triples as the second candidate relationship set;
[0080] Step 4.4: Merge the first candidate relationship set and the second candidate relationship set to obtain a candidate relationship set corresponding to the extracted relationship.
[0081] Step 4.5, obtain the subject and object corresponding to the extracted relationship, and combine the subject and object with each candidate relationship in the candidate relationship set into a preliminary relationship triplet; wherein the embedding of the subject and the embedding of the object are extracted through the RoBERTa model, and the embedding of the candidate relationship is captured by the graph convolutional network learning of the existing network security knowledge graph. In order to calculate the relationship matching score, this embodiment adopts a technology based on GCN (graph convolutional network). GCN takes the nodes and edges of the knowledge graph as input, and applies a series of graph convolutions to learn the representation of each node that captures its neighborhood information. The output of GCN is a matrix containing the learned expressions of all nodes in the constructed knowledge graph;
[0082] Step 4.6: extract the embedding of the subject, the embedding of the candidate relation, and the embedding of the object in the preliminary relation triple, and concatenate the three embeddings as the triple embedding;
[0083] Step 4.7, embed the triples into the feedforward neural network, and obtain the relation matching score output by the feedforward neural network, which is used as the relation matching score between the candidate relation and the extracted relation;
[0084] Step 4.8: Replace the extracted relation with the candidate relation with the highest relation matching score to obtain the final relation triple.
[0085] It should be noted that if there is no existing network security knowledge graph, there is no need to execute step 4. The relationship triples can be determined based on the output of step 3 alone, and the network security knowledge graph can be constructed based on the relationship triples (when the network security knowledge graph is constructed for the first time, it can be verified by expert knowledge to improve the accuracy of the basic network security knowledge graph), and the constructed network security knowledge graph can be used as the existing network security knowledge graph when it is run next time; similarly, when matching the extracted relationship candidate relationship formula, if the candidate relationship is not matched, the extracted relationship is used as the final relationship to form a relationship triple. Expert knowledge can also be introduced for verification of this type of relationship triple.
[0086] Step 5: Calculate the loss function based on the final relation triplet of the sentence, as well as the entities and relations annotated in the sentence, and train the joint model based on parameter sharing according to the loss value.
[0087] In order to optimize the entire model, a suitable loss function can be designed so that it not only predicts the correct label sequence, but also achieves the best performance when all relations are considered jointly. Negative Log-Likelihood (NLL) is usually used as the loss function of the joint CRF. This loss function ensures that the model can comprehensively consider the label consistency of all relation types during learning, thereby improving the overall performance and extraction accuracy of the model.
[0088] During the training process, the model optimizes this loss function through the gradient descent method, while updating the parameters of the shared layer and the specific task layer. In this way, the model not only learns how to encode effective sequence features, but also learns how to make globally optimal sequence labeling decisions based on these features, ensuring the common improvement of all relationship extraction tasks. Among them, the parameters of the shared layer will be updated by both tasks. Specifically, when the back propagation algorithm calculates the gradient and updates the model parameters, the parameters of the shared layer will be weighted according to the loss functions of the two tasks of named entity recognition and relationship extraction. This parameter sharing method helps the model learn common feature representations that are useful for both tasks, thereby improving overall performance.
[0089] The training and evaluation phases are crucial to the model building process. To this end, this embodiment first divides the data set into an 80% training set, a 10% validation set, and a 10% test set. The training set is used to train the model, which is the basis of model learning and is used to fit the model parameters. The model minimizes the loss function on the training data, that is, the degree of error or mismatch, by constantly trying to adjust the parameters. It usually occupies the largest part of the data set, such as 70%-80%. The model learns patterns and rules on this data set.
[0090] The validation set is used to adjust the model's hyperparameters, such as learning rate, regularization strength, etc., and to select the best model structure. It helps evaluate the model's performance on unseen data and prevent overfitting (i.e., the model is too adapted to the training data and has poor generalization ability). It usually accounts for less than the training set, such as 10%-20%. During the training process, the model's performance on the validation set will be monitored to determine when to stop training or adjust the model configuration.
[0091] The test set is used to evaluate the final performance of the model. It ensures that the model can accurately predict on new data and is a key indicator for measuring the actual application effect of the model. It also accounts for a small proportion, such as 10%-20%.
[0092] Step 6: Use the trained parameter-sharing-based joint model and the existing network security knowledge graph to extract relation triplets from the sentences in the document to be processed, and store the extracted relation triplets in the graph database Neo4j.
[0093] In this embodiment, the open source graph database Neo4j is used as a tool for knowledge storage. The graph database Neo4j is specially designed for storing and processing graph data, which is very suitable for the representation and query of knowledge graphs. Neo4j provides its own query language Cypher for interaction. This is a declarative query language with a simple and easy-to-understand design that can easily express complex graph traversal and pattern matching operations. It supports precise query and provides a powerful query interface. Users can perform refined queries based on information such as entity ID, entity attributes, relationship type, etc., and quickly locate specific information related to network security.
[0094] Since it is difficult for most users to directly write Cyber language, the graph database Neo4j has designed an intuitive and user-friendly interface to facilitate user operation. After the user fills out the selection form, the backend system will automatically assemble the corresponding entity and relationship query instructions. According to the different entity categories, quantities and relationship types specified by the user on the interface, the system immediately generates the corresponding Cypher query language instructions to obtain the desired results.
[0095] In order to reflect the performance of the joint model based on parameter sharing proposed in this embodiment (based on the RoBERTa-BiGRU-MA-CRF model for experiments), precision (P), recall (R) and F1 value are used to evaluate the performance of the model. The existing models involved in the experiment are CNN-BiGRU-CRF model, BERT-BiLSTM-CRF model and BERT-BiGRU-CRF model. Pytorch is used to create the joint model based on parameter sharing of the present invention, and statistical significance tests are used when evaluating the performance of the model and other cutting-edge models.
[0096] The Adam (Adaptive Moment Estimation) optimizer is used in the training process, and the learning efficiency parameter alpha is set to 0.0002. This is a key hyperparameter that determines the magnitude of the model parameter update in each iteration. A higher learning rate may lead to unstable training, while a lower learning rate may lead to slow convergence. Dropout is set to 0.3, that is, the output neurons will be temporarily "discarded" with a probability of 30% during training to prevent overfitting. Experiments were conducted based on 876 APT and ransomware reports screened in this embodiment, and the experimental results are shown in Table 3.
[0097] Table 3 Experimental results
[0098] Model Name Precision (P) Recall (R) F1 value CNN-BiGRU-CRF 0.667 0.648 0.662 BERT-BiLSTM-CRF 0.820 0.706 0.757 BERT-BiGRU-CRF 0.842 0.728 0.782 Model of the present invention 0.891 0.779 0.834
[0099] According to the experimental results in Table 3, it can be seen that the model of the present invention performs well in CTI relationship extraction, with an F1 value score of 0.834, which is 26.0% higher than the CNN-BiGRU-CRF model, 10.2% higher than the BERT-BiLSTM-CRF model, and 6.6% higher than the BERT-BiGRU-CRF model. It also has the best performance in precision and recall, indicating that the model of the present invention has the best performance, in which the multi-head attention layer helps the decoding model to differentiate the input information at different times, thereby improving the overall performance.
[0100] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0101] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims
1. A relation triple extraction method for network security knowledge graph construction, characterized in that: The relation triple extraction method for constructing a network security knowledge graph includes: Obtain cybersecurity-related literature based on cybersecurity-related websites and screen the obtained cybersecurity-related literature; Calling annotation tools to annotate entities and relationships in the screened cybersecurity related literature; A joint model based on parameter sharing is established to learn the sentences in the annotated cybersecurity-related literature to complete the named entity recognition and relationship extraction of the sentences; the joint model based on parameter sharing includes a sharing layer and a specific task layer, the sharing layer includes a word embedding layer, a feature extraction layer and a multi-head attention layer, the specific task layer includes two parallel branches, one branch is a named entity recognition layer, and the other branch is a relationship extraction layer, the output of the feature extraction layer and the output of the multi-head attention layer are connected and used as the input of the named entity recognition layer and the relationship extraction layer respectively; For each extracted relationship, search for candidate relationships in the existing network security knowledge graph, calculate the relationship matching score between each candidate relationship and the extracted relationship, and replace the extracted relationship with the candidate relationship with the highest relationship matching score to obtain the final relationship triple; The loss function is calculated based on the final relation triplet of the sentence, as well as the entities and relations annotated in the sentence, and the joint model based on parameter sharing is trained according to the loss value; The trained parameter-sharing-based joint model and the existing network security knowledge graph are used to extract relation triplets from sentences in the processed documents, and the extracted relation triplets are stored in the graph database Neo4j.
2. The method for extracting relational triples for constructing a network security knowledge graph according to claim 1, characterized in that: The screening of the obtained network security related literature includes: Document length statistics: count the total number of words in each document; Keyword identification: Use text analysis tools to count the number of times a keyword appears in a preset keyword list in each document; Calculate density: Divide the number of times a keyword appears by the total number of words in the document to get the keyword density; Final screening: retain documents with a keyword density of more than 5% and a length of more than 200 words.
3. The method for extracting relational triples for constructing a network security knowledge graph according to claim 1, characterized in that: The categories of entities include: response teams, websites, applications, companies, attack techniques, protection techniques, infected files, security products, attack campaigns, APT groups, malware, and vulnerabilities; The categories of relationships described include: presence, repair, confrontation, initiation, use, vulnerability, inclusion, and belonging; The entity relationship matching criteria are: the relationship from the website to the vulnerability is existence, the relationship from the response team to the vulnerability is repair, the relationship from the response team to the protection technology is use, the relationship from the response team to the company is belong to, the relationship from the APT organization to the security product is confrontation, the relationship from the APT organization to the attack action is initiation, the relationship from the APT organization to the attack technology is use, the relationship from the application to the vulnerability is vulnerable, the relationship from the malware to the infected file is inclusion, the relationship from the company to the protection technology is use, the relationship from the company to the security product is belong to, and the relationship from the security product to the protection technology is use.
4. The method for extracting relational triples for constructing a network security knowledge graph according to claim 1, characterized in that: For each extracted relationship, searching for candidate relationships in the existing network security knowledge graph includes: Get the subject and object corresponding to the extracted relationship; Input the subject into an existing network security knowledge graph, filter the relationship triples of the same subject, and use the relationships in all the filtered relationship triples as the first candidate relationship set; Input the object into an existing network security knowledge graph, filter the relationship triples of the same object, and use the relationships in all the filtered relationship triples as the second candidate relationship set; The first candidate relationship set and the second candidate relationship set are combined to obtain a candidate relationship set corresponding to the extracted relationship.
5. The method for extracting relational triples for constructing a network security knowledge graph according to claim 1, characterized in that: Calculating the relationship matching score between each candidate relationship and the extracted relationship includes: Obtain the subject and object corresponding to the extracted relationship, and combine the subject and object with the candidate relationship into a preliminary relationship triple; Extract the embedding of the subject, the embedding of the candidate relation, and the embedding of the object in the preliminary relation triple, and concatenate the three embeddings as the triple embedding; The triples are embedded into the feedforward neural network and the relation matching score output by the feedforward neural network is obtained. The relation matching score is used as the relation matching score between the candidate relation and the extracted relation.
6. The method for extracting relational triples for constructing a network security knowledge graph according to claim 5, characterized in that: The embedding of the subject and the embedding of the object are extracted through the RoBERTa model, and the embedding of the candidate relationship is captured by learning the existing network security knowledge graph through a graph convolutional network.
Citation Information
Cited By
Knowledge graph generation method and device, equipment, storage medium and program product
CN122332577A
