SSRF security management method and device

By analyzing URL requests and combining multiple security check mechanisms, DNS customization methods are used to analyze and handle SSRF vulnerabilities, the problem of poor defense effects of SSRF vulnerabilities in the existing technology is solved, and more efficient security management and vulnerability processing is achieved.

CN119051885APending Publication Date: 2024-11-29HANGZHOU TUYA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410924299.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

The prior art is difficult to achieve complete defense without reducing business availability when defending against SSRF vulnerabilities, and conventional code defense solutions are easily bypassed, resulting in poor security management effects.

Method used

By analyzing the URL request, determining the request target, and conducting preliminary security checks on it based on the preliminary security check method, analyzing it using the preset DNS customization method, establishing a TCP connection, and vulnerability processing is performed based on the information sent by the target object through the TCP connection, combined with Customize a variety of security check mechanisms such as built-in security policies, default built-in security policies, exception domain name list, exception IP list, whitelist and blacklist to ensure the security of URL requests.

Benefits of technology

It improves the defense efficiency of SSRF vulnerabilities and the targetedness of security checks, prevents vulnerabilities from being bypassed, reduces the identification and blocking of potential security threats, and improves the overall security of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119051885A_ABST
    Figure CN119051885A_ABST
Patent Text Reader

Abstract

The invention provides an SSRF security management method and device, and relates to the technical field of network security. The SSRF security management method comprises the following steps: analyzing a URL request to determine a request target; determining a preliminary security check mode based on the request target, and performing preliminary security check on the URL request based on the preliminary security check mode to generate a preliminary security check result; analyzing the request target according to the preliminary security check result and a preset DNS customization method; establishing TCP connection with a target object requested by the URL according to an analysis result; and performing vulnerability processing according to information sent by the target object through the TCP connection. According to the method, the initial security check mode is determined by analyzing the URL request, so that risks caused by wrong configuration of software research and development personnel are prevented; and subsequent DNS security analysis is carried out by using a DNS customization method, so that the SSRF vulnerability is prevented from bypassing a preliminary security check mode, and the validity of security check is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, for example, to a SSRF security management method and device. Background Art

[0002] SSRF (Server-Side Request Forgery) is a high-risk vulnerability that can be exploited by malicious attackers to break through the target network boundary and attack the intranet. There are many ways to bypass the corresponding attacks, and the vulnerabilities are often bypassed repeatedly after being fixed, which greatly wastes the time cost of security personnel and R&D personnel.

[0003] In the related technologies, SSRF defense and repair are usually performed at the code level, but it is difficult to achieve thorough SSRF defense and repair at the code level without reducing business availability. Some conventional code defense and repair solutions are to perform blacklist parameter verification after the URL (Uniform Resource Locator, web address) parameter is passed in, but there is still a risk of bypassing through domain name resolution rebinding. Therefore, the current security management effect of defense and repair for SSRF vulnerabilities is poor. Summary of the invention

[0004] The present application aims to provide a SSRF security management method and device.

[0005] According to one aspect of the present application, a SSRF vulnerability security management method is proposed, including: parsing a URL request to determine a request target; determining a preliminary security check method based on the request target, and performing a preliminary security check on the URL request based on the preliminary security check method to generate a preliminary security check result; analyzing the request target according to the preliminary security check result and a preset DNS customization method; establishing a TCP connection with the target object of the URL request according to the analysis result; and performing vulnerability processing according to information sent by the target object through the TCP connection.

[0006] According to some embodiments, based on the request target, a preliminary security check method is determined, including: detecting whether a preset built-in security policy is set; if a customized built-in security policy is set, determining the customized built-in security policy and the default built-in security policy corresponding to the request target as the preliminary security check method; if no customized built-in security policy is set, determining the default built-in security policy as the preliminary security check method.

[0007] According to some embodiments, the request target includes Host; wherein, when the preliminary security check method is a customized built-in security policy and a default built-in security policy, a preliminary security check is performed on the URL request based on the preliminary security check method to generate a preliminary security check result, including: when the check of the preset exception domain name list is enabled, if it is determined that the Host is in the exception domain name list, then it is determined that the URL request has passed the preliminary security check; when the check of the exception domain name list is not enabled, or when the check of the preset exception domain name list is enabled, if it is determined that the Host is not in the exception domain name list, then it is determined whether to enable the check of the preset exception IP list; when the check of the exception IP list is enabled, if it is determined that the Host resolution value corresponding to the Host matches the exception IP list, then it is determined that the URL request has passed the preliminary security check result; when the check of the exception is not enabled, In the case of checking the IP list, or in the case of turning on the checking of the exception IP list, if it is determined that the Host does not match the exception IP list, then it is determined whether the default built-in security policy has passed the check; in the case of passing the check of the default built-in security policy, it is determined whether the preset whitelist check is turned on; in the case of failing the check of the default built-in security policy, or in the case of turning on the whitelist check, if it is determined that the URL request does not match the corresponding whitelist, then it is determined that the URL request has not passed the preliminary security check; in the case of not turning on the whitelist check, or in the case of matching the URL request with the whitelist, it is determined whether the preset blacklist check is turned on; in the case of turning on the blacklist check, if it is determined that the URL request matches the corresponding blacklist, then it is determined that the URL request has not passed the preliminary security check; in the case of judging that the URL request does not match the blacklist, then it is determined that the URL request has passed the preliminary security check.

[0008] According to some embodiments, the request target includes a protocol type; wherein, determining whether the default built-in security policy has passed the check includes: determining that the protocol type is a target protocol type, and detecting whether the Host contains closed characters; when it is determined that the protocol type is not the target protocol type, or the Host contains closed characters, determining that the URL request has not passed the check of the default built-in security policy; when it is determined that the Host does not contain closed characters, resolving the Host according to the native DNS method to determine the corresponding Host resolution value; when it is detected that the Host resolution value has a preset reserved IP address, determining that the URL request has not passed the check of the default built-in security policy; when it is detected that the Host resolution value does not have a reserved IP address, determining that the URL request has passed the check of the default built-in security policy.

[0009] According to some embodiments, the request target is analyzed based on the preliminary security check results and a preset DNS customization method, including: analyzing the preliminary security check results to determine whether the URL request passes the preliminary security check; if it passes the preliminary security check, passing the Host resolution value to the DNS customization method and analyzing it to determine the DNS resolution result; if it fails the preliminary security check, reporting an error or throwing an exception.

[0010] According to some embodiments, the Host resolution value is passed into the DNS custom method and analyzed to determine the DNS resolution result, including: calling the native DNS method, and analyzing the request target based on the native DNS method and the DNS custom method to determine the complete IP resolution result; when the check of the exception domain name list is enabled and the Host is in the exception domain name list, determining that the DNS resolution result is safe; when the check of the exception domain name list is not enabled, or the Host is not in the exception domain name list, creating a DNS resolution result list instance and traversing the complete IP resolution result to determine whether the DNS resolution result list is empty based on the traversal result; if it is empty, reporting an error or throwing an exception; if it is not empty, generating a DNS resolution result, and determining that the DNS resolution result is safe.

