Malicious request defense method based on Web front-end page and related equipment

By monitoring and classifying the timestamps and frequency of data interaction requests on the Web front-end page, judging and defending against malicious requests, the problems of excessive server resource consumption and poor judgment accuracy in the prior art are solved, and efficient malicious request defense is achieved.

CN114386037BActive Publication Date: 2024-11-26CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210040638.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-14
Publication Date
2024-11-26
Estimated Expiration
2042-01-14

AI Technical Summary

Technical Problem

When determining whether the data interaction request is a malicious request, existing web front-end pages need to rely on server logic, resulting in excessive server resources consumption and inability to accurately distinguish different types of data interaction requests, affecting the defense effect.

Method used

By obtaining the timestamp of data interaction requests on the web front-end page, dividing the request types, monitoring the number and frequency of each request type, if the threshold is exceeded, it is judged as an abnormal request, authenticating and defense are performed, and server resource consumption is reduced.

Benefits of technology

It realizes that without calling server resources, it can more accurately judge and defend against malicious requests, reduce server resource consumption and improve defense effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114386037B_ABST
    Figure CN114386037B_ABST
Patent Text Reader

Abstract

The present invention provides a malicious request defense method based on a Web front-end page, which relates to the field of Internet applications. It includes: obtaining a data interaction request for a Web front-end page, determining the request type of the data interaction request, and adding the timestamp of the current data interaction request to the timestamp array corresponding to the request type; obtaining the number of requests for data interaction requests of different request types within the current monitoring time period according to the timestamp array; if the number of requests corresponding to the request type is greater than the request number threshold of the request type, the request type is used as an abnormal request type; if the number of abnormal request types is greater than the first number threshold, the current access is determined to be an abnormal access; log out of the current login account, and send an identity authentication request. The present invention can not only defend against malicious requests alone, but also more accurately determine whether a data interaction request is a malicious request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet applications, and in particular to a malicious request defense method based on a Web front-end page and related equipment. Background Art

[0002] When the existing Web front-end page determines whether the data interaction request generated by itself is a malicious request, it needs to rely on the server's operating logic to make the judgment. The above-mentioned method of relying on the server's own logic judgment will cause the server to consume more resources, so that the server cannot effectively defend against hacker attacks (such as distributed denial of service DDOS), thereby affecting users' normal access to the website; at the same time, when the existing server determines whether the data interaction request from the Web front-end page is a malicious request, it does not distinguish the request type of the data interaction request in the Web front-end page, but only focuses on the total request frequency and the total number of requests for data interaction requests within a preset unit time, so that the server does not distinguish between data interaction requests that call relatively more server resources and data interaction requests that call relatively less resources, and thus the server has poor accuracy when determining whether the data interaction request from the Web front-end page is a malicious request. Therefore, it is necessary to make improvements. Summary of the invention

[0003] The purpose of the present invention is to provide a malicious request defense method based on a Web front-end page and related equipment, which can not only defend against malicious requests independently, but also more accurately determine whether a data interaction request is a malicious request.

[0004] The technical solution of the present invention is: a malicious request defense method based on a Web front-end page, comprising:

[0005] Obtain a data interaction request for a Web front-end page, determine a request type of the data interaction request, and add a timestamp of the current data interaction request to a timestamp array corresponding to the request type;

[0006] Acquire the number of data interaction requests of different request types within the current monitoring time period according to the timestamp array;

[0007] If the number of requests corresponding to the request type is greater than the request number threshold of the request type, the request type is regarded as an abnormal request type;

[0008] If the number of the abnormal request types is greater than a first number threshold, determining that the current access is an abnormal access;

[0009] Log out of the current account and send an authentication request to defend against malicious requests.

[0010] Preferably, obtaining the number of data interaction requests of different request types within the current monitoring time period according to the timestamp array includes:

[0011] For each of the request types, obtaining a timestamp array of the request type;

[0012] Filter the timestamps in the timestamp array whose corresponding time is not within the current monitoring time period to obtain a filtered timestamp array of the request type;

[0013] The number of the timestamps in the filtering timestamp array is obtained as the request number of the data interaction request of the request type.

