Threat entity extraction method based on autoregression tag subsequences
Through the threat entity extraction method based on autoregressive label subsequences, the local context and sequence order dependence in threat intelligence are captured, which solves the problems of low recognition accuracy and poor adaptability in the existing technology, and achieves higher threat entity recognition accuracy. Adaptability of sexual and security defenses.
Patent Information
- Application Number
- CN202410365412.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-28
- Publication Date
- 2024-08-23
AI Technical Summary
Existing threat entity extraction methods are difficult to effectively capture the local context dependency and sequence order dependence in threat intelligence, resulting in low recognition accuracy and poor adaptability, especially in the face of complex attack patterns and domain-specific semantic deviations.
A threat entity extraction method based on autoregressive label subsequences is used to capture local context and sequence order dependency features through token encoders, part-of-speech encoders and bidirectional sequence attention modules, construct named entity labels and generate attack fingerprints, improving entity Recognition accuracy and adaptability.
It significantly improves the accuracy of threat entity extraction, solves the problem of semantic deviation and sequence pattern dependency in specific fields, and transforms threat intelligence into organized defense measures through attack fingerprints, thereby enhancing the pertinence and adaptability of security defense.
Smart Images

Figure CN118536508A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security, and in particular relates to a threat entity extraction method based on autoregressive label subsequences. Background Art
[0002] Threat Intelligence is a collection of information and knowledge about existing or potential security threats that can help understand, identify, and prevent cyber attacks. Threat Intelligence can include malware features, attacker behavior patterns, indicators of affected systems, and attack methods and strategies. Threat Entity Extraction is an important part of threat intelligence. It refers to identifying and extracting key entities related to security threats from various data sources, such as IP addresses, domain names, malware names, and attacker organizations. The significance of this process is that it can help security analysts quickly understand and evaluate threat scenarios, optimize security policies, and take effective measures to defend or mitigate potential security threats. By automatically extracting and summarizing key threat information, risk assessment and decision-making can be performed more efficiently, thereby improving overall security defense capabilities. The mainstream methods for extracting threat entities in threat intelligence can be roughly divided into three methods: rule-based, statistical feature-based, and deep learning (named entity recognition).
[0003] For the first rule-based threat entity extraction method: it first conducts detailed text analysis to identify common language patterns and syntactic structures of threat entities; then, based on these findings, a set of complex regular expressions or other matching rules are designed specifically to identify these patterns; then these rules are applied to unstructured text data to extract the corresponding threat entities; finally, the extraction results are post-processed and verified to ensure accuracy, and the rules are adjusted when necessary to optimize performance. Although the rule-based threat entity extraction method is famous for its accurate rule system, it has problems such as insufficient portability, high maintenance cost, and weak adaptability. The most critical problem is that it relies heavily on expert knowledge and manually written rules, which makes it difficult to adapt to the evolving threat entities and complex attack patterns in the field of threat intelligence.
[0004] For the second threat entity extraction method based on statistical features: this method first extracts a set of features from the text, which are designed to capture the contextual information around the threat entity, such as part of speech, local lexical environment, and dependency relationships; then selects a suitable machine learning algorithm (such as hidden Markov model, support vector machine, or conditional random field, etc.) to train it using annotated datasets; then applies the trained model to new text data to identify and extract the target threat entity; finally, the output of the model is evaluated and adjusted to further improve the extraction accuracy and efficiency. The second threat entity extraction method based on statistical features combines feature engineering and machine learning, showing its adaptability in identifying new entities, but it has problems such as strong feature dependence, insufficient generalization performance, high noise sensitivity, and weak context capture ability. The key reason is that this method relies on a pre-defined feature set, which is not enough to capture the key features of new or uncommon threat entities, resulting in insufficient generalization performance and lack of effective mechanisms to exploit the complex contextual relationships between entities.
[0005] For the third threat entity extraction method based on deep learning, there are several representative works as follows: 1. Huang Y et al. proposed an innovative named entity recognition method in the paper "NER in Cyber Threat Intelligence Domain Using Transformer with TSGL". This method uses pre-training based on the Bert model to initialize the features of sequence tokens, and then uses a bidirectional long short-term memory network (Bi-LSTM) to effectively integrate the token features with their sentence-level context information. This method further learns the sentence-level label sequence structure through the conditional random field (CRF) model, thereby improving the accuracy and efficiency of entity recognition; expanding on this, the paper "Anopen cyber threat intelligence knowledge graph" introduces an attention mechanism to enhance the feature representation of tokens, thereby further improving the accuracy of the model for entity recognition in text; in addition, the paper "Multi-featuresbased Semantic Augmentation Nerworks for Named Entity Recognition in ThreatIntelligence explores a multi-dimensional feature fusion method to capture the complex semantics of threat intelligence entities. By integrating the features of word level, part of speech, character level and other linguistic components, it realizes the accurate identification of threat intelligence entities. It is worth noting that considering the rapid change of entities in the field of threat intelligence, this method proposes a method based on word vector space distance, which adapts to the dynamic changes of threat intelligence entities by finding the n words closest to the target word in the vocabulary and using the attention mechanism to weightedly combine the features of these words. Although deep learning methods automatically learn the complex features of raw data through advanced neural network architectures, they have significant advantages over traditional methods that require manual feature design; and they can use deep semantic relationships in large amounts of data to effectively deal with pattern changes and entity diversity in threat intelligence; however, they do not fully consider the semantic deviation of threat intelligence in specific fields in the field of network security. Take "phishing" as an example. It refers to a specific attacker in threat intelligence, but refers to a certain activity in other fields. It can be seen that this semantic deviation in specific fields directly affects the accuracy of entity extraction.It is also found that threat entities in threat intelligence (such as hacker organizations, sample files, vulnerabilities, etc.) are usually defined or described in the sentences in which they appear, and their meanings are often determined by the surrounding words. The reason is that threat intelligence tends to provide dense and precise information in a shorter text range. This phenomenon is called local context dependency, which means that entity recognition in threat intelligence strongly depends on the specific context around it; for example: sentences mentioning threat organizations are often followed by relevant sample files, attack methods and exploited vulnerability information, such as. Figure 1 Although some methods have made innovations in token-level feature extraction, they have not fully addressed the problem of sequential pattern dependency. For example, 93% of sentences in threat intelligence contain the entity “vulnerability” immediately after the entity “organization” and “sample file”. Figure 1 As shown in (a) and (b) in the figure, this phenomenon is therefore defined as serial order dependency, which reflects the importance of serial relationships between entities in threat intelligence, especially when describing attack patterns and threat methods, and standardized terms are often used to express the mechanisms used in network attacks.
[0006] However, it remains a challenge to effectively convert the progress in named entity recognition into defensive measures. The effectiveness of these entities depends on how they are integrated into alert response measures and security operations, and existing research rarely explores the process of quickly converting information into defensive actions. Although there are methods that propose to store entities in graph databases to facilitate information retrieval, or encapsulate extraction models into Python libraries to simplify user operations, none of them clearly explain how to convert them into defensive measures in real time, which leads to adaptability issues in security defense applications; in addition, there is a lack of a clear bridge to convert dynamic intelligence into rapid decision support. Summary of the invention
[0007] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and provide a threat entity extraction method based on autoregressive label subsequences, which specifically captures the two key characteristics of local context dependency and sequence order dependency in threat intelligence, thereby extracting threat entities more accurately.
[0008] In order to achieve the above object, the present invention adopts the following technical solutions:
[0009] The threat entity extraction method based on autoregressive label subsequence includes the following steps:
[0010] Obtain a threat intelligence text collection, including multiple sentence sequences; each sentence sequence contains multiple tokens;
[0011] Build a named entity recognition model, including a token encoder, a part-of-speech encoder, a label encoder, and a bidirectional sequence attention module;
[0012] Input the threat intelligence text set into the token encoder to obtain token features through subsequence feature extraction;
[0013] Input the threat intelligence text collection into the part-of-speech encoder to extract and enhance the part-of-speech features of each token;
[0014] Use the label encoder to randomly initialize the label embedding table and encode the label sequence to obtain the sequence order dependency feature;
[0015] Input token features, part-of-speech features, and sequence order dependency features into the bidirectional sequence attention module to obtain named entity labels;
[0016] Construct attack fingerprints of threat entities based on named entity labels.
[0017] As a preferred technical solution, the token encoder includes a text encoder, an attention module and an MLP network;
[0018] The part-of-speech encoder includes a natural language processing tool and a Bi-LSTM network;
[0019] The label encoder includes a label embedding network and a Bi-LSTM network.
[0020] As a preferred technical solution, the text encoder is a pre-trained BERT model; the natural language processing tool is a spaCy processing library.
[0021] As a preferred technical solution, the threat intelligence text set is input into a token encoder to obtain token features through subsequence feature extraction, specifically:
[0022] For the sentence sequence X in the input threat intelligence text set, the text encoder is used to extract features to obtain the initial feature set, which is expressed as:
[0023] H=[h1,…,h i ,…,h N ]=Encoder(x1,…,x i ,…,x N )
[0024] Among them, h i is the d-dimensional initial feature of the i-th token; x i is the i-th token in the sentence sequence X; Encoder is the text encoder, and N is the number of tokens;
[0025] Construct a subsequence feature for each token in the sentence sequence X, and fill the subsequence feature of each token with a zero vector, expressed as:
[0026]
[0027]
[0028] in, The subsequence features constructed for the i-th token in the sentence sequence X, A new feature set is constructed for each token in the sentence sequence X as a subsequence. k is a hyperparameter used to control the length of the subsequence.
[0029] The subsequence features are regarded as query vectors, the initial features of the input sentence sequence are used as key vectors and value vectors, and the attention weights are calculated using the attention mechanism;
[0030] The input sentence sequence is weighted summed based on the attention weights to obtain the token features of each token.
[0031] As a preferred technical solution, before using the attention mechanism to calculate the attention weight, the subsequence features are connected through a fully connected layer. Projected to the corresponding initial feature h i In a space of the same dimension, the projection formula is:
[0032]
[0033] in, is the subsequence feature of the ith token after projection, W we is the learnable weight matrix, b we is the bias vector;
[0034] The attention weight is calculated using the Softmax function, and the formula is:
[0035]
[0036] in, is the attention weight, H T is the transposed matrix of the initial features of the input sentence sequence, and d is the dimension;
[0037] The weighted summation formula is:
[0038]
[0039] Among them, h′ i is the token feature of the i-th token, α t is the attention weight The weight value corresponding to the tth token in , h t is the initial feature of the tth token in the input sentence sequence X.
[0040] As a preferred technical solution, the threat intelligence text set is input into the part-of-speech encoder to extract and enhance the part-of-speech features of each token, specifically:
[0041] Use natural language processing tools to extract part-of-speech strings from sentence sequences in the input threat intelligence text collection;
[0042] Construct a randomly initialized part-of-speech lookup table Where M is the number of unique part-of-speech strings in the threat intelligence text collection, and d2 represents the dimension size of the part-of-speech embedding;
[0043] Use the part-of-speech lookup table to convert each token x i The corresponding part of speech is embedded into a vector middle;
[0044] The vector p for each token i Generate part-of-speech features through Bi-LSTM network The generating formula is:
[0045] p′ i =[LSTM f (p i ),LSTM b (p i )],i∈[1:N]
[0046] Among them, LSTM f For the forward component of the Bi-LSTM network, LSTM b It is the backward component of the Bi-LSTM network.
[0047] As a preferred technical solution, the label encoder is used to randomly initialize the label embedding table and encode the label sequence to obtain the sequence order dependency feature, specifically:
[0048] Build a randomly initialized label embedding table Where L is the total number of labels in the sentence sequence, and d3 is the embedding dimension;
[0049] Based on the label embedding table T label The true label y corresponding to each token γ ,γ∈[1:i-1] maps to its corresponding embedding vector i is the i-th token in the sentence sequence;
[0050] According to the embedding vector of the token, the label sequence is encoded using the Bi-LSTM network to obtain the sequence order dependency features corresponding to each token. It is expressed as:
[0051] S=[s′1,…,s′ γ ,…,s′ i-1 ]
[0052] s′ γ=[LSTM f (s γ ),LSTM b (s γ )],γ∈[1:i-1]
[0053] Among them, S is the sequence order dependency feature set of the sentence sequence, LSTM f For the forward component of the Bi-LSTM network, LSTM b It is the backward component of the Bi-LSTM network.
[0054] As a preferred technical solution, the obtaining of named entity tags is specifically as follows:
[0055] Use a fully connected layer to adjust the last feature s′ in the sequence order dependency feature i-1 The dimension of s is made the same as the dimension of the token feature to obtain a new feature representation s″ i-1 , the adjustment formula is:
[0056]
[0057] The new feature is represented by s″ i-1 As the query vector, the new feature set after the input sentence sequence is constructed into subsequences is used as the key vector and value vector, and the first attention weight is calculated The formula is:
[0058]
[0059] in, is the first learnable weight matrix of the bidirectional sequence attention module, is the first bias vector of the bidirectional sequence attention module, A new feature set is constructed for each token in the sentence sequence as a subsequence, and d is the dimension of the token embedding;
[0060] Based on the attention weights, the tokens of the input sentence sequence are weighted to obtain a new token representation
[0061]
[0062] Where N is the number of tokens in the input sentence sequence, α t As quantity, calculate the weight value corresponding to the tth token in the first attention weight, h t is the initial feature of the tth token in the input sentence sequence, and H is the initial feature set of the input sentence sequence;
[0063] The initial feature h of the i-th token is transformed through a fully connected layer i and its corresponding subsequence feature h′i Project it to the last feature s′ in the sequence order dependency feature i-1 The dimension matches, and the projection is expressed as:
[0064]
[0065] Among them, z i is the projection representation, is the second learnable weight matrix in the bidirectional sequence attention module, is the vector concatenation operation, is the second bias vector in the bidirectional sequence attention module;
[0066] The projection representation is regarded as the query vector, the sequence order dependency features are regarded as the key vector and the value vector, and a simple attention module is used to calculate the second attention weight and label context information. The formula is:
[0067]
[0068]
[0069] in, is the second attention weight, S is the sequence order dependency feature set, is the label context information of the i-th token, α t is the weight value corresponding to the tth token in the second attention weight, s′ t is the sequence order dependency feature corresponding to the tth token in the sequence order dependency feature set;
[0070] The new token represents Tag context information Part-of-speech feature p′ i and initial feature h i Splice and get the coupling vector u i , expressed as:
[0071]
[0072] Use a trainable weight matrix W o and the bias vector b o Project the coupling vector to the output space and predict the label:
[0073] o i ∈R C =W o u i +b o
[0074]
[0075] Among them, C is the set of real labels of threat entities in the threat intelligence text set, y i is the predicted label of the ith token, The score predicted for the i-th token as class c, The score predicted for class j for the i-th token.
[0076] As a preferred technical solution, the attack fingerprint of the threat entity is constructed based on the named entity tag, specifically:
[0077] Filter out threat entities whose named entity labels are threat organizations from threat entities extracted from threat intelligence texts;
[0078] Define the fingerprint of the threat entity whose named entity label is the threat organization as A set of named entity labels that includes threat entities related to this threat entity and its fixed relationship with the named entity label of the threat entity
[0079] For each threat entity e∈ε extracted from the threat intelligence text, a mapping function Identify its named entity label T(e), where ε is the set of threat entities extracted from the threat intelligence text;
[0080] For each pair of threat entity named entity labels (T(e i ),T(e j )), through the relational function Specify a relationship
[0081] Taking the threat entity whose named entity label is the threat organization as the center, an attack fingerprint graph G is constructed, where the node set is determined by the threat entity whose named entity label is the threat organization:
[0082] V={v T(e) |e∈ε}
[0083] The edge set is determined by the relationship between the named entity types of the threat entity:
[0084]
[0085] Finally, the attack fingerprint graph of the threat entity whose named entity label is the threat organization is obtained, which is expressed as:
[0086]
[0087] Among them, v T(e) Name the node of the entity label for the threat entity e, R(T(e i ),T(ej )) is the threat entity e i and e j Relation edges between named entity labels;
[0088] The fingerprint of each threat entity whose named entity is labeled as a threat organization is put into the threat fingerprint database for storage.
[0089] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0090] 1. Aiming at the unique local context dependency and sequence order dependency of threat intelligence, the present invention proposes a threat entity extraction method based on autoregressive label subsequence, which effectively captures the local semantics and sequence structure in the intelligence text, significantly improves the accuracy of threat entity extraction, and solves the semantic deviation problem and sequence pattern dependency problem in specific fields.
[0091] 2. Aiming at the problem of adaptability of security defense applications, the present invention constructs a knowledge graph fingerprint with threat organizations as the core through the extracted threat entities, and converts the information extracted from the threat intelligence into organized attack fingerprints through fingerprint rules, so that threat identification and defense are more accurate and targeted; the attack fingerprint graph integrates multi-source knowledge and reveals attack patterns, strengthens defense measures, reduces APT attacks, and can convert threat entities in threat intelligence into actual defense measures. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0093] Figure 1 This is an example diagram of a threat intelligence sentence in an embodiment of the present invention.
[0094] Figure 2 The figure is a flowchart of a threat entity extraction method based on autoregressive label subsequences in an embodiment of the present invention.
[0095] Figure 3 Schematic diagram of the named entity recognition model in an embodiment of the present invention.
[0096] Figure 4 Schematic diagram of an attack fingerprint constructed in an embodiment of the present invention. DETAILED DESCRIPTION
[0097] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0098] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0099] like Figure 2 As shown, the threat entity extraction method based on the autoregressive label subsequence in this embodiment includes the following steps:
[0100] S1. Obtain a threat intelligence text collection, including multiple sentence sequences, each of which contains multiple tokens;
[0101] S2. Build a named entity recognition model, including a token encoder, a part-of-speech encoder, a label encoder, and a bidirectional sequence attention module;
[0102] S3, input the sequence into the token encoder to obtain token features through subsequence feature extraction;
[0103] S4, input the sequence into the part-of-speech encoder to refine and enhance the part-of-speech features of each token;
[0104] S5. Use the label encoder to randomly initialize the label embedding table and encode the label sequence to obtain the sequence order dependency feature;
[0105] S6, inputting token features, part-of-speech features and sequence order dependency features into a bidirectional sequence attention module to obtain named entity labels;
[0106] S7. Construct an attack fingerprint of the threat entity based on the named entity label.
[0107] First, the threat intelligence text set is composed of a series of sentences. In this application, the sentences are regarded as a sentence sequence, such as Figure 1 As shown in (a), (b), and (c); then each word in the sentence sequence is used as a token. The purpose of this application is to identify the label of each token and extract the threat entity.
[0108] Furthermore, the existing threat intelligence named entity recognition methods are mainly based on the conditional random field (CRF) enhancement method, and are usually combined with the long short-term memory network (LSTM) module or the convolutional neural network (CNN) module to learn token features. However, these methods have limitations in capturing the unique characteristics of threat entities in threat intelligence texts; the reason is that CRF mainly focuses on the local optimum of the solution and cannot fully resolve the local contextual dependencies existing in threat intelligence texts; in addition, traditional methods also show limitations in using label features to capture sequence order dependencies, which is particularly critical in processing the complex context of threat intelligence.
[0109] In order to solve this problem, the present invention constructs a new named entity recognition model. The model architecture is as follows: Figure 3 As shown in the figure, the model is specially designed to capture the two key features of local context dependency and sequence order dependency in threat intelligence. By integrating a new encoder and attention mechanism, the model significantly improves the ability to capture these two dependencies, making it more suitable for the task of extracting large-scale threat intelligence entities. The model mainly consists of four modules:
[0110] The token encoder (Word Encoder) includes a text encoder, an attention module, and an MLP network (multi-layer perceptron network): by acquiring the token feature embeddings in the sequence, and then constructing these feature embeddings into subsequences, it lays the foundation for subsequent fine-grained local information capture. This module is used to capture local context dependencies. In this embodiment, the text editor uses a pre-trained BERT model.
[0111] The part-of-speech encoder (Pos Encoder) includes a natural language processing tool and a Bi-LSTM network; by extracting features related to part-of-speech, the model is used to better understand and process professional terms and entities in threat intelligence. The natural language processing tool in this embodiment uses the spaCy processing library.
[0112] The Label Encoder includes a label embedding network and a Bi-LSTM network. It extracts label features to model the contextual information within the label, so that the model can effectively identify and distinguish different threat entities. This module is used to capture sequence order dependencies.
[0113] Dual-Sequence Attention: It is used to enhance the association between tags and tokens by deeply mining the complex interdependencies between tags and tokens.
[0114] Furthermore, the threat intelligence text set is input into the token editor to extract the token features through subsequence features, specifically:
[0115] S301. For a sentence sequence X in an input threat intelligence text set, a text encoder is used to extract features to obtain an initial feature set H, which is expressed as:
[0116] H=[h1,…,h i ,…,h N ]=Encoder(x1,…,x i ,…,x N )
[0117] Among them, h i is the d-dimensional initial feature of the i-th token; x i is the i-th token in the sentence sequence X; Encoder is the text encoder; N is the number of tokens;
[0118] S302. Since the bidirectional Transformer structure and self-attention mechanism are used in the BERT model, the obtained vector not only reflects the independent features of each token, but also contains coarse-grained global information at the sentence level. In order to capture the local context dependency in threat intelligence, a subsequence feature is constructed for each token in the sentence sequence X, and a zero vector is used to fill the subsequence feature of each token to ensure that the length of each token subsequence feature is equal, which is expressed as:
[0119]
[0120]
[0121] in, The subsequence features constructed for the i-th token in the sentence sequence X, A new feature set is constructed for each token in the sentence sequence X as a subsequence. k is a hyperparameter used to control the length of the subsequence.
[0122] S303, in order to enhance the interaction and feature representation between words in a sentence, an attention mechanism is used to focus on processing the contextual features of the subsequence, and the subsequence features are Considered as a query vector, the initial features of the input sentence sequence are used as the key vector and value vector, and the attention weight is calculated using the attention mechanism;
[0123] In this embodiment, before calculating the attention weight, the subsequence features are connected through a fully connected layer. Projected to the corresponding initial feature h i In a space of the same dimension, the projection formula is:
[0124]
[0125] in, is the subsequence feature of the ith token after projection, Wwe is the learnable weight matrix, b we is the bias vector;
[0126] Then use the Softmax function to calculate the attention weight, the formula is:
[0127]
[0128] in, is the attention weight, H T is the transposed matrix of the initial features of the input sentence sequence, and d is the dimension;
[0129] S304: Perform weighted summation on the input sentence sequence based on the attention weight to obtain token features.
[0130] Attention Weight It can be regarded as a probability distribution, which is used to perform weighted summation on the input sentence sequence to obtain the token feature, expressed as:
[0131]
[0132] Among them, h′ i is the token feature of the i-th token, α t is the attention weight The weight value corresponding to the tth token in , h t is the initial feature of the tth token in the input sentence sequence X.
[0133] Through this subsequence feature extraction strategy, the token encoder is able to capture the local contextual dependencies in threat intelligence text more accurately.
[0134] Furthermore, the part-of-speech encoder pays special attention to refining and enhancing the part-of-speech features of each token in the input sequence to accurately understand professional terms, technical details and entity relationships, specifically:
[0135] S401, first use a natural language processing tool to extract the part-of-speech character string of the sentence sequence in the input threat intelligence text set;
[0136] S402: Then construct a randomly initialized part-of-speech lookup table Where M is the number of unique part-of-speech strings in the threat intelligence text collection, and d2 represents the dimension size of the part-of-speech embedding;
[0137] S403, then, use the part-of-speech lookup table Tpos to convert each token x i The corresponding part of speech is embedded into a vector middle;
[0138] S404, finally the vector p of each tokeni Generate part-of-speech features through Bi-LSTM network The generating formula is:
[0139] p′ i =[LSTM f (p i ),LSTM b (p i )],i∈[1:N]
[0140] Among them, LSTM f For the forward component of the Bi-LSTM network, LSTM b It is the backward component of the Bi-LSTM network.
[0141] Through part-of-speech encoding processing, the part-of-speech features of each token are carefully refined and enhanced, which improves the model's ability to understand word meanings and the accuracy of entity recognition in threat intelligence analysis.
[0142] Furthermore, the label encoder pays special attention to solving the problem of sequential order dependency of entities in threat intelligence text. Therefore, this application proposes an innovative label encoding strategy to capture and model the complex sequential order dependency between threat entity labels, specifically:
[0143] S501: Establish a randomly initialized label embedding table Where L is the total number of labels in the sentence sequence, and d3 is the embedding dimension;
[0144] S502: embedding table T based on tags label The true label y corresponding to each token γ ,γ∈[1:i-1] maps to its corresponding embedding vector i is the i-th token in the sentence sequence;
[0145] S503: Use the Bi-LSTM network to encode the label sequence according to the embedding vector of the token to obtain the sequence order dependency feature corresponding to each token. It is expressed as:
[0146] S=[s′1,…,s′ γ ,…,s′ i-1 ]
[0147] s′ γ =[LSTM f (s γ ),LSTM b (s γ )],γ∈[1:i-1]
[0148] Among them, S is the sequence order dependency feature set of the sentence sequence, LSTMf For the forward component of the Bi-LSTM network, LSTM b It is the backward component of the Bi-LSTM network.
[0149] Through this innovative label encoding, the label encoder can more accurately capture and utilize the serial order dependencies in threat intelligence text, significantly improving the accuracy and reliability of named entity recognition.
[0150] Furthermore, in order to improve the integration of contextual information of the input sentence sequence and the preceding label sequence, so as to accurately predict the entity label, the present invention proposes an innovative dual-sequence attention module in the field of intelligence; in this module, the last hidden state of the Bi-LSTM network in the label encoder will be regarded as the query vector representing the preceding label sequence; at the same time, the new feature set after the input sentence sequence is constructed into subsequences is used as the key vector and value vector, in order to effectively fuse these two types of information, specifically:
[0151] S601, use a fully connected layer to adjust the last feature s′ in the sequence order dependency feature i-1 The dimension of s is made the same as the dimension of the token feature to obtain a new feature representation s″ i-1 , the adjustment formula is:
[0152]
[0153] S602, represent the new feature s″ i-1 As the query vector, the new feature set after the input sentence sequence is constructed into subsequences is used as the key vector and value vector, and the Softmax function is used to calculate the first attention weight The formula is:
[0154]
[0155] in, is the first learnable weight matrix of the bidirectional sequence attention module, is the first bias vector of the bidirectional sequence attention module, A new feature set is constructed for each token in the sentence sequence as a subsequence, where d is the dimension of the token embedding; the purpose of this step is to enable the model to effectively evaluate the relative importance of each token in the input sentence sequence, thereby enhancing its processing and understanding capabilities;
[0156] S603: Based on the attention weight, the tokens of the input sentence sequence are weighted to represent the tokens, so that the model can adjust the representation of the current token according to the previous label information to obtain a new token representation.
[0157]
[0158] Where N is the number of tokens in the input sentence sequence, α t As the quantity, calculate the weight value corresponding to the tth token in the first attention weight, h t is the initial feature of the tth token in the input sentence sequence, and H is the initial feature set of the input sentence sequence;
[0159] New token representation By s′ i-1 Guided by, it naturally represents the label of the current token (i.e., y i ) and the entire input sentence sequence; in addition, it captures the current token x i Compared with the previously predicted label (i.e. y 1:i-1 ) is also necessary to enhance x i Sensitivity to prior named entity labels.
[0160] S604, therefore, the initial feature h of the i-th token is transformed through a fully connected layer i and its corresponding subsequence feature h′ i Project it to the last feature s′ in the sequence order dependency feature i-1 The dimension matches, and the projection is expressed as:
[0161]
[0162] Among them, z i is the projection representation, is the second learnable weight matrix in the bidirectional sequence attention module, is the vector concatenation operation, is the second bias vector in the bidirectional sequence attention module;
[0163] S605. Consider the projection representation as a query vector, the sequence order dependency feature as a key vector and a value vector, and use a simple attention module to calculate the second attention weight and label context information. The formula is:
[0164]
[0165]
[0166] in, is the second attention weight, S is the sequence order dependency feature set, is the label context information of the i-th token, α t is the weight value corresponding to the tth token in the second attention weight, s′ tis the sequence order dependency feature corresponding to the tth token in the sequence order dependency feature set;
[0167] S606, in order to integrate these features, the new token represents Tag context information Part-of-speech feature p′ i and initial feature h i Splice and get the coupling vector u i , expressed as:
[0168]
[0169] S607, finally adopt a trainable weight matrix W o and the bias vector b o Project the coupling vector to the output space and use the Softmax function to predict the label:
[0170] o i ∈R C =W o u i +b o
[0171]
[0172] Among them, C is the set of real labels of threat entities in the threat intelligence text set, y i is the predicted label of the ith token, The score predicted for the i-th token as class c, The score predicted for class j for the i-th token.
[0173] Furthermore, the attack fingerprint of the threat entity is constructed based on the named entity label, specifically:
[0174] S701, filtering out threat entities whose named entity labels are threat organizations from threat entities extracted from threat intelligence text;
[0175] S702: Define the fingerprint of the threat entity whose named entity tag is the threat organization. A set of named entity labels that includes threat entities related to this threat entity and its fixed relationship with the named entity label of the threat entity
[0176] S703, for each threat entity e∈ε extracted from the threat intelligence text, a mapping function Identify its named entity type T(e), where ε is the set of threat entities extracted from the threat intelligence text;
[0177] S704: For each pair of threat entity named entity tags (T(e i ),T(e j )), through the relational function Specify a relationship
[0178] S705. Taking the threat entity whose named entity label is the threat organization as the center, construct an attack fingerprint graph G, where the node set is determined by the named entity labels of the threat entity whose named entity label is the threat organization and the threat entities related to the threat entity:
[0179] V={v T(e) |e∈ε}
[0180] The set of edges is determined by the relationships between nodes:
[0181]
[0182] Finally, the attack fingerprint graph of the threat entity whose named entity label is the threat organization is obtained, which is expressed as:
[0183]
[0184] Among them, v T(e) The node of the named entity label of threat entity e, the node attribute contains the specific information of the threat entity (such as threat entity name, identification information, etc.), R(T(e i ),T(e j )) is the threat entity e i and e j The relationship edge between named entity tags, based on fingerprint The decision is made based on the relationship type defined in , and the directionality and other relevant attributes of the included relationship are considered to enrich the expressiveness of the attack fingerprint graph.
[0185] S706: Put the fingerprint of each threat entity whose named entity tag is a threat organization into a threat fingerprint database for storage.
[0186] Figure 4 The following is a schematic diagram of an attack fingerprint graph. The graph contains 17 types of nodes in total. After threat entities are extracted from threat intelligence, an attack fingerprint graph of the threat organization is constructed based on the fingerprint structure.
[0187] After obtaining the threat fingerprint database, we can compare the alarm data with the threat fingerprints stored in the threat fingerprint database to find threat organizations with similar attack behaviors. We can then perform defenses based on historical information in the database, such as blocking IP addresses used by the threat organization or repairing vulnerabilities exploited by the threat organization.
[0188] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.
[0189] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above 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.
[0190] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. Threat entity extraction method based on autoregressive label subsequence, It is characterized in that The steps include: Obtain a threat intelligence text collection, including multiple sentence sequences; each sentence sequence contains multiple tokens; Build a named entity recognition model, including a token encoder, a part-of-speech encoder, a label encoder, and a bidirectional sequence attention module; Input the threat intelligence text set into the token encoder to obtain token features through subsequence feature extraction; Input the threat intelligence text collection into the part-of-speech encoder to extract and enhance the part-of-speech features of each token; Use the label encoder to randomly initialize the label embedding table and encode the label sequence to obtain the sequence order dependency feature; Input token features, part-of-speech features, and sequence order dependency features into the bidirectional sequence attention module to obtain named entity labels; Construct attack fingerprints of threat entities based on named entity labels.
2. According to the method for extracting threat entities based on autoregressive label subsequences according to claim 1, It is characterized in that The token encoder includes a text encoder, an attention module and an MLP network; The part-of-speech encoder includes a natural language processing tool and a Bi-LSTM network; The label encoder includes a label embedding network and a Bi-LSTM network.
3. According to claim 2, the threat entity extraction method based on autoregressive label subsequence, It is characterized in that The text encoder is a pre-trained BERT model; the natural language processing tool is the spaCy processing library.
4. According to claim 2, the threat entity extraction method based on autoregressive label subsequence, It is characterized in that The threat intelligence text set is input into the token encoder to obtain token features through subsequence feature extraction, specifically: For the sentence sequence X in the input threat intelligence text set, the text encoder is used to extract features to obtain the initial feature set, which is expressed as: H=[h 1 ,…,h i ,…,h N ]=Encoder(x 1 ,…,x i ,…,x N ) Among them, h i is the d-dimensional initial feature of the i-th token; x i is the i-th token in the sentence sequence X; Encoder is the text encoder, and N is the number of tokens; Construct a subsequence feature for each token in the sentence sequence X, and fill the subsequence feature of each token with a zero vector, expressed as: in, The subsequence features constructed for the i-th token in the sentence sequence X, A new feature set is constructed for each token in the sentence sequence X as a subsequence. k is a hyperparameter used to control the length of the subsequence. The subsequence features are regarded as query vectors, the initial features of the input sentence sequence are used as key vectors and value vectors, and the attention weights are calculated using the attention mechanism; The input sentence sequence is weighted summed based on the attention weights to obtain the token features of each token.
5. According to claim 4, the threat entity extraction method based on autoregressive label subsequence, It is characterized in that Before using the attention mechanism to calculate the attention weight, the subsequence features are transformed through a fully connected layer. Projected to the corresponding initial feature h i In a space of the same dimension, the projection formula is: in, is the subsequence feature of the ith token after projection, W we is the learnable weight matrix, b we is the bias vector; The attention weight is calculated using the Softmax function, and the formula is: in, is the attention weight, H T is the transposed matrix of the initial features of the input sentence sequence, and d is the dimension; The weighted summation formula is: Among them, h′ i is the token feature of the i-th token, α t is the attention weight The weight value corresponding to the tth token in , h t is the initial feature of the tth token in the input sentence sequence X.
6. According to claim 2, the threat entity extraction method based on autoregressive label subsequence, It is characterized in that The threat intelligence text set is input into the part-of-speech encoder to refine and enhance the part-of-speech features of each token, specifically: Use natural language processing tools to extract part-of-speech strings from sentence sequences in the input threat intelligence text collection; Construct a randomly initialized part-of-speech lookup table Where M is the number of unique part-of-speech strings in the threat intelligence text collection, d 2 Indicates the dimension size of part-of-speech embedding; Use the part-of-speech lookup table to convert each token x i The corresponding part of speech is embedded into a vector middle; The vector p for each token i Generate part-of-speech features through Bi-LSTM network The generating formula is: p′ i =[LSTM f (p i ),LSTM b (p i )],i∈[1:N] Among them, LSTM f For the forward component of the Bi-LSTM network, LSTM b It is the backward component of the Bi-LSTM network.
7. According to claim 2, the threat entity extraction method based on autoregressive label subsequence, It is characterized in that The label encoder is used to randomly initialize the label embedding table and encode the label sequence to obtain the sequence order dependency feature, specifically: Build a randomly initialized label embedding table Among them, L is the total number of labels in the sentence sequence, d 3 is the embedding dimension; Based on the label embedding table T label The true label y corresponding to each token γ ,γ∈[1:i-1] maps to its corresponding embedding vector i is the i-th token in the sentence sequence; According to the embedding vector of the token, the label sequence is encoded using the Bi-LSTM network to obtain the sequence order dependency features corresponding to each token. It is expressed as: S=[s′ 1 ,…,s′ γ ,…,s′ i-1 ] s′ γ =[LSTM f (s γ ),LSTM b (s γ )],γ∈[1:i-1] Among them, S is the sequence order dependency feature set of the sentence sequence, LSTM f For the forward component of the Bi-LSTM network, LSTM b It is the backward component of the Bi-LSTM network.
8. According to claim 2, the threat entity extraction method based on autoregressive label subsequence, It is characterized in that The named entity tag is obtained as follows: Use a fully connected layer to adjust the last feature s′ in the sequence order dependency feature i-1 The dimension of s is made the same as the dimension of the token feature to obtain a new feature representation s″ i-1 , the adjustment formula is: The new feature is represented by s″ i-1 As the query vector, the new feature set after the input sentence sequence is constructed into subsequences is used as the key vector and value vector, and the first attention weight is calculated The formula is: in, is the first learnable weight matrix of the bidirectional sequence attention module, is the first bias vector of the bidirectional sequence attention module, A new feature set is constructed for each token in the sentence sequence as a subsequence, and d is the dimension of the token embedding; Based on the attention weights, the tokens of the input sentence sequence are weighted to obtain a new token representation Where N is the number of tokens in the input sentence sequence, α t As the quantity, calculate the weight value corresponding to the tth token in the first attention weight, h t is the initial feature of the tth token in the input sentence sequence, and H is the initial feature set of the input sentence sequence; The initial feature h of the i-th token is transformed through a fully connected layer i and its corresponding subsequence feature h′ i Project it to the last feature s′ in the sequence order dependency feature i-1 The dimension matches, and the projection is expressed as: Among them, z i is the projection representation, is the second learnable weight matrix in the bidirectional sequence attention module, is the vector concatenation operation, is the second bias vector in the bidirectional sequence attention module; The projection representation is regarded as the query vector, the sequence order dependency features are regarded as the key vector and the value vector, and a simple attention module is used to calculate the second attention weight and label context information. The formula is: in, is the second attention weight, S is the sequence order dependency feature set, is the label context information of the i-th token, α t is the weight value corresponding to the tth token in the second attention weight, s t ′ is the sequence order dependency feature corresponding to the tth token in the sequence order dependency feature set; The new token represents Tag context information Part of speech feature i ′ and initial feature h i Splice and get the coupling vector u i , expressed as: Use a trainable weight matrix W o and the bias vector b o Project the coupling vector to the output space and predict the label: o i ∈R C =W o u i +b o Among them, C is the set of real labels of threat entities in the threat intelligence text set, y i is the predicted label of the ith token, The score predicted for the i-th token as class c, The score predicted for class j for the i-th token.
9. According to claim 2, the threat entity extraction method based on autoregressive label subsequence, It is characterized in that The attack fingerprint of the threat entity is constructed based on the named entity tag, specifically: Filter out threat entities whose named entity labels are threat organizations from threat entities extracted from threat intelligence texts; Define the fingerprint of the threat entity whose named entity label is the threat organization as A set of named entity labels that includes threat entities related to this threat entity and its fixed relationship with the named entity label of the threat entity For each threat entity e∈ε extracted from the threat intelligence text, a mapping function Identify its named entity label T(e), where ε is the set of threat entities extracted from the threat intelligence text; For each pair of threat entity named entity labels (T(e i ),T(e j )), through the relational function Specify a relationship Taking the threat entity whose named entity label is the threat organization as the center, an attack fingerprint graph G is constructed, in which the node set is determined by the named entity labels of the threat entity whose named entity label is the threat organization and the threat entities related to the threat entity: V={v T(e) |e∈ε} The set of edges is determined by the relationships between nodes: Finally, the attack fingerprint graph of the threat entity whose named entity label is the threat organization is obtained, which is expressed as: Among them, v T(e) Name the node of the entity label for the threat entity e, R(T(e i ),T(e j )) is the threat entity e i and e j Relation edges between named entity labels; The fingerprint of each threat entity whose named entity is labeled as a threat organization is put into the threat fingerprint database for storage.
Citation Information
Cited By
APT attack detection and tracing method based on log
CN119299214A
Data management method based on sentence semantic perception and related equipment
CN120277117A
Network information security adaptive threat intelligence analysis and response method and system
CN120602225A