[0011] According to some embodiments, the complete IP resolution result includes at least one IP resolution result; wherein, creating a DNS resolution result list instance and traversing the complete IP resolution result to determine whether the DNS resolution result list is empty based on the traversal result includes: creating a DNS resolution result list instance; for each IP resolution result in at least one IP resolution result, when the check of the exception IP list is turned on, detecting whether each IP resolution result matches the exception IP list; when each IP resolution result matches the exception IP list, writing each IP resolution result into the DNS resolution result list instance; when the check of the exception IP list is not turned on, or when each IP resolution result does not match the exception IP list, determining whether to turn on the check of the IP whitelist; when the check of the IP whitelist is turned on, detecting whether each IP resolution result matches the IP whitelist; if each IP resolution result does not match the IP whitelist, then End the traversal and determine whether the DNS resolution result list is empty; when the IP whitelist check is not enabled, or each IP resolution result matches the IP whitelist, determine whether the IP blacklist check is enabled; when the IP blacklist check is enabled, detect whether each IP resolution result matches the IP blacklist; if each IP resolution result matches the IP blacklist, end the traversal and determine whether the DNS resolution result list is empty; when the IP blacklist check is not enabled, or each IP resolution result does not match the IP blacklist, determine whether each IP resolution result is a reserved IP or an intranet address; if each IP resolution result is a reserved IP or an intranet address, end the traversal and determine whether the DNS resolution result list is empty; when each IP resolution result is not a reserved IP or an intranet address, write each IP resolution result into the DNS resolution result list instance, and determine whether the DNS resolution result list is empty.

[0012] According to some embodiments, vulnerability processing is performed based on information sent by the target object through a TCP connection, including: receiving information sent by the target object through a TCP connection; analyzing the information to determine whether it is a redirection; and performing vulnerability processing based on the redirection analysis result.

[0013] According to some embodiments, vulnerability processing is performed based on the redirection analysis results, including: in the case of no redirection, determining that information processing is completed; in the case of redirection, obtaining the number of redirections of the URL request, and comparing the number of redirections with a preset number limit; if it is greater than or equal to the preset number limit, determining that the URL request has not passed the security check to report an error; if it is less than the preset number limit, parsing the redirection URL to perform corresponding vulnerability processing based on the redirection URL.

[0014] According to one aspect of the present application, a SSRF security management device is proposed, including: a request analysis module, a preliminary security check result generation module, a security parsing result determination module, a connection module and an information analysis module.

[0015] The request analysis module parses the URL request to determine the request target; the preliminary security check result generation module determines the preliminary security check method based on the request target, and performs a preliminary security check on the URL request based on the preliminary security check method to generate a preliminary security check result; the security analysis result determination module analyzes the request target according to the preliminary security check result and the preset DNS customization method to determine the security analysis result; the connection module establishes a TCP connection with the target object of the URL according to the analysis result; the information analysis module performs vulnerability processing according to the information sent by the target object through the TCP connection.

[0016] According to one aspect of the present application, an electronic device is proposed, which includes: a processor; a memory storing a computer program, and when the computer program is executed by the processor, the processor executes the SSRF security management method as described above.

[0017] According to one aspect of the present application, a non-transitory computer-readable medium is provided, on which readable instructions are stored. When the instructions are executed by a processor, the processor executes the SSRF security management method as described above.

[0018] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application.

[0019] Beneficial effects:

[0020] By analyzing the URL request, determining the request target, and then matching the corresponding preliminary security check method, we can prevent risks caused by incorrect configuration by software developers and identify and prevent potential security threats in the early stages of request processing. We use the preset DNS customization method to perform subsequent DNS security resolution to prevent SSRF vulnerabilities from bypassing the preliminary security check method, further improving the pertinence and effectiveness of security checks. When the analysis result is a safe DNS resolution result, we establish a TCP connection and perform vulnerability processing based on the information returned by the target object, improving the efficiency of defending or repairing SSRF. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without exceeding the scope of protection required by the present application.

[0022] Figure 1 A flowchart of the SSRF security management method provided in the embodiment of the present application;

[0023] Figure 2 A flowchart of step S11 of the embodiment of the present application for determining a preliminary security check method based on a request target;

[0024] Figure 3 A flowchart of step S11 provided in an embodiment of the present application is to perform a preliminary security check on the URL request based on the preliminary security check method to generate a preliminary security check result;

[0025] Figure 4 A flowchart of step S114 of the embodiment of the present application for determining whether the default built-in security policy has passed the check;

[0026] Figure 5 A schematic diagram of the process of step S12 provided in an embodiment of the present application;

[0027] Figure 6 A flowchart of step S122 of the embodiment of the present application for transferring the Host resolution value to the DNS customization method and analyzing it to determine the DNS resolution result;

[0028] Figure 7 A flowchart of step S1221 of the embodiment of the present application for creating a DNS resolution result list instance and traversing the complete IP resolution result to determine whether the DNS resolution result list is empty based on the traversal result;

[0029] Figure 8 A schematic diagram of the process of step S14 provided in an embodiment of the present application;

[0030] Fig. 9 A schematic diagram of the process of step S142 provided in an embodiment of the present application;

[0031] Fig.10 A schematic diagram of an application of a software development kit provided in an embodiment of the present application;

[0032] Fig.11 A block diagram of a SSRF security management device provided in an embodiment of the present application;

[0033] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0034] Explanation of the accompanying drawings: 1100, SSRF security management device; 1101, request analysis module; 1102, preliminary security check result generation module; 1103, security analysis result determination module; 1104, connection module; 1105, information analysis module; 1200, electronic device; 1201, memory; 1202, processor. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0036] Figure 1 Flow chart of the SSRF security management method provided in the embodiment of the present application. The method of this embodiment can be applied to the defense repair server. Figure 1 As shown, the method includes S10, S11, S12, S13 and S14.

[0037] In step S10, the URL request is parsed to determine the request target.

[0038] According to an example embodiment, the defense repair server parses the URL request to determine the request target. The URL request can be a request sent by a client (such as a web browser, API caller, etc.) to a server in network programming and Internet applications to obtain or send resources. The request target may include multiple components of the URL request, such as the protocol, domain name, IP address, port number, path, and query parameters.

[0039] In step S11, a preliminary security check method is determined based on the request target, and a preliminary security check is performed on the URL request based on the preliminary security check method to generate a preliminary security check result.

