CN116743698A - Detection methods, devices and electronic equipment for domain name cache injection - Google Patents

Detection methods, devices and electronic equipment for domain name cache injection Download PDF

Info

Publication number
CN116743698A
CN116743698A CN202310760698.6A CN202310760698A CN116743698A CN 116743698 A CN116743698 A CN 116743698A CN 202310760698 A CN202310760698 A CN 202310760698A CN 116743698 A CN116743698 A CN 116743698A
Authority
CN
China
Prior art keywords
domain name
query
resolver
conditional
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310760698.6A
Other languages
Chinese (zh)
Inventor
李想
陆超逸
刘保君
段海新
李琦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tsinghua University
Original Assignee
Tsinghua University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tsinghua University filed Critical Tsinghua University
Priority to CN202310760698.6A priority Critical patent/CN116743698A/en
Publication of CN116743698A publication Critical patent/CN116743698A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to a detection method and device for domain name cache injection and electronic equipment. The method comprises the following steps: sending a first query request for the target domain name to a target domain name resolver; acquiring a first query result corresponding to the first query request from a target domain name resolver; sending a second query request for the target domain name to a domain name server, wherein the domain name server is an authoritative domain name server or a recursion domain name resolver without forwarding query function; obtaining a second query result corresponding to the second query request from the domain name server; if the second query result is different from the Internet protocol IP address of the target domain name indicated by the first query result, determining that the target domain name resolver is cached for injection. By the method, the cache injection of the target domain name resolver can be detected, so that precautionary measures are taken for the cache injection behavior on the basis, and the security of accessing the Internet is improved.

Description

域名缓存注入的检测方法、装置和电子设备Detection methods, devices and electronic equipment for domain name cache injection

技术领域Technical field

本申请涉及计算机技术领域,尤其涉及域名缓存注入的检测方法、装置和电子设备。The present application relates to the field of computer technology, and in particular to detection methods, devices and electronic equipment for domain name cache injection.

背景技术Background technique

在用户通过域名访问互联网时,首先要通过域名解析器查询域名所对应的因特网协议(internet protocol,IP)地址。随着互联网的普及,域名查询的需求日趋庞大,为了提高域名查询效率,并减轻域名解析器的负荷和减少互联网上的域名查询报文数量,在域名解析器中广泛使用了本地缓存,用来存放最近查询过的域名的相关信息。当用户再次查询相同的域名时,域名解析器会返回本地缓存中的域名相关信息。When a user accesses the Internet through a domain name, he must first query the Internet Protocol (IP) address corresponding to the domain name through a domain name resolver. With the popularization of the Internet, the demand for domain name queries is becoming increasingly large. In order to improve the efficiency of domain name queries, reduce the load of the domain name parser and reduce the number of domain name query messages on the Internet, local cache is widely used in the domain name parser. Stores information related to recently queried domain names. When the user queries the same domain name again, the domain name resolver will return the domain name related information in the local cache.

目前,域名安全问题日益凸显,特别是域名缓存注入技术的威胁。通过域名缓存注入技术,攻击者可以向域名解析器发送特制的恶意域名查询响应,篡改域名解析器的本地缓存,使得用户在访问目标网站时被重定向到恶意服务器。这种攻击方法可能导致用户数据泄露,还可能被用于发起钓鱼攻击、拒绝服务攻击等其他网络攻击。Currently, domain name security issues are becoming increasingly prominent, especially the threat of domain name cache injection technology. Through domain name cache injection technology, attackers can send specially crafted malicious domain name query responses to the domain name resolver and tamper with the local cache of the domain name resolver, causing users to be redirected to the malicious server when accessing the target website. This attack method may lead to user data leakage, and may also be used to launch phishing attacks, denial of service attacks and other network attacks.

发明内容Contents of the invention

本申请提供了域名缓存注入的检测方法、装置和电子设备,能够检测出对条件域名解析器的缓存注入行为,从而在此基础上采取防范措施,以提高访问互联网的安全性。This application provides a detection method, device and electronic equipment for domain name cache injection, which can detect the cache injection behavior of conditional domain name parsers, so as to take preventive measures on this basis to improve the security of access to the Internet.

根据本申请的第一方面,提供了一种域名缓存注入的检测方法。该方法包括向目标域名解析器发送对目标域名的第一查询请求,其中,目标域名解析器为同时具有转发查询功能和递归查询功能的条件域名解析器。该方法还包括从目标域名解析器获取与第一查询请求对应的第一查询结果。该方法还包括向域名服务器发送对目标域名的第二查询请求,其中,域名服务器为权威域名服务器或不具备转发查询功能的递归域名解析器。该方法还包括从域名服务器获取与第二查询请求对应的第二查询结果。该方法还包括在第二查询结果与第一查询结果所指示的目标域名的IP地址不同的情况下,确定目标域名解析器被缓存注入。According to a first aspect of this application, a detection method for domain name cache injection is provided. The method includes sending a first query request for the target domain name to a target domain name resolver, where the target domain name resolver is a conditional domain name resolver having both a forward query function and a recursive query function. The method also includes obtaining a first query result corresponding to the first query request from the target domain name resolver. The method also includes sending a second query request for the target domain name to a domain name server, where the domain name server is an authoritative domain name server or a recursive domain name parser that does not have a query forwarding function. The method also includes obtaining a second query result corresponding to the second query request from the domain name server. The method also includes determining that the target domain name resolver is cache-injected when the second query result is different from the IP address of the target domain name indicated by the first query result.

根据本申请的第二方面,提供了一种域名缓存注入的检测方法。该方法包括接收域名查询请求,该域名查询请求用于查询第一域名。该方法还包括向域名服务器查询第一域名。该方法还包括接收域名查询响应,该域名查询响应包括指示第二域名的记录。该方法还包括在第二域名与第一域名不关联的情况下,确定域名解析器被缓存注入。According to the second aspect of this application, a detection method for domain name cache injection is provided. The method includes receiving a domain name query request, the domain name query request being used to query the first domain name. The method also includes querying the domain name server for the first domain name. The method also includes receiving a domain name query response, the domain name query response including a record indicating the second domain name. The method also includes determining that the domain name resolver is cache injected when the second domain name is not associated with the first domain name.

根据本申请的第三方面,提供了一种域名缓存注入的检测装置,该装置包括第一发送模块,被配置为向目标域名解析器发送对目标域名的第一查询请求,其中,目标域名解析器为同时具有转发查询功能和递归查询功能的条件域名解析器。该装置还包括第一接收模块,被配置为从目标域名解析器获取与第一查询请求对应的第一查询结果。该装置还包括第二发送模块,被配置为向域名服务器发送对目标域名的第二查询请求,其中,域名服务器为权威域名服务器或不具备转发查询功能的递归域名解析器。该装置还包括第二接收模块,被配置为从域名服务器获取与第二查询请求对应的第二查询结果。该装置还包括确定模块,被配置为在第二查询结果与第一查询结果所指示的目标域名的IP地址不同的情况下,确定目标域名解析器被缓存注入。According to a third aspect of the present application, a device for detecting domain name cache injection is provided. The device includes a first sending module configured to send a first query request for the target domain name to the target domain name parser, wherein the target domain name parsing It is a conditional domain name parser with both forwarding query function and recursive query function. The device also includes a first receiving module configured to obtain a first query result corresponding to the first query request from the target domain name resolver. The device also includes a second sending module configured to send a second query request for the target domain name to a domain name server, where the domain name server is an authoritative domain name server or a recursive domain name parser that does not have the query forwarding function. The device also includes a second receiving module configured to obtain a second query result corresponding to the second query request from the domain name server. The device further includes a determining module configured to determine that the target domain name resolver is cache injected when the second query result is different from the IP address of the target domain name indicated by the first query result.

根据本申请的第四方面,提供了一种域名缓存注入的检测装置,该装置包括第一接收模块,被配置为接收域名查询请求,该域名查询请求用于查询第一域名。该装置还包括查询模块,被配置为向域名服务器查询第一域名。该装置还包括第二接收模块,被配置为接收域名查询响应,该域名查询响应包括指示第二域名的记录。该装置还包括确定模块,被配置为在第二域名与第一域名不关联的情况下,确定域名解析器被缓存注入。According to a fourth aspect of the present application, a device for detecting domain name cache injection is provided. The device includes a first receiving module configured to receive a domain name query request, and the domain name query request is used to query the first domain name. The device also includes a query module configured to query the domain name server for the first domain name. The device also includes a second receiving module configured to receive a domain name query response, where the domain name query response includes a record indicating the second domain name. The device further includes a determining module configured to determine that the domain name resolver is cache injected when the second domain name is not associated with the first domain name.

根据本申请的第五方面,提供了一种电子设备。该电子设备包括至少一个处理器;以及存储器,耦合至至少一个处理器并且具有存储于其上的指令,指令在由至少一个处理器执行时使设备执行动作,所述动作包括:向目标域名解析器发送对目标域名的第一查询请求,其中,目标域名解析器为同时具有转发查询功能和递归查询功能的条件域名解析器;从目标域名解析器获取与第一查询请求对应的第一查询结果;向域名服务器发送对目标域名的第二查询请求,域名服务器为权威域名服务器或不具备转发查询功能的递归域名解析器;从域名服务器获取与第二查询请求对应的第二查询结果;如果第二查询结果与第一查询结果所指示的目标域名的因特网协议IP地址不同,确定目标域名解析器被缓存注入。According to a fifth aspect of the present application, an electronic device is provided. The electronic device includes at least one processor; and a memory coupled to the at least one processor and having instructions stored thereon that, when executed by the at least one processor, cause the device to perform actions, the actions including: resolving to a target domain name The server sends a first query request for the target domain name, wherein the target domain name parser is a conditional domain name parser with both forwarding query function and recursive query function; and obtains the first query result corresponding to the first query request from the target domain name parser. ; Send a second query request for the target domain name to the domain name server, which is an authoritative domain name server or a recursive domain name resolver that does not have the forwarding query function; obtain the second query result corresponding to the second query request from the domain name server; if If the second query result is different from the Internet Protocol IP address of the target domain name indicated by the first query result, it is determined that the target domain name resolver is cache injected.

根据本申请的第六方面,提供了一种电子设备。该电子设备包括至少一个处理器;以及存储器,耦合至至少一个处理器并且具有存储于其上的指令,指令在由至少一个处理器执行时使设备执行动作,所述动作包括:接收域名查询请求,该域名查询请求用于查询第一域名;向域名服务器查询第一域名;接收域名查询响应,该域名查询响应包括指示第二域名的记录;在第二域名与第一域名不关联的情况下,确定域名解析器被缓存注入。According to a sixth aspect of the present application, an electronic device is provided. The electronic device includes at least one processor; and a memory coupled to the at least one processor and having instructions stored thereon that, when executed by the at least one processor, cause the device to perform actions, the actions including: receiving a domain name query request , the domain name query request is used to query the first domain name; query the domain name server for the first domain name; receive a domain name query response, the domain name query response includes a record indicating the second domain name; when the second domain name is not associated with the first domain name , confirm that the domain name resolver is cache injected.