[0014] Preferably, if the number of requests corresponding to the request type is greater than a request number threshold of the request type, then after treating the request type as an abnormal request type, the method further includes:

[0015] Obtaining the submission duration of the abnormal request type according to the filtering timestamp array;

[0016] Calculate the submission frequency of the abnormal request type according to the submission duration and the number of requests;

[0017] If the submission frequency is greater than the request frequency threshold of the abnormal request type, the abnormal request type is regarded as a malicious request type;

[0018] If a data interaction request of the malicious request type is received, the data interaction request is rejected.

[0019] Preferably, adding the timestamp of the current time to the timestamp array corresponding to the request type includes:

[0020] Get the timestamp array of the request type from the browser cache;

[0021] Add the timestamp of the current time to the acquired timestamp array to obtain an updated timestamp array;

[0022] The timestamp array cached by the browser is updated according to the updated timestamp array.

[0023] Preferably, if the number of requests corresponding to the request type is greater than a request number threshold of the request type, then after treating the request type as an abnormal request type, the method further includes:

[0024] Marking the current monitoring time period as an abnormal period;

[0025] Obtain the number of data interaction requests of different request types within multiple consecutive non-abnormal historical monitoring time periods closest to the current time;

[0026] For each of the request types, obtaining the average number of requests according to the number of requests in different historical monitoring time periods;

[0027] The request quantity threshold corresponding to the request type is adjusted according to the average request quantity.

[0028] Preferably, after logging out of the current login account and sending the identity authentication request, the method further includes:

[0029] When the identity authentication is passed, the abnormal request count of the current user is increased by one, and the monitoring time period is shortened;

[0030] If the abnormal request count is greater than the preset number threshold, the current login account is logged out again and the corresponding user is marked as an abnormal user;

[0031] If a login request from the abnormal user is received within a second preset time period from the current time, the login request is rejected.

[0032] Preferably, after adding the timestamp of the current time to the timestamp array corresponding to the request type, the method further includes:

[0033] Acquire the user who initiates the data interaction request, and associate the user ID of the user with the timestamp of the current time in the timestamp array;

[0034] Extracting, from the timestamp array, a personal timestamp array corresponding to different request types of the user according to the user identifier;

[0035] Obtaining behavior data of the user of different request types according to the personal timestamp array; and determining whether the user is an abnormal user according to the behavior data.

[0036] Another technical solution of the present invention is: a malicious request defense device based on a Web front-end page, comprising:

[0037] A request collection module is used to obtain a data interaction request for a Web front-end page, determine the request type of the data interaction request, and add the timestamp of the current data interaction request to a timestamp array corresponding to the request type;

[0038] A request quantity monitoring module, used for obtaining the request quantity of data interaction requests of different request types within a current monitoring time period according to the timestamp array;

[0039] an abnormal request determination module, configured to treat the request type as an abnormal request type if the number of requests corresponding to the request type is greater than a request number threshold of the request type;

[0040] an abnormal request confirmation module, configured to determine that the current access is an abnormal access if the number of the abnormal request type is greater than a first number threshold;

[0041] The user authentication module is used to log out of the current login account, send an authentication request, and implement malicious request defense.

[0042] Another technical solution of the present invention is: a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that when the processor executes the computer program, the steps of the malicious request defense method based on a Web front-end page are implemented.

[0043] Another technical solution of the present invention is: a computer-readable storage medium, the computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, the steps of the malicious request defense method based on a Web front-end page are implemented.

[0044] The beneficial effects of the present invention are:

[0045] 1. The present application obtains the timestamp corresponding to each data interaction request, and classifies the data interaction requests of the same type into the same category of data interaction requests, thereby obtaining the monitoring time periods of the data interaction requests of different request types; then the number of requests of the data interaction requests of different request types in their respective monitoring time periods is obtained in real time on the web front-end page, thereby determining whether the current data interaction request is a malicious request, and thus allowing the present application to independently complete the defense work against malicious requests without calling server resources, thereby reducing the consumption of server resources.