[0040] According to an example embodiment, the preliminary security check methods and corresponding check operations corresponding to different request targets may be pre-set in the defense repair server. The defense repair server may match the preliminary security check based on the request target determined in step S101, and then obtain the preliminary security check result. The preliminary security check result may include whether the URL request fails the security check or passes the security check.

[0041] In some implementations, based on some elements in the request target, such as the domain name, a corresponding available preliminary security check method can be searched in a preset preliminary security check method. A preliminary security check is performed on the URL request using the preliminary security check method to obtain a preliminary security check result.

[0042] In step S12, the request target is analyzed according to the preliminary security check result and the preset DNS customization method.

[0043] According to an example embodiment, the DNS customization method may be a customized method for domain name resolution. The defense repair server may perform different analyses on the request target based on the preliminary security check result generated in step S102, i.e., failure to pass the security check and passing the security check, in combination with the preset DNS customization method, to obtain the analysis result.

[0044] In step S13, a TCP connection is established with the target object of the URL request according to the analysis result.

[0045] The analysis result may be a DNS resolution result, which may include a secure DNS resolution result and an unsecure DNS resolution result. The target object may be used to represent a website server that establishes a TCP connection, etc. TCP is a connection-oriented transport layer communication protocol. In some implementations, when a website needs to be accessed through a browser, a TCP connection may be established with the target object to transmit web page data. In other implementations, when a file needs to be transferred to the target object, a TCP connection may also be established to ensure that data packets can be correctly sent and received. Visiting a website, transferring files, etc. may all be used as specific request purposes for a URL request.

[0046] According to an example embodiment, if the analysis result is a secure DNS resolution result, a TCP connection may be established with the target object; if the analysis result is an unsecure DNS resolution result, an error may be reported.

[0047] In step S14, vulnerability processing is performed according to the information sent by the target object through the TCP connection.

[0048] When the TCP connection is successful, the target object can return a piece of information to the defense repair server, and the defense repair server can record the number of connections when receiving the return information corresponding to the same URL request, that is, one return information corresponds to one connection. Since some malicious attacks corresponding to SSRF may be aimed at server resource occupation, the corresponding return information will show multiple connections, so the vulnerability can be handled based on the return information.

[0049] According to an example embodiment, the defense repair server can preset the format of the returned information without vulnerability, that is, the format of security information. The target object can match the format of the information sent by the TCP connection with the preset format of security information to determine whether vulnerability processing is required.

[0050] According to some embodiments, the vulnerability handling method may include reporting an error. If vulnerability handling is not required, the security management process for the URL request is terminated, thereby achieving the request purpose corresponding to the URL request.

[0051] This application can analyze URL requests, determine the request target, and then match the corresponding preliminary security check method to prevent risks caused by incorrect configuration by software developers, and identify and prevent potential security threats in the early stages of request processing. The preset DNS customization method is used for subsequent DNS security resolution to prevent SSRF vulnerabilities from bypassing the preliminary security check method, further improving the pertinence and effectiveness of security checks. When the analysis result is a safe DNS resolution result, a TCP connection is established, and vulnerability processing is performed based on the information returned by the target object, which improves the efficiency of defending or repairing SSRF vulnerabilities.

[0052] In some embodiments, reference Figure 2 In step S11, a preliminary security check method is determined based on the request target, which can be specifically implemented through steps S110, S111 and S112.

[0053] In step S110, it is detected whether a preset built-in security policy is set.

[0054] According to an exemplary embodiment, it may be first checked whether a customized built-in security policy is set in a configuration file or a database. This may be achieved by reading a configuration file, querying a database, or calling a specific API interface.

[0055] In step S111, in the case where a customized built-in security policy is set, the customized built-in security policy and the default built-in security policy corresponding to the request target are determined as the preliminary security check mode.

[0056] According to an example embodiment, if it is detected that a customized built-in security policy has been set, the defense repair server can read the policy and determine it together with the default built-in security policy as the preliminary security check mode. That is, in the preliminary security check stage, the defense repair server will apply these two policies at the same time to evaluate the security of the URL request.

[0057] In step S112, when no customized built-in security policy is set, the default built-in security policy is determined as the preliminary security check mode.

[0058] According to an example embodiment, if no customized built-in security policy is detected, the defense repair server will only use the default built-in security policy as a preliminary security check method.

[0059] By applying custom built-in security policies (if any) and the default built-in security policies, the server can more comprehensively evaluate the security of URL requests. This helps to promptly detect and block potentially malicious requests, thereby improving the overall security of the system. New security policies can be easily added or existing policies updated to adapt to changing security threats and business needs. This scalability enables the system to maintain long-term security and effectiveness.

[0060] In some embodiments, the request target includes a Host. In the case where the initial security check method is a customized built-in security policy and a default built-in security policy, refer to Figure 3 In step S11, a preliminary security check is performed on the URL request based on a preliminary security check method to generate a preliminary security check result, which can be specifically implemented through steps S113, S114, S115 and S116.

[0061] In step S113, when the check of the preset exception domain name list is enabled and it is determined that the Host is in the exception domain name list, it is determined that the URL request has passed the preliminary security check; when the check of the exception domain name list is not enabled, or when the check of the preset exception domain name list is enabled and it is determined that the Host is not in the exception domain name list, it is determined whether to enable the check of the preset exception IP list.

[0062] According to an example embodiment, the exception domain name list and the exception IP list may be preset. The exception domain name list and the exception IP list may contain domain names and IPs that are specially marked to indicate that they are necessarily safe. When the check of the preset exception domain name list is turned on, the Host may be matched with the preset Host in the exception domain name list. If the match is successful, it is determined that the URL request has passed the preliminary security check.

[0063] If the check of the exception domain name list is not enabled, or the Host fails to match the exception domain name list, further detection is performed to determine whether there is a script corresponding to the preset exception IP list in the security management-related running scripts. If so, it indicates that the check of the exception IP list is enabled. If not, it indicates that the check of the exception IP list is not enabled.

[0064] In step S114, when the check of the exception IP list is enabled, if it is determined that the Host resolution value corresponding to the Host matches the exception IP list, it is determined that the URL request has passed the preliminary security check result; when the check of the exception IP list is not enabled, or when the check of the exception IP list is enabled, if it is determined that the Host does not match the exception IP list, it is determined whether the default built-in security policy has passed the check.

[0065] According to an example embodiment, a command line tool can be used to parse the Host, convert the domain name into a corresponding IP address, that is, convert the Host into a corresponding Host resolution value. When the check of the exception IP list is turned on, the Host resolution value is compared with the preset IP address in the exception IP list. If a match is successful, it is determined that the URL request passes the preliminary security check result.

[0066] If the exception IP list is not enabled, or the Host resolution value fails to match the preset IP address in the exception IP list, it is determined whether the default built-in security policy has passed the check. The default built-in security policy can be a general security policy, and the defense repair server can pre-set the execution method of the default built-in security policy and the corresponding check results.