根据本申请的第七方面,提供了一种计算机可读存储介质,其上存储有计算机程序产品,该计算机程序产品包括机器可执行指令,该机器可执行指令在被执行时使机器执行本申请的第一方面或第二方面中的方法的步骤。According to a seventh aspect of the present application, there is provided a computer-readable storage medium on which a computer program product is stored. The computer program product includes machine-executable instructions that, when executed, cause the machine to execute the present application. The steps of the method in the first aspect or the second aspect.

根据本申请的第八方面,提供了一种计算机程序产品,该计算机程序产品被有形地存储在非易失性计算机可读介质上并且包括机器可执行指令,该机器可执行指令在被执行时使机器执行本申请的第一方面或第二方面中的方法的步骤。According to an eighth aspect of the present application, a computer program product is provided, which computer program product is tangibly stored on a non-volatile computer-readable medium and includes machine-executable instructions that, when executed, The machine is caused to perform the steps of the method in the first or second aspect of the application.

附图说明Description of drawings

通过结合附图对本申请示例性实施例进行更详细的描述,本申请的上述以及其它目的、特征和优势将变得更加明显,其中,在本申请示例性实施例中,相同的参考标号通常代表相同部件。The above and other objects, features and advantages of the present application will become more apparent through a more detailed description of the exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein, in the exemplary embodiments of the present application, the same reference numerals generally represent Same parts.

图1A图示了根据本申请的实施例的设备和/或方法可以在其中被实施的一个示例场景的示意图;1A illustrates a schematic diagram of an example scenario in which devices and/or methods according to embodiments of the present application may be implemented;

图1B图示了根据本申请的实施例的设备和/或方法可以在其中被实施的另一个示例场景的示意图;Figure 1B illustrates a schematic diagram of another example scenario in which devices and/or methods according to embodiments of the present application may be implemented;

图2图示了本申请实施例中的基于链路的域名缓存注入过程的示意性流程图;Figure 2 illustrates a schematic flow chart of the link-based domain name cache injection process in the embodiment of the present application;

图3图示了本申请实施例中的基于旁路的域名缓存注入过程的示意性流程图;Figure 3 illustrates a schematic flow chart of the bypass-based domain name cache injection process in the embodiment of the present application;

图4图示了本申请实施例中的条件域名解析器被缓存注入后的递归查询过程的示意性流程图;Figure 4 illustrates a schematic flow chart of the recursive query process after the conditional domain name resolver is cache-injected in the embodiment of the present application;

图5图示了本申请实施例提供的一种域名缓存注入的检测方法的示意性流程图;Figure 5 illustrates a schematic flow chart of a domain name cache injection detection method provided by an embodiment of the present application;

图6图示了本申请实施例提供的另一种域名缓存注入检测方法的示意性流程图;Figure 6 illustrates a schematic flow chart of another domain name cache injection detection method provided by an embodiment of the present application;

图7图示了本申请实施例提供的一种域名缓存注入的检测装置的示意性框图;Figure 7 illustrates a schematic block diagram of a domain name cache injection detection device provided by an embodiment of the present application;

图8图示了本申请实施例提供的另一种域名缓存注入的检测装置的示意性框图;以及Figure 8 illustrates a schematic block diagram of another domain name cache injection detection device provided by an embodiment of the present application; and

图9图示了适于用来实施本申请的实施例的示例设备的示意性框图。Figure 9 illustrates a schematic block diagram of an example device suitable for implementing embodiments of the present application.

在各个附图中,相同或对应的标号表示相同或对应的部分。In the various drawings, the same or corresponding reference numerals represent the same or corresponding parts.

具体实施方式Detailed ways

下面将参照附图更详细地描述本申请的实施例。虽然附图中显示了本申请的某些实施例,然而应当理解的是,本申请可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本申请。应当理解的是,本申请的附图及实施例仅用于示例性作用,并非用于限制本申请的保护范围。Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather these embodiments are provided for Understand this application more thoroughly and completely. It should be understood that the drawings and embodiments of the present application are for illustrative purposes only and are not intended to limit the scope of protection of the present application.

在本申请的实施例的描述中,术语“包括”及其类似用语应当理解为开放性包括,即“包括但不限于”。术语“基于”应当理解为“至少部分地基于”。术语“一个实施例”或“该实施例”应当理解为“至少一个实施例”。术语“第一”、“第二”等等可以指代不同的或相同的对象。下文还可能包括其它明确的和隐含的定义。In the description of the embodiments of the present application, the term "including" and its similar expressions should be understood as an open inclusion, that is, "including but not limited to." The term "based on" should be understood to mean "based at least in part on." The terms "one embodiment" or "the embodiment" should be understood to mean "at least one embodiment". The terms "first," "second," etc. may refer to different or the same object. Other explicit and implicit definitions may be included below.

在用户通过客户端使用域名访问互联网时,需要通过域名解析器查询域名所对应的IP地址。域名解析器进一步可以通过递归查询或转发查询的方式查询域名,获取域名的IP地址并将之回复给客户端。域名解析器在查询域名的过程中可以将查询结果存入本地缓存中,在该域名解析器下一次对于相同域名进行递归查询时,可以直接基于本地缓存中的内容进行查询,而不用再完成整个递归查询过程,从而可以减少互联网上的域名查询报文数量。When users use a domain name to access the Internet through a client, they need to query the IP address corresponding to the domain name through a domain name resolver. The domain name resolver can further query the domain name through recursive query or forward query, obtain the IP address of the domain name and reply it to the client. The domain name parser can store the query results in the local cache during the process of querying the domain name. The next time the domain name parser performs a recursive query for the same domain name, it can directly query based on the content in the local cache without having to complete the entire query. The recursive query process can reduce the number of domain name query messages on the Internet.

然而,域名解析器的这种缓存机制面临域名缓存注入技术的威胁,域名解析器本地缓存中的内容可能会因域名缓存注入技术而被篡改,或被注入虚假的域名,使得用户在访问目标网站时被重定向到恶意服务器,使用户面临数据泄露的风险。因此,对域名缓存注入技术的防范十分重要。However, this caching mechanism of the domain name resolver faces the threat of domain name cache injection technology. The content in the local cache of the domain name resolver may be tampered with due to the domain name cache injection technology, or a false domain name may be injected, causing the user to access the target website. When redirected to a malicious server, users are exposed to the risk of data leakage. Therefore, it is very important to prevent domain name cache injection technology.

至少为了解决上述和其他潜在问题,本申请的实施例提供了一种针对条件域名解析器的域名缓存注入的识别方法。在该方法中,客户端向条件域名解析器查询目标域名并获取第一查询结果,向另一个递归域名解析器或权威域名服务器查询目标域名,获得第二查询结果,在第二查询结果与第一查询结果不同的情况下,确定第一域名解析器被缓存注入。通过该方法,能够识别出条件域名解析器是否被缓存注入,从而提醒用户采取防范措施,以提高用户访问互联网的安全性。At least to solve the above and other potential problems, embodiments of the present application provide a method for identifying domain name cache injection for conditional domain name resolvers. In this method, the client queries the conditional domain name resolver for the target domain name and obtains the first query result, queries another recursive domain name resolver or authoritative domain name server for the target domain name, and obtains the second query result. When the query results are different, it is determined that the first domain name resolver is cache injected. Through this method, it can be identified whether the conditional domain name resolver has been cache-injected, thereby reminding the user to take preventive measures to improve the security of users accessing the Internet.

下面将进一步结合附图来详细描述本申请的实施例。The embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

首先,结合图1A和图1B描述本申请的实施例所适用的域名查询场景。在图1A和图1B所示的场景中,以条件域名解析器为例进行了说明。条件域名解析器是本申请实施例中提供的一种同时具有转发查询功能和递归查询功能的域名解析器。基于预定义的配置,条件域名解析器可以对域名进行转发查询,也可以对域名进行递归查询,示例性地,条件域名解析器可以配置有转发区域和递归区域,若待查询的域名属于转发区域,条件域名解析器将对其进行转发查询,若待查询的域名属于递归区域,条件域名解析器将对其进行递归查询。条件域名解析器的转发查询过程和递归查询过程共用相同的本地缓存,也就是说,在转发查询过程中存入缓存中的结果,会被条件域名解析器在递归查询的过程中使用。First, the domain name query scenario applicable to the embodiment of the present application is described with reference to FIG. 1A and FIG. 1B. In the scenarios shown in Figures 1A and 1B, the conditional domain name resolver is used as an example for explanation. The conditional domain name parser is a domain name parser provided in the embodiment of the present application that has both a forwarding query function and a recursive query function. Based on the predefined configuration, the conditional domain name resolver can perform forwarding queries on domain names, and can also perform recursive queries on domain names. For example, the conditional domain name resolver can be configured with a forwarding area and a recursive area. If the domain name to be queried belongs to the forwarding area , the conditional domain name resolver will forward the query to it. If the domain name to be queried belongs to the recursive area, the conditional domain name resolver will perform a recursive query on it. The forwarding query process and the recursive query process of the conditional domain name resolver share the same local cache. That is to say, the results stored in the cache during the forwarding query process will be used by the conditional domain name resolver in the recursive query process.

图1A示出了转发查询场景100A。示例性地,图1A所示的转发查询场景100A可以包括客户端101、条件域名解析器102和域名服务器103,其中,条件域名解析器102通过转发查询的方式查询域名。Figure 1A illustrates a forward query scenario 100A. For example, the query forwarding scenario 100A shown in FIG. 1A may include a client 101, a conditional domain name resolver 102, and a domain name server 103, where the conditional domain name resolver 102 queries the domain name by forwarding the query.

在图1A所示的场景下,客户端101向条件域名解析器102查询域名,条件域名解析器102确定对该域名进行转发查询,将该域名查询请求转发给域名服务器103,域名服务器103可以是递归域名解析器或所查询的域名的权威域名服务器,其中,权威域名服务器是负责管理和解析特定域名的域名服务器,例如,在对一个域名进行递归查询时,域名解析器所查询根域名服务器、顶级域名服务器、二级域名服务器等,均是待查询域名的权威域名服务器。域名服务器103完成对域名的查询后,将指示域名所对应的IP地址的记录返回给条件域名解析器102。从而条件域名解析器完成转发查询,将查询结果返回给客户端101。In the scenario shown in Figure 1A, the client 101 queries the conditional domain name resolver 102 for a domain name. The conditional domain name resolver 102 determines to forward the query for the domain name and forwards the domain name query request to the domain name server 103. The domain name server 103 can be A recursive domain name resolver or an authoritative domain name server for the queried domain name. An authoritative domain name server is a domain name server responsible for managing and resolving a specific domain name. For example, when performing a recursive query on a domain name, the root domain name server queried by the domain name resolver, Top-level domain name servers, second-level domain name servers, etc. are all authoritative domain name servers for the domain name to be queried. After completing the query for the domain name, the domain name server 103 returns a record indicating the IP address corresponding to the domain name to the conditional domain name parser 102 . Thus, the conditional domain name resolver completes the forwarding query and returns the query result to the client 101.

