DNS tunnel detection method and device, electronic equipment and readable storage medium
By obtaining log information in the domain name system and setting preset judgment conditions, extracting and grouping domain name transmission information, the problem of insufficient applicability and accuracy of DNS tunnel detection is solved, achieving higher detection accuracy and reducing the false alarm rate. .
Patent Information
- Application Number
- CN202410569590.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2024-08-23
AI Technical Summary
Existing DNS tunnel detection methods such as regular matching detection and packet structure detection have problems of insufficient applicability and low accuracy, especially when dealing with complex language structures and high false positive rates.
By obtaining the log information of the domain name system, extract the domain name transfer information and group it according to time periods, set preset judgment conditions to determine whether the domain name transfer information and sub-information meet the threshold conditions, and output anomaly detection results to improve the accuracy of detection.
It improves the accuracy of DNS tunnel detection, reduces the false alarm rate, is suitable for different DNS tunnel detection environments, and avoids the difficulty of complex text detection.
Smart Images

Figure CN118540109A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of anomaly detection technology, and in particular to a DNS tunnel detection method, device, electronic device and readable storage medium. Background Art
[0002] DNS Tunneling is a technology that encapsulates the content of other protocols in the DNS protocol and then transmits data (communication) with DNS request and response packets. In the network world, DNS (Domain Name System) is an indispensable service, so firewalls and intrusion detection devices generally do not filter DNS traffic for the sake of availability and user-friendliness, which also creates conditions for DNS to become a covert channel. Therefore, DNS tunneling plays an important role in botnet and APT attacks.
[0003] The created DNS tunnel often uses regular matching detection and data packet structure detection. However, the regular matching detection method does not support complex language structures, and the data packet structure detection method has many false positives and the detection accuracy is insufficient. Summary of the invention
[0004] In view of this, embodiments of the present invention provide a DNS tunnel detection method, device, electronic device and readable storage medium to solve the problem of insufficient applicability and accuracy of DNS tunnel detection.
[0005] According to one aspect of the present invention, a DNS tunnel detection method is provided, comprising:
[0006] Get the log information of the domain name system;
[0007] Based on the log information, extracting domain name transmission information within a first time period, the domain name transmission information being information including a domain name request packet and a domain name response packet;
[0008] Extracting a plurality of domain name information contained in the domain name transmission information;
[0009] Grouping the domain name transmission information according to the plurality of domain name information to obtain a plurality of groups of domain name transmission sub-information;
[0010] Acquire a preset judgment condition, where the preset judgment condition includes a first condition and a second condition, where the first condition is a restriction condition for transmitting information of the domain name, and the second condition is a restriction condition for transmitting sub-information of the domain name;
[0011] Determine whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition;
[0012] In the case that either the domain name transmission information or the domain name transmission sub-information does not satisfy the preset judgment condition, an abnormality detection result is output; otherwise, it is output that there is no abnormality in the domain name system.
[0013] Optionally, the first condition is a first information quantity threshold of the domain name transmission information;
[0014] The determining whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition includes:
[0015] Obtaining the information quantity value of the domain name transmission information;
[0016] If the information quantity value is greater than the first information quantity threshold, it is determined that the domain name transmission information does not meet the first condition.
[0017] Optionally, the second condition is a second information quantity threshold of the domain name transmission sub-information;
[0018] The determining whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition includes:
[0019] Obtain the information quantity value of the domain name transmission sub-information;
[0020] If the information quantity value is less than the second information quantity threshold, it is determined that the domain name transmission sub-information does not meet the second condition.
[0021] Optionally, the second condition is a subdomain type threshold and a subdomain length threshold of the domain name transmission sub-information;
[0022] The determining whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition includes:
[0023] Obtain the subdomain type value and subdomain length value of the domain name transmission sub-information;
[0024] If the subdomain type value is greater than the subdomain type threshold, or the subdomain length value is greater than the subdomain length threshold, it is determined that the domain name transmission sub-information does not meet the second condition.
[0025] According to a second aspect of the present invention, there is provided a DNS tunnel detection device, comprising:
[0026] A first receiving module is used to obtain log information of the domain name system;
[0027] A first processing module, configured to extract domain name transmission information within a first time period based on the log information, wherein the domain name transmission information is information including a domain name request packet and a domain name response packet;
[0028] A second processing module is used to extract a plurality of domain name information contained in the domain name transmission information;
[0029] A third processing module, configured to group the domain name transmission information according to a plurality of domain name information to obtain a plurality of groups of domain name transmission sub-information;
[0030] A second receiving module is used to obtain a preset judgment condition, where the preset judgment condition includes a first condition and a second condition, where the first condition is a restriction condition for transmitting information of the domain name, and the second condition is a restriction condition for transmitting sub-information of the domain name;
[0031] A fourth processing module, used to determine whether the domain name transmission information and the domain name transmission sub-information meet the preset judgment condition;
[0032] The fifth processing module is used to output an abnormality detection result when either the domain name transmission information or the domain name transmission sub-information does not meet the preset judgment condition; otherwise, output that there is no abnormality in the domain name system.
[0033] Optionally, the first condition is a first information quantity threshold of the domain name transmission information;
[0034] The fourth processing module comprises:
[0035] A first receiving submodule, used to obtain the information quantity value of the domain name transmission information;
[0036] The first processing submodule is used to determine that the domain name transmission information does not meet the first condition when the information quantity value is greater than the first information quantity threshold.
[0037] Optionally, the second condition is a second information quantity threshold of the domain name transmission sub-information;
[0038] The fourth processing module comprises:
[0039] A second receiving submodule is used to obtain the information quantity value of the domain name transmission sub-information;
[0040] The second processing submodule is used to determine that the domain name transmission sub-information does not meet the second condition when the information quantity value is less than the second information quantity threshold.
[0041] Optionally, the second condition is a subdomain type threshold and a subdomain length threshold of the domain name transmission sub-information;
[0042] The fourth processing module comprises:
[0043] A third receiving submodule is used to obtain a subdomain type value and a subdomain length value of the domain name transmission sub-information;
[0044] The third processing submodule is used to determine that the domain name transmission sub-information does not meet the second condition when the subdomain type value is greater than the subdomain type threshold or the subdomain length value is greater than the subdomain length threshold.
[0045] According to a third aspect of the present invention, there is provided an electronic device, comprising:
[0046] Processor; and
[0047] Memory for storing programs,
[0048] The program includes instructions, and when the instructions are executed by a processor, the processor executes any one of the methods according to the first aspect of the present invention.
[0049] According to a fourth aspect of the present invention, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute any method according to the first aspect of the present invention.
[0050] One or more technical solutions provided in the embodiments of the present invention obtain log information in a domain name system, extract domain name transmission information within a first time period according to the setting of the first time period, and group the domain name transmission information according to the domain name information, and determine whether the domain name transmission sub-information and domain name transmission information obtained after grouping meet preset judgment conditions, and obtain an abnormality detection result when either the domain name transmission sub-information or the domain name transmission information does not meet the preset judgment conditions.
[0051] The DNS tunnel detection method provided by the present invention performs abnormal detection based on the domain name transmission information in the domain name system log information. Since the log information is the operation record of the domain name, it avoids the problem of detecting the complex text contained in the DNS tunnel in the conventional method and is applicable to different DNS tunnel detection environments. At the same time, by reasonably setting preset judgment conditions for the domain name transmission sub-information and the domain name transmission information, the false alarm situation is greatly reduced, and the accuracy of DNS tunnel detection is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Further details, features and advantages of the invention are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0053] Figure 1 A flow chart of a DNS tunnel detection method according to an exemplary embodiment of the present invention is shown;
[0054] Figure 2A diagram showing an implementation of DNS tunnel detection according to an exemplary embodiment of the present invention is shown;
[0055] Figure 3 A schematic block diagram of a DNS tunnel detection device according to an exemplary embodiment of the present invention is shown;
[0056] Figure 4 A block diagram of an exemplary electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0057] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.
[0058] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0059] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0060] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0061] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0062] The solution of the present invention is described below with reference to the accompanying drawings, and the technical solution provided by the embodiment of the present invention is explained in detail through specific embodiments and their application scenarios.
[0063] Common DNS tunnel detection methods include regular matching detection and data packet structure detection.
[0064] The regular matching detection method is to first extract the DNS request information from the DNS traffic data. The DNS request information includes the domain name, IP address, query type, etc. According to the requirements of DNS tunnel detection, write the corresponding regular expression to match the keywords. For example, the regular expression .*\.A\.com can be used to match all domain names ending with ".A.com". Then further analyze the matching results to determine whether there is an abnormality.
[0065] However, this method does not support complex language structures, because regular expressions have difficulty processing complex language structures, such as nested and conditional statements. When more complex text rules need to be processed, the capabilities of regular expressions may not be sufficient to meet the needs. In addition, regular expressions may consume a lot of computing resources during the matching process, especially when processing large amounts of text data, so some complex regular expressions may cause performance degradation or matching failure.
[0066] The packet structure detection method is because the DNS tunnel usually causes the DNS packet size to be abnormal due to the need to encode and segment the data. Therefore, by monitoring the packet size of the DNS query and response, it is possible to detect whether there is an abnormal size.
[0067] Since DNS tunneling technology is quite mature, attackers can use various techniques to hide their activities, including disguising the structure of data packets to mimic normal DNS traffic. Therefore, relying solely on data packet structure anomalies to detect DNS tunneling may result in a large number of false positives, affecting the accuracy of detection.
[0068] In view of this, the present invention provides a DNS tunnel detection method, device, electronic device and readable storage medium, wherein the DNS tunnel detection method is applied to any electronic device with a DNS tunnel detection function, and the electronic device includes but is not limited to: personal mobile terminal devices, computers or server devices, etc.
[0069] like Figure 1 As shown, Figure 1 : is a flow chart of a DNS tunnel detection method provided by an embodiment of the present invention. The DNS tunnel detection method may include the following steps S101 to S107:
[0070] S101, obtaining log information of the domain name system.
[0071] As an implementation method, the Domain Name System (DNS) is a service of the Internet. It is a distributed database that maps domain names and IP addresses to each other. The log information of the Domain Name System is the operation record of the Domain Name System. It is listed by time and operation content to facilitate users to manage domain names. The domain name log is automatically generated by the system and cannot be added by users.
[0072] S102: extracting domain name transmission information within a first time period based on the log information, where the domain name transmission information is information including a domain name request packet and a domain name response packet.
[0073] As an implementation method, the historical time is divided into several time periods, and the anomaly detection of the DNS tunnel in each time period is performed to realize the anomaly detection of the log information in different time periods. Taking any time period as the first time period, the domain name transmission information is extracted from the log information, and the domain name transmission information is the information in the log information including the domain name request packet and the domain name response packet.
[0074] As a specific implementation method, the time on the timeline is divided into a first time period from one hour before the current time point, and the domain name transmission information that matches the time information of the first time period is extracted from the log information. For example, if the current time is 18:00 Beijing time, then the first time period is from 17:00 to 18:00 Beijing time, and the domain name transmission information including the domain name request packet and the domain name response packet in the first time period is obtained.
[0075] S103, extracting several domain name information included in the domain name transmission information.
[0076] As an implementation method, in the domain name transmission information, several domain name information is extracted according to the different second-level domain names. The second-level domain name generally refers to the online name chosen by the domain name registrant, who usually uses his own trademark, trade name or other commercial mark as his online name. The second-level domain name under the country top-level domain name generally refers to a mark indicating the category and function of the registrant similar to the international top-level domain name. For example, in the ".com.cn" domain name structure, ".com" is the second-level domain name placed under the country top-level domain name ".cn", indicating a commercial organization, and so on.
[0077] As a specific implementation method, if the domain name transmission information includes second-level domain names such as A1, A2, A3, A4, A5, etc., then the domain name information such as A1, A2, A3, A4, A5, etc. is extracted from the domain name transmission information.
[0078] S104, grouping the domain name transmission information according to a number of domain name information to obtain a number of groups of domain name transmission sub-information.
[0079] As an implementation method, the domain name transmission information extracted within the first time period is divided into a plurality of groups of domain name transmission sub-information using the secondary domain name corresponding to each domain name information as a basis for grouping.
[0080] As a specific implementation method, the domain name transmission information includes second-level domain names such as A1, A2, A3, A4, A5..., and the domain name transmission information is divided into domain name transmission sub-information according to the second-level domain names A1, A2, A3, A4, A5...
[0081] S105, obtaining a preset judgment condition, where the preset judgment condition includes a first condition and a second condition, where the first condition is a restriction condition for domain name transmission information, and the second condition is a restriction condition for domain name transmission sub-information.
[0082] As an implementation method, according to the abnormal reasons of the historical DNS tunnel, a judgment condition is preset, which includes a first condition for the domain name transmission information and a second condition for the domain name transmission sub-information.
[0083] S106: Determine whether the domain name transmission information and the domain name transmission sub-information meet a preset determination condition.
[0084] As an implementation manner, it is determined whether the domain name transmission information satisfies the first condition, and it is determined whether the domain name transmission sub-information satisfies the second condition, and the determination result is output.
[0085] S107, when either the domain name transmission information or the domain name transmission sub-information does not meet the preset judgment condition, output the abnormality detection result; otherwise, output that there is no abnormality in the domain name system.
[0086] As an implementation method, in the analysis and judgment result, whether the domain name transmission information satisfies the first condition, and whether the domain name transmission sub-information satisfies the second condition, if any one of them is not satisfied, it indicates that the DNS tunnel is abnormal, and the abnormality detection result is output. Otherwise, it indicates that the domain name system is normal, and a signal that the DNS tunnel of the domain name system is normal is output.
[0087] In one embodiment of the present invention, the first condition is a first information quantity threshold of the domain name transmission information;
[0088] S106, judging whether the domain name transmission information and the domain name transmission sub-information meet a preset judgment condition, including:
[0089] S106-1, obtaining the information quantity value of the domain name transmission information;
[0090] S106-2: If the information quantity value is greater than the first information quantity threshold, it is determined that the domain name transmission information does not meet the first condition.
[0091] As an implementation method, the first condition is set based on the characteristic that a large number of data packets are exchanged in the DNS tunnel request. A first information quantity threshold of the domain name transmission information is preset, and the first information quantity threshold is used to limit the information quantity of the domain name transmission information. Then, the information quantity value of the current domain name transmission information is obtained, and the information quantity value of the domain name transmission information is compared with the first information quantity threshold. If the information quantity value is not greater than the first information quantity threshold, the current domain name is a normal domain name, and a signal that the domain name transmission information meets the first condition is output; if the information quantity value is greater than the first information quantity threshold, a signal that the domain name transmission information does not meet the first condition is output.
[0092] As a specific implementation method, the first information quantity threshold of the domain name transmission information is pre-set to 100, and the information quantity value B1 of the current domain name transmission information is obtained. When B1=88, the current domain name is a normal domain name, and a signal that the domain name transmission information meets the first condition is output; when B1=103, a signal that the domain name transmission information does not meet the first condition is output.
[0093] In one embodiment of the present invention, the second condition is a second information quantity threshold of the domain name transmission sub-information;
[0094] S106, judging whether the domain name transmission information and the domain name transmission sub-information meet a preset judgment condition, including:
[0095] S106-3, obtaining the information quantity value of the domain name transmission sub-information;
[0096] S106-4: If the information quantity value is less than the second information quantity threshold, it is determined that the domain name transmission sub-information does not meet the second condition.
[0097] As an implementation method, the second condition is set because if multiple hosts request the domain name, the domain name is considered safe. A second information quantity threshold of the domain name transmission sub-information is preset, and the second information quantity threshold is used to limit the number of request information in the domain name transmission sub-information. Then, the information quantity value of the current domain name transmission sub-information is obtained, and the information quantity value is the number value of the request information. The information quantity value of the domain name transmission sub-information is compared with the second information quantity threshold. If the information quantity value is greater than the second information quantity threshold, the current domain name is a normal domain name, and a signal that the domain name transmission sub-information meets the second condition is output; if the information quantity value is not greater than the second information quantity threshold, a signal that the domain name transmission sub-information does not meet the second condition is output.
[0098] As a specific implementation method, the second information quantity threshold of the domain name transmission sub-information is pre-set to 15, and the request information quantity value C1 of the current domain name transmission sub-information is obtained. When C1=17, the current domain name is a normal domain name, and a signal that the domain name transmission sub-information meets the second condition is output; when C1=13, a signal that the domain name transmission sub-information does not meet the second condition is output.
[0099] In one embodiment of the present invention, the second condition is a subdomain type threshold and a subdomain length threshold of the domain name transmission sub-information;
[0100] S106, judging whether the domain name transmission information and the domain name transmission sub-information meet a preset judgment condition, including:
[0101] S106-5, obtaining a subdomain type value and a subdomain length value of domain name transmission sub-information;
[0102] S106-6: If the subdomain type value is greater than the subdomain type threshold, or the subdomain length value is greater than the subdomain length threshold, it is determined that the domain name transmission sub-information does not meet the second condition.
[0103] As an implementation method, the second-level domain name also includes the third-level domain name and the fourth-level domain name as its subdomain names. A complete domain name (*.com, *.cn, *.top, *.net, *.edu, *.gov, etc.) consists of two or more parts, and each part is separated by an English period. The right part of the last period is called the top-level domain name (Top-level Domain Name), the left part of the top-level domain name "." is called the second-level domain name (Second-level Domain Name), and the left part of the second-level domain name is called the third-level domain name, and so on. Each level of domain name controls the allocation of the next level of domain names.
[0104] The second condition is set because there will be a large number of changes in multi-level domain names in DNS tunnel transmission. The subdomain type threshold and subdomain length threshold of the domain name transmission sub-information are pre-set, and the subdomain type threshold and subdomain length threshold are used to limit the subdomain type threshold and subdomain length threshold in the domain name transmission sub-information. Then obtain the subdomain type value and subdomain length value of the current domain name transmission sub-information. Compare the subdomain type value of the domain name transmission sub-information with the subdomain type threshold, and compare the subdomain length value of the domain name transmission sub-information with the subdomain length threshold. If the subdomain type value is greater than the subdomain type threshold, or the subdomain length value is greater than the subdomain length threshold, a signal is output that the domain name transmission sub-information does not meet the second condition. If it is other comparison results, the current domain name is a normal domain name, and a signal that the domain name transmission sub-information meets the second condition is output.
[0105] As a specific implementation, the subdomain type threshold of the domain name transmission sub-information is preset to 50, and the subdomain length threshold of the domain name transmission sub-information is preset to 20. The subdomain type value D1 of the current domain name transmission sub-information is obtained, and the subdomain length value E1 of the current domain name transmission sub-information is obtained. When D1 is greater than 50, or E1 is greater than 20, a signal is output that the domain name transmission sub-information does not meet the second condition. When D1 is not greater than 50 and E1 is not greater than 20, the current domain name is a normal domain name, and a signal that the domain name transmission sub-information meets the second condition is output.
[0106] In one embodiment of the present invention, Figure 2 As shown, DNS log information is obtained from the cloud database of the domain name system, and domain name transmission information within a first time period is extracted. The first time period is one hour before the current time. The domain name transmission information is grouped by secondary domain name in the domain name transmission information to obtain several groups of domain name transmission sub-information.
[0107] Based on the preset judgment condition, the domain name transmission information and the domain name transmission sub-information are logically judged, and the first condition and the second condition included in the preset judgment condition are used to judge the domain name transmission information and the domain name transmission sub-information. If the conditions meet the requirements, Figure 2 If the preset judgment conditions in the output domain name are not met, the current domain name is a normal domain name, and the domain name transmission information and domain name transmission sub-information meet the preset judgment conditions. Figure 2 If the preset judgment condition is not met, a signal that the domain name transmission information or the domain name transmission sub-information does not meet the preset judgment condition is output.
[0108] The DNS tunnel detection method provided in the embodiment of the present invention obtains log information in the domain name system, extracts domain name transmission information within the first time period according to the setting of the first time period, and groups the domain name transmission information according to the domain name information, and determines whether the domain name transmission sub-information and domain name transmission information obtained after grouping meet the preset judgment conditions, and obtains an abnormal detection result when either the domain name transmission sub-information or the domain name transmission information does not meet the preset judgment conditions.
[0109] The DNS tunnel detection method provided by the present invention performs abnormal detection based on the domain name transmission information in the domain name system log information. Since the log information is the operation record of the domain name, it avoids the problem of detecting the complex text contained in the DNS tunnel in the conventional method and is applicable to different DNS tunnel detection environments. At the same time, by reasonably setting preset judgment conditions for the domain name transmission sub-information and the domain name transmission information, the false alarm situation is greatly reduced, and the accuracy of DNS tunnel detection is improved.
[0110] Corresponding to the above embodiment, see Figure 3The embodiment of the present invention further provides a DNS tunnel detection device 300, the DNS tunnel detection device 300 comprising:
[0111] The first receiving module 301 is used to obtain log information of the domain name system;
[0112] The first processing module 302 is used to extract domain name transmission information within a first time period based on the log information, where the domain name transmission information is information containing a domain name request packet and a domain name response packet;
[0113] The second processing module 303 is used to extract a plurality of domain name information contained in the domain name transmission information;
[0114] The third processing module 304 is used to group the domain name transmission information according to a plurality of domain name information to obtain a plurality of groups of domain name transmission sub-information;
[0115] The second receiving module 305 is used to obtain a preset judgment condition, where the preset judgment condition includes a first condition and a second condition, where the first condition is a restriction condition for domain name transmission information, and the second condition is a restriction condition for domain name transmission sub-information;
[0116] The fourth processing module 306 is used to determine whether the domain name transmission information and the domain name transmission sub-information meet a preset determination condition;
[0117] The fifth processing module 307 is used to output an abnormality detection result when either the domain name transmission information or the domain name transmission sub-information does not meet the preset judgment condition; otherwise, output that there is no abnormality in the domain name system.
[0118] Optionally, the first condition is a first information quantity threshold of the domain name transmission information;
[0119] The fourth processing module 306 includes:
[0120] The first receiving submodule 3061 is used to obtain the information quantity value of the domain name transmission information;
[0121] The first processing submodule 3062 is configured to determine that the domain name transmission information does not satisfy a first condition when the information quantity value is greater than a first information quantity threshold.
[0122] Optionally, the second condition is a second information quantity threshold of the domain name transmission sub-information;
[0123] The fourth processing module 306 includes:
[0124] The second receiving submodule 3063 is used to obtain the information quantity value of the domain name transmission sub-information;
[0125] The second processing submodule 3064 is configured to determine that the domain name transmission sub-information does not satisfy the second condition when the information quantity value is less than a second information quantity threshold.
[0126] Optionally, the second condition is a subdomain type threshold and a subdomain length threshold of the domain name transmission sub-information;
[0127] The fourth processing module 306 includes:
[0128] The third receiving submodule 3065 is used to obtain the subdomain type value and subdomain length value of the domain name transmission sub-information;
[0129] The fifth processing submodule 3066 is used to determine that the domain name transmission sub-information does not meet the second condition when the subdomain name type value is greater than the subdomain name type threshold, or the subdomain name length value is greater than the subdomain name length threshold.
[0130] The DNS tunnel detection device provided in the embodiment of the present invention obtains log information in the domain name system, extracts domain name transmission information within the first time period according to the setting of the first time period, and groups the domain name transmission information according to the domain name information, determines whether the domain name transmission sub-information and domain name transmission information obtained after grouping meet the preset judgment conditions, and obtains an abnormal detection result when either the domain name transmission sub-information or the domain name transmission information does not meet the preset judgment conditions.
[0131] The DNS tunnel detection device provided by the present invention performs abnormal detection based on the domain name transmission information in the domain name system log information. Since the log information is the operation record of the domain name, it avoids the problem of detecting the complex text contained in the DNS tunnel in the conventional method, and is suitable for different DNS tunnel detection environments. At the same time, by reasonably setting preset judgment conditions for the domain name transmission sub-information and the domain name transmission information, the false alarm situation is greatly reduced, and the accuracy of DNS tunnel detection is improved.
[0132] The exemplary embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to cause the electronic device to perform the method according to the embodiment of the present invention when executed by the at least one processor.
[0133] Exemplary embodiments of the present invention also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present invention.
[0134] An exemplary embodiment of the present invention further provides a computer program product, including a computer program, wherein the computer program is used to cause the computer to perform a method according to an embodiment of the present invention when executed by a processor of a computer.
[0135] refer to Figure 4 , a block diagram of an electronic device 400 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0136] like Figure 4 As shown, the electronic device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0137] A plurality of components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, an output unit 407, a storage unit 408, and a communication unit 409. The input unit 406 may be any type of device capable of inputting information to the electronic device 400, and the input unit 406 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 407 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 408 may include, but is not limited to, a disk, an optical disk. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0138] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing module (CPU), a graphics processing module (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above. For example, in some embodiments, the DNS tunnel detection method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via the ROM 402 and / or the communication unit 409. In some embodiments, the computing unit 401 may be configured to perform the DNS tunnel detection method in any other appropriate manner (e.g., by means of firmware).
[0139] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable DNS tunnel detection device, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0140] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0141] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0142] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0143] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0144] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
Claims
1. A DNS tunnel detection method, characterized in that: include: Get the log information of the domain name system; Based on the log information, extracting domain name transmission information within a first time period, the domain name transmission information being information including a domain name request packet and a domain name response packet; Extracting a plurality of domain name information contained in the domain name transmission information; Grouping the domain name transmission information according to the plurality of domain name information to obtain a plurality of groups of domain name transmission sub-information; Acquire a preset judgment condition, where the preset judgment condition includes a first condition and a second condition, where the first condition is a restriction condition for transmitting information of the domain name, and the second condition is a restriction condition for transmitting sub-information of the domain name; Determine whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition; When either the domain name transmission information or the domain name transmission sub-information does not satisfy the preset judgment condition, outputting an abnormality detection result; Otherwise, output that there is no abnormality in the domain name system.
2. The DNS tunnel detection method according to claim 1, characterized in that: The first condition is a first information quantity threshold of the domain name transmission information; The determining whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition includes: Obtaining the information quantity value of the domain name transmission information; If the information quantity value is greater than the first information quantity threshold, it is determined that the domain name transmission information does not meet the first condition.
3. The DNS tunnel detection method according to claim 1, characterized in that: The second condition is a second information quantity threshold of the domain name transmission sub-information; The determining whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition includes: Obtain the information quantity value of the domain name transmission sub-information; If the information quantity value is less than the second information quantity threshold, it is determined that the domain name transmission sub-information does not meet the second condition.
4. The DNS tunnel detection method according to claim 1, characterized in that: The second condition is a subdomain type threshold and a subdomain length threshold of the domain name transmitting sub-information; The determining whether the domain name transmission information and the domain name transmission sub-information meet the preset determination condition includes: Obtain the subdomain type value and subdomain length value of the domain name transmission sub-information; If the subdomain type value is greater than the subdomain type threshold, or the subdomain length value is greater than the subdomain length threshold, it is determined that the domain name transmission sub-information does not meet the second condition.
5. A DNS tunnel detection device, characterized in that: include: A first receiving module is used to obtain log information of the domain name system; A first processing module, configured to extract domain name transmission information within a first time period based on the log information, wherein the domain name transmission information is information including a domain name request packet and a domain name response packet; A second processing module is used to extract a plurality of domain name information contained in the domain name transmission information; A third processing module, configured to group the domain name transmission information according to a plurality of domain name information to obtain a plurality of groups of domain name transmission sub-information; A second receiving module is used to obtain a preset judgment condition, where the preset judgment condition includes a first condition and a second condition, where the first condition is a restriction condition for transmitting information of the domain name, and the second condition is a restriction condition for transmitting sub-information of the domain name; A fourth processing module, used to determine whether the domain name transmission information and the domain name transmission sub-information meet the preset judgment condition; A fifth processing module, configured to output an abnormality detection result when either the domain name transmission information or the domain name transmission sub-information does not satisfy the preset judgment condition; Otherwise, output that there is no abnormality in the domain name system.
6. The DNS tunnel detection device according to claim 5, characterized in that: The first condition is a first information quantity threshold of the domain name transmission information; The fourth processing module comprises: A first receiving submodule, used to obtain the information quantity value of the domain name transmission information; The first processing submodule is used to determine that the domain name transmission information does not meet the first condition when the information quantity value is greater than the first information quantity threshold.
7. The DNS tunnel detection device according to claim 5, characterized in that: The second condition is a second information quantity threshold of the domain name transmission sub-information; The fourth processing module comprises: A second receiving submodule is used to obtain the information quantity value of the domain name transmission sub-information; The second processing submodule is used to determine that the domain name transmission sub-information does not meet the second condition when the information quantity value is less than the second information quantity threshold.
8. The DNS tunnel detection device according to claim 5, characterized in that: The second condition is a subdomain type threshold and a subdomain length threshold of the domain name transmitting sub-information; The fourth processing module comprises: A third receiving submodule is used to obtain a subdomain type value and a subdomain length value of the domain name transmission sub-information; The third processing submodule is used to determine that the domain name transmission sub-information does not meet the second condition when the subdomain type value is greater than the subdomain type threshold or the subdomain length value is greater than the subdomain length threshold.
9. An electronic device, comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 4.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-4.