[0067] In step S115, if the check of the default built-in security policy passes, it is determined whether the preset whitelist check is enabled; if the check of the default built-in security policy fails, or the whitelist check is enabled, it is determined that the URL request does not match the corresponding whitelist, then it is determined that the URL request has failed the preliminary security check.

[0068] The whitelist check may be pre-set by the defense repair server, which may include checks on whitelists corresponding to IP, domain name, port, and protocol, and the corresponding whitelist may include IP, domain name, port, and protocol marked as safe.

[0069] According to an example embodiment, when the check of the default built-in security policy passes, the defense and repair server may detect whether there is a script corresponding to the preset whitelist check in the running script related to security management.

[0070] If the default built-in security policy fails to pass the check, or the IP, domain name, port, and protocol in the URL request are not in the corresponding whitelist, it is determined that the URL request fails the preliminary security check.

[0071] In step S116, when the whitelist check is not enabled or the URL request matches the whitelist, it is determined whether the preset blacklist check is enabled; when the blacklist check is enabled, it is determined that the URL request matches the corresponding blacklist, then it is determined that the URL request has not passed the preliminary security check; when it is determined that the URL request does not match the blacklist, it is determined that the URL request has passed the preliminary security check.

[0072] The blacklist check may be pre-set by the defense repair server, which may include checks on the blacklists corresponding to the IP, domain name, port, and protocol, and the corresponding blacklist may include IP, domain name, port, and protocol marked as dangerous.

[0073] According to an example embodiment, when the whitelist check is not enabled or the URL request matches the whitelist, the defense repair server may detect whether there is a script corresponding to the preset blacklist check in the running script related to security management.

[0074] If the blacklist check is turned on, the URL request can be checked to see if the IP, domain name, port, and protocol are in the corresponding blacklist. If they are, the URL request is determined to have failed the preliminary security check. If the IP, domain name, port, and protocol in the URL request are not in the corresponding blacklist, the URL request is determined to have passed the preliminary security check.

[0075] This application combines multiple security check mechanisms such as customized built-in security policies, default built-in security policies, exception domain name lists, exception IP lists, white lists and black lists, which can ensure that URL requests can identify and intercept potential security threats as comprehensively as possible when undergoing preliminary security checks, thereby reducing the risk of malicious requests being mistakenly released.

[0076] In some embodiments, the request target includes a protocol type. Figure 4 In step S114, it is determined whether the default built-in security policy has passed the check, which can be specifically implemented through steps S1140, S1141 and S1142.

[0077] In step S1140, it is determined that the protocol type is the target protocol type, and it is detected whether Host contains a closed character.

[0078] According to an example embodiment, the target protocol type may be a protocol of type http or https, which may be used to indicate a protocol type that is pre-marked as safe. Closed characters may include closed letters and numbers in a special format, which may be used to identify potential security risks. The defense repair server may pre-store the target protocol type. The protocol type is compared with the target protocol type. If the protocol type of the URL request is the target protocol type, it may be detected whether the Host contains closed characters.

[0079] In step S1141, when it is determined that the protocol type is not the target protocol type, or the Host contains closed characters, it is determined that the URL request does not pass the check of the default built-in security policy; when it is determined that the Host does not contain closed characters, the Host is parsed according to the native DNS method to determine the corresponding Host resolution value.

[0080] According to the example embodiment, when it is determined that the protocol type is not the target protocol type or the Host contains closed characters, it can be determined that the URL request has not passed the default built-in security policy check. If the Host does not contain closed characters, the native DNS method can be called to resolve the Host to determine the corresponding Host resolution value. Among them, the native DNS method can be a currently common DNS method, and the DNS can be directly set through the operating system or network equipment to ensure that the domain name can be correctly resolved to the corresponding IP address when the network is connected.

[0081] In step S1142, when it is detected that the Host resolution value contains a preset reserved IP address, it is determined that the URL request has not passed the default built-in security policy check; when it is detected that the Host resolution value does not contain a reserved IP address, it is determined that the URL request has passed the default built-in security policy check.

[0082] According to an example embodiment, the reserved IP address can be pre-set for the defense repair server and is used to represent an IP address with uncertain security. If the Host resolution value is detected to contain a preset reserved IP address, it means that the URL request has not passed the default built-in security policy check.

[0083] If it is detected that the Host resolution value does not contain a reserved IP address, it means that the URL request passes the default built-in security policy check. This application checks the protocol type and whether the target Host contains closed characters, so that the system can preliminarily screen out potential unsafe requests. This helps prevent certain types of malicious requests or requests that do not meet security specifications from entering the system. By using the native DNS method to resolve the Host, the defense repair server can accurately obtain the IP address corresponding to the Host, thereby performing a more in-depth security check and making the resolution results more reliable and accurate.

[0084] In some embodiments, reference Figure 5 , step S12 can be specifically implemented through step S120, step S121 and step S122.

[0085] In step S120, the preliminary security check result is analyzed to determine whether the URL request passes the preliminary security check.

[0086] According to an example embodiment, the preliminary security check result may include passing the preliminary security check and failing the preliminary security check. Whether the URL request passes the preliminary security check may be determined by analyzing the detailed description of the preliminary security check result.

[0087] In step S121, when the preliminary security check is passed, the Host resolution value is passed to the DNS custom method and analyzed to determine the DNS resolution result.

[0088] According to the example embodiment, if the preliminary security check result is "passed the preliminary security check", the next step of the DNS resolution analysis process is entered. The DNS resolution result is determined by processing the Host resolution value using a DNS customization method. The DNS customization method may be a DNS method that is pre-configured and customized based on actual applications.

[0089] According to some embodiments, for URL requests that pass the preliminary security check, the defense repair server will pass it to the DNS custom method module for analysis. The DNS custom method module may contain a series of customized DNS resolution rules and policies for deep resolution and verification of the domain name in the URL request. During the DNS resolution process, it can be checked whether the domain name exists, whether it is maliciously hijacked, whether it is consistent with the expected result, etc. After the DNS resolution is completed, a DNS resolution result can be generated, which indicates whether the domain name resolution is successful, as well as the IP address or other relevant information obtained by the resolution. Based on the DNS resolution result, the defense repair server will determine the final security resolution result. If the DNS resolution is successful and no security issues are found, the URL request can be considered safe, and the result will be notified to the relevant module or system. If the DNS resolution fails or a security issue is found (such as the domain name is hijacked, the resolved IP address is at risk, etc.), the corresponding repair measures are automatically taken, and the relevant information is recorded for subsequent analysis.

[0090] In step S122, if the preliminary security check fails, an error is reported or an exception is thrown.

[0091] According to an example embodiment, if the result of the preliminary security check is "failed the preliminary security check", an error report is immediately processed, error information is recorded, or an exception is thrown. The error report can be an operation performed for a serious problem encountered by the program during operation; the exception is thrown for an operation performed when the program encounters a condition that does not meet expectations during operation.