在一些实施例中,域名服务器103可以是与所查询的域名对应的权威域名服务器,权威域名服务器可以在条件域名解析器102查询域名的过程中对条件域名解析器102进行缓存注入。示例性地,在权威域名服务器收到来自条件域名解析器102的查询请求后,可以向条件域名解析器102返回另一个域名的授权记录或A记录,或向条件域名解析器102返回指示错误IP地址的记录。条件域名解析器102接收到这些记录后,会将这些记录存储在本地缓存中。In some embodiments, the domain name server 103 may be an authoritative domain name server corresponding to the queried domain name, and the authoritative domain name server may perform cache injection on the conditional domain name resolver 102 when the conditional domain name resolver 102 queries the domain name. For example, after the authoritative domain name server receives a query request from the conditional domain name resolver 102, it may return an authorization record or an A record of another domain name to the conditional domain name resolver 102, or return an IP indicating an error to the conditional domain name resolver 102. Record of address. After receiving these records, the conditional domain name resolver 102 will store these records in the local cache.

在图1B中,示出了递归查询场景100B。示例性地,图1B所示的递归查询场景100B可以包括客户端101、条件域名解析器102、根域名服务器104、顶级域名服务器105和二级域名服务器106,其中,条件域名解析器102通过递归查询的方式查询域名。In Figure IB, a recursive query scenario 100B is shown. Exemplarily, the recursive query scenario 100B shown in FIG. 1B may include a client 101, a conditional domain name resolver 102, a root domain name server 104, a top-level domain name server 105, and a second-level domain name server 106, where the conditional domain name resolver 102 recursively Query the domain name by querying.

在图1B所示的场景下,客户端101向条件域名解析器102查询域名,条件域名解析器102会从根域名服务器104开始,逐级向下查询,查询顶级域名服务器105、二级域名服务器106等域名服务器,直至获得与域名对应的IP地址。In the scenario shown in Figure 1B, the client 101 queries the conditional domain name resolver 102 for a domain name. The conditional domain name resolver 102 will start from the root domain name server 104 and query downwards step by step to the top-level domain name server 105 and the second-level domain name server. 106 and other domain name servers until the IP address corresponding to the domain name is obtained.

在递归查询时,若条件域名解析器102的本地缓存中存储有待查询域名的授权记录,则条件域名解析器102会基于该授权记录,向该授权记录所指示的域名服务器查询待查询的域名。示例性地,接收到来自客户端101的对于某个域名的域名查询请求后,若条件域名解析器102的本地缓存中存储有该域名的授权记录,该授权记录指示与域名对应的权威域名服务器为二级域名服务器106,则条件域名解析器102不用从根域名服务器104逐级向下查询,而是可以直接查询二级域名服务器106,从而获得与域名对应的IP地址。其中,条件域名解析器102本地缓存中的授权记录可以是在上一次对域名的递归查询过程中获取的,也可以是在转发查询的过程中获取的,例如在图1A所示的场景下获取。During recursive query, if the local cache of the conditional domain name resolver 102 stores an authorization record for the domain name to be queried, the conditional domain name resolver 102 will query the domain name server indicated by the authorization record for the domain name to be queried based on the authorization record. For example, after receiving a domain name query request for a certain domain name from the client 101, if the local cache of the conditional domain name resolver 102 stores an authorization record for the domain name, the authorization record indicates the authoritative domain name server corresponding to the domain name. As the second-level domain name server 106, the conditional domain name resolver 102 does not need to query downwards from the root domain name server 104, but can directly query the second-level domain name server 106 to obtain the IP address corresponding to the domain name. Among them, the authorization record in the local cache of the conditional domain name resolver 102 can be obtained during the last recursive query for the domain name, or can be obtained during the process of forwarding the query, for example, obtained in the scenario shown in Figure 1A .

应理解,图1A和图1B所示的场景仅为本申请的示例,不能成为对本申请的限制。本申请对域名解析过程中涉及的域名服务器的数量和类型不作限制,适用于本申请实施例的域名解析场景还可以包括更多个或更少个域名服务器。还应理解,本申请实施例中的客户端仅是示意性的,客户端可以是任意合适的设备,可以通过软件和/或硬件的方式实现。It should be understood that the scenarios shown in FIG. 1A and FIG. 1B are only examples of the present application and cannot be used to limit the present application. This application does not limit the number and type of domain name servers involved in the domain name resolution process. Domain name resolution scenarios applicable to the embodiments of this application may also include more or fewer domain name servers. It should also be understood that the client in the embodiment of this application is only illustrative, and the client can be any suitable device and can be implemented in software and/or hardware.

上面结合图1描述了本申请的实施例的设备和/或方法可以在其中被实施的示例场景。下面结合图2和图3,描述本申请实施例所涉及的域名缓存注入过程。Example scenarios in which devices and/or methods of embodiments of the present application may be implemented are described above in conjunction with FIG. 1 . The following describes the domain name cache injection process involved in the embodiment of this application with reference to Figures 2 and 3.

图2示例性地示出了本申请实施例中的基于链路的域名缓存注入过程200。在过程200中,在条件域名解析器2002对域名进行转发查询时,域名服务器2003对条件域名解析器2002进行缓存注入。应理解,图2中的客户端2001、条件域名解析器2002以及域名服务器2003仅是示意性地给出,不能成为对本申请的限制。参考图2,过程200可以包括步骤201至步骤206,接下来将对过程200所包含的步骤进行详细说明。Figure 2 exemplarily shows the link-based domain name cache injection process 200 in the embodiment of the present application. In process 200, when the conditional domain name resolver 2002 performs forwarding query on the domain name, the domain name server 2003 performs cache injection on the conditional domain name resolver 2002. It should be understood that the client 2001, the conditional domain name resolver 2002 and the domain name server 2003 in Figure 2 are only schematically provided and cannot be used to limit the present application. Referring to FIG. 2 , the process 200 may include steps 201 to 206 , and the steps included in the process 200 will be described in detail next.

在步骤201中,客户端2001向条件域名解析器2002发送域名查询请求,查询域名。为了便于理解,在接下来的示例中,以域名“example.com”为例进行说明,示例性地,与域名“example.com”所对应的正确IP地址为“192.0.2.1”,正确权威域名服务器为“ns.example.com”。In step 201, the client 2001 sends a domain name query request to the conditional domain name parser 2002 to query the domain name. For ease of understanding, in the following example, the domain name "example.com" is used as an example. For example, the correct IP address corresponding to the domain name "example.com" is "192.0.2.1", and the correct authoritative domain name The server is "ns.example.com".

在步骤202中,条件域名解析器2002确定域名属于转发区域。在本申请的实施例中,条件域名解析器2002本地缓存中可以配置有转发区域,其中保存有需要进行转发查询的域名。条件域名解析器2002接收到域名查询请求后,可以先将该域名查询请求所请求查询的域名与转发区域中的域名进行匹配。域名“example.com”属于条件域名解析器2002的转发区域,条件域名解析器2002将对域名“example.com”进行转发查询。In step 202, the conditional domain name resolver 2002 determines that the domain name belongs to the forwarding zone. In the embodiment of the present application, the local cache of the conditional domain name resolver 2002 may be configured with a forwarding area, which stores domain names that need to be forwarded and queried. After receiving the domain name query request, the conditional domain name resolver 2002 may first match the domain name requested by the domain name query request with the domain name in the forwarding zone. The domain name "example.com" belongs to the forwarding area of the conditional domain name resolver 2002, and the conditional domain name resolver 2002 will forward the query for the domain name "example.com".

在步骤203中,条件域名解析器2002将来自客户端2001的域名查询请求转发给预先配置在条件域名解析器2002中的其他域名服务器2003。示例性地,域名服务器2003可以为递归域名解析器,或域名“example.com”的权威域名服务器。In step 203, the conditional domain name resolver 2002 forwards the domain name query request from the client 2001 to other domain name servers 2003 pre-configured in the conditional domain name resolver 2002. For example, the domain name server 2003 may be a recursive domain name resolver, or an authoritative domain name server for the domain name "example.com".

在步骤204中,域名服务器2003向条件域名解析器2002回复查询结果,包括任意域名的虚假信息。虚假信息包括域名的资源记录。一个示例,域名服务器2003可以向条件域名解析器2002回复指示错误的IP地址的A记录。例如,域名服务器2003可以回复A记录“example.com.A 192.0.1.1”,即,将指示虚假的IP地址的信息返回给条件域名解析器2002。又一个示例,域名服务器2003可以向条件域名解析器2002回复错误的NS记录,例如,域名服务器2003可以回复NS记录“example.com.NS ns.wrong.com”,即,将指示虚假的权威服务器的信息返回给条件域名解析器2002。In step 204, the domain name server 2003 returns the query results to the conditional domain name resolver 2002, including false information of any domain name. The false information included resource records for domain names. As an example, the domain name server 2003 may reply to the conditional domain name resolver 2002 with an A record indicating an incorrect IP address. For example, the domain name server 2003 may reply with the A record "example.com.A 192.0.1.1", that is, return information indicating a false IP address to the conditional domain name resolver 2002. As another example, the domain name server 2003 may reply to the conditional domain name resolver 2002 with an incorrect NS record. For example, the domain name server 2003 may reply with the NS record "example.com.NS ns.wrong.com", which will indicate a false authoritative server. The information is returned to the conditional domain name resolver 2002.

在一些实施例中,域名服务器2003还可以向条件域名解析器2002回复其他除域名“example.com”之外的域名的资源记录,例如域名“ex.com”的A记录或NS记录,该A记录或NS记录可以指向预先配置的虚假服务器。In some embodiments, the domain name server 2003 can also reply to the conditional domain name resolver 2002 with resource records of other domain names other than the domain name "example.com", such as the A record or NS record of the domain name "ex.com". The A record Records or NS records can point to pre-configured fake servers.

在步骤205中,条件域名解析器2002将来自于域名服务器2003的查询结果存入本地缓存中。在该域名被配置于递归区域后,若条件域名解析器2002下一次接收到对相同域名的域名查询请求,条件域名解析器2002可以根据本地缓存中的内容进行查询。In step 205, the conditional domain name resolver 2002 stores the query results from the domain name server 2003 into the local cache. After the domain name is configured in the recursive zone, if the conditional domain name resolver 2002 receives a domain name query request for the same domain name next time, the conditional domain name resolver 2002 can query based on the content in the local cache.

在步骤206中,条件域名解析器2002将查询结果发送给客户端2001。若条件域名解析器2002从域名服务器2003处获取的查询结果指示所查询的域名的虚假IP地址,条件域名解析器2002发送给客户端2001的结果中也将指示该虚假的IP地址。In step 206, the conditional domain name resolver 2002 sends the query result to the client 2001. If the query result obtained by the conditional domain name resolver 2002 from the domain name server 2003 indicates a false IP address of the queried domain name, the result sent by the conditional domain name resolver 2002 to the client 2001 will also indicate the false IP address.

通过以上过程200,域名服务器2003实现了对条件域名解析器2002的域名缓存注入,即,在条件域名解析器2002的本地缓存中存入了域名的虚假信息。Through the above process 200, the domain name server 2003 implements the domain name cache injection into the conditional domain name parser 2002, that is, the false information of the domain name is stored in the local cache of the conditional domain name parser 2002.