[0046] 2. This application divides data interaction requests into different categories and monitors the data interaction requests of each request type in a targeted manner, so that this application can more accurately determine whether the access request of the web front-end page is a malicious request. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flowchart of a malicious request defense method based on a Web front-end page according to the first embodiment of the present invention;

[0048] Figure 2 It is a schematic diagram of the structure of a malicious request defense device based on a Web front-end page in a second embodiment of the present invention;

[0049] Figure 3 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention;

[0050] Figure 4 FIG. 4 is a schematic diagram of the structure of a storage medium according to a fourth embodiment of the present invention. DETAILED DESCRIPTION

[0051] The present invention will be further described below in conjunction with the accompanying drawings and implementation modes.

[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0053] The terms "first", "second", and "third" in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined as "first", "second", and "third" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. All directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products, or devices.

[0054] The server of the present application can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0055] Distributed Denial of Service (DDoS) is the most widespread hacker attack method. Hackers frequently access and send large amounts of data to the server, occupying service resources, thereby preventing ordinary users from accessing the website normally. According to a report from the US Computer Emergency Response Center, there is no good way to truly solve the problem of distributed denial of service DDoS attacks so far.

[0056] At the same time, in the project operation practice, it was also found that there were some abnormal users who would submit data requests frequently or repeatedly. Although they did not paralyze the server like hackers, they also consumed some resources of the server and generated abnormal user statistics.

[0057] The inventors found that the existing Web front-end pages can only limit multiple repeated requests caused by button clicks or content input, but cannot limit multiple repeated requests caused by browser interface related operations (such as page refresh); at the same time, when the existing technology needs to determine whether the request of the Web front-end page is a malicious request, it can only be determined by the server's own logic, and the above-mentioned method of determining by the server's own logic will cause the server to consume more resources, thereby making the server unable to effectively defend against hacker attacks (such as distributed denial of service DDOS), thereby affecting users' normal access to the website.

[0058] Figure 1 The figure is a flowchart of a method for defending against malicious requests based on a Web front-end page according to the first embodiment of the present invention. The present application mainly relates to how to defend against data interaction requests generated during the Web front-end page display phase, so that users can access the website normally. It should be noted that if there is substantially the same result, the method of the present invention does not Figure 1 The process sequence shown is limited. Figure 1 As shown, the malicious request defense method based on the Web front-end page includes the following steps:

[0059] S1. Obtain a data interaction request for a Web front-end page, determine a request type of the data interaction request, and add a timestamp of the current data interaction request to a timestamp array corresponding to the request type.

[0060] In this step, the application divides the web page into the front-end page and the back-end page. The web front-end page is mainly responsible for page display, which mainly refers to the functional modules or buttons that users can directly see and touch in the web application, including: the structure of the web page, the visual appearance of the web, and the interactive implementation at the web level. The web back-end page is the business logic implementation, which is more about interacting with the database to process the corresponding business logic. What needs to be considered is how to implement functions, data access, platform stability and performance, etc.

[0061] In actual operation, this application divides the requests generated by (users in) the web front-end page into data interaction requests that need to send request data to the server, and local operation requests that do not need to send request data to the server, according to whether it is necessary to call the server's response data. Since local operation requests do not need to occupy server resources, there is no data interaction between them and the server, and it will not affect the user's normal access to Web pages. Therefore, this application ignores local operation requests, but data interaction requests that need to call the server's response data need to be monitored and defended. The specific steps of how this application monitors and defends can be referred to the records of steps S1 to S6.

[0062] This application divides the requests sent from the Web front-end page to the server into different categories of data interaction requests, wherein the data interaction requests include browser requests based on the browser and web requests based on the web page, wherein the browser requests include user requests generated based on the browser such as page refresh and history record, and the web requests include requests within the Web page, such as in the mailbox login page, the requests generated by the inbox, outbox and attachment download operations are web requests, and the requests generated by page refresh, etc. are browser requests.

[0063] In actual work, the web requests of this application include but are not limited to: button clicks, content input, obtaining URL links in web pages, etc. Browser requests include but are not limited to: page refresh operations, reading links on history pages, directly reading links determined by searching in pages, etc.