[0092] This application can effectively identify and intercept potential security threats and protect the network from malicious attacks and illegal access through preliminary security checks and DNS customization method analysis. The DNS customization method module allows administrators to define customized DNS resolution rules and policies according to actual needs, so that the system can adapt to different network environments and security requirements. In addition, security checks and analysis can be performed immediately after receiving a URL request, without waiting for manual triggering by the user or system scheduled scanning, which improves the efficiency of security detection and response.

[0093] In some embodiments, reference Figure 6 In step S122, the Host resolution value is passed to the DNS customization method and analyzed to determine the DNS resolution result, which can be specifically carried out through steps S1220, step S1221 and step S1222.

[0094] In step S1220, the native DNS method is called, and the request target is analyzed based on the native DNS method and the DNS customized method to determine the complete IP resolution result.

[0095] According to an example embodiment, the native DNS method may be a DNS resolution library provided by the operating system. The native DNS method may be called, the DNS custom method may be loaded and applied, and the native DNS method and the DNS custom method may be combined to analyze the domain name in the request data request target to obtain a complete IP resolution result.

[0096] In step S1221, when the check of the exception domain name list is enabled and the Host is in the exception domain name list, the DNS resolution result is determined to be safe; when the check of the exception domain name list is not enabled, or the Host is not in the exception domain name list, a DNS resolution result list instance is created and the complete IP resolution result is traversed to determine whether the DNS resolution result list is empty based on the traversal result.

[0097] According to an exemplary embodiment, if the defense repair server is configured with an exception domain name list, and the host (domain name) of the current request exists in the list, the defense repair server will directly generate a DNS resolution result and determine that the resolution result is safe. This is because these domain names have been considered safe and no further security check is required.

[0098] If the check of the exception domain name list is not enabled, or the host of the current request is not in the exception domain name list, the server will create a DNS resolution result list instance. Then, you can traverse the complete IP resolution results obtained previously through the native DNS method and the DNS custom method. During the traversal process, you can filter and verify the resolution results according to the rules in the DNS custom method.

[0099] In step S1222, if it is empty, an error is reported or an exception is thrown; if it is not empty, a DNS resolution result is generated and it is determined that the DNS resolution result is safe.

[0100] According to the example embodiment, if the DNS resolution result list is empty after the traversal is completed (i.e., no suitable or safe IP address is found), an error processing may be performed, an error message may be returned to the requesting party, and a log may be recorded for subsequent analysis. If the list is not empty, a final DNS resolution result may be generated based on the information in the list, and the resolution result may be determined to be safe.

[0101] This application combines native DNS methods with DNS customization methods to apply more complex security policies during the resolution process, effectively identify and block malicious domain names and IP addresses, and improve network security. By traversing the complete IP resolution result list, further security checks can be performed on multiple resolution results, improving the accuracy and efficiency of DNS resolution.

[0102] In some embodiments, the complete IP resolution result includes at least one IP resolution result. Figure 7In step S1221, a DNS resolution result list instance is created and the complete IP resolution result is traversed to determine whether the DNS resolution result list is empty based on the traversal result. This can be specifically achieved through steps S12210, S12211, S12212 and S12213.

[0103] In step S12210, a DNS resolution result list instance is created; for each of the at least one IP resolution result, when the check of the exception IP list is turned on, each IP resolution result is checked whether it matches the exception IP list; when each IP resolution result matches the exception IP list, each IP resolution result is written into the DNS resolution result list instance.

[0104] According to an example embodiment, when the defense repair server receives a domain name resolution request, it can first call the DNS resolution method to obtain the complete IP resolution result of the domain name. These results may contain multiple IP addresses. Then, the defense repair server will create an empty DNS resolution result list instance for storing the IP addresses that have passed the security check. Among them, the DNS resolution result list instance can be a collection of all resolution records for a certain domain name. These records define how to map a domain name to a corresponding IP address.

[0105] It is possible to determine whether a certain check is enabled and whether a match is found in the manner described in the above embodiment. If the check of the exception IP list is enabled, the defense repair server will traverse each IP address in the complete IP resolution result to check whether it is in the exception IP list. If so, the defense repair server will directly write this IP address into the DNS resolution result list instance.

[0106] In step S12211, when the check of the exception IP list is not enabled, or each IP resolution result does not match the exception IP list, determine whether to enable the check of the IP whitelist; when the check of the IP whitelist is enabled, detect whether each IP resolution result matches the IP whitelist; if each IP resolution result does not match the IP whitelist, end the traversal and determine whether the DNS resolution result list is empty; when the check of the IP whitelist is not enabled, or each IP resolution result matches the IP whitelist, determine whether to enable the check of the IP blacklist.

[0107] According to an example embodiment, for IP addresses that are not in the exception IP list, it can be further checked whether the IP whitelist check is enabled. If it is enabled, it can be checked whether these IP addresses are in the IP whitelist. If each IP address is not in the IP whitelist, the traversal process is terminated, and it is determined whether the DNS resolution result list is empty. If the IP whitelist check is not enabled, or the IP address is in the IP whitelist, the server will further check whether the IP blacklist check is enabled.

[0108] If there is no IP resolution result in the DNS resolution result list, it may indicate that the DNS resolution result list is empty.

[0109] In step S12212, when the IP blacklist check is turned on, check whether each IP resolution result matches the IP blacklist; if each IP resolution result matches the IP blacklist, end the traversal and determine whether the DNS resolution result list is empty; when the IP blacklist check is not turned on, or each IP resolution result does not match the IP blacklist, determine whether each IP resolution result is a reserved IP or an intranet address.

[0110] According to an exemplary embodiment, if the IP blacklist check is enabled, the defense repair server will check whether these IP addresses are in the IP blacklist. If an IP address is in the IP blacklist, the traversal process can be terminated and it is determined whether the DNS resolution result list is empty.

[0111] If the IP blacklist check is not enabled, or the IP address is not in the IP blacklist, the IP blacklist check server will check whether these IP addresses are reserved IPs or intranet addresses. These addresses are usually not used for external network communication.

[0112] In step S12213, if each IP resolution result is a reserved IP or an intranet address, the traversal is terminated and a determination is made as to whether the DNS resolution result list is empty; if each IP resolution result is not a reserved IP or an intranet address, each IP resolution result is written into the DNS resolution result list instance, and a determination is made as to whether the DNS resolution result list is empty.

[0113] According to the example embodiment, if an IP address is identified as a reserved IP or an intranet address, the traversal process is terminated, and it is determined whether the DNS resolution result list is empty. For an IP address that is in the exception IP list, or in the IP whitelist but not in the IP blacklist, and is not a reserved IP or an intranet address, it can be written into the DNS resolution result list instance.