在任意客户端(包括客户端2001)下一次向条件域名解析器2002查询与缓存注入的内容相关的域名时,若该域名被配置为条件域名解析器的递归区域,条件域名解析器2002可能将本地缓存中的被注入的虚假信息返回给客户端,或基于被注入的虚假信息进行查询并获得虚假的结果,从而使客户端访问错误的服务器。The next time any client (including client 2001) queries the conditional domain name resolver 2002 for a domain name related to the cached injected content, if the domain name is configured as a recursive region of the conditional domain name resolver, the conditional domain name resolver 2002 may The injected false information in the local cache is returned to the client, or a query based on the injected false information gets false results, causing the client to access the wrong server.

例如,条件域名解析器2002被缓存注入的内容为“example.com.A 192.0.1.1”,若客户端下一次向条件域名解析器2002查询域名“example.com”时条件域名解析器对该域名进行递归查询,客户端从条件域名解析器2002处获取的查询结果可能指示IP地址“192.0.1.1”,而非正确的IP地址“192.0.2.1”,从而客户端将基于错误的IP地址访问错误的服务器。For example, the content injected by the cache of the conditional domain name resolver 2002 is "example.com.A 192.0.1.1". If the client queries the conditional domain name resolver 2002 for the domain name "example.com" next time, the conditional domain name resolver 2002 will query the domain name for the domain name. Performing a recursive query, the query results obtained by the client from the conditional domain name resolver 2002 may indicate the IP address "192.0.1.1" instead of the correct IP address "192.0.2.1", so the client will access the error based on the wrong IP address. server.

又例如,条件域名解析器2002在查询域名“example.com”时被注入了虚假的NS记录“ex.com.NS ns.wrong.com”,在域名“ex.com”被配置为递归区域后,后续任意客户端向该条件域名解析器2002查询域名“ex.com”时,条件域名解析器2002可能基于本地缓存中的虚假NS记录,向虚假的权威域名服务器查询域名,进而获得错误的查询结果。For another example, the conditional domain name resolver 2002 was injected with a false NS record "ex.com.NS ns.wrong.com" when querying the domain name "example.com". After the domain name "ex.com" was configured as a recursive zone , when any subsequent client queries the conditional domain name resolver 2002 for the domain name "ex.com", the conditional domain name resolver 2002 may query the domain name from the false authoritative domain name server based on the false NS record in the local cache, thereby obtaining an incorrect query. result.

上面结合图2描述了本申请实施例中涉及的基于链路的域名缓存注入过程,接下来结合图3描述本申请实施例中涉及的基于旁路的域名缓存注入过程。在图3所示的域名缓存注入过程300中,客户端3001伪造权威域名服务器的域名查询响应,向条件域名解析器3002进行缓存注入。应理解,图3中的客户端3001、条件域名解析器3002、上层域名服务器3003以及权威域名服务器3004仅是示意性地给出,不能成为对本申请的限制。在图3中,过程300可以包括步骤301至步骤309。接下来将对过程300所包含的步骤进行详细说明。The link-based domain name cache injection process involved in the embodiment of the present application is described above with reference to Figure 2. Next, the bypass-based domain name cache injection process involved in the embodiment of the present application is described with reference to Figure 3. In the domain name cache injection process 300 shown in Figure 3, the client 3001 forges the domain name query response of the authoritative domain name server and performs cache injection into the conditional domain name resolver 3002. It should be understood that the client 3001, the conditional domain name resolver 3002, the upper-layer domain name server 3003 and the authoritative domain name server 3004 in Figure 3 are only provided schematically and cannot be used to limit the present application. In FIG. 3 , process 300 may include steps 301 to 309 . Next, the steps included in the process 300 will be described in detail.

在步骤301中,客户端3001向条件域名解析器3002发送域名查询请求,查询域名。In step 301, the client 3001 sends a domain name query request to the conditional domain name parser 3002 to query the domain name.

在步骤302中,条件域名解析器3002确定域名属于转发区域。In step 302, the conditional domain name resolver 3002 determines that the domain name belongs to the forwarding zone.

步骤301至步骤301与前述步骤201至步骤202相同,这里不再赘述。Steps 301 to 301 are the same as the aforementioned steps 201 to 202, and will not be described again here.

在步骤303中,条件域名解析器3002将域名查询请求转发至上层域名解析器3003,该上层域名解析器3003例如可以是递归域名解析器。In step 303, the conditional domain name resolver 3002 forwards the domain name query request to the upper-level domain name resolver 3003. The upper-level domain name resolver 3003 may be, for example, a recursive domain name resolver.

在步骤304中,上层域名解析器3003接收到条件域名解析器3002转发的域名查询请求,对域名进行查询,例如向权威域名服务器3004发送域名查询请求,请求查询域名。权威域名服务器3004本地可以配置有与所查询的域名相关的信息,可以完成域名的查询。In step 304, the upper-layer domain name resolver 3003 receives the domain name query request forwarded by the conditional domain name resolver 3002, and queries the domain name, for example, sends a domain name query request to the authoritative domain name server 3004 to request the domain name query. The authoritative domain name server 3004 can be locally configured with information related to the queried domain name, and can complete the query of the domain name.

在步骤305中,权威域名服务器3004响应于上层域名服务器3003的域名查询请求,从本地配置文件中获取与所查询的域名对应的IP地址,并向上层域名解析器回复正确的查询结果,指示域名的正确IP地址。In step 305, the authoritative domain name server 3004 responds to the domain name query request of the upper-layer domain name server 3003, obtains the IP address corresponding to the queried domain name from the local configuration file, and replies the correct query result to the upper-layer domain name resolver, indicating the domain name the correct IP address.

在步骤306中,上层域名解析器3003从权威域名服务器3004处获取到正确的查询结果后,将该正确的结果回复给条件域名解析器3002。In step 306, after obtaining the correct query result from the authoritative domain name server 3004, the upper-layer domain name parser 3003 replies the correct result to the conditional domain name parser 3002.

上述步骤303至步骤306仅是示意性的给出,在一些实施例中,条件域名解析器3002可以将来自客户端3001的域名查询请求直接转发至权威域名服务器3004,并从权威服务器3004处获得正确的查询结果。The above steps 303 to 306 are only illustrative. In some embodiments, the conditional domain name resolver 3002 can directly forward the domain name query request from the client 3001 to the authoritative domain name server 3004, and obtain the domain name from the authoritative server 3004. Correct query results.

在步骤307中,客户端3001伪造来自所查询域名的权威域名服务器的回复,向条件域名解析器3002发送虚假信息。在本申请的实施例中,条件域名解析器通过接收到的数据包中的请求序列号和端口号来识别来自权威域名服务器的回复,因此,客户端3001可以将向条件域名解析器3002发送的数据包中的请求序列号和端口号更改为域权威域名服务器对应的请求序列号和端口号,从而伪装为权威域名服务器,向条件域名解析器3002发送虚假信息。In step 307, the client 3001 forges a reply from the authoritative domain name server of the queried domain name and sends false information to the conditional domain name resolver 3002. In the embodiment of this application, the conditional domain name resolver identifies the reply from the authoritative domain name server through the request sequence number and port number in the received data packet. Therefore, the client 3001 can send the request sequence number and port number to the conditional domain name resolver 3002. The request sequence number and port number in the data packet are changed to the request sequence number and port number corresponding to the domain authoritative domain name server, thus pretending to be the authoritative domain name server and sending false information to the conditional domain name resolver 3002.

在条件域名解析器接收到来自上层域名解析器3003或权威域名服务器3004的回复后,会在预定义的时间内将该结果存入本地缓存,并完成对域名的查询,之后到达的与该域名相关的查询响应将不会被条件域名解析器3002所接受,因此,客户端3001需要在条件域名解析器将结果存入本地缓存之前,向条件域名解析器3002发送虚假信息。即,步骤307在步骤308之前执行。After the conditional domain name resolver receives the reply from the upper-level domain name resolver 3003 or the authoritative domain name server 3004, it will store the result in the local cache within a predefined time and complete the query for the domain name. The relevant query response will not be accepted by the conditional domain name resolver 3002. Therefore, the client 3001 needs to send false information to the conditional domain name resolver 3002 before the conditional domain name resolver stores the results in the local cache. That is, step 307 is performed before step 308.

在步骤308中,条件域名解析器3002将查询结果存入本地缓存。In step 308, the conditional domain name resolver 3002 stores the query results in the local cache.

在一些实施例中,来自客户端3001中的虚假信息是其他域名的虚假记录,条件域名解析器3002会将该虚假记录存入本地缓存。在一些实施例中,来自客户端3001中的虚假信息是所查询域名的虚假记录,若条件域名解析器3002先接收到该虚假记录,而后接收到来自上层域名解析器3003或权威域名服务器3004的正确结果,则条件域名解析器会将后接收到的正确结果存入本地缓存,若条件域名解析器3002先接收到来自上层域名解析器3003或权威域名服务器3004的正确结果,而后接收到该虚假记录,则条件域名解析器3002会将后接收到的虚假记录存入本地缓存。In some embodiments, the false information from the client 3001 is false records of other domain names, and the conditional domain name resolver 3002 will store the false records in the local cache. In some embodiments, the false information from the client 3001 is a false record of the queried domain name. If the conditional domain name resolver 3002 first receives the false record, and then receives the false record from the upper-level domain name resolver 3003 or the authoritative domain name server 3004 If the conditional domain name resolver 3002 first receives the correct result from the upper-layer domain name resolver 3003 or the authoritative domain name server 3004, and then receives the false record, the conditional domain name resolver 3002 will store the false record received later in the local cache.

在步骤309中,条件域名解析器3002将获取到的查询结果发送给客户端3001。条件域名解析器3002发送给客户端的查询结果是后接收到的指示所查询域名的IP地址的记录。In step 309, the conditional domain name resolver 3002 sends the obtained query results to the client 3001. The query result sent by the conditional domain name resolver 3002 to the client is the subsequently received record indicating the IP address of the queried domain name.

基于上述步骤,客户端3001在条件域名解析器3002对域名进行转发查询的过程中,可以实现对条件域名解析器3002的域名缓存注入。与过程200中由权威域名服务器进行的域名缓存注入行为不同,过程300中的域名缓存注入行为由客户端进行,即,任意设备(包括客户端3001)均可以通过伪造来自权威服务器的响应的方式,对条件域名解析器进行域名缓存注入。Based on the above steps, the client 3001 can implement domain name cache injection into the conditional domain name parser 3002 during the process of forwarding the domain name query by the conditional domain name parser 3002. Different from the domain name cache injection behavior performed by the authoritative domain name server in the process 200, the domain name cache injection behavior in the process 300 is performed by the client, that is, any device (including the client 3001) can forge the response from the authoritative server. , perform domain name cache injection into the conditional domain name resolver.

在条件域名解析器进行转发查询过程中被缓存注入的虚假信息,会被条件域名解析器在递归查询的过程中使用。接下来结合图4,以客户端4001和条件域名解析器4002为例,对条件域名解析器4002被缓存注入后的递归查询过程进行说明。示例性地,在图4所示的过程400中,条件域名解析器4002被域名服务器通过图2所示的过程200进行了缓存注入,或被其他客户端通过图3所示的过程300进行了缓存注入,缓存注入的内容包括域名“ex.com”的虚假资源记录。在图4中,域名查询过程400可以包括步骤401至步骤404,接下来将对过程400包括的步骤进行详细说明。The false information injected by the cache during the forwarding query process of the conditional domain name resolver will be used by the conditional domain name resolver during the recursive query process. Next, with reference to Figure 4, taking the client 4001 and the conditional domain name resolver 4002 as an example, the recursive query process after the conditional domain name resolver 4002 is cache-injected will be described. Exemplarily, in the process 400 shown in Figure 4, the conditional domain name resolver 4002 is cache injected by the domain name server through the process 200 shown in Figure 2, or is performed by other clients through the process 300 shown in Figure 3 Cache injection. The content of cache injection includes false resource records for the domain name "ex.com". In Figure 4, the domain name query process 400 may include steps 401 to 404. Next, the steps included in the process 400 will be described in detail.