[0064] Furthermore, since the page refresh operation often requires relatively more server resources during actual work, the present application further divides the page refresh operation into a page refresh request, which specifically corresponds to the user's refresh operation, so that the present application can defend against malicious requests more specifically.

[0065] Furthermore, in order to prevent hackers from forging data interaction requests, the present application sets data interaction requests (including browser requests and WEB requests) to a specific format, thereby achieving strict screening of data interaction requests, such as the data interaction request including but not limited to: request type identification, request parameters, request header information, request body information, Uniform Resource Identifier (URI); parameter information contained in the Uniform Resource Locator (URL).

[0066] In this step, the method of adding the timestamp of the current time to the timestamp array corresponding to the request type is as follows:

[0067] a. Obtain a timestamp array of the request type from the browser cache;

[0068] b. Add the timestamp of the current time to the acquired timestamp array to obtain an updated timestamp array;

[0069] c. updating the timestamp array cached by the browser according to the updated timestamp array.

[0070] Furthermore, after adding the timestamp of the current time to the timestamp array corresponding to the request type, it also includes:

[0071] d. Obtain the user who initiated the data interaction request, and associate the user ID of the user with the timestamp of the current time in the timestamp array;

[0072] e. extracting, from the timestamp array, a personal timestamp array corresponding to different request types of the user according to the user identifier;

[0073] f. Obtaining the behavior data of the user of different request types according to the personal timestamp array;

[0074] g. Determine whether the user is an abnormal user based on the behavior data.

[0075] In actual work, this application needs to obtain the timestamp corresponding to each data interaction request, and merge the timestamps generated by the same type of data interaction requests together to form a timestamp array (that is, the timestamp array of the request type); the timestamp of this application can only contain time information, and the timestamp can also be set to a specific format for strict screening.

[0076] During actual work, the timestamp recorded in the present application is obtained through the data cache record. Each data interaction request will generate a corresponding data cache record. The data cache record of the present application records the name of the data interaction request, the timestamp array of the data interaction request, and the specific format data of the preset standard and other information. Each type of data cache record will be updated due to the newly added timestamp. In this way, the data cache record of the present application can not only be distinguished from the prior art more conveniently, but also can further help the present application to independently complete the malicious request defense work.

[0077] Preferably, the present application also obtains a data cache record corresponding to each data interaction request, wherein the key name of the data cache record corresponds to the name identifier of each type of data interaction request itself, and the key value of the data cache record is an array data with a timestamp.

[0078] In this step, the data cache records corresponding to each type of data interaction request are updated in real time, and the time span of the timestamp array in each type of data cache record is always the monitoring time period corresponding to the respective data interaction request.

[0079] In this step, the application divides the data cache records into browser cache records corresponding to browser requests and web cache records corresponding to web requests. Each data interaction request adds the timestamp corresponding to the time when the new request is initiated to the original timestamp array, and deletes the timestamp that is not within the monitoring time period.

[0080] In actual work, if a corresponding data cache record is not found in a data interaction request, the application should add a cache record (such as a Web cache record) for the data interaction request and initialize the cache value of the data cache record; if a browser cache record is found, the browser cache value is read. Furthermore, when naming the browser cache record and the WEB cache record, they can have the same suffix, or they can have different suffixes in the case of the same suffix to distinguish the above-mentioned browser cache record from the WEB cache record.

[0081] Furthermore, the key value of the data cache record of the present application will be updated in real time, and the key value of the data cache record (cache array) adopts an inert update strategy, that is, the key value of the data cache record is only updated at the next request. Preferably, the data cache record is also set to a specific format like the data interaction request, so as to achieve strict screening of the request, and the specific reference can be made to the setting method of the data interaction request in step S1.

[0082] S2. Obtaining the number of data interaction requests of different request types within the current monitoring time period according to the timestamp array;

[0083] In actual work, this application initializes the request monitor settings according to business needs and sets two parameters: 1. unit time T (ie, monitoring time period); 2. the maximum number of requests M allowed within unit time T (ie, monitoring time period).