[0114] After traversing all IP addresses, the server will determine whether the DNS resolution result list is empty. If it is empty, an error can be reported; if it is not empty, a DNS resolution result can be generated and determined to be safe.

[0115] By combining the exception IP list, IP whitelist, IP blacklist, and identification of reserved IP or intranet addresses, the server can perform multiple security checks on the IP address to ensure the security of network access. Through accurate security checks and IP address identification, the server can reduce interference caused by false positives and security risks caused by missed positives. By traversing the complete IP resolution result list and ending the traversal in time when the conditions are met, the server can improve resolution efficiency while ensuring security.

[0116] In some embodiments, reference Figure 8 , step S14 can be specifically implemented through step S140, step S141 and step S142.

[0117] In step S140, information sent by the target object through the TCP connection is received.

[0118] According to an exemplary embodiment, after the target object establishes a TCP connection with the defense and repair server, a message is returned to indicate that the connection is successful. The defense and repair server can receive the message accordingly.

[0119] In step S141, the information is analyzed to determine whether it is a redirection.

[0120] According to an example embodiment, the information is analyzed to determine whether there is a redirection. This can be done by checking the HTTP status code, especially the 3xx series of status codes (such as 301, 302, etc.). If such a status code exists, it can indicate a redirection; if such a status code does not exist, it can indicate that it is not a redirection.

[0121] According to some embodiments, the determination of redirection can be achieved by tracking the Location header field in the HTTP response, because this field contains the redirected URL. Requests can be recursively sent to this new URL request, and redirection tracking continues until there are no more redirections.

[0122] In step S142, vulnerability processing is performed according to the redirection analysis result.

[0123] According to the exemplary embodiment, if it is not a redirection, then it can be considered that the URL request has completed the security check, which can indicate that the URL request is safe and can be allowed to continue to execute. If it is a redirection, it can indicate that the URL request has other hidden dangers and can be further analyzed to implement vulnerability handling.

[0124] This application can identify and handle potential security vulnerabilities by analyzing the information received in the TCP connection, with special attention to redirection behavior, helping to prevent malicious redirection attacks. Because the process is analyzed in real time in the TCP connection, the defense repair server can immediately respond and handle the detected security threats. This real-time protection mechanism helps reduce the time window for attackers to exploit vulnerabilities and improve the system's defense capabilities.

[0125] In some embodiments, reference Fig. 9 , step S142 can be specifically implemented through step S1420 and step S1421.

[0126] In step S1420, if it is not a redirection, it is determined that the information processing is completed; if it is a redirection, the number of redirections of the URL request is obtained, and the number of redirections is compared with the preset number limit.

[0127] According to an example embodiment, the preset number limit can be set according to the actual use of the network, and this number limit is set to prevent unlimited redirection or redirection attack. If it is not a redirection, it can be determined that the information processing is completed and the security management process of the URL request is ended. If the information indicates a redirection, the number of redirections stored corresponding to the URL request can be detected.

[0128] In step S1421, if it is greater than or equal to the preset number limit, it is determined that the URL request has not passed the security check and an error is reported; if it is less than the preset number limit, the redirection URL is parsed to perform corresponding vulnerability processing based on the redirection URL.

[0129] According to the example embodiment, if the number of redirections exceeds, that is, is greater than or equal to, the preset number limit, it can be considered that the URL request has a security risk, and the vulnerability handling information is determined to be "failed the security check". At this time, an error processing can be performed and relevant information can be recorded for subsequent analysis.

[0130] If the number of redirections is not exceeded, that is, less than the preset number limit, the last redirection URL can be parsed and the corresponding vulnerability handling information can be generated. This process may include another security check on the redirection URL (such as checking whether it contains malicious code, whether it points to a known security threat, etc.). Based on the inspection results, the corresponding vulnerability handling information can be generated, such as "safe" or "potential risk".

[0131] This application can prevent potential infinite redirection loop attacks by comparing the number of redirections with the preset number limit. This mechanism helps protect system resources and avoid resource exhaustion. For non-redirection situations, the system can quickly determine that the information processing is complete without additional redirection analysis, thereby improving processing efficiency. This application also allows the preset number limit to be set according to actual needs, and adopts different processing strategies based on the number of redirections, which can adapt to different security needs and threat environments.

[0132] In other embodiments, a software development kit can be pre-designed and developed. Fig.10 This is a schematic diagram of the application of the software development kit provided in the embodiment of the present application. Fig.10 As shown, software developers can introduce software development kits and configure various policies based on different business scenarios, such as customizing built-in security policies. They can also directly call methods in the software development kit to create security instances, supporting the development of normal business logic functions.

[0133] The following describes an apparatus embodiment of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, reference can be made to the method embodiment of the present application.

[0134] Fig.11 A block diagram of a SSRF security management device provided in an embodiment of the present application. Fig.11 As shown, the SSRF security management device 1100 includes a request analysis module 1101, a preliminary security check result generation module 1102, a security parsing result determination module 1103, a connection module 1104 and an information analysis module 1105.

[0135] The request analysis module 1101 parses the URL request to determine the request target. The preliminary security check result generation module 1102 determines the preliminary security check method based on the request target, and performs a preliminary security check on the URL request based on the preliminary security check method to generate a preliminary security check result. The security analysis result determination module 1103 analyzes the request target according to the preliminary security check result and the preset DNS customization method to determine the security analysis result. The connection module 1104 establishes a TCP connection with the target object of the URL according to the analysis result. The information analysis module 1105 performs vulnerability processing according to the information sent by the target object through the TCP connection.

[0136] According to some embodiments, the preliminary security check result generation module 1102, when determining the preliminary security check method based on the request target, specifically: detects whether a preset built-in security policy is set; if a customized built-in security policy is set, determines the customized built-in security policy and the default built-in security policy corresponding to the request target as the preliminary security check method; if no customized built-in security policy is set, determines the default built-in security policy as the preliminary security check method.

[0137] According to some embodiments, the request target includes a Host.

[0138] If the preliminary security check method is a customized built-in security policy and a default built-in security policy, the preliminary security check result generation module 1102 performs a preliminary security check on the URL request based on the preliminary security check method to generate a preliminary security check result. Specifically: when the check of the preset exception domain name list is enabled, if it is determined that the Host is in the exception domain name list, then it is determined that the URL request has passed the preliminary security check; when the check of the exception domain name list is not enabled, or when the check of the preset exception domain name list is enabled, if it is determined that the Host is not in the exception domain name list, then it is determined whether to enable the check of the preset exception IP list; when the check of the exception IP list is enabled, if it is determined that the Host resolution value corresponding to the Host matches the exception IP list, then it is determined that the URL request has passed the preliminary security check result; when the check of the exception IP list is not enabled, then it is determined that the URL request has passed the preliminary security check result. If the host does not match the exception IP list when checking the default built-in security policy, or if the exception IP list is checked, it is determined that the Host does not match the exception IP list, then it is determined whether the default built-in security policy has passed the check; if the default built-in security policy has passed the check, it is determined whether the preset whitelist check is turned on; if the default built-in security policy has not passed the check, or if the whitelist check is turned on, it is determined that the URL request does not match the corresponding whitelist, then it is determined that the URL request has not passed the preliminary security check; if the whitelist check is not turned on, or the URL request matches the whitelist, it is determined whether the preset blacklist check is turned on; if the blacklist check is turned on, it is determined that the URL request matches the corresponding blacklist, then it is determined that the URL request has not passed the preliminary security check; if it is determined that the URL request does not match the blacklist, then it is determined that the URL request has passed the preliminary security check.