在步骤401中,客户端4001向条件域名解析器4002查询域名。作为示例,接下来以客户端4001查询域名“ex.com”为例进行说明。。In step 401, the client 4001 queries the conditional domain name resolver 4002 for the domain name. As an example, let's take the client 4001 to query the domain name "ex.com" as an example. .

在步骤402中,在接收到来自客户端4001的对于域名“ex.com”的查询请求后,条件域名解析器4002确定需要对域名“ex.com”进行递归查询。条件域名解析器4002先在本地缓存中搜索该域名的资源记录,例如根据最长后缀匹配原则,匹配到本地缓存中的“ex.com”的虚假资源记录。在一些实施例中,该虚假记录例如可以是指示虚假IP地址的A记录,条件域名解析器4002匹配到“ex.com”的A记录后,会将其回复给客户端4001。在一些实施例中,虚假记录可以是指示域名的虚假权威域名服务器的授权记录,条件域名解析器4002匹配到“ex.com”的授权记录后,可以根据该授权记录向虚假的权威域名服务器查询域名“ex.com”,进而获得错误的查询结果。In step 402, after receiving a query request for the domain name "ex.com" from the client 4001, the conditional domain name resolver 4002 determines that a recursive query for the domain name "ex.com" needs to be performed. The conditional domain name resolver 4002 first searches the local cache for the resource record of the domain name. For example, according to the longest suffix matching principle, it matches the false resource record of "ex.com" in the local cache. In some embodiments, the false record may be, for example, an A record indicating a false IP address. After the conditional domain name resolver 4002 matches the A record of "ex.com", it will reply to the client 4001. In some embodiments, the false record may be an authorization record indicating a false authoritative domain name server of the domain name. After the conditional domain name resolver 4002 matches the authorization record of "ex.com", it may query the false authoritative domain name server based on the authorization record. Domain name "ex.com", thereby obtaining incorrect query results.

在步骤403中,条件域名解析器4002将查询结果返回给客户端4001,该查询结果是基于被缓存注入的虚假记录得到的,指示错误的IP地址。In step 403, the conditional domain name resolver 4002 returns the query result to the client 4001. The query result is obtained based on the false record injected by the cache, indicating the wrong IP address.

在步骤404中,客户端4001基于接收到的查询结果中所指示的IP地址,访问与IP地址对应的服务器。由于查询结果中的IP地址为错误的IP地址,客户端4001对域名的访问将被定向至错误的服务器,导致客户端4001对域名的访问失败,甚至造成客户端4001的数据泄露。In step 404, the client 4001 accesses the server corresponding to the IP address based on the IP address indicated in the received query result. Since the IP address in the query result is a wrong IP address, client 4001's access to the domain name will be directed to the wrong server, causing client 4001's access to the domain name to fail, and even causing client 4001's data to be leaked.

针对上述图2至图4中的域名缓存注入行为,本申请实施例提供了域名缓存注入的检测方法。接下来结合图5和图6,对本申请实施例中的域名缓存注入的检测方法进行说明。In view of the above-mentioned domain name cache injection behavior in Figures 2 to 4, embodiments of the present application provide a detection method for domain name cache injection. Next, the detection method of domain name cache injection in the embodiment of the present application will be described with reference to Figures 5 and 6.

图5是本申请实施例提供的一种域名缓存注入的检测方法的示意性流程图。在方法500中,由客户端进行对条件域名解析器的域名缓存注入检测。在图5中,方法500可以包括步骤501至步骤505,接下来以客户端5001、条件域名解析器5002和域名服务器5003为例,对各步骤进行说明。Figure 5 is a schematic flow chart of a domain name cache injection detection method provided by an embodiment of the present application. In method 500, the client performs domain name cache injection detection on the conditional domain name resolver. In Figure 5, the method 500 may include steps 501 to 505. Next, each step will be described by taking the client 5001, the conditional domain name resolver 5002, and the domain name server 5003 as examples.

在步骤501中,客户端5001向条件域名解析器5002查询目标域名。示例性地,客户端5001可以向条件域名解析器5002发送域名查询请求,该请求用于请求条件域名解析器5002查询目标域名。In step 501, the client 5001 queries the conditional domain name resolver 5002 for the target domain name. For example, the client 5001 may send a domain name query request to the conditional domain name resolver 5002, where the request is used to request the conditional domain name resolver 5002 to query the target domain name.

在步骤502中,响应于客户端对目标域名的查询,条件域名解析器502完成对目标域名的查询,并向客户端5001发送第一查询结果。条件域名解析器5002可以通过递归查询或转发查询的方式完成对目标域名的查询。In step 502, in response to the client's query for the target domain name, the conditional domain name resolver 502 completes the query for the target domain name and sends the first query result to the client 5001. The conditional domain name resolver 5002 can complete the query for the target domain name through recursive query or forward query.

在步骤503中,客户端5001向域名服务器5003查询目标域名。该域名服务器5003是权威域名服务器或不具备转发查询功能的递归域名解析器。也就是说,客户端5001所查询的域名服务器不会对域名进行转发查询。如果客户端5001向递归域名解析器进行查询,在递归域名解析器进行的递归查询过程中,递归域名解析器会对虚假的回复内容进行拦截,从而使客户端获得正确的结果;如果客户端向权威域名服务器直接进行的查询,权威服务器会基于本地配置文件回复正确结果。也就是说,客户端5001能从域名服务器5003获得正确的查询结果。In step 503, the client 5001 queries the domain name server 5003 for the target domain name. The domain name server 5003 is an authoritative domain name server or a recursive domain name resolver without forwarding query function. In other words, the domain name server queried by client 5001 will not forward the domain name query. If the client 5001 queries the recursive domain name resolver, during the recursive query process of the recursive domain name resolver, the recursive domain name resolver will intercept the false reply content, so that the client can obtain the correct result; For queries performed directly by the authoritative domain name server, the authoritative server will reply with correct results based on the local configuration file. In other words, client 5001 can obtain correct query results from domain name server 5003.

在步骤504中,域名服务器5003将第二查询结果发送给客户端5001,如上所述,第二结果中指示的IP地址为目标域名的正确IP地址。In step 504, the domain name server 5003 sends the second query result to the client 5001. As mentioned above, the IP address indicated in the second result is the correct IP address of the target domain name.

在步骤505中,客户端5001基于第一结果和第二结果,确定条件域名解析器是否被缓存注入。由于第二结果中指示的IP地址为正确的IP地址,若第一结果所指示的IP地址与第二结果中所指示的IP地址不同,则代表条件域名解析器5002查询目标域名的查询结果指示错误的IP地址,即条件域名解析器5002在查询目标域名的过程中被缓存注入了。相应地,若第一结果所指示的IP地址与第二结果中所指示的IP地址相同,则代表条件域名解析器5002在查询目标域名的过程中未被注入目标域名的虚假IP地址。In step 505, the client 5001 determines whether the conditional domain name resolver is cache injected based on the first result and the second result. Since the IP address indicated in the second result is a correct IP address, if the IP address indicated in the first result is different from the IP address indicated in the second result, it means that the conditional domain name parser 5002 queries the query result indication of the target domain name. The wrong IP address, that is, conditional domain name resolver 5002, was injected into the cache during the query of the target domain name. Correspondingly, if the IP address indicated in the first result is the same as the IP address indicated in the second result, it means that the conditional domain name resolver 5002 did not inject a false IP address of the target domain name during the process of querying the target domain name.

基于上述技术内容,客户端可以将从条件域名解析器获得的查询结果与正确查询结果进行比对,从而确定该条件域名解析器是否被缓存注入,进而可以提醒用户对条件域名解析器进行处理,或避免使用该条件域名解析器进行域名查询,如此,能够提高用户访问互联网的安全性。Based on the above technical content, the client can compare the query results obtained from the conditional domain name resolver with the correct query results to determine whether the conditional domain name resolver has been cache-injected, and then remind the user to process the conditional domain name resolver. Or avoid using this conditional domain name resolver to perform domain name queries. This can improve the security of users accessing the Internet.

在一些实施例中,方法500中的条件域名解析器5002的域名安全拓展功能为关闭状态。域名安全拓展功能是一种用于检测域名查询响应中的数据的完整性和合法性的功能,基于该功能,域名解析器可以识别并拒绝虚假域名的缓存注入。方法500是一种基于查询结果的检测方法,因此,在条件域名解析器未开启域名安全拓展功能的情况下,客户端也能够通过方法500检测条件域名解析器是否被缓存注入。In some embodiments, the domain name security extension function of the conditional domain name resolver 5002 in method 500 is turned off. The domain name security extension function is a function used to detect the integrity and legality of data in domain name query responses. Based on this function, the domain name resolver can identify and reject cache injection of false domain names. Method 500 is a detection method based on query results. Therefore, when the conditional domain name resolver does not enable the domain name security extension function, the client can also use method 500 to detect whether the conditional domain name resolver is cache injected.

在一些实施例中,在前述步骤501之前,客户端5001可以先确定所查询的域名解析器是条件域名解析器。例如,客户端5001可以向域名解析器发送对于多个域名的至少两次查询,以确定域名解析器是具有转发查询功能和递归查询功能的条件域名解析器。客户端5001向域名解析器对一个域名发起两次查询,第一次查询可以使域名解析器获取到域名的资源记录,第二次查询可以请求获取域名解析器本地缓存中该域名的授权记录。在第二次查询无法获取到域名的授权记录时,可以确定域名解析器对域名的第一次查询为转发查询,域名解析器具有转发查询功能,在第二次查询成功获取到域名的授权记录时,可以确定域名解析器对域名的第一次查询为递归查询,域名解析器具有递归查询功能。当查询多个域名时,若既有查询结果表明域名解析器具有递归功能,又有查询结果表明该域名解析器具有转发功能,则可以确定该域名解析器为条件域名解析器。In some embodiments, before the aforementioned step 501, the client 5001 may first determine that the queried domain name resolver is a conditional domain name resolver. For example, the client 5001 may send at least two queries for multiple domain names to the domain name resolver to determine that the domain name resolver is a conditional domain name resolver with a forward query function and a recursive query function. Client 5001 initiates two queries for a domain name to the domain name resolver. The first query allows the domain name resolver to obtain the resource record of the domain name, and the second query allows the domain name resolver to obtain the authorization record of the domain name in the local cache. When the authorization record of the domain name cannot be obtained in the second query, it can be determined that the first query of the domain name by the domain name resolver is a forward query. The domain name resolver has a forward query function and the authorization record of the domain name is successfully obtained in the second query. When , it can be determined that the domain name parser's first query for the domain name is a recursive query, and the domain name parser has a recursive query function. When querying multiple domain names, if both the query results indicate that the domain name parser has a recursive function and the query results indicate that the domain name parser has a forwarding function, the domain name parser can be determined to be a conditional domain name parser.