[0084] This application builds a monitor in the WEB front-end page, and uses the monitor to determine whether the length (number) of the timestamp array corresponding to each type of data interaction request at each preset threshold time exceeds the preset length (number). If it exceeds, it is an abnormal access. If not, it is a normal access.

[0085] In the above monitor algorithm of the present application, the parameters unit time T and request number M can be customized according to the business situation to limit the frequency of data interaction requests. Through the monitor algorithm, the browser cache is used to manage request records, and the front-end page requests are monitored to detect frequent requests, so that the front-end page can defend against malicious requests.

[0086] This application puts the defense work of frequent requests on the client side, which no longer consumes server resources compared to the traditional server processing defense work. In addition, in the operation of the project, users can no longer generate abnormal behavior data, and the record of user behavior data is more realistic. It saves the server operation and maintenance costs and operating costs for enterprises.

[0087] In this step, the main purpose of this proposal is to obtain the number of requests for various data interaction requests per unit time. This application also records the number of various data interaction requests, the total number of all data interaction requests, and the time of each submission in the localSterage cache system to ensure persistent caching. Among them, the above localSterage is a local cache, which can still exist when the page is refreshed and never expires.

[0088] In this step, the monitor is set on the WEB front-end page, and the monitor uses real-time monitoring to determine whether the user's current access behavior is normal access; at the same time, multiple monitors can be set, and each monitor monitors a data interaction request and its generated data cache record and timestamp array. Preferably, since the page refresh request is relatively special and the server resources are more each time, a separate monitor can be set for the page refresh request.

[0089] Furthermore, a monitor is set at the front end of the page, and the monitor is used to determine in real time whether the format of the data interaction request, data cache record and timestamp is correct. If not, it means that it is not a normal access. If correct, it is determined whether it is a normal access based on subsequent steps.

[0090] In this step, the monitor determines whether the number of data interaction requests within the unit time T is within the preset allowable range by judging the length (number) of the timestamp array in real time. The unit time T (that is, the monitoring time period) can be determined by the time recorded by the timestamp, and the length of the timestamp array can be judged by the monitor. Therefore, the technical solution of the present application can be implemented on the front-end page.

[0091] In this step, obtaining the number of data interaction requests of different request types within the current monitoring time period includes the following steps:

[0092] S21. For each request type, obtain a timestamp array of the request type;

[0093] S22, filtering the timestamps in the timestamp array whose corresponding time is not within the current monitoring time period, to obtain a filtered timestamp array of the request type;

[0094] S23. Obtain the number of the timestamps in the filtering timestamp array as the request number of the data interaction request of the request type.

[0095] In actual operation, the time span of the timestamps corresponding to each data interaction request is the monitoring time period recorded in the above steps (that is, the unit time T), and the end point of the timestamp array is the time corresponding to the current data interaction request. Timestamps that are not within the monitoring time period can be filtered out by this application.

[0096] In actual operation, the present application can intercept the timestamps of each data interaction request from each data cache record according to the preset unit time T, and add the timestamp generated by the current data interaction request to the original timestamp according to the category. At the same time, the unit time T described in the present application can be obtained from the time recorded by each timestamp, and the present application will also filter out the timestamps that are not within the above unit time T.

[0097] Preferably, the timestamp of the present application is also divided into a browser timestamp corresponding to the browser and a web timestamp corresponding to the web. Furthermore, the present application also specifically provides a page refresh timestamp, which is used to specifically record the number of page refresh requests of the user.

[0098] In this step, the data interaction requests of the present application are divided according to the request type, and a threshold time (that is, a monitoring time period) is preset for the data interaction requests of each request type. The preset threshold time of the present application is set by the technician according to the memory size of the server response data called by each data interaction request. The more server resources called, the shorter the preset threshold time is, and the smaller the number of allowed requests is. For example, the monitoring time period (that is, the preset threshold time) of the WEB page refresh request in the present application is 10 seconds, and the number of allowed requests is 5. For another example, the monitoring time period (that is, the preset threshold time) of the button click request in the web page is 2 seconds, and the number of allowed requests is 4.