[0139] According to some embodiments, the request target includes a protocol type.

[0140] When determining whether the default built-in security policy has passed the check, the preliminary security check result generation module 1102 specifically: determines that the protocol type is the target protocol type, and detects whether the Host contains closed characters; when it is determined that the protocol type is not the target protocol type, or the Host contains closed characters, determines that the URL request has not passed the check of the default built-in security policy; when it is determined that the Host does not contain closed characters, resolves the Host according to the native DNS method to determine the corresponding Host resolution value; when it is detected that the Host resolution value contains a preset reserved IP address, determines that the URL request has not passed the check of the default built-in security policy; when it is detected that the Host resolution value does not contain a reserved IP address, determines that the URL request has passed the check of the default built-in security policy.

[0141] According to some embodiments, the security resolution result determination module 1103 specifically: analyzes the preliminary security check result to determine whether the URL request passes the preliminary security check; if it passes the preliminary security check, passes the Host resolution value to the DNS custom method and performs analysis to determine the DNS resolution result; if it fails the preliminary security check, reports an error or throws an exception.

[0142] According to some embodiments, when the Host resolution value is passed to the DNS custom method and analyzed to determine the DNS resolution result, the security resolution result determination module 1103 specifically: calls the native DNS method, and analyzes the request target based on the native DNS method and the DNS custom method to determine the complete IP resolution result; when the check of the exception domain name list is enabled and the Host is in the exception domain name list, the DNS resolution result is determined to be safe; when the check of the exception domain name list is not enabled, or the Host is not in the exception domain name list, a DNS resolution result list instance is created and the complete IP resolution result is traversed to determine whether the DNS resolution result list is empty based on the traversal result; if it is empty, an error is reported or an exception is thrown; if it is not empty, a DNS resolution result is generated, and the DNS resolution result is determined to be safe.

[0143] According to some embodiments, the complete IP resolution result includes at least one IP resolution result.

[0144] The security resolution result determination module 1103 creates a DNS resolution result list instance and traverses the complete IP resolution results to determine whether the DNS resolution result list is empty based on the traversal results. Specifically: Create a DNS resolution result list instance; for each IP resolution result in at least one IP resolution result, when the check of the exception IP list is turned on, detect whether each IP resolution result matches the exception IP list; when each IP resolution result matches the exception IP list, write each IP resolution result into the DNS resolution result list instance; when the check of the exception IP list is not turned on, or when each IP resolution result does not match the exception IP list, determine whether to turn on the check of the IP whitelist; when the check of the IP whitelist is turned on, detect whether each IP resolution result matches the IP whitelist; if each IP resolution result does not match the IP whitelist, end the traversal and judge Check whether the DNS resolution result list is empty; when the IP whitelist check is not enabled, or each IP resolution result matches the IP whitelist, determine whether the IP blacklist check is enabled; when the IP blacklist check is enabled, detect whether each IP resolution result matches the IP blacklist; if each IP resolution result matches the IP blacklist, end the traversal and determine whether the DNS resolution result list is empty; when the IP blacklist check is not enabled, or each IP resolution result does not match the IP blacklist, determine whether each IP resolution result is a reserved IP or an intranet address; if each IP resolution result is a reserved IP or an intranet address, end the traversal and determine whether the DNS resolution result list is empty; when each IP resolution result is not a reserved IP or an intranet address, write each IP resolution result into the DNS resolution result list instance, and determine whether the DNS resolution result list is empty.

[0145] According to some embodiments, when the information analysis module 1105 performs vulnerability processing based on the information sent by the target object through the TCP connection, specifically: receives the information sent by the target object through the TCP connection; analyzes the information to determine whether it is a redirection; and performs vulnerability processing based on the redirection analysis result.

[0146] According to some embodiments, when the information analysis module 1105 performs vulnerability processing based on the redirection analysis result, specifically: if it is not a redirection, determine that the information processing is completed; if it is a redirection, obtain the number of redirections of the URL request, and compare the number of redirections with the preset number limit; if it is greater than or equal to the preset number limit, determine that the URL request has not passed the security check and report an error; if it is less than the preset number limit, parse the redirection URL to perform corresponding vulnerability processing based on the redirection URL.

[0147] The device performs functions similar to the method provided above. For other functions, please refer to the previous description and will not be repeated here.

[0148] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.12 As shown, the electronic device 1200 of this embodiment may include: a memory 1201 and a processor 1202 .

[0149] The memory 1201 stores a computer program. When the computer program is executed by the processor 1202, the processor 1202 executes the method in the above embodiment.

[0150] The processor 1202 and the memory 1201 are connected, for example, via a bus.

[0151] Optionally, the electronic device 1200 may further include a transceiver. It should be noted that in actual applications, the number of transceivers is not limited to one, and the structure of the electronic device 1200 does not constitute a limitation on the embodiments of the present application.

[0152] Processor 1202 may be a CPU (Central Processing Unit), a general purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 1202 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0153] The bus may include a path to transmit information between the above components. The bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0154] The memory 1201 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0155] The memory 1201 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 1202. The processor 1202 is used to execute the application code stored in the memory 1201 to implement the contents shown in the above method embodiment.

[0156] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Fig.12 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0157] The electronic device of this embodiment can be used to execute the method of any of the above embodiments, and its implementation principle and technical effect are similar, which will not be described in detail here.

[0158] The present application also provides a non-transitory computer-readable storage medium having computer-readable instructions stored thereon. When the aforementioned instructions are executed by a processor, the processor executes the method in the above embodiment.

[0159] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a non-transient computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0160] The embodiments of the present application are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and its core idea of ​​the present application. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present application, the specific implementation methods and the scope of application of the present application, all belong to the scope of protection of the present application. In summary, the content of this specification should not be construed as a limitation on the present application.

Claims

1. A SSRF security management method, characterized in that: include: Parse the URL request to determine the request target; Determining a preliminary security check method based on the request target, and performing a preliminary security check on the URL request based on the preliminary security check method to generate a preliminary security check result; Analyze the request target according to the preliminary security check result and the preset DNS customization method; Establishing a TCP connection with the target object of the URL request according to the analysis result; Vulnerability processing is performed according to the information sent by the target object through the TCP connection.