在一些实施例中,一个域名可以仅与一个正确的IP地址对应。在前述步骤504中,客户端5001从域名服务器5003获取的第二结果中可以指示一个与目标域名对应的正确IP地址,为了便于描述,称其为第二IP地址。相应地,将在前述步骤502中客户端5001从条件域名解析器5002获取的第一结果中所指示的IP地址称为第一IP地址。在前述步骤505中,客户端5001可以判断第一IP地址与第二IP地址是否相同,例如将第一结果中用于指示第一IP地址的字段与第二结果中用于指示第二IP地址的字段进行对比,当两个字段的内容不同时,即可确定第一IP地址与第二IP地址不同,客户端5001进而可以确定条件域名解析器5002被缓存注入了。当两个字段的内容相同时,即可确定第一IP地址与第二IP地址相同,客户端5001进而可以确定条件域名解析器5002未被缓存注入。In some embodiments, a domain name may correspond to only one correct IP address. In the aforementioned step 504, the second result obtained by the client 5001 from the domain name server 5003 may indicate a correct IP address corresponding to the target domain name. For convenience of description, it is called the second IP address. Correspondingly, the IP address indicated in the first result obtained by the client 5001 from the conditional domain name resolver 5002 in the aforementioned step 502 is called the first IP address. In the aforementioned step 505, the client 5001 can determine whether the first IP address and the second IP address are the same, for example, compare the field used to indicate the first IP address in the first result with the field used to indicate the second IP address in the second result. Comparing the fields, when the contents of the two fields are different, it can be determined that the first IP address and the second IP address are different, and the client 5001 can further determine that the conditional domain name parser 5002 has been cache-injected. When the contents of the two fields are the same, it can be determined that the first IP address and the second IP address are the same, and the client 5001 can further determine that the conditional domain name resolver 5002 has not been cached and injected.

在一些实施例中,一个域名可以与多个正确的IP地址对应,例如,与一个域名对应的某项网络服务可以由多台处于不同地理位置的服务器提供,每台服务器均能提供相同的服务,能这多台服务器分别对应于不同的IP地址,因此,这多个IP地址均是正确的IP地址。客户端在向域名解析器查询域名时,会获取到与域名对应的所有IP地址。在前述步骤504中,客户端5001从域名服务器5003获取的第二结果中可以包括第二IP地址集合,该集合包括与目标域名对应的所有正确的IP地址。在前述步骤504中,客户端5001从条件域名解析器5002获取的第一结果中也可以包括第一IP地址集合,该第一IP地址集合中也可以包括多个IP地址。在前述步骤505中,客户端5001可以判断第一IP地址集合与第二IP地址集合是否相同。若第一IP地址集合中的IP地址数量与第二IP地址集合中的IP地址数量不同,或者第一IP地址集合中的多个IP地址与第二IP地址集合中的多个IP地址之间至少有一个IP地址不同,则可以确定条件域名解析器5002被缓存注入了。若第一IP地址集合中的IP地址与第二IP地址集合中的IP地址完全相同,则可以确定条件域名解析器5002未被缓存注入。In some embodiments, a domain name can correspond to multiple correct IP addresses. For example, a certain network service corresponding to a domain name can be provided by multiple servers located in different geographical locations, and each server can provide the same service. , these multiple servers correspond to different IP addresses respectively, therefore, these multiple IP addresses are all correct IP addresses. When the client queries the domain name resolver for a domain name, it will obtain all IP addresses corresponding to the domain name. In the aforementioned step 504, the second result obtained by the client 5001 from the domain name server 5003 may include a second set of IP addresses, which set includes all correct IP addresses corresponding to the target domain name. In the aforementioned step 504, the first result obtained by the client 5001 from the conditional domain name resolver 5002 may also include a first IP address set, and the first IP address set may also include multiple IP addresses. In the aforementioned step 505, the client 5001 can determine whether the first IP address set and the second IP address set are the same. If the number of IP addresses in the first IP address set is different from the number of IP addresses in the second IP address set, or between multiple IP addresses in the first IP address set and multiple IP addresses in the second IP address set, If at least one IP address is different, it can be determined that the conditional domain name resolver 5002 is cache-injected. If the IP addresses in the first IP address set are exactly the same as the IP addresses in the second IP address set, it can be determined that the conditional domain name resolver 5002 has not been cache injected.

通过上述方法500,可以由客户端识别域名解析器是否被缓存注入。图6是本申请实施例提供的另一种域名缓存注入检测方法,在图6所示的方法600中,由域名解析器执行对域名缓存注入的检测。在图6中,方法600可以包括框601至框606,接下来将对方法600进行详细说明。Through the above method 500, the client can identify whether the domain name resolver is cache-injected. Figure 6 is another domain name cache injection detection method provided by an embodiment of the present application. In the method 600 shown in Figure 6, the domain name parser performs detection of domain name cache injection. In FIG. 6 , the method 600 may include blocks 601 to 606 , and the method 600 will be described in detail next.

在框601中,域名解析器接收到来自客户端的域名查询请求,该域名查询请求用于查询第一域名。在一些实施例中,域名查询请求中包括用于指示第一域名的信息,域名解析器可以将指示第一域名的信息暂时存储在本地缓存中。In block 601, the domain name resolver receives a domain name query request from the client, and the domain name query request is used to query the first domain name. In some embodiments, the domain name query request includes information indicating the first domain name, and the domain name resolver may temporarily store the information indicating the first domain name in a local cache.

在框602中,域名解析器向域名服务器查询第一域名。在一些实施例中,域名解析器为具有转发查询功能的域名解析器,该域名解析器将来自客户端的域名查询请求转发给其他域名服务器,例如递归域名解析器或权威域名服务器,从而借助域名服务器完成对第一域名的转发查询。在一些实施例中,域名解析器为具有递归查询功能的域名解析器,该域名解析器逐级查询根域名服务器、顶级域名服务器、二级域名服务器等域名服务器,直到从权威域名服务器获得查询结果。In block 602, the domain name resolver queries the domain name server for the first domain name. In some embodiments, the domain name resolver is a domain name resolver with a forwarding query function. The domain name resolver forwards the domain name query request from the client to other domain name servers, such as a recursive domain name resolver or an authoritative domain name server, thereby using the domain name server Complete the forwarding query for the first domain name. In some embodiments, the domain name resolver is a domain name resolver with a recursive query function. The domain name resolver queries root domain name servers, top-level domain name servers, second-level domain name servers and other domain name servers hierarchically until the query results are obtained from the authoritative domain name server. .

在框603中,域名解析器接收域名查询响应,该响应包括指示第二域名的记录。指示第二域名的记录例如可以包括但不限于以下一种或多种:第二域名的A记录、第二域名的AAAA记录和第二域名的NS记录等。In block 603, the domain name resolver receives a domain name query response, the response including a record indicating the second domain name. The record indicating the second domain name may include, for example, but is not limited to one or more of the following: A record of the second domain name, AAAA record of the second domain name, NS record of the second domain name, etc.

在一些实施例中,域名查询响应来自于权威域名服务器;在一些实施例中,域名查询响应是任意设备伪装成权威域名服务器发送的。本申请对此不作限制。In some embodiments, the domain name query response comes from an authoritative domain name server; in some embodiments, the domain name query response is sent by any device pretending to be an authoritative domain name server. This application does not limit this.

在框604中,域名解析器判断域名查询响应所指示的第二域名与来自客户端的域名查询请求中指示的第一域名是否关联。示例性地,域名解析器在前述框601中暂时将第一域名存储在本地缓存中,域名解析器可以将在框603中接收到的域名查询响应所指示的第二域名与第一域名进行对比,基于预定义的规则判断第一域名与第二域名是否对应。在一些实施例中,第一域名与第二域名对应,域名解析器执行框605。在一些实施例中,第一域名与第二域名不对应,域名解析器执行框606。In block 604, the domain name resolver determines whether the second domain name indicated in the domain name query response is associated with the first domain name indicated in the domain name query request from the client. For example, the domain name resolver temporarily stores the first domain name in the local cache in the aforementioned block 601, and the domain name resolver can compare the second domain name indicated by the domain name query response received in block 603 with the first domain name. , based on predefined rules, determine whether the first domain name corresponds to the second domain name. In some embodiments, the first domain name corresponds to the second domain name, and the domain name resolver performs block 605. In some embodiments, the first domain name does not correspond to the second domain name, and the domain name resolver performs block 606.

在框605中,域名解析器确定自身未被缓存注入。可选地,域名解析器确定自身未被缓存注入后,可以将在框603中接收到的域名查询响应中的信息存入本地缓存中。在一些实施例中,对于一个域名查询,域名解析器确定自身未被缓存注入后,可以继续接收对下一个域名的查询请求,并对该域名进行查询,同时可以再次执行方法600中包括的各框中的动作。In block 605, the domain name resolver determines that it is not cache-injected. Optionally, after the domain name resolver determines that it has not been cache-injected, it may store the information in the domain name query response received in block 603 into the local cache. In some embodiments, for a domain name query, after the domain name resolver determines that it has not been cached and injected, it can continue to receive a query request for the next domain name and query the domain name, and at the same time, it can execute each step included in method 600 again. action in the box.

在步骤606中,域名解析器确定自身被缓存注入。可选地,域名解析器确定自身被缓存注入后,可以拦截接收到的域名查询响应,不将该响应中所包含的指示第二域名的记录存入本地缓存中。In step 606, the domain name resolver determines that it is cache injected. Optionally, after the domain name resolver determines that it has been injected into the cache, it can intercept the received domain name query response and not store the record indicating the second domain name contained in the response into the local cache.

基于上述技术方案,域名解析器可以在查询域名的过程中实现对用于注入虚假域名的缓存注入行为的识别,进而能够在此基础上对域名缓存注入行为进行防范,例如拦截用于域名缓存注入的域名查询响应。如此,可以避免后续在用户查询域名时提供错误的查询结果,能够提高用户访问互联网的可靠性。Based on the above technical solution, the domain name parser can recognize the cache injection behavior used to inject false domain names during the process of querying the domain name, and then can prevent the domain name cache injection behavior on this basis, such as intercepting the cache injection behavior of the domain name. Domain name query response. In this way, it can avoid providing incorrect query results when users query domain names later, and can improve the reliability of users' access to the Internet.

在一些实施例中,方法600中的域名解析器为同时具有转发查询功能和递归查询功能的条件域名解析器,即,可以通过方法600实现对条件域名解析器的域名缓存注入的识别。条件域名解析器在对域名进行转发查询的过程中如果被缓存注入,将影响其后续对域名的递归查询,因此,通过方法600,条件域名解析器能够识别并避免在转发查询过程中被缓存注入,从而能够极大提高条件域名解析器的安全性。In some embodiments, the domain name resolver in method 600 is a conditional domain name resolver that has both a forward query function and a recursive query function. That is, the recognition of domain name cache injection of the conditional domain name resolver can be implemented through method 600. If the conditional domain name resolver is cache-injected during the forwarding process of querying the domain name, it will affect its subsequent recursive query of the domain name. Therefore, through method 600, the conditional domain name resolver can identify and avoid being cache-injected during the forwarding query process. , which can greatly improve the security of the conditional domain name resolver.