[0099] S3. If the number of requests corresponding to the request type is greater than the request number threshold of the request type, the request type is regarded as an abnormal request type;

[0100] In actual work, when the data interaction request is an abnormal request type, this application also includes the following steps:

[0101] a1. Obtain the submission duration of the abnormal request type according to the filtering timestamp array;

[0102] b1. Calculate the submission frequency of the abnormal request type according to the submission duration and the number of requests; wherein the submission frequency of the abnormal request type is equal to the submission duration divided by the number of requests;

[0103] c1. If the submission frequency is greater than the request frequency threshold of the abnormal request type, the abnormal request type is regarded as a malicious request type;

[0104] d1. If a data interaction request of the malicious request type is received, reject the data interaction request.

[0105] In actual work, this application also includes adjusting the historical monitoring time period so that this application can defend against malicious requests more accurately. It specifically includes the following steps:

[0106] a2. Mark the current monitoring time period as an abnormal period;

[0107] b2. Obtain the number of data interaction requests of different request types within multiple consecutive non-abnormal historical monitoring time periods closest to the current time;

[0108] c3. For each of the request types, obtaining the average number of requests according to the number of requests in different historical monitoring time periods;

[0109] d4. Adjust the request quantity threshold corresponding to the request type according to the average request quantity.

[0110] S5. If the number of the abnormal request types is greater than a first number threshold, determine that the current access is an abnormal access.

[0111] In actual work, when it is determined to be a normal access, the timestamp corresponding to the current data interaction request is added to the filtered timestamp array, and then converted into a browser cache value and stored in the browser cache record.

[0112] The present application can also check whether the format of cache records and data interaction requests is a preset format, thereby determining whether the user's access request is a malicious request.

[0113] In this step, when determining whether a data interaction request is a malicious request, the present application can further determine based on the frequency of the data interaction request. The request frequency = the number of cached records per unit time / the preset unit time of each data interaction request. If a request frequency is higher than a preset threshold, the web page request is determined to be a malicious request.

[0114] In actual operation, this application does not add a proxy service device when determining whether a user's access request is a malicious request. This application can defend against malicious requests only through the web client's own web page function by taking only the cache value.

[0115] S6. Log out of the current login account and send an identity authentication request to implement malicious request defense.

[0116] In this step, online identity authentication is a prior art and will not be described in detail here. When the online identity authentication fails, the user name and user IP address of the malicious request can be recorded, and then the user name and user IP address can be stored in the blacklist library of the server system, which can effectively prevent the user from submitting maliciously again. Preferably, the above blacklist information can also be stored in the local database of the WEB page.

[0117] After the current login account is logged out and the identity authentication request is sent, the following steps are also included:

[0118] a. When the identity authentication is passed, the abnormal request count of the current user is increased by one, and the monitoring time period is shortened;

[0119] b. If the abnormal request count is greater than a preset number threshold, the current login account is logged out again and the corresponding user is marked as an abnormal user;

[0120] c. If a login request from the abnormal user is received within a second preset time period from the current time, the login request is rejected.

[0121] d. If the user's access request is a normal access, the page access request is sent to the server to interact with the server; if the user's access request is an abnormal access, the user is asked to perform online identity verification within a preset time period to reconfirm the user's identity.

[0122] In actual work, the technical problem to be solved by the present application is how to more accurately judge whether a user's access request is a malicious request without occupying server resources. The prior art not only needs to call the server's resources when judging whether it is a malicious request, but also does not classify the type of request. As a result, the prior art can only judge whether all requests within a unit of time are malicious requests together, and cannot judge whether the user's access request is a malicious request in a targeted manner based on the server resources actually to be called. That is, the judgment result of the prior art is not as accurate as that of the present application.

[0123] In actual operation, the cache in the prior art stores the number of requests and the request submission time, while the cache in the present application stores cache key names (request names), key values ​​(timestamp arrays), and other types of content. At the same time, the prior art only records whether the user's access request is malicious by whether the number of requests per unit time exceeds a preset range, and there is no record of the need to classify the requests. In the present application, whether the user's access request is malicious is determined by the length of the timestamp array per unit time, and the requests are classified, and each type of request is individually judged whether it is malicious. Therefore, the technical solution of the present application is different from the technical solution of the prior art.