2. The method according to claim 1, characterized in that The method of determining a preliminary security check based on the request target includes: Check whether there is a preset built-in security policy; In the case where the customized built-in security policy is set, determining the customized built-in security policy and the default built-in security policy corresponding to the request target as the preliminary security check mode; In the case where the customized built-in security policy is not set, the default built-in security policy is determined as the preliminary security check mode.

3. The method according to claim 2, characterized in that The request target includes Host; Wherein, when the preliminary security check mode is the customized built-in security policy and the default built-in security policy, performing a preliminary security check on the URL request based on the preliminary security check mode to generate a preliminary security check result includes: When checking the preset exception domain name list is enabled, it is determined that the Host is in the exception domain name list, and it is determined that the URL request passes the preliminary security check; In the case where the check of the exception domain name list is not enabled, or in the case where the check of the preset exception domain name list is enabled, if it is determined that the host is not in the exception domain name list, it is determined whether to enable the check of the preset exception IP list; When the check of the exception IP list is turned on, it is determined that the Host resolution value corresponding to the Host matches the exception IP list, and then it is determined that the URL request passes the preliminary security check result; In the case where the check of the exception IP list is not enabled, or in the case where the check of the exception IP list is enabled, if it is determined that the Host does not match the exception IP list, then it is determined whether the default built-in security policy has passed the check; If the default built-in security policy is checked, determine whether the preset whitelist check is enabled; If the default built-in security policy fails to be checked, or if the whitelist check is turned on, it is determined that the URL request does not match the corresponding whitelist, then it is determined that the URL request fails the preliminary security check; If the whitelist check is not enabled, or the URL request matches the whitelist, determining whether the preset blacklist check is enabled; When the blacklist check is turned on, it is determined that the URL request matches the corresponding blacklist, and then it is determined that the URL request fails the preliminary security check; If it is determined that the URL request does not match the blacklist, it is determined that the URL request passes the preliminary security check.

4. The method according to claim 3, characterized in that: The request target includes a protocol type; The step of determining whether the default built-in security policy has passed the check includes: Determine that the protocol type is a target protocol type, and detect whether the Host contains a closed character; When it is determined that the protocol type is not the target protocol type, or the Host contains the closed character, determining that the URL request fails to pass the check of the default built-in security policy; When it is determined that the Host does not contain the enclosed character, the Host is parsed according to a native DNS method to determine a corresponding resolution value of the Host; In the case where it is detected that the Host resolution value contains a preset reserved IP address, determining that the URL request fails to pass the inspection of the default built-in security policy; When it is detected that the Host resolution value does not contain the reserved IP address, it is determined that the URL request passes the check of the default built-in security policy.

5. The method according to claim 3, characterized in that: The analyzing the request target according to the preliminary security check result and the preset DNS customization method includes: Analyzing the preliminary security check result to determine whether the URL request passes the preliminary security check; In the case of passing the preliminary security check, the Host resolution value is passed to the DNS custom method and analyzed to determine the DNS resolution result; If the preliminary security check fails, an error is reported or an exception is thrown.

6. The method according to claim 5, characterized in that The step of passing the Host resolution value to the DNS customization method and analyzing it to determine the DNS resolution result includes: Calling a native DNS method, and analyzing the request target based on the native DNS method and the DNS customized method to determine a complete IP resolution result; When checking the exception domain name list is enabled and the host is in the exception domain name list, determining that the DNS resolution result is safe; If the check of the exception domain name list is not enabled, or the host is not in the exception domain name list, create a DNS resolution result list instance and traverse the complete IP resolution result to determine whether the DNS resolution result list is empty based on the traversal result; If it is empty, an error will be reported or an exception will be thrown; If it is not empty, the DNS resolution result is generated and determined to be safe.

7. The method according to claim 6, characterized in that The complete IP resolution result includes at least one IP resolution result; The step of creating a DNS resolution result list instance and traversing the complete IP resolution result to determine whether the DNS resolution result list is empty based on the traversal result includes: Create the DNS resolution result list instance; For each of the at least one IP resolution result, when the check of the exception IP list is turned on, detecting whether each of the IP resolution results matches the exception IP list; When each IP resolution result matches the exception IP list, writing each IP resolution result into the DNS resolution result list instance; If the check of the exception IP list is not enabled, or each IP resolution result does not match the exception IP list, determine whether to enable the check of the IP whitelist; When the IP whitelist check is enabled, detecting whether each IP resolution result matches the IP whitelist; If each of the IP resolution results does not match the IP whitelist, then the traversal is terminated and it is determined whether the DNS resolution result list is empty; If the IP whitelist check is not enabled, or if each IP resolution result matches the IP whitelist, determine whether to enable the IP blacklist check; When the IP blacklist check is turned on, detecting whether each IP resolution result matches the IP blacklist; If each of the IP resolution results matches the IP blacklist, the traversal is terminated and it is determined whether the DNS resolution result list is empty; When the IP blacklist check is not enabled, or each IP resolution result does not match the IP blacklist, determining whether each IP resolution result is a reserved IP or an intranet address; If each of the IP resolution results is a reserved IP or an intranet address, then the traversal is terminated and it is determined whether the DNS resolution result list is empty; In the case that each IP resolution result is not a reserved IP or an intranet address, each IP resolution result is written into the DNS resolution result list instance, and it is determined whether the DNS resolution result list is empty.

8. The method according to any one of claims 1 to 7, characterized in that: The performing vulnerability processing according to the information sent by the target object through the TCP connection includes: Receiving information sent by the target object through the TCP connection; Analyze the information to determine whether it is a redirect; Perform vulnerability processing based on the redirection analysis results.

9. The method according to claim 8, characterized in that The vulnerability processing according to the redirection analysis result includes: In the case of not redirecting, determining that the information processing is completed; In the case of the redirection, obtaining the redirection count of the URL request, and comparing the redirection count with a preset limit; If the number of times is greater than or equal to the preset limit, it is determined that the URL request has not passed the security check, so as to report an error; If the number is less than the preset limit, the redirection URL is parsed to perform corresponding vulnerability processing based on the redirection URL.

10. A SSRF security management device, characterized in that: include: The request analysis module is used to parse the URL request to determine the request target; A preliminary security check result generating module, used to determine a preliminary security check method based on the request target, and perform a preliminary security check on the URL request based on the preliminary security check method to generate a preliminary security check result; A security analysis result determination module, used to analyze the request target according to the preliminary security check result and a preset DNS customization method to determine a security analysis result; A connection module, used to establish a TCP connection with the target object of the URL according to the analysis result; The information analysis module is used to perform vulnerability processing according to the information sent by the target object through the TCP connection.