在一些实施例中,方法600中的域名解析器的域名安全拓展功能为关闭状态,也就是说,在域名安全拓展功能关闭后,域名解析器也可以通过方法600实现对域名缓存注入行为的检测,域名解析器的可靠性和安全性得以提高。In some embodiments, the domain name security extension function of the domain name resolver in method 600 is turned off. That is to say, after the domain name security extension function is turned off, the domain name resolver can also detect the domain name cache injection behavior through method 600. , the reliability and security of the domain name resolver are improved.

在一些实施例中,在前述步骤604中,第一域名与第二域名对应,包括第一域名与第二域名相同,或第二域名是第一域名的子域名。相应地,第一域名与第二域名不对应,包括第一域名与第二域名不同,且第一域名不是第二域名的子域名。子域名通常由父域名生成并管理,若接收到的域名查询响应中的域名是来自客户端的域名查询请求中所指示的域名的子域名,域名解析器可以不认为这是一种域名缓存注入,如此,可以避免对域名缓存注入行为的错误识别。In some embodiments, in the aforementioned step 604, the first domain name corresponds to the second domain name, including the first domain name and the second domain name being the same, or the second domain name is a sub-domain name of the first domain name. Correspondingly, the first domain name does not correspond to the second domain name, including the first domain name and the second domain name being different, and the first domain name is not a subdomain name of the second domain name. Subdomain names are usually generated and managed by the parent domain name. If the domain name in the received domain name query response is a subdomain name of the domain name indicated in the domain name query request from the client, the domain name resolver does not need to consider this to be a domain name cache injection. In this way, misidentification of domain name cache injection behavior can be avoided.

应理解,图5的方法和图6的方法可以结合实施,即,对于一个网络系统,其中的域名解析器可以检测自身是否被缓存注入,客户端也可以对域名解析器是否被缓存注入进行检测。从而能够提高对域名解析器的域名缓存注入行为的检测的准确度。It should be understood that the method in Figure 5 and the method in Figure 6 can be implemented in combination, that is, for a network system, the domain name parser can detect whether it has been injected by the cache, and the client can also detect whether the domain name parser has been injected by the cache. . This can improve the accuracy of detecting the domain name cache injection behavior of the domain name parser.

图5或图6所示的域名缓存注入的检测方法,可以检测出的域名缓存注入行为包括前述图2中所示的域名缓存注入行为和图3中所示的域名缓存注入行为。The domain name cache injection detection method shown in Figure 5 or Figure 6 can detect the domain name cache injection behavior including the domain name cache injection behavior shown in Figure 2 and the domain name cache injection behavior shown in Figure 3.

上述内容结合图5和图6分别介绍了客户端执行的域名缓存注入检测方法和域名解析器执行的域名缓存注入检测方法。接下来结合图7至图9,介绍本申请实施例提供的装置。The above content is combined with Figure 5 and Figure 6 to introduce the domain name cache injection detection method executed by the client and the domain name cache injection detection method executed by the domain name parser respectively. Next, the device provided by the embodiment of the present application will be introduced with reference to FIGS. 7 to 9 .

图7是本申请实施例提供的域名缓存注入检测装置700的示意图。如图7所示,装置700可以包括第一发送模块701、第一接收模块702、第二发送模块703、第二接收模块704、以及确定模块705。Figure 7 is a schematic diagram of a domain name cache injection detection device 700 provided by an embodiment of the present application. As shown in Figure 7, the device 700 may include a first sending module 701, a first receiving module 702, a second sending module 703, a second receiving module 704, and a determining module 705.

其中,第一发送模块701用于向目标域名解析器发送对目标域名的第一查询请求,其中,目标域名解析器为同时具有转发查询功能和递归查询功能的条件域名解析器;第一接收模块702用于从目标域名解析器获取与第一查询请求对应的第一查询结果;第二发送模块703用于向域名服务器发送对目标域名的第二查询请求,其中,域名服务器为权威域名服务器或不具备转发查询功能的递归域名解析器;第二接收模块704用于从域名服务器获取与第二查询请求对应的第二查询结果;确定模块705用于在第二查询结果与第一查询结果所指示的目标域名的IP地址不同的情况下,确定目标域名解析器被缓存注入。Among them, the first sending module 701 is used to send a first query request for the target domain name to the target domain name resolver, where the target domain name resolver is a conditional domain name resolver with both forwarding query function and recursive query function; the first receiving module 702 is used to obtain the first query result corresponding to the first query request from the target domain name resolver; the second sending module 703 is used to send the second query request for the target domain name to the domain name server, wherein the domain name server is an authoritative domain name server or A recursive domain name parser that does not have the function of forwarding queries; the second receiving module 704 is used to obtain the second query result corresponding to the second query request from the domain name server; the determining module 705 is used to select between the second query result and the first query result. In the case where the IP address of the indicated target domain name is different, it is determined that the target domain name resolver is cache injected.

在一些实施例中,目标域名解析器的域名安全拓展功能为关闭状态。In some embodiments, the domain name security extension function of the target domain name resolver is turned off.

在一些实施例中,确定模块705还包括第一子模块,用于在第一发送模块701向目标域名解析器发送对目标域名的第一查询请求之前,根据向目标域名解析器发起的对多个域名的至少两次查询,确定目标域名解析器为条件域名解析器。In some embodiments, the determining module 705 also includes a first sub-module, configured to determine the query request for the target domain name according to the query request initiated to the target domain name resolver before the first sending module 701 sends the first query request to the target domain name resolver. Query at least two domain names to determine that the target domain name resolver is a conditional domain name resolver.

在一些实施例中,上述第一查询结果指示第一IP地址,上述第二查询结果指示第二IP地址。确定模块705还包括第二子模块,用于在第二接收模块704从域名服务器获取与第二查询请求对应的第二查询结果之后,判断第一IP地址与第二IP地址是否相同。确定模块705具体用于,在第一IP地址与第二IP地址不同的情况下,确定目标域名解析器被缓存注入。In some embodiments, the first query result indicates a first IP address, and the second query result indicates a second IP address. The determining module 705 also includes a second sub-module for determining whether the first IP address and the second IP address are the same after the second receiving module 704 obtains the second query result corresponding to the second query request from the domain name server. The determining module 705 is specifically configured to determine that the target domain name resolver is cache injected when the first IP address and the second IP address are different.

在一些实施例中,前述第一查询结果中包括第一IP地址集合,该第一IP地址集合包括与目标域名对应的多个IP地址,前述第二查询结果中包括第二IP地址集合,该第二IP地址集合包括与目标域名对应的多个IP地址。确定模块705还包括第三子模块,用于在第二接收模块704从域名服务器获取与第二查询请求对应的第二查询结果之后,判断第一IP地址集合与第二IP地址集合是否相同。确定模块705具体用于,在第一IP地址集合中的多个IP地址与第二IP地址集合中的多个IP地址之间至少有一个IP地址不同的情况下,确定目标域名解析器被缓存注入。In some embodiments, the first query result includes a first IP address set, the first IP address set includes multiple IP addresses corresponding to the target domain name, and the second query result includes a second IP address set, The second set of IP addresses includes a plurality of IP addresses corresponding to the target domain name. The determining module 705 also includes a third sub-module for determining whether the first IP address set and the second IP address set are the same after the second receiving module 704 obtains the second query result corresponding to the second query request from the domain name server. The determining module 705 is specifically configured to determine that the target domain name resolver is cached when at least one IP address is different between the multiple IP addresses in the first IP address set and the multiple IP addresses in the second IP address set. injection.

图8是本申请实施例提供的另一个域名缓存注入检测装置800的示意图,如图8所示,装置800可以包括第一接收模块801、查询模块802、第二接收模块803、以及确定模块804。装置800可以是域名解析器,或被配置在域名解析器内。Figure 8 is a schematic diagram of another domain name cache injection detection device 800 provided by an embodiment of the present application. As shown in Figure 8, the device 800 may include a first receiving module 801, a query module 802, a second receiving module 803, and a determination module 804 . Device 800 may be a domain name resolver, or may be configured within a domain name resolver.

其中,第一接收模块801用于接收域名查询请求,该域名查询请求用于查询第一域名;查询模块802用于向域名服务器查询第一域名;第二接收模块803用于接收域名查询响应,该域名查询响应包括指示第二域名的记录;确定模块804用于在第二域名与第一域名不关联的情况下,确定域名解析器被缓存注入。Among them, the first receiving module 801 is used to receive a domain name query request, and the domain name query request is used to query the first domain name; the query module 802 is used to query the domain name server for the first domain name; the second receiving module 803 is used to receive a domain name query response, The domain name query response includes a record indicating the second domain name; the determining module 804 is configured to determine that the domain name resolver is cache injected when the second domain name is not associated with the first domain name.

在一些实施例中,上述域名解析器为条件域名解析器,条件域名解析器是同时具有转发查询功能和递归查询功能的域名解析器。In some embodiments, the above-mentioned domain name parser is a conditional domain name parser, and the conditional domain name parser is a domain name parser that has both a forward query function and a recursive query function.

在一些实施例中,上述域名解析器的域名安全拓展功能为关闭状态。In some embodiments, the domain name security extension function of the domain name resolver is turned off.

在一些实施例中,确定模块804具体用于,在第二域名第一域名不同,且第二域名不是第一域名的子域名的情况下,确定域名解析器被缓存注入。In some embodiments, the determining module 804 is specifically configured to determine that the domain name resolver is cache injected when the second domain name is different from the first domain name and the second domain name is not a subdomain name of the first domain name.

在一些实施例中,装置800还包括拦截模块,用于拦截上述域名查询响应。In some embodiments, the device 800 further includes an interception module for intercepting the above domain name query response.

应理解,本申请实施例中对于模块的划分仅是示意性的,在一些实施例中,装置700或装置800还可以包括更多或更少的模块,这些模块可以组合成为更大的模块,也可以单独配置,各模块可以通过硬件和/或软件的方式实现。It should be understood that the division of modules in the embodiments of this application is only illustrative. In some embodiments, the device 700 or the device 800 may also include more or fewer modules, and these modules may be combined into larger modules. It can also be configured individually, and each module can be implemented by hardware and/or software.

图9示出了可以用来实施本申请的实施例的示例设备900的示意性框图。上文方法实施例中的客户端或域名解析器可以利用设备900来实现。如图所示,设备900包括中央处理单元(CPU)901,其可以根据存储在只读存储器(ROM)902中的计算机程序指令或者从存储单元908加载到随机访问存储器(RAM)903中的计算机程序指令,来执行各种适当的动作和处理。在RAM 903中,还可存储设备900操作所需的各种程序和数据。CPU 901、ROM 902以及RAM 903通过总线904彼此相连。输入/输出(I/O)接口905也连接至总线904。Figure 9 shows a schematic block diagram of an example device 900 that may be used to implement embodiments of the present application. The client or domain name resolver in the above method embodiment can be implemented using the device 900. As shown, the device 900 includes a central processing unit (CPU) 901 that can operate according to computer program instructions stored in a read-only memory (ROM) 902 or loaded from a storage unit 908 into a random access memory (RAM) 903 of a computer. Program instructions to perform various appropriate actions and processes. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The CPU 901, ROM 902, and RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.