[0124] Figure 2 FIG. 2 is a schematic diagram of a malicious request defense device based on a Web front-end page according to a second embodiment of the present invention. Figure 2 As shown, the malicious request defense device based on the Web front-end page includes:

[0125] The request collection module 21 is used to obtain a data interaction request for a Web front-end page, determine the request type of the data interaction request, and add the timestamp of the current data interaction request to a timestamp array corresponding to the request type;

[0126] A request quantity monitoring module 22, used for obtaining the request quantity of data interaction requests of different request types within a current monitoring time period according to the timestamp array;

[0127] an abnormal request determination module 23, configured to treat the request type as an abnormal request type if the number of requests corresponding to the request type is greater than a request number threshold of the request type;

[0128] An abnormal request confirmation module 24, configured to determine that the current access is an abnormal access if the number of the abnormal request type is greater than a first number threshold;

[0129] The user identity authentication module 25 is used to log out of the current login account and send an identity authentication request.

[0130] In actual work, the specific limitations of the malicious request defense device based on the Web front-end page can be found in the limitations of the malicious request defense method based on the Web front-end page above, which will not be repeated here. Each module in the above-mentioned malicious request defense device based on the Web front-end page can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0131] Figure 3Schematic diagram of the structure of the electronic device according to the third embodiment of the present invention. Figure 3 As shown, the electronic device 30 includes a processor 31 and a memory 32 coupled to the processor 31 .

[0132] The memory 32 stores program instructions for implementing the malicious request defense method based on a Web front-end page of any of the above embodiments.

[0133] The processor 31 is used to execute program instructions stored in the memory 32 to perform malicious request defense processing based on the Web front-end page.

[0134] The processor 31 may also be referred to as a CPU (Central Processing Unit). The processor 31 may be an integrated circuit chip having signal processing capabilities. The processor 31 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0135] See also Figure 4 , Figure 4 Schematic diagram of the structure of the storage medium of the fourth embodiment of the present invention. The storage medium 40 of the fourth embodiment of the present invention stores program instructions 41 that can implement all the above methods, wherein the program instructions 41 can be stored in the above storage medium in the form of a software product, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or terminal devices such as a computer, a server, a mobile phone, and a tablet.

[0136] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0137] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units. The above is only an implementation mode of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present invention.

[0138] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile and / or volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0139] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, this application only uses the division of the above-mentioned functional units and modules as examples. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

Claims

1. A method for defending against malicious requests based on a Web front-end page, characterized in that: include: Obtain a data interaction request for a Web front-end page, determine a request type of the data interaction request, and add a timestamp of the current data interaction request to a timestamp array corresponding to the request type; The data interaction request includes a browser request based on a browser and a web request based on a web page, wherein the browser request includes a user request generated by a browser, and the web request includes a request inside a web page; After adding the timestamp of the current data interaction request to the timestamp array corresponding to the request type, the method further includes: obtaining the user who initiated the data interaction request, associating the user ID of the user with the timestamp of the current time in the timestamp array; extracting the personal timestamp array corresponding to the different request types of the user from the timestamp array according to the user ID; obtaining the behavior data of the user of different request types according to the personal timestamp array; and determining whether the user is an abnormal user according to the behavior data; Obtaining the number of data interaction requests of different request types within the current monitoring time period according to the timestamp array; obtaining the number of data interaction requests of different request types within the current monitoring time period according to the timestamp array, including, for each of the request types, obtaining the timestamp array of the request type; filtering the timestamps in the timestamp array whose corresponding times are not within the current monitoring time period to obtain a filtered timestamp array of the request type; obtaining the number of the timestamps in the filtered timestamp array as the number of data interaction requests of the request type; If the number of requests corresponding to the request type is greater than the request number threshold of the request type, the request type is regarded as an abnormal request type; If the number of the abnormal request types is greater than a first number threshold, determining that the current access is an abnormal access; Log out of the current login account and send an authentication request to prevent malicious requests; When the identity authentication is passed, the abnormal request count of the current user is increased by one, and the monitoring time period is shortened; If the abnormal request count is greater than the preset number threshold, the current login account is logged out again and the corresponding user is marked as an abnormal user; If a login request from the abnormal user is received within a second preset time period from the current time, the login request is rejected.

