Benchmark testing method, device and server of web attack detection model
By capturing online traffic and simulating attacks on target websites, access and attack logs are generated and labeled to form a test dataset. This solves the problems of low testing efficiency and poor accuracy of existing web attack detection models, and achieves more efficient benchmark testing.
Patent Information
- Application Number
- CN202211210540.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-09-30
AI Technical Summary
In existing technologies, benchmark testing of web attack detection models suffers from low testing efficiency and inaccurate test results. This is mainly because the test data comes from training data provided by developers or publicly available attack sample libraries, resulting in poor data exclusivity and incomplete coverage of attack types.
By capturing and storing real online traffic of the target website, replaying online network traffic samples, sending correct and attacking HTTP requests in the test environment, generating access and attack logs using the network application firewall rule engine, labeling samples and forming a test dataset, and processing them using the model under test to output benchmark test results.
It improves the efficiency and accuracy of model testing, ensures more comprehensive attack type coverage of test samples, reduces manpower and time costs, and enables rapid collection and construction of test samples.
Smart Images

Figure CN117857406B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a benchmark testing method, apparatus and server for a web attack detection model. Background Technology
[0002] Traditional web application attack detection primarily relies on Web Application Firewall (WAF) rules. This method mainly detects known attack types but suffers from false negatives and false negatives, and rule maintenance is challenging. The introduction of machine learning detection technology can reduce these issues, serving as a supplement to WAF rule-based detection. However, machine learning detection models require continuous updates and iterations to improve accuracy. Benchmarking the model in the early development stages effectively evaluates the impact of these updates. However, benchmarking is still in its early stages of algorithm testing and lacks sufficient test sample data.
[0003] In existing technologies, during the benchmarking phase of a model, test data comes from two sources: one is the data used by developers for model training, and the other is publicly available attack sample libraries online.
[0004] However, the inventors discovered that directly using the test data used by developers for model training does not satisfy the mutual exclusion of data for algorithm testing. Obtaining publicly available attack sample libraries online is time-consuming and labor-intensive, the number of samples collected in a short period of time is limited, and the attack types are not fully covered. As a result, when using test data in existing technologies to benchmark the Web attack detection model, there are often problems of low testing efficiency and inaccurate test results. Summary of the Invention
[0005] This invention provides a benchmark testing method, apparatus, and server for a web attack detection model, to solve the problems of low testing efficiency and inaccurate test results when benchmarking web attack detection models with test data in the prior art.
[0006] In a first aspect, the present invention provides a benchmark testing method for a web attack detection model, comprising:
[0007] Capture and store the actual online traffic of the target website to obtain network traffic samples;
[0008] The network traffic sample was replayed in a test environment to obtain the replayed traffic.
[0009] In a test environment, multiple HTTP requests are sent to the target website, including both legitimate HTTP requests and malicious HTTP requests.
[0010] Based on the replay traffic and multiple HTTP requests, multiple access logs and attack logs are generated;
[0011] Extract test samples from each access log and label them as normal samples; extract test samples from each attack log and label them as attack samples.
[0012] The attack samples and normal samples are extracted according to a preset ratio to form a test dataset;
[0013] The test dataset is processed using the web attack detection model to be tested, and the model test results are output.
[0014] Based on the model test results and the number of labeled attack samples, output the benchmark test results.
[0015] In one possible design, capturing and storing the actual online traffic of the target website to obtain a network traffic sample includes:
[0016] Configure an online traffic replay tool to capture and store the online traffic of the target website, thereby obtaining a network traffic sample.
[0017] In one possible design, the step of sending HTTP requests to the target website in a test environment, wherein the HTTP requests include both legitimate HTTP requests and malicious HTTP requests, includes:
[0018] In a test environment, use the JMeter tool to send the correct HTTP request to the target website;
[0019] The attack payload is passed to the web address of the correct HTTP request to obtain the attack HTTP request. The attack HTTP request is then sent to the target website in the test environment using the JMeter tool.
[0020] In one possible design, the generation of multiple attack logs and multiple access logs based on the replay traffic and multiple HTTP requests includes:
[0021] The replay traffic and any one of the multiple HTTP requests are input into the network application firewall rule engine, so that the firewall rule engine parses the first request content of the replay traffic and the second request content of any one of the HTTP requests respectively; the parsing results are matched in the matching rule base in the firewall rule engine. If the match is successful, a defense action is taken and an attack log is recorded; if the match is unsuccessful, an access log is recorded.
[0022] In one possible design, the step of outputting benchmark test results based on the model test results and the number of labeled attack samples includes:
[0023] Obtain the number of attack samples in the model test results;
[0024] The ratio of the number of attack samples to the number of labeled attack samples in the model test results is determined as the benchmark test result.
[0025] Secondly, the present invention provides a benchmark testing apparatus for a web attack detection model, comprising:
[0026] The traffic capture module is used to capture and store the real online traffic of the target website to obtain network traffic samples;
[0027] The traffic replay module is used to replay the network traffic sample in a test environment to obtain the replayed traffic;
[0028] The attack simulation module is used to send multiple HTTP requests to a target website in a test environment, including both legitimate HTTP requests and attack HTTP requests.
[0029] The network application firewall rule engine is used to generate multiple access logs and attack logs based on the replay traffic and multiple HTTP requests;
[0030] The test sample extraction module is used to extract test samples from each access log and label them as normal samples, and to extract test samples from each attack log and label them as attack samples; the attack samples and the normal samples are extracted according to a preset ratio to form a test dataset;
[0031] The test result analysis module is used to process the test dataset using the web attack detection model to be tested and output the model test results; based on the model test results and the number of labeled attack samples, it outputs the benchmark test results.
[0032] Thirdly, the present invention provides a server, comprising: at least one processor and a memory;
[0033] The memory stores computer-executed instructions;
[0034] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the benchmark testing method for the web attack detection model as described in the first aspect and various possible designs of the first aspect.
[0035] Fourthly, the present invention provides a computer storage medium storing computer execution instructions, wherein when a processor executes the computer execution instructions, a benchmark testing method for the web attack detection model described in the first aspect and various possible designs of the first aspect is implemented.
[0036] The web attack detection model benchmark testing method, apparatus, and server provided by this invention, through replaying online network traffic samples and simulating attacks on target websites in the early stage of model development, attack samples and normal samples are labeled. The attack samples and normal samples are extracted to obtain test samples, which are used as the test dataset of the model to be detected. The model to be detected is used to process the test dataset, and the labeling results and model test results are compared to obtain the benchmark test results. This method can quickly collect and construct test samples, improving the efficiency of model testing; and the simulated attacks make the attack types of the test samples more comprehensive, improving the accuracy of model testing. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 A schematic flowchart of the benchmark testing method for the web attack detection model provided in this embodiment of the invention. Figure 1 ;
[0039] Figure 2 A schematic flowchart of the benchmark testing method for the web attack detection model provided in this embodiment of the invention. Figure 2 ;
[0040] Figure 3 A schematic diagram of the structure of a benchmark testing device for a web attack detection model provided in an embodiment of the present invention;
[0041] Figure 4 This is a schematic diagram of the hardware structure of a server provided in an embodiment of the present invention. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0043] Web application attack detection primarily relies on WAF rules. This method mainly detects known attack types, but the limitations of regular expressions in this approach lead to false negatives and false positives, and rule maintenance is challenging. The introduction of machine learning detection technology can reduce false negatives and false positives in rule-based protection, serving as a supplement to WAF rule-based detection. Machine learning detection models require continuous updates and iterations to improve accuracy. In the early stages of development, benchmarking the model can effectively evaluate the effects of these updates. However, benchmarking is still in its early stages of algorithm testing, lacking sufficient sample data accumulation. The main difficulty in benchmarking lies in the construction and collection of test samples. In existing technologies, test data for model benchmarking comes from two sources: data used by developers for model training and publicly available attack sample libraries.
[0044] However, directly using test data that developers use for model training does not satisfy the data mutual exclusion requirement for algorithm testing. Collecting publicly available attack samples from the internet requires a certain investment of manpower and time, the number of samples collected in a short period of time is limited, the attack types are not fully covered, the testing efficiency is low, and the test results are inaccurate.
[0045] To address the aforementioned technical problems, this invention proposes the following technical solution: In the early stages of model development, attack samples and normal samples are obtained by replaying online network traffic samples and simulating attacks on target websites. These attack samples and normal samples are then extracted and used as test samples. These test samples are used as the test dataset for the detection model. The detection model is then used to process the test dataset, and the annotation results and model test results are compared to obtain the benchmark test results. This method can quickly collect and construct test samples, and the attack types covered by the test samples are more comprehensive, which can improve the efficiency and accuracy of model testing.
[0046] Figure 1 A schematic flowchart of the benchmark testing method for the web attack detection model provided in this embodiment of the invention. Figure 1 In this embodiment, the executing entity can be a server; however, no special restrictions are imposed here. Figure 1 As shown, the method includes:
[0047] S101: Capture and store the actual online traffic of the target website to obtain a network traffic sample.
[0048] In this embodiment, the capture of the target website's actual online traffic is performed randomly. The traffic consists of all requests within a certain time period.
[0049] In this embodiment, the network traffic sample includes both normal requests and attack requests. Optionally, the network traffic sample includes a certain number of normal requests and a small number of attack requests.
[0050] In one embodiment of the present invention, an online traffic replay tool is configured to capture and store online traffic to obtain a network traffic sample.
[0051] Among them, the online traffic playback tool can be either GoReplay, a traffic recording and playback tool, or SandboxRepeater, a traffic playback tool.
[0052] S102: Replay the network traffic sample in the test environment to obtain the replayed traffic.
[0053] In this embodiment, the purpose of traffic replay is to replay network traffic samples in the test environment.
[0054] Optionally, if the network traffic sample contains a certain number of normal requests and a small number of attack requests, the normal requests and the small number of attack requests in the network traffic sample will not change after the traffic replay process.
[0055] S103: Send multiple HTTP requests to the target website in a test environment, including both legitimate HTTP requests and malicious HTTP requests.
[0056] In one embodiment of the present invention, a valid HTTP request is sent to the target website using the JMeter tool in a test environment. An attack payload is passed to the web address of the HTTP request to obtain an attack HTTP request, which is then sent to the target website using the JMeter tool in the test environment.
[0057] In this embodiment, the attacking HTTP request serves to simulate an attack, by sending an attacking HTTP request to the target website to simulate an attack on the target website.
[0058] For example, an attack payload could be: http: / / www.test.com / ?id=1%20or%201=1.
[0059] In this embodiment, a normal HTTP request serves as a normal access function, simulating access to the target website by sending a normal HTTP request to the target website.
[0060] S104: Generate multiple access logs and attack logs based on the replay traffic and multiple HTTP requests.
[0061] In one embodiment of the present invention, the replay traffic and any one of the multiple HTTP requests are input into the network application firewall rule engine, so that the firewall rule engine parses the first request content of the replay traffic and the second request content of any one of the HTTP requests respectively; the parsing result is matched in the matching rule library in the firewall rule engine. If the match is successful, a defense action is performed and an attack log is recorded; if the match is unsuccessful, an access log is recorded.
[0062] In this embodiment, when matching the first and second request contents in the matching rule base of the firewall rule engine, the matched content includes: request URL, HTTP request headers, HTTP request body, and XML DOM, etc. For example, the rule for SQL injection attacks is to detect whether the request cookie, request parameters, or XML DOM contains strings of a certain format. Another example is HTTP header injection attacks; if the request header contains "\n|\r", it is considered an HTTP header injection attack. Automated attacks are determined by matching malicious crawlers using the User-Agent.
[0063] In this embodiment, the Web Application Firewall (WAF) rule engine generates multiple access logs and attack logs from the replay traffic and multiple HTTP requests.
[0064] The rule engine is actually an inference engine, used to match input data with rules to derive conclusions. The WAF rule engine, on the other hand, matches replay traffic and multiple HTTP requests with rules in the Web Application Firewall rule engine to generate access logs and attack logs.
[0065] S105: Extract test samples from each access log and label them as normal samples; extract test samples from each attack log and label them as attack samples.
[0066] In this embodiment, the operation of extracting test samples and labeling them as normal samples or attack samples is done manually. Normal samples are labeled as (0), and attack samples are labeled as (1), which facilitates the subsequent statistics on the number of normal samples and the number of attack samples.
[0067] S106: Extract attack samples and normal samples according to a preset ratio to form a test dataset.
[0068] In this embodiment, attack samples and normal samples are extracted in a ratio of 1 to 3:9. For example, the ratio of attack samples to normal samples is 1:9, 2:9 or 3:9.
[0069] S107: Process the test dataset using the web attack detection model to be tested, and output the model test results.
[0070] In this embodiment, the model test results output by the web attack detection model include the number of attack samples and the number of normal samples. The web attack detection models include cross-site scripting (XSS) attack detection models, structured query language (SQL) injection detection models, etc. These detection models are machine learning detection models for attack types that lack sample accumulation.
[0071] S108: Output benchmark test results based on model test results and the number of labeled attack samples.
[0072] In one embodiment of the present invention, the number of attack samples in the model test results is obtained, and the ratio of the number of attack samples in the model test results to the number of labeled attack samples is determined as the benchmark test result.
[0073] The number of labeled attack samples is the number of attack samples extracted and labeled from each attack log in step S105.
[0074] The test dataset can be reused in the continuous optimization and iteration of the web attack detection model. By comparing the iterative test results with the benchmark test results, the effectiveness of the model optimization can be quickly tested.
[0075] In summary, the benchmark testing method for the web attack detection model provided in this embodiment obtains attack samples and normal samples by replaying online network traffic samples and simulating attacks on target websites in the early stage of model development. The attack samples and normal samples are then extracted to obtain test samples, which are used as the test dataset for the model to be detected. The model to be detected is then used to process the test dataset, and the annotation results and model test results are compared to obtain the benchmark test results. This method can quickly collect and construct test samples, improving the efficiency of model testing. Furthermore, the simulated attacks make the attack types of the test samples more comprehensive, improving the accuracy of model testing.
[0076] Figure 2 A schematic flowchart of the benchmark testing method for the web attack detection model provided in this embodiment of the invention. Figure 2 This embodiment is in Figure 1 Implementation examples based on the provided embodiments. For example... Figure 2 As shown, the method includes:
[0077] S201: Configure an online traffic replay tool to capture and store the online traffic of the target website, thereby obtaining a network traffic sample.
[0078] S202: Replay the network traffic sample in the test environment to obtain the replayed traffic.
[0079] S203: In the test environment, send a valid HTTP request to the target website using the JMeter tool; pass the attack payload into the web address of the valid HTTP request to obtain the attack HTTP request, and then send the attack HTTP request to the target website in the test environment using the JMeter tool.
[0080] S204: Input the replay traffic and any one of the multiple HTTP requests into the network application firewall rule engine, so that the firewall rule engine can parse the first request content of the replay traffic and the second request content of any one of the HTTP requests respectively; match the parsing results in the matching rule base in the firewall rule engine. If the match is successful, perform defense actions and record attack logs; if the match is unsuccessful, record access logs.
[0081] S205: Extract test samples from each access log and label them as normal samples; extract test samples from each attack log and label them as attack samples.
[0082] S206: Extract attack samples and normal samples according to a preset ratio to form a test dataset.
[0083] S207: Use the web attack detection model under test to process the test dataset and output the model test results.
[0084] S208: Obtain the number of attack samples in the model test results; determine the ratio of the number of attack samples in the model test results to the number of labeled attack samples as the benchmark test result.
[0085] In summary, the benchmark testing method for the web attack detection model provided in this embodiment, in the early stage of model development, involves replaying online network traffic samples and simulating attacks on the target website. Attack logs and access logs generated by the WAF rule engine are collected, and target test data are extracted and labeled as attack samples and normal samples. These extracted attack and normal samples form the test dataset for the detection model. The model to be detected processes the test dataset, and the labeled results and model test results are compared to obtain the benchmark test results. This method simulates attacks on the target website by sending attack HTTP requests to the target website in the test environment. This not only provides more comprehensive attack type coverage but also collects more attack samples in a shorter time, with lower manpower and time costs, and better data exclusivity for model training. The WAF rule engine is used to convert replay traffic and HTTP requests into attack logs and access logs, enabling rapid construction of test samples.
[0086] Figure 3 This is a schematic diagram of the structure of a benchmark testing device for a web attack detection model provided in an embodiment of the present invention. Figure 3 As shown, the benchmark testing device for this web attack detection model includes: a traffic capture module 301, a traffic replay module 302, an attack simulation module 303, a network application firewall rule engine 304, a test sample extraction module 305, and a test result analysis module 306.
[0087] The traffic capture module 301 is used to capture and store the real online traffic of the target website to obtain network traffic samples.
[0088] The traffic replay module 302 is used to replay network traffic samples in a test environment to obtain replayed traffic.
[0089] Attack simulation module 303 is used to send multiple HTTP requests to a target website in a test environment, including both legitimate HTTP requests and attack HTTP requests.
[0090] The 304 rule engine of the Web Application Firewall is used to generate multiple access logs and attack logs based on replay traffic and multiple HTTP requests.
[0091] The test sample extraction module 305 is used to extract test samples from each access log and label them as normal samples, and to extract test samples from each attack log and label them as attack samples; the attack samples and normal samples are extracted according to a preset ratio to form a test dataset.
[0092] The test result analysis module 306 is used to process the test dataset using the web attack detection model under test and output the model test results; based on the model test results and the number of labeled attack samples, it outputs the benchmark test results.
[0093] In one possible implementation, the traffic capture module 301 is specifically used to configure an online traffic replay tool, which captures and stores the online traffic of the target website to obtain a network traffic sample.
[0094] In one possible implementation, the attack simulation module 303 is specifically used to send correct HTTP requests to the target website in a test environment using the JMeter tool;
[0095] The attack payload is passed into the web address of the HTTP request, and the attack HTTP request is sent to the target website in the test environment using the JMeter tool.
[0096] In one possible implementation, the network application firewall rule engine 304 is specifically used to input the replay traffic and any one of the multiple HTTP requests into the network application firewall rule engine, so that the firewall rule engine parses the first request content of the replay traffic and the second request content of any one of the HTTP requests respectively; the parsing result is matched in the matching rule base in the firewall rule engine; if the match is successful, a defense action is performed and an attack log is recorded; if the match is unsuccessful, an access log is recorded.
[0097] In one possible implementation, the test result analysis module 306 is specifically used to extract the number of attack samples from the model test results and determine the ratio of the number of attack samples in the model test results to the number of attack samples in the labeled results as the benchmark test result.
[0098] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.
[0099] Figure 4 This is a schematic diagram of the hardware structure of a server provided in an embodiment of the present invention. Figure 4 As shown, the server in this embodiment includes: a processor 401 and a memory 402; wherein
[0100] Memory 402 is used to store instructions executed by the computer;
[0101] Processor 401 is used to execute computer execution instructions stored in memory to implement the various steps performed by the server in the above embodiments. For details, please refer to the relevant descriptions in the foregoing method embodiments.
[0102] Alternatively, the memory 402 can be either standalone or integrated with the processor 401.
[0103] When the memory 402 is configured independently, the server also includes a bus 403 for connecting the memory 402 and the processor 401.
[0104] This invention also provides a computer storage medium storing computer execution instructions. When the processor executes the computer execution instructions, it implements the benchmark testing method for the web attack detection model described above.
[0105] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements a benchmark testing method for the web attack detection model described above.
[0106] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements a benchmark testing method for the web attack detection model described above.
[0107] In the several embodiments provided by this invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0108] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to implement the solution of this embodiment according to actual needs.
[0109] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.
[0110] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention.
[0111] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0112] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.
[0113] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0114] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0115] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.
[0116] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A benchmark testing method for a web attack detection model, characterized in that, include: Capture and store the actual online traffic of the target website to obtain network traffic samples; The network traffic sample was replayed in a test environment to obtain the replayed traffic. In a test environment, multiple HTTP requests are sent to the target website, including both legitimate HTTP requests and malicious HTTP requests. Based on the replay traffic and multiple HTTP requests, multiple access logs and attack logs are generated; Extract test samples from each access log and label them as normal samples; extract test samples from each attack log and label them as attack samples. The attack samples and normal samples are extracted according to a preset ratio to form a test dataset; The test dataset is processed using the web attack detection model to be tested, and the model test results are output. Based on the model test results and the number of labeled attack samples, output the benchmark test results.
2. The method according to claim 1, characterized in that, The process of capturing and storing the actual online traffic of the target website to obtain network traffic samples includes: Configure an online traffic replay tool to capture and store the online traffic of the target website, thereby obtaining a network traffic sample.
3. The method according to claim 1, characterized in that, The step of sending HTTP requests to the target website in a test environment, wherein the HTTP requests include both legitimate HTTP requests and malicious HTTP requests, includes: In a test environment, use the JMeter tool to send the correct HTTP request to the target website; The attack payload is passed to the web address of the correct HTTP request to obtain the attack HTTP request. The attack HTTP request is then sent to the target website in the test environment using the JMeter tool.
4. The method according to claim 1, characterized in that, The process of generating multiple attack logs and multiple access logs based on the replayed traffic and multiple HTTP requests includes: The replay traffic and any one of the multiple HTTP requests are input into the network application firewall rule engine, so that the firewall rule engine parses the first request content of the replay traffic and the second request content of any one of the HTTP requests respectively; the parsing results are matched in the matching rule base of the firewall rule engine. If the match is successful, a defense action is taken and an attack log is recorded; if the match is unsuccessful, an access log is recorded.
5. The method according to any one of claims 1-4, characterized in that, The step of outputting benchmark test results based on the model test results and the number of labeled attack samples includes: Obtain the number of attack samples in the model test results; The ratio of the number of attack samples to the number of labeled attack samples in the model test results is determined as the benchmark test result.
6. A benchmark testing device for a web attack detection model, characterized in that, include: The traffic capture module is used to capture and store the real online traffic of the target website to obtain network traffic samples; The traffic replay module is used to replay the network traffic sample in a test environment to obtain the replayed traffic; The attack simulation module is used to send multiple HTTP requests to a target website in a test environment, including both legitimate HTTP requests and attack HTTP requests. The network application firewall rule engine is used to generate multiple access logs and attack logs based on the replay traffic and multiple HTTP requests; The test sample extraction module is used to extract test samples from each access log and label them as normal samples, and to extract test samples from each attack log and label them as attack samples; the attack samples and the normal samples are extracted according to a preset ratio to form a test dataset; The test result analysis module is used to process the test dataset using the web attack detection model under test and output the model test results. Based on the model test results and the number of labeled attack samples, output the benchmark test results.
7. The apparatus according to claim 6, characterized in that, The traffic capture module is specifically used to configure an online traffic replay tool, capture and store the online traffic of the target website through the online traffic replay tool, and obtain network traffic samples.
8. The apparatus according to claim 6, characterized in that, The attack simulation module is specifically used for, In a test environment, use the JMeter tool to send the correct HTTP request to the target website; The attack payload is passed to the web address of the correct HTTP request to obtain the attack HTTP request. The attack HTTP request is then sent to the target website in the test environment using the JMeter tool.
9. A server, characterized in that, include: Processor and memory; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform a benchmark testing method for the web attack detection model as described in any one of claims 1 to 5.
10. A computer storage medium, characterized in that, The computer storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, it implements the benchmark testing method of the web attack detection model as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Construction method of URL-based classification model and Webshell attack website detection method
CN107888616A
Attack detection method and device based on attack detection model, medium and equipment
CN114553523A
