Metalearning-based small sample malicious domain name detection method and device
By modeling DNS scenarios as heterogeneous graphs and introducing meta-learning algorithms, the problem of insufficient generalization capabilities and insufficient labeled samples of existing malicious domain name detection methods is solved, and efficient malicious domain name detection in small sample conditions is achieved.
Patent Information
- Application Number
- CN202310221375.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2024-09-10
AI Technical Summary
Existing malicious domain name detection methods rely on expert domain knowledge, feature extraction or labeled data, have insufficient generalization capabilities and cannot accurately detect scenarios with insufficient labeled samples.
The DNS scenario is modeled as a heterogeneous graph, a heterogeneous graph neural network is used to learn domain name node representation, and a meta-learning algorithm with a knowledge distillation module is introduced to optimize the detection model to detect malicious domain names in small sample cases.
With fewer labeled samples, it achieves a higher accuracy in detecting malicious domain names, fully explores the complex relationships in DNS scenarios, and uses unlabeled samples to improve detection results.
Smart Images

Figure CN118631477A
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network security technology, specifically relating to a method and apparatus for detecting malicious domain names in small samples based on meta-learning. Background Art
[0002] The Domain Name System (DNS) is one of the most important infrastructure components of the Internet. It is a distributed database composed of hierarchical DNS servers that translates easy-to-remember domain names into IP addresses, enabling the location of Internet resources. Due to its crucial role on the Internet, DNS has become a significant vector for cyberattacks such as spam, phishing, and malware. Therefore, malicious domain name detection is a hot topic in cybersecurity research.
[0003] Existing methods for detecting malicious domain names include rule-based methods, statistical feature-based methods, and association-based methods.
[0004] (I) Rule-based approach
[0005] Rule-based methods are the most traditional and widely used methods for detecting malicious domains. These methods primarily rely on expert domain knowledge to detect malicious domains. (Sato et al., 2012) Analysis revealed that if two domains are frequently requested for resolution by the same user, and one domain is malicious, the other is also very likely malicious. (Grill et al., 2015) Research on the principles of Domain-Flux technology found that infected hosts can resolve a large number of domains in a short period without accessing a corresponding number of IPs. The authors modeled the ratio between DNS requests issued by each host and the accessed IPs, using a fuzz equation and setting a threshold to identify malicious domains, achieving good results on the test dataset. However, these methods heavily rely on expert domain experience, can only detect a certain type of malicious domain, and have poor generalization ability.
[0006] (II) Methods Based on Statistical Characteristics
[0007] Feature-based methods extract domain characteristics from DNS traffic data, DNS logs, or other DNS-related data, and then build classifiers to classify domains. (Antonakakis et al., 2010) designed a dynamic and comprehensive DNS evaluation system called Notos, which extracted three types of domain characteristics: network-based characteristics, domain-based characteristics, and evidence-based characteristics. Notos assigns low reputation scores to malicious domains and high reputation scores to benign domains based on these characteristics and historical malicious data. (Bilge et al., 2011) proposed the online malicious domain detection system Exposure, which extracts four categories of domain characteristics: time-based, DNS response-based, TTL-based, and domain text information-based. (Schüppen et al., 2018) proposed the FANCI system to classify non-existent domains (NXDomains) in DNS traffic into malicious and benign domains. This system extracts features only from the domain itself, including 21 features in three categories: domain structural features, domain linguistic features, and domain statistical features. It then uses machine learning methods SVM and RF to classify domains, achieving high accuracy on multiple real networks. Compared to the aforementioned feature-based malicious domain detection methods, the FANCI system only requires the text information of the domain name and consumes less training time.
[0008] Feature-based malicious domain detection methods require domain knowledge because they need to extract feature information, and the designed features can be easily modified by attackers.
[0009] (III) Relationship-based methods
[0010] Relationship-based methods transform the malicious domain detection problem into a graph node classification problem by leveraging the relationships between domain names. (Manadhata et al., 2014) constructed a host-domain bipartite graph, labeled the graph nodes with known malicious domains and infected hosts, and then used the belief propagation algorithm to calculate the probability that a domain name is malicious. (Khalil et al., 2016) argued that attackers tend to reuse IP address resources, built a domain name-IP domain name resolution graph, and used a path reasoning algorithm to detect malicious domains. Due to the limitations of bipartite graphs, they cannot fully explore the DNS scenario. (Sun et al., 2020) proposed the Deepdom malicious domain detection system, modeling the DNS scenario as a heterogeneous information network containing four types of nodes: hosts, domains, IP addresses, and accounts. They designed a graph convolutional network, SHetGCN, to learn node embeddings and achieve node classification. Results on the real CERNET2 dataset show that SHetGCN outperforms some current mainstream heterogeneous graph embedding methods.
[0011] However, most researchers currently model DNS scenarios as bipartite graphs. Due to the limitations of bipartite graphs, they cannot fully uncover the complex relationships within DNS scenarios. Furthermore, association-based methods require a large amount of labeled data to train neural networks; however, labeling domain name samples is a time-consuming and labor-intensive task. Therefore, existing models are limited by insufficient labeled samples and cannot accurately detect malicious domain names. Summary of the Invention
[0012] To address the aforementioned problems, this invention proposes a method and apparatus for detecting malicious domain names in small samples based on meta-learning. This method analyzes the complex relationships between domain names, IP addresses, and clients. First, it models the DNS scenario as a heterogeneous graph to capture richer information. Then, it uses a heterogeneous graph neural network to learn the representation of domain name nodes on this graph. Finally, considering that only a few labeled samples are available in real-world DNS scenarios, this invention introduces a meta-learning algorithm with a knowledge distillation module to optimize the detection model.
[0013] The technical content of this invention includes:
[0014] A few-sample malicious domain name detection method based on meta-learning, the method comprising:
[0015] The DNS scenario is modeled as a heterogeneous graph; the nodes of the heterogeneous graph include: clients, domain names, and IP addresses, and the edges of the heterogeneous graph include: clients querying domain names, domain names resolving to IP addresses, and the canonical names of domain names;
[0016] The node representation of a domain name is learned based on a heterogeneous graph neural network (HGT) to obtain an updated domain name feature vector.
[0017] The updated domain name feature vector is classified using a classifier to obtain malicious domain name detection results; wherein the heterogeneous graph neural network (HGT) and the classifier are optimized end-to-end based on a meta-learning algorithm.
[0018] Furthermore, after constructing the heterogeneous graph of the domain name resolution process, the process also includes:
[0019] Prune noisy nodes or nodes whose contribution to information propagation is less than the threshold.
[0020] Furthermore, the initial representation of the domain names in the heterogeneous graph includes: structural features, linguistic features, and statistical features.
[0021] Furthermore, the heterogeneous graph neural network (HGT) and the classifier are optimized end-to-end based on a meta-learning algorithm, including:
[0022] Based on the number of labeled samples corresponding to each malicious domain detection task in the training set, the malicious domain detection task is divided into meta-training task and meta-test task.
[0023] Each training task T i Heyuan Test Task T mt The training data is divided into support sets. query set and support set query set
[0024] Based on support set The heterogeneous graph neural network (HGT) and the classifier are trained, and the results are obtained by training the query set. Calculate loss Obtain the meta-trained model;
[0025] Based on support set The meta-training model is trained and combined with cross-entropy loss L. ce The fine-tuned meta-training model is obtained;
[0026] Through query set Soft knowledge is propagated from the fine-tuned meta-training model to the meta-testing model, and combined with knowledge distillation loss L. KD The trained heterogeneous graph neural network (HGT) and classifier are obtained.
[0027] Furthermore, the above is achieved through the query set Calculate loss The resulting meta-trained model includes:
[0028] Calculate query set Losses
[0029] The gradient is then used to update the parameter θ. Where α represents the step size of the inner layer training. f represents the gradient of the parameter θ. θ This represents a model with parameter θ.
[0030] Stochastic gradient descent is used for cross-task meta-optimization to update parameters. Where β represents the learning rate, and L represents the total number of meta-training task types;
[0031] Based on the updated parameters θ, the meta-trained model is obtained.
[0032] Furthermore, the loss knowledge distillation loss Where t represents the temperature exponent used to smooth the peak value of the softmax distribution, and l represents the number of tags. This represents the prediction distribution of the fine-tuned meta-trained model. Z represents the predicted distribution of the meta-test model. j Represents query set The embedding of the j-th node.
[0033] A few-sample malicious domain name detection device based on meta-learning, the device comprising:
[0034] The construction module is used to model the DNS scenario as a heterogeneous graph; the nodes of the heterogeneous graph include: clients, domain names and IP addresses, and the edges of the heterogeneous graph include: client querying domain names, domain name resolution to IP addresses and the canonical name of the domain name; the calculation module is used to learn the node representation of the domain name based on the heterogeneous graph neural network HGT to obtain the updated domain name feature vector.
[0035] The classification module is used to classify the updated domain name feature vector using a classifier to obtain malicious domain name detection results; wherein the heterogeneous graph neural network (HGT) and the classifier are optimized end-to-end based on a meta-learning algorithm.
[0036] An electronic device includes: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements any of the methods described above.
[0037] A computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement any of the methods described above.
[0038] Compared with existing technologies, this invention models the DNS scenario as a heterogeneous graph, considering more node and edge types. Furthermore, this paper proposes a small-sample malicious domain name detection model, which achieves high detection efficiency even with a limited number of labeled samples. The technical advantages of this invention mainly include the following aspects:
[0039] 1. To better simulate real-world DNS scenarios and aggregate more information, this invention models the DNS scenario as a heterogeneous graph based on real DNS traffic data. This heterogeneous graph contains three different types of nodes: domain names, IP addresses, and clients, and three different types of edges: the request relationship between a client and a domain name, the resolution relationship of a domain name resolving to an IP address, and the CNAME relationship between domain names. This modeling method can fully represent real-world DNS scenarios.
[0040] 2. Considering that only a small number of labeled samples are available in real DNS traffic data, and that manually labeling samples is time-consuming and labor-intensive, malicious domain name detection is modeled as a small-sample binary classification problem. A meta-learning algorithm (MAML) is introduced for small-sample classification. The learned domain name node representations serve as input to the MAML algorithm. MAML can learn knowledge from multiple meta-training tasks and adapt it to the meta-testing task. Simultaneously, a knowledge distillation module is added to utilize unlabeled samples in the test data, ultimately distinguishing whether a node is a malicious or benign domain. Attached Figure Description
[0041] Figure 1 Framework diagram of a small-sample malicious domain name detection method based on meta-learning.
[0042] Figure 2 The heterogeneous graph constructed in this invention.
[0043] Figure 3 The pseudocode for the detection algorithm.
[0044] Figure 4 Hyperparameter sensitivity analysis.
[0045] Figure 5 Model stability analysis. Detailed Implementation
[0046] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments and accompanying drawings. It should be understood that the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] This invention provides a method for detecting malicious domain names, comprising three parts: heterogeneous graph construction, domain name node representation, and few-shot classification. First, this invention collects real DNS traffic data, cleans and integrates the data, and models the DNS scenario as a heterogeneous graph. This heterogeneous graph contains three different types of nodes and three different types of edges, and some noisy nodes are pruned to reduce the graph's complexity. Then, a heterogeneous graph neural network with an attention mechanism is used to learn the representation of domain name nodes. Considering that real DNS traffic data contains only a small number of labeled samples, a meta-learning algorithm (MAML) is introduced for few-shot classification. The learned domain name node representations are used as input to the MAML algorithm, which can learn knowledge from multiple meta-training tasks and adapt it to the meta-testing task. Simultaneously, a knowledge distillation module is added to utilize unlabeled samples in the test data, ultimately distinguishing whether a node is a malicious or benign domain name.
[0048] 1) Construction of heterogeneous graphs
[0049] From the moment a client sends a domain name resolution request to the moment the DNS protocol returns the IP address to the host, a lot of data is generated, such as DNS logs cached by the DNS server, passive DNS data generated by iterative queries, and DNS traffic data. To reflect a real DNS scenario and obtain more representative DNS data, this paper extracts two weeks' worth of DNS traffic data from a university's local area network as experimental data. Figure 2 The resulting heterogeneous graph contains three types of nodes: clients, domain names, and IP addresses, and three types of relationships:
[0050] 1. Querying domain names: Since the malicious domain names requested by the victim client of the same attacker often have some overlap, normal clients usually will not query these malicious domain names.
[0051] 2. DNS resolution: Domain names resolve to IP addresses. Due to the limited IP address resources, domain names that resolve to the same IP address within the same time period usually belong to the same category.
[0052] 3. CNAME, domain a is the canonical name of domain b: because a domain and its CNAME domain usually belong to the same category.
[0053] Because real-world DNS data contains a significant amount of noise, this paper prunes nodes that are unlikely to be malicious or contribute little to information dissemination. For domain name node characteristics, this paper references the FANCI method for handling domain name characteristics, designing a total of 21 features for each domain name across structural, linguistic, and statistical categories. For client and IP node characteristics, the initial values are all 0.
[0054] 2) Domain name node representation
[0055] This invention is designed for small-sample malicious domain name detection on heterogeneous graphs. It takes the constructed heterogeneous graph as input and outputs the classification result for each node, indicating whether the node is a malicious or benign domain. This paper uses a heterogeneous graph neural network (HGT) (Hu et al., 2020) to learn the node representation of the domain name. It includes attention and message propagation mechanisms, allowing different types of nodes and edges to maintain their specific representation space. The update vector of node t at layer l can be described as:
[0056]
[0057] The attention mechanism evaluates the importance of each neighbor node (source node s) and each meta-relation e of the target node t, while the message propagation mechanism extracts and transmits information from the neighbor nodes. By using the attention vector as weights and weighting and summing the corresponding message vectors, the updated domain name feature vector can be obtained.
[0058] 3) Small sample classification
[0059] Due to the limited number of labeled domain name samples, this paper uses a meta-learning algorithm to optimize the model. This algorithm employs a gradient-based approach to learn the model's initialization parameters; well-initialized parameters allow for rapid adaptation to new, unseen tasks. Inspired by MAML (Antoniou et al., 2018), this invention designs several binary classification tasks based on the categories of malicious domain names and selects three classification tasks with relatively large numbers of labeled samples (such as malicious software domain name detection) as meta-training tasks T = {T1, T2, ..., T...}. L}, select the phishing domain detection task with a smaller number of labeled samples as the meta-test task T. mt Then, the training data for each meta-training task is divided into support sets S. T and query set Q T The training data for the meta-test task is divided into support sets. and query set .
[0060] This invention describes the model as a function f with θ as a parameter. θ During the meta-training phase, for each meta-training task T i First, it will support collections Input into the model and compute in the query set Losses Then, gradient descent is used to update the parameter θ to θ0. i ':
[0061]
[0062] Here, α is a hyperparameter representing the step size of the inner meta-training. Then, stochastic gradient descent is used for cross-task meta-optimization, resulting in the following final update of the model parameters θ:
[0063]
[0064] Where β is the learning rate. This means that the gradient of the parameter θ is calculated, so that after sufficient training on the meta-training task T, a well-initialized parameter θ will be obtained.
[0065] This parameter will be further applied to the meta-test task T. mt Above, that is, based on the support set In T mt Predict the domain name's label and use cross-entropy loss L ce Continue updating the parameter θ to obtain the teacher model.
[0066] Since the above optimization strategy directly adapts the classifier learned from the labeled data of meta-training to the new test task, ignoring the hidden information of the unlabeled data during meta-testing, this invention, referring to meta-knowledge distillation (Qian et al., 2021), utilizes the unlabeled data (query set) of the test task. This involves transmitting soft knowledge from the meta-training classifier (teacher model) to the meta-test classifier (student model). By mimicking the predictions of the teacher model, the student model can learn some secondary information, which is only based on the support set. Unexpressible. Knowledge distillation loss L between the teacher and student models. kd Defined as:
[0067]
[0068] in, and Let Z represent the predicted distributions of the classroom model and the student model, respectively. i It is a query set Middle node v i The embedding is defined as follows: l is the number of labels, and t is the temperature exponent used to smooth the peak of the softmax distribution (Hinton et al., 2015). Finally, the knowledge distillation loss on the query set and the cross-entropy loss on the support set are combined using the following formula to form the final loss:
[0069] L total =L ce +λ kd L kd
[0070] Where, λ kd These are the weights that balance these two losses. Ultimately, the student model's parameters are updated according to the following parameters:
[0071]
[0072] Where α is the learning rate and θ are the initialization parameters obtained during the meta-training phase. The optimized student model will be used to predict domain labels on the query set. The pseudocode for the entire algorithm is as follows: Figure 3 As shown:
[0073] The following section elaborates on the specific steps of the invention. First, it introduces the dataset used in the experiment, the specific pruning strategy adopted, the setting of domain node labels, and the evaluation metrics and related parameter settings used in subsequent experiments.
[0074] 1) Dataset
[0075] The applicant collected real DNS traffic logs from a university's local area network for two weeks, from August 31, 2020 to September 13, 2020, as real DNS data for the experiment. Analyzing this DNS traffic dataset can yield detailed domain name information, such as domain name length, the ratio of domain name vowel-consonant characters, and the number of domain name subdomains.
[0076] 2) Heterogeneous graph pruning:
[0077] Because real-world DNS data contains a large amount of noise, this invention employs the following six strategies to prune heterogeneous graphs:
[0078] 1. Inactive clients: The number of domains retrieved is less than K. f The client is inactive and contributes little to the identification of malicious domains.
[0079] 2. Large clients: Some clients query more than 100 domain names, exceeding the total number of domain names in K. c %, these clients may be proxies or forwarders.
[0080] 3. Well-known domains: Some have been queried more than 1000 times. q Domains with a percentage of total client counts are less likely to be attacked because they are easily detected by network security management systems.
[0081] 4. Abnormal domains: Some domains have fewer than 1000 visits. l These domain names lack valuable information.
[0082] 5. Rare IPs: Some IP addresses map to only one domain. These IP addresses contribute less to label delivery.
[0083] 6. Rare domain names: Some domain names can only resolve to a single IP address. These domain names provide less information, making tag propagation difficult.
[0084] After pruning noisy nodes, the DNS heterogeneous graph was completed. It contains 82,500 domain name nodes, 16,736 client nodes, 65,648 IP address nodes, and some edges connecting them.
[0085] 3) Domain name tags:
[0086] To obtain the true labels for domain nodes, this invention defines domains appearing in the top 1M of Alexa's 2LD as benign domains. Malicious domains are divided into four groups: phishing domains, cryptocurrency mining domains, malware domains, and advertising domains. Furthermore, to facilitate information transfer on the heterogeneous graph, some unlabeled domain nodes are retained, ultimately resulting in 24,000 benign domains, 36,000 malicious domains, and 40,000 unlabeled domains. Table 1 details the statistical information of the experimental dataset.
[0087] Table 1 Statistical Information of Experimental Data
[0088]
[0089] 4) Evaluation indicators and parameter settings
[0090] To evaluate the performance of the method of this invention compared to baseline methods, three widely used evaluation metrics were selected: precision (P), recall (R), and F1 score. For the meta-learning model, the inner and outer layer learning rates were set to 0.05 and 0.08, respectively. Furthermore, the hyperparameter λ of knowledge distillation... kd Set to 0.01. For the graph representation learning model, the node embedding dimension is set to 64, and the number of iterations is set to 200. For the heterogeneous graph pruning parameter, K... f =2, K c =80, K q =50, K l =50.
[0091] Furthermore, to verify the effectiveness of the proposed method, it was compared with six baseline methods from three groups. The first group consisted of other malicious domain detection systems, including two state-of-the-art (SOTA) methods: feature-based FANCI (Schüppen et al., 2018) and association-based DeepDom (Sun et al., 2020). The second group consisted of heterogeneous graph representation learning models, using RGCN (Schlichtkrull et al., 2018) and HAN (Wang et al., 2019) to learn node representations of domains on a heterogeneous graph, and then feeding the learned node representations into a DNN for classification. The third group consisted of meta-learning models, with the meta-learning algorithm MAML using GCN (Kipf et al., 2016) and GAT (…). This invention trains a learner using domain embeddings learned in [reference 2017] et al. Referring to research on the importance of meta-paths in DeepDom, this invention selects the three highest-weighted meta-paths for the meta-path-based methods HAN and DeepDom: domain-domain, domain-client-domain, and domain-IP address-domain. Simultaneously, this invention transforms the heterogeneous graph into three homogeneous graphs based on these three meta-paths and selects the one with the best detection performance as the result of GCN and GAT.
[0092] 1) Overall performance
[0093] Table 2 shows the experimental results for all models. The number of shots indicates the size of the support set during model training and testing.
[0094] Based on the table, we can draw the following conclusions:
[0095] 1. This method is superior to FANCI and DeepDom (Group 1) because FANCI does not utilize the association between domain names, while DeepDom ignores the model optimization problem when the labeled samples are limited.
[0096] 2. This method outperforms the heterogeneous graph representation learning model (Group 2), which shows that the meta-learning algorithm can effectively optimize the model and solve the problem of limited labeled samples in malicious domain name detection.
[0097] 3. This method outperforms GCN and GAT (Group 3) which are optimized using meta-learning. This is because constructing the DNS scene as a heterogeneous graph preserves richer information compared to homogeneous graphs, which is more conducive to the model's representation learning.
[0098] 4. In all experimental settings, the performance of this method in detecting malicious domain names was significantly better than all baseline methods, which confirms the effectiveness of the method design.
[0099] Table 2 Comparison of Malicious Domain Name Detection Systems
[0100]
[0101] 2) Small sample performance
[0102] To verify the effectiveness of this method in a small sample setting, different numbers of malicious domains in the support set were used to evaluate the model performance (1-shot, 5-shot, 10-shot, and 20-shot). The following conclusions can be drawn from Table 2:
[0103] 1. Even with a single setting that marks a malicious domain (1-shot), this method significantly outperforms other baseline methods.
[0104] 2. Experimental results show that the detection performance of this system improves with the increase of the number of marked malicious domains, indicating that the system can achieve better detection results on datasets with a large number of marked samples.
[0105] 3) Hyperparameter sensitivity and model stability
[0106] This study investigated the application of the proposed method to the hyperparameter λ in the knowledge distillation module. kd Sensitivity. Figure 4 This indicates that λ kd The proposed method achieves optimal performance when the coefficient of performance (COP) is 0.01. This finding underscores the necessity of incorporating the knowledge distillation module into the optimization process. To evaluate the model's stability, two additional test tasks (T1: advertising domain detection, T2: malware domain detection) were implemented, and 10-shot malware domain detection was performed using the proposed method and three baseline methods. Figure 5 As shown, this method has higher accuracy and more stable experimental results compared to the baseline method, demonstrating the robustness and effectiveness of this detection system.
[0107] In summary, this invention not only fully considers domain names, IP addresses, clients, and their relationships in the DNS scenario, modeling them as a heterogeneous graph and setting the malicious domain detection problem as a node classification task on a heterogeneous graph, but also takes into account the constraint of limited labeled samples on model training. This invention proposes a small-sample malicious domain name detection model and introduces a meta-learning algorithm with a knowledge distillation module to optimize the model.
[0108] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary examples described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the examples should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention, and no reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A small sample malicious domain name detection method based on meta-learning, characterized by: The method comprises: The DNS scenario is modeled as a heterogeneous graph; the nodes of the heterogeneous graph include: clients, domain names and IP addresses; the edges of the heterogeneous graph include: client query domain names, domain name resolution to IP addresses and canonical names of domain names; Based on the heterogeneous graph neural network HGT, we learn the node representation of the domain name to obtain the updated domain name feature vector; A classifier is used to classify the updated domain name feature vector to obtain a malicious domain name detection result; wherein the heterogeneous graph neural network HGT and the classifier are end-to-end optimized based on a meta-learning algorithm.
2. The method according to claim 1, wherein After constructing the heterogeneous graph of the domain name resolution process, the following steps are further included: Prune noisy nodes or nodes whose information propagation contribution is less than a threshold.
3. The method according to claim 1, wherein The initial representation of domain names in the heterogeneous graph includes structural features, language features, and statistical features.
4. The method according to claim 1, wherein The heterogeneous graph neural network (HGT) and the classifier are end-to-end optimized based on a meta-learning algorithm, including: Based on the number of labeled samples corresponding to each malicious domain name detection task in the training set, the malicious domain name detection task is divided into a meta-training task and a meta-testing task; Each training task T i and meta-test task T mt The training data is divided into support sets Query Set and support set Query Set Based on support set The heterogeneous graph neural network HGT and the classifier are trained and Calculate the loss Get the meta-training model; Based on support set Train the meta-training model and combine it with the cross entropy loss L ce , get the fine-tuned meta-training model; Through the query set Propagate soft knowledge from the fine-tuned meta-training model to the meta-testing model and combine it with the knowledge distillation loss L KD , and obtain the trained heterogeneous graph neural network HGT and classifier.
5. The method according to claim 4, wherein The query set Calculate the loss Get the meta-training model, including: Computing query sets Losses The parameter θ is updated to Among them, α represents the step size of inner layer meta-training, Indicates the gradient of the parameter θ, f θ represents a model with parameter θ; Use stochastic gradient descent to perform meta-optimization across tasks to update parameters Where β represents the learning rate, L represents the total number of meta-training task types; Based on the updated parameters θ, the meta-training model is obtained.
6. The method according to claim 4, wherein The loss is the knowledge distillation loss Among them, t represents the temperature index used to smooth the peak of the softmax distribution, l represents the number of labels, represents the predictive distribution of the meta-trained model after fine-tuning, represents the predictive distribution of the meta-test model, Z j Represents a query set The embedding of the jth node in .
7. A small sample malicious domain name detection device based on meta-learning, characterized in that: The device comprises: A construction module is used to model the DNS scenario as a heterogeneous graph; the nodes of the heterogeneous graph include: clients, domain names and IP addresses; the edges of the heterogeneous graph include: client query domain names, domain names resolved to IP addresses and canonical names of domain names; The computing module is used to learn the node representation of the domain name based on the heterogeneous graph neural network (HGT) to obtain the updated domain name feature vector; A classification module is used to classify the updated domain name feature vector using a classifier to obtain a malicious domain name detection result; wherein the heterogeneous graph neural network HGT and the classifier are end-to-end optimized based on a meta-learning algorithm.
8. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the method described in any one of claims 1 to 6 is implemented.