2. The method for defending against malicious requests based on a Web front-end page according to claim 1, characterized in that: If the number of requests corresponding to the request type is greater than the request number threshold of the request type, then after treating the request type as an abnormal request type, the method further includes: Obtaining the submission duration of the abnormal request type according to the filtering timestamp array; Calculate the submission frequency of the abnormal request type according to the submission duration and the number of requests; If the submission frequency is greater than the request frequency threshold of the abnormal request type, the abnormal request type is regarded as a malicious request type; If a data interaction request of the malicious request type is received, the data interaction request is rejected.

3. The method for defending against malicious requests based on a Web front-end page according to claim 1, characterized in that: The adding the timestamp of the current data interaction request to the timestamp array corresponding to the request type includes: Get the timestamp array of the request type from the browser cache; Add the timestamp of the current time to the acquired timestamp array to obtain an updated timestamp array; The timestamp array cached by the browser is updated according to the updated timestamp array.

4. The method for defending against malicious requests based on a Web front-end page according to claim 1, characterized in that: If the number of requests corresponding to the request type is greater than the request number threshold of the request type, then after treating the request type as an abnormal request type, the method further includes: Marking the current monitoring time period as an abnormal period; Obtain the number of data interaction requests of different request types within multiple consecutive non-abnormal historical monitoring time periods closest to the current time; For each of the request types, obtaining an average number of requests according to the number of requests in different historical monitoring time periods; The request quantity threshold corresponding to the request type is adjusted according to the average request quantity.

5. A malicious request defense device based on a Web front-end page, characterized in that: include: A request collection module is used to obtain a data interaction request for a Web front-end page, determine the request type of the data interaction request, and add the timestamp of the current data interaction request to a timestamp array corresponding to the request type; The data interaction request includes a browser request based on a browser and a web request based on a web page, wherein the browser request includes a user request generated by a browser, and the web request includes a request inside a web page; after adding the timestamp of the current data interaction request to the timestamp array corresponding to the request type, it also includes: obtaining the user who initiated the data interaction request, associating the user identifier of the user with the timestamp of the current time in the timestamp array; extracting a personal timestamp array corresponding to different request types of the user from the timestamp array according to the user identifier; obtaining the behavior data of the user of different request types according to the personal timestamp array; and determining whether the user is an abnormal user according to the behavior data; A request quantity monitoring module is used to obtain the request quantity of data interaction requests of different request types within the current monitoring time period according to the timestamp array; the obtaining the request quantity of data interaction requests of different request types within the current monitoring time period according to the timestamp array includes, for each of the request types, obtaining the timestamp array of the request type; filtering the timestamps in the timestamp array whose corresponding time is not within the current monitoring time period to obtain a filtered timestamp array of the request type; obtaining the number of the timestamps in the filtered timestamp array as the request quantity of data interaction requests of the request type; an abnormal request determination module, configured to treat the request type as an abnormal request type if the number of requests corresponding to the request type is greater than a request number threshold of the request type; an abnormal request confirmation module, configured to determine that the current access is an abnormal access if the number of the abnormal request type is greater than a first number threshold; The user identity authentication module is used to log out of the current login account, send an identity authentication request, and implement malicious request defense; when the identity authentication is passed, the abnormal request count of the current user is accumulated by one, and the monitoring time period is shortened; if the abnormal request count is greater than the preset number of times threshold, the current login account is logged out again, and the corresponding user is marked as an abnormal user; within the second preset time length from the current time, if a login request from the abnormal user is received, the login request is rejected.

6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the malicious request defense method based on a Web front-end page as described in any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the steps of the malicious request defense method based on the Web front-end page as described in any one of claims 1 to 4 are implemented.