设备900中的多个部件连接至I/O接口905,包括:输入单元906,例如键盘、鼠标等;输出单元907,例如各种类型的显示器、扬声器等;存储页面908,例如磁盘、光盘等;以及通信单元909,例如网卡、调制解调器、无线通信收发机等。通信单元909允许设备900通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the device 900 are connected to the I/O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; and a storage page 908, such as a disk, optical disk, etc. ; and communication unit 909, such as a network card, modem, wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information/data with other devices through computer networks such as the Internet and/or various telecommunications networks.

上文所描述的各个过程和处理,例如过程200、300和400以及方法500和600,可由处理单元901执行。例如,在一些实施例中,过程200、300和400以及方法500和600可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元908。在一些实施例中,计算机程序的部分或者全部可以经由ROM 902和/或通信单元909而被载入和/或安装到设备900上。当计算机程序被加载到RAM 903并由CPU 901执行时,可以执行上文描述的过程200、300和400以及方法500和600的一个或多个动作。The various processes and processes described above, such as processes 200, 300, and 400 and methods 500 and 600, may be performed by the processing unit 901. For example, in some embodiments, processes 200, 300, and 400 and methods 500 and 600 may be implemented as computer software programs tangibly embodied in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 900 via ROM 902 and/or communication unit 909 . When the computer program is loaded into RAM 903 and executed by CPU 901, one or more actions of processes 200, 300, and 400 and methods 500 and 600 described above may be performed.

本申请可以是方法、装置、系统和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于执行本申请的各个方面的计算机可读程序指令。The application may be a method, apparatus, system and/or computer program product. A computer program product may include a computer-readable storage medium having thereon computer-readable program instructions for performing various aspects of the present application.

计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是——但不限于——电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。Computer-readable storage media may be tangible devices that can retain and store instructions for use by an instruction execution device. The computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or Flash memory), Static Random Access Memory (SRAM), Compact Disk Read Only Memory (CD-ROM), Digital Versatile Disk (DVD), Memory Stick, Floppy Disk, Mechanical Coding Device, such as a printer with instructions stored on it. Protruding structures in hole cards or grooves, and any suitable combination of the above. As used herein, computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.

这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。Computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to various computing/processing devices, or to an external computer or external storage device over a network, such as the Internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage on a computer-readable storage medium in the respective computing/processing device .

用于执行本申请操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本申请的各个方面。Computer program instructions for performing the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or instructions in one or more programming languages. Source code or object code written in any combination of object-oriented programming languages - such as Smalltalk, C++, etc., and conventional procedural programming languages - such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server implement. In situations involving remote computers, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider through the Internet). connect). In some embodiments, by utilizing state information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can Computer readable program instructions are executed to implement various aspects of the application.

这里参照根据本申请实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本申请的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。Various aspects of the present application are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.

这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理单元,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理单元执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。These computer-readable program instructions may be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus, thereby producing a machine such that the instructions, when executed by a processing unit of the computer or other programmable data processing apparatus, , resulting in an apparatus that implements the functions/actions specified in one or more blocks in the flowchart and/or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium. These instructions cause the computer, programmable data processing device and/or other equipment to work in a specific manner. Therefore, the computer-readable medium storing the instructions includes An article of manufacture that includes instructions that implement aspects of the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.

也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other equipment, causing a series of operating steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executed on a computer, other programmable data processing apparatus, or other equipment to implement the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams.

附图中的流程图和框图显示了根据本申请的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions that embody one or more elements for implementing the specified logical function(s). Executable instructions. In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two consecutive blocks may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts. , or can be implemented using a combination of specialized hardware and computer instructions.

以上已经描述了本申请的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的技术改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。The embodiments of the present application have been described above. The above description is illustrative, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (15)

1. The method for detecting domain name cache injection is characterized by comprising the following steps:
sending a first query request for a target domain name to a target domain name resolver, wherein the target domain name resolver is a conditional domain name resolver with both forwarding query function and recursive query function;
acquiring a first query result corresponding to the first query request from the target domain name resolver;
sending a second query request for the target domain name to a domain name server, wherein the domain name server is an authoritative domain name server or a recursion domain name resolver without forwarding query function;
Obtaining a second query result corresponding to the second query request from the domain name server;
and if the second query result is different from the Internet Protocol (IP) address of the target domain name indicated by the first query result, determining that the target domain name resolver is cached and injected.
2. The method of claim 1, wherein the domain name security extension function of the conditional domain name resolver is off.
3. The method of claim 1, wherein prior to the sending the first query request for the target domain name to the target domain name resolver, the method further comprises:
and determining the target domain name resolver as the conditional domain name resolver according to at least two queries of a plurality of domain names initiated to the target domain name resolver.
4. A method according to any one of claims 1 to 3, wherein the first query result indicates a first IP address and the second query result indicates a second IP address; the method further includes, after the obtaining, from the domain name server, a second query result corresponding to the second query request:
judging whether the first IP address is the same as the second IP address, and
Wherein the second query result is different from the IP address of the target domain name indicated by the first query result, including:
the first IP address is different from the second IP address.
5. A method according to any one of claims 1 to 3, wherein the first query result comprises a first set of IP addresses, the first set of IP addresses comprising a plurality of IP addresses corresponding to the target domain name, and the second query result comprises a second set of IP addresses, the second set of IP addresses comprising a plurality of IP addresses corresponding to the target domain name; the method further includes, after the obtaining, from the domain name server, a second query result corresponding to the second query request:
judging whether the first IP address set is the same as the second IP address set, and
wherein the second query result is different from the IP address of the target domain name indicated by the first query result, including:
at least one IP address differs between the plurality of IP addresses in the first set of IP addresses and the plurality of IP addresses in the second set of IP addresses.
6. A method for detecting domain name cache injection, wherein the method is applied to a domain name resolver, the method comprising:
Receiving a domain name query request, wherein the domain name query request is used for querying a first domain name;
querying a domain name server for the first domain name;
receiving a domain name query response, the domain name query response comprising a record indicating a second domain name;
if the second domain name is not associated with the first domain name, determining that the domain name resolver is cache injected.
7. The method of claim 6, wherein the domain name resolver is a conditional domain name resolver, the conditional domain name resolver being a domain name resolver having both a forwarding query function and a recursive query function.
8. The method of claim 7, wherein the domain name security extension function of the conditional domain name resolver is off.
9. The method according to any one of claims 6 to 8, wherein the second domain name does not correspond to the first domain name, comprising:
the second domain name is different from the first domain name, and the second domain name is not a sub-domain name of the first domain name.
10. The method according to any one of claims 6 to 8, further comprising:
intercepting the domain name query response.
11. The utility model provides a detection device that domain name buffer injected which characterized in that includes:
the first sending module is used for sending a first query request for a target domain name to a target domain name resolver, wherein the target domain name resolver is a conditional domain name resolver with a forwarding query function and a recursion query function;
the first receiving module is used for acquiring a first query result corresponding to the first query request from the target domain name resolver;
the second sending module is used for sending a second query request for the target domain name to a domain name server, wherein the domain name server is an authoritative domain name server or a recursion domain name resolver without forwarding query function;
the second receiving module is used for acquiring a second query result corresponding to the second query request from the domain name server;
and the determining module is used for determining that the target domain name resolver is cached and injected under the condition that the second query result is different from the IP address of the target domain name indicated by the first query result.
12. The utility model provides a detection device that domain name buffer injected which characterized in that includes:
the first receiving module is used for receiving a domain name query request, wherein the domain name query request is used for querying a first domain name;
The inquiring module is used for inquiring the first domain name from the domain name server;
a second receiving module configured to receive a domain name query response, where the domain name query response includes a record indicating a second domain name;
and the determining module is used for determining that the domain name resolver is cached and injected under the condition that the second domain name is not associated with the first domain name.
13. An electronic device, comprising:
at least one processor; and
a memory coupled to the at least one processor and having instructions stored thereon that, when executed by the at least one processor, cause the apparatus to perform the method of any of claims 1-5 or perform the method of any of claims 6-10.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program product comprising machine executable instructions which, when executed, cause the method according to any of claims 1 to 5 to be implemented or the method according to any of claims 6 to 10 to be implemented.
15. A computer program product tangibly stored on a non-volatile computer readable medium and comprising machine executable instructions that when executed cause the method according to any one of claims 1 to 5 to be implemented or cause the method according to any one of claims 6 to 10 to be implemented.
CN202310760698.6A 2023-06-26 2023-06-26 Detection methods, devices and electronic equipment for domain name cache injection Pending CN116743698A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310760698.6A CN116743698A (en) 2023-06-26 2023-06-26 Detection methods, devices and electronic equipment for domain name cache injection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310760698.6A CN116743698A (en) 2023-06-26 2023-06-26 Detection methods, devices and electronic equipment for domain name cache injection

Publications (1)

Publication Number Publication Date
CN116743698A true CN116743698A (en) 2023-09-12

Family

ID=87904329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310760698.6A Pending CN116743698A (en) 2023-06-26 2023-06-26 Detection methods, devices and electronic equipment for domain name cache injection

Country Status (1)

Country Link
CN (1) CN116743698A (en)

Similar Documents

Publication Publication Date Title
US9300623B1 (en) Domain name system cache integrity check
US8533581B2 (en) Optimizing security seals on web pages
US20190334946A1 (en) Defense against nxdomain hijacking in domain name systems
US10735461B2 (en) Method for minimizing the risk and exposure duration of improper or hijacked DNS records
CN108353083B (en) System and method for detecting Domain Generation Algorithm (DGA) malware
US8955123B2 (en) Method and system for preventing malicious communication
CN111953638B (en) Network attack behavior detection method and device and readable storage medium
US12081512B2 (en) Collecting passive DNS traffic to generate a virtual authoritative DNS server
US10440059B1 (en) Embedding contexts for on-line threats into response policy zones
EP4472169A1 (en) Domain name resolution method, apparatus, device, and medium based on content delivery network
US8407802B2 (en) Method and system for providing security seals on web pages
US20190014083A1 (en) Url filtering method and device
CN113037886B (en) Network device management method, device, medium, and electronic device
CN107736003B (en) Method and apparatus for securing domain names
US12041095B2 (en) System and method for DNS misuse detection
CN116743698A (en) Detection methods, devices and electronic equipment for domain name cache injection
US20140283080A1 (en) Identifying stored vulnerabilities in a web service
CN108848076B (en) Method and equipment for detecting DNS hijacking through user equipment
CN113329035B (en) Method and device for detecting attack domain name, electronic equipment and storage medium
CN113824748A (en) Asset characteristic active detection countermeasure method, device, electronic equipment and medium
US11595386B2 (en) Method, electronic device and computer program product for storage management
US20240333755A1 (en) Reactive domain generation algorithm (dga) detection
CN118055095B (en) Authoritative domain name server determination method and device, electronic equipment and storage medium
Li et al. RDDNS: A domain name system for robust dynamic address resolution
CN116708361A (en) Domain name resolver identification method, device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination