Intelligent Web application protection method based on AI semantics

By building a deep learning-driven neural network model, combining pre-trained language model, replacing the traditional WAF rule matching mechanism, efficient threat evaluation and identification of network requests is achieved, and the problems of performance bottlenecks and 0day vulnerability attacks in traditional WAF technology are solved. , improves the efficiency and security of web application protection.

CN119030732APending Publication Date: 2024-11-26HANGZHOU ANQUAN DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410895999.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

Traditional WAF technology relies on a complex regular expression policy library, resulting in reduced response delay and processing capabilities in scenarios such as large rule sets or frequent requests, and is unable to effectively intercept 0day vulnerability attacks, which has performance and security vulnerability issues.

Method used

Adopting an intelligent web application protection method based on AI semantics, by building a deep learning-driven neural network model, combining pre-trained language model and specific domain parameters, it realizes efficient and accurate threat evaluation and identification of network requests, and replaces the traditional rule matching mechanism. Dynamically adjust protection strategies.

Benefits of technology

It significantly improves the efficiency and protection capabilities of web application protection, can actively identify and intercept 0day attacks, reduce the risk of unknown threats, avoid performance bottlenecks caused by security checks, and ensures high-speed response and high processing capabilities of web applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030732A_ABST
    Figure CN119030732A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Web application protection, in particular to an intelligent Web application protection method based on AI semanteme, which adopts the following steps: S10: a model construction stage: constructing an AI model; s20, a model application stage: seamlessly fusing the AI model in the step S10 into an existing Web application security protection system to form an intelligent brain module for security protection execution; when the intelligent brain module recognizes a high-risk request, the system immediately starts high-level defense measures, such as enhancing an authentication process, limiting access authority or directly blocking connection, and keeps relatively low intervention on low-risk or normal flow, so that the user experience is not influenced; according to the method, the operation efficiency of Web application protection is improved, the accurate identification capability of AI on normal contexts is ingeniously utilized, abnormal request behaviors are strictly screened and intercepted on the basis, and an active defense barrier aiming at 0day vulnerability attacks is effectively constructed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Web application protection, and in particular to an intelligent Web application protection method based on AI semantics. Background Art

[0002] WAF (web application firewall) is mainly deployed at the edge of the enterprise network. It is used as the core key device (product) for web application protection and is also the main means of web protection. At present, the core implementation of WAF technology is to load the ModSecurity module on mainstream web servers such as Apache. The ModSecurity engine is based on regular expressions and builds a policy protection library, which can effectively detect and block various web attacks such as SQL injection, cross-site scripting (XSS), and illegal resource access.

[0003] Apache: One of the most widely used web servers on the Internet, it supports cross-platform operation and is suitable for most operating systems, including Windows, Linux, Unix, etc. Modsecurity: It is an intrusion detection and protection engine, mainly used for web application protection. It can be integrated as a module of the Apache web server, or it can run independently or be used in conjunction with other web servers (such as Apache). ModSecurity is located between the web server and the client. As an intermediate layer, it analyzes and filters incoming and outgoing HTTP traffic. By reading and parsing HTTP requests and responses, it determines whether to allow requests to continue or responses to be issued based on the configured rule set. Regular expression: It is a powerful text processing tool that describes a pattern through a series of characters and special symbols. This pattern defines a set of string matching rules. It allows users to build patterns to match, find, replace or extract specific content in a string. For example: [a-zA-Z]+@\w+\.\w+: matches the basic email address format.

[0004] The protection capabilities of traditional WAF (web application firewall) mainly rely on the establishment and improvement of protection strategies (Modsecurity). The protection strategy is to match the request packet in the form of regular expressions. If a match is found, a predetermined action is performed, such as release, discard, block, etc.

[0005] ModSecurity security rules work by building a decision tree structure, which involves traversing the entire rule tree to accurately match incoming HTTP requests. This mechanism involves deep parsing of the data packet of each network request and analyzing its content layer by layer. Specifically, the system checks the details of the data packet one by one and compares them one by one with the established security rule set. Although this linear matching strategy ensures the comprehensiveness of rule checking, it also exposes an efficiency defect: even if a match is finally found at the end of the rule tree, the checking process of all the previously missed rules actually constitutes a heavy and redundant operation. This pre-consumption of resources undoubtedly has a negative impact on the performance of Web applications, especially in scenarios with large rule sets or frequent requests, resulting in response delays and a significant decrease in processing power.

[0006] ModSecurity's protection effectiveness fundamentally relies on a carefully planned and continuously updated rule base. However, due to the nature of 0day vulnerabilities - as undisclosed and unfixed security weaknesses, ModSecurity cannot proactively write corresponding defense rules. This limitation makes it unable to proactively identify and effectively intercept 0day vulnerability attacks, exposing its obvious vulnerability in resisting the rapidly spreading 0day threats, and invisibly amplifying the risk of being attacked by Web applications. Summary of the invention

[0007] The purpose of the present invention is to provide an intelligent Web application protection method based on AI semantics in view of the defects and shortcomings of the prior art.

[0008] The intelligent Web application protection method based on AI semantics described in the present invention adopts the following steps:

[0009] S10: Model building phase, building AI models;

[0010] S20: In the model application phase, the AI ​​model in step S10 is seamlessly integrated into the existing Web application security protection system, becoming the intelligent brain module for security protection execution; when the intelligent brain module identifies a high-risk request, the system will immediately initiate high-level defense measures, such as enhancing the authentication process, restricting access rights, or directly blocking the connection, while maintaining low intervention for low-risk or normal traffic.

[0011] Furthermore, the construction of the AI ​​model in step S10 comprises the following steps:

[0012] S1010: Build deep learning driven neural network models;

[0013] S1020: The neural network model in step S1010 can efficiently and accurately evaluate potential threats in the data request packet through a complex multi-level feature extraction and pattern recognition mechanism;

[0014] S1030: also includes intelligent extraction of normal and malicious request features;

[0015] Furthermore, the AI ​​semantic model construction in step S1010 adopts the following steps:

[0016] S1010-1: Model design architecture. The left side of the architecture, Model 1, represents the pre-trained LLM model, forming a pre-trained language model and forming a solid foundation. The right side of the architecture, Model 2, is the model parameter for the specific domain to be optimized. A small number of trainable parameters are introduced at the selected level of the model, which reduces the amount of training parameters and shortens the training cycle.

[0017] S1010-2: During the training data preparation period, when the model parameters in the specific domain model parameters on the right side of the architecture in step S1010-1 are trained, the pre-trained model on the left side plays the role of reasoning guidance, and the parameters and algorithm mechanisms of both sides work together to participate in the decision-making process in order to output the most accurate prediction results; after the above prediction results are compared and evaluated with the actual situation, the back propagation mechanism is used to iteratively update only the active training parameters on the right side;

[0018] S1010-3: Model training optimization period:

[0019] (1) The output layer of the model uses the Sigmoid activation function to generate a suspicious coefficient that reflects the threat level of the request packet. This coefficient is directly related to the security assessment result.

[0020] (2) Since the key to Web protection is to effectively block threat attacks (known vulnerabilities and unknown vulnerabilities), precision and false negative rate are selected as the core indicators to measure the effectiveness of the model, aiming to accurately identify each potential threat;

[0021] (3) The training goal is to set the false negative rate to less than 0.1% and ensure that the overall accuracy rate reaches 95%, so as to strictly test the defense effectiveness of the model with such high standards;

[0022] (4) In the binary classification task framework, the model prediction results can be summarized into four basic situations:

[0023] (4-1) TP: The positive sample is predicted as positive by the model, which is called the correct rate of judgment;

[0024] (4-2) TN: Negative samples are predicted as negative by the model, which is called the accuracy rate of false judgments;

[0025] (4-3) FP: Negative samples are predicted as positive by the model, which is called false positive rate;

[0026] (4-4) FN: The positive sample is predicted as negative by the model, which is called the false negative rate;

[0027] (5) The key indicators for evaluating model performance are expressed as:

[0028] (5-1) Precision: reflects the proportion of samples predicted as threats that are actually true threats, calculated as TP / (TP+FP). A high precision means fewer false positives.

[0029] (5-2) Recall: measures the proportion of all actual threats successfully identified by the model, expressed as TP / (TP+FN); a high recall means fewer missed detections;

[0030] S1010-4: Model pruning & retraining period.

[0031] Further, step S1010-4: model pruning phase in the model pruning & retraining period, the specific steps are as follows:

[0032] (1) Before pruning, we first analyze the internal structure of the model in an advanced way. Through a detailed parameter correlation evaluation, we identify adjacent network layers with high similarity. Such high similarity indicates the existence of functional redundancy.

[0033] (2) Based on the above analysis, carefully select potentially removable layers from the constructed similarity pool for preliminary evaluation and verification;

[0034] (3) This validation relies on carefully selected validation set data to ensure the reliability of the evaluation results. If the initial validation results show a significant performance degradation, indicating that the selected layer is critical to the model performance, we will re-examine the similarity data and select other candidate layers for evaluation until we find a pruning solution that has the least impact on model performance.

[0035] (4) The goal of pruning is to significantly reduce the size of the model and improve its computational efficiency without sacrificing the model's defense effectiveness, that is, maintaining the original high accuracy and low false negative rate;

[0036] (5) Using a structured pruning strategy, compared with traditional methods, this structured pruning strategy can effectively achieve a significant reduction in the number of model parameters by systematically removing some submodules or channels in the entire neural network structure rather than randomly or individually removing weights;

[0037] (6) It not only ensures the structural and logical nature of the pruning process, but also facilitates the direct mapping of subsequent hardware accelerators, promoting the effective use of computing resources and accelerating execution.

[0038] Further, step S1010-4: the retraining period in the model pruning & retraining period, the specific steps are as follows:

[0039] (1) Through a specific training procedure for the pruned model, the model is fine-tuned and performance is restored using the initial training dataset or a subset thereof, ensuring that while the model reduces parameters, its ability to identify security threats - accuracy and false negative rate - can maintain or approach the excellent level before pruning;

[0040] (2) Once the initial evaluation shows that the performance degradation is within an acceptable range, that is, the gap with the target performance is small, we will deepen the pruning scheme and fine-tune the model through retraining strategies to further narrow the small gap with the optimization target, and conduct a comprehensive verification and evaluation again;

[0041] (3) The entire pruning optimization process is designed as an iterative cycle, aiming to approach the ideal balance between model compression and performance through gradual and careful adjustments;

[0042] (4) Excessive one-time large-scale pruning may cause the model to fall into a concave bottom, requiring time-consuming and costly additional training to recover, and may even force the abandonment of some pruning work. A delicate and strategic pruning strategy is adopted to ensure that the optimization of the model at each stage can steadily move towards the goal of smaller size and higher efficiency, while adhering to the bottom line of safety protection effectiveness, and ultimately achieving the expected model optimization state.

[0043] Furthermore, in the model application phase of step S20, the following steps are specifically adopted: the trained AI semantic model in step S10 is integrated into the core of the Web application security protection system. The specific implementation steps are as follows:

[0044] S2010: Instant Intelligent Assessment: When a new network request is received, the system immediately activates the AI ​​semantic model, conducts in-depth analysis of the request data packet, calculates the threat coefficient of each request, and accurately classifies it according to the preset risk level to form an instant assessment mechanism; this instant assessment mechanism lays a foundation for fast and accurate decision-making in the subsequent processing process;

[0045] S2020: Refined traffic processing:

[0046] S2020-1: Safe Passage: For request data that the model determines to be risk-free, the system directly releases it to ensure that legitimate traffic can smoothly reach the backend server without affecting user experience and business processing efficiency;

[0047] S2020-2: Grayscale policy re-check: When faced with gray zone requests, i.e. traffic with potential risks but unclear information, the system will direct them to the traditional policy library for secondary inspection. This double insurance mechanism ensures that misjudgments are minimized and resource utilization is optimized without sacrificing security.

[0048] S2020-3: High-risk response strategy: For high-risk requests identified by the AI ​​model, the system activates the emergency response mechanism and takes decisive action - directly discarding potential malicious traffic, or blocking operations and returning clear warning information to the requester, so as to effectively intercept the source of harm;

[0049] S2020-4: The system records every interception action in detail in the attack log, providing valuable data for security analysts to conduct in-depth traceability analysis and strategy optimization, further consolidating the defense system, ensuring the system is safe and effectively resisting external malicious intrusions.

[0050] The beneficial effects of the present invention are as follows: the intelligent Web application protection method based on AI semantics described in the present invention overcomes the limitations of previous technologies, introduces advanced AI semantic analysis technology, and abandons the traditional policy library method that relies on complicated regular matching, aiming to build a more efficient and intelligent network security protection system. The system focuses on using the deep understanding ability of AI to achieve one-time accurate risk assessment, fundamentally reversing the trend of performance decreasing as security rules expand. In addition, the present invention is not only committed to improving the operating efficiency of Web application protection, but also cleverly uses AI's ability to accurately identify normal contexts, and uses this as a basis to strictly screen and intercept abnormal request behaviors, effectively building an active defense barrier against 0day vulnerability attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application, but do not constitute an improper limitation of the present invention. In the drawings:

[0052] Figure 1 It is a topological schematic diagram of the model building process of the present invention;

[0053] Figure 2 A topological diagram of the model design overview of the present invention;

[0054] Figure 3 A topological diagram of the model pruning and retraining of the present invention;

[0055] Figure 4 A topological diagram of an overview of the model application of the present invention;

[0056] Figure 5A topological diagram of the AI ​​semantic model coefficient calculation of the present invention; DETAILED DESCRIPTION

[0057] The present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments, wherein the illustrative embodiments and descriptions are only used to explain the present invention but are not intended to limit the present invention.

[0058] like Figure 1 As shown, the intelligent Web application protection method based on AI semantics described in this specific implementation adopts the following steps:

[0059] S10: Model building phase, building AI models,

[0060] S1010: Build deep learning driven neural network models;

[0061] S1020: The neural network model in step S1010 can efficiently and accurately evaluate potential threats in the data request packet through a complex multi-level feature extraction and pattern recognition mechanism;

[0062] S1030: It also includes intelligent extraction of normal and malicious request features to ensure that the model can capture even the slightest abnormal signal;

[0063] S20: In the model application phase, the AI ​​model in step S10 is seamlessly integrated into the existing Web application security protection system, becoming the intelligent brain module for security protection execution; when the intelligent brain module identifies a high-risk request, the system will immediately initiate high-level defense measures, such as enhancing the authentication process, restricting access rights, or directly blocking the connection, while maintaining low intervention for low-risk or normal traffic to ensure that the user experience is not affected.

[0064] Furthermore, the AI ​​semantic model construction in step S1010 adopts the following steps:

[0065] S1010-1: Model design architecture. The left side of the architecture, Model 1, represents the pre-trained LLM model, forming a pre-trained language model and forming a solid foundation. The right side of the architecture, Model 2, represents the model parameters for the specific domain to be optimized. A small number of trainable parameters are introduced at the selected level of the model, which reduces the amount of training parameters, shortens the training cycle, and reduces resource consumption.

[0066] S1010-2: During the training data preparation period, when the model parameters in the specific domain model parameters on the right side of the architecture in step S1010-1 are being trained, the pre-trained model on the left side plays the role of reasoning guidance. The parameters and algorithm mechanisms of both sides work together and participate in the decision-making process to output the most accurate prediction results;

[0067] After comparing and evaluating the above prediction results with the actual situation, the back-propagation mechanism is used to iteratively update only the active training parameters on the right, and the knowledge accumulation of the pre-trained model is used to ensure that the adaptability and accuracy of the model on specific tasks are continuously improved;

[0068] Regarding S1010-2: Optimization of training data preparation and processing:

[0069] (1) Dataset construction: Our training data is selected from two core materials: attack vector corpus and regular access records (HTTP packets involving user web browsing and API interaction). Among them, the attack sample library gathers about 300,000 records. These valuable data come from the open network attack and defense database and the company's unique security incident accumulation, covering SQL injection, OS command injection, code injection, XXE attack, LDAP injection, cross-site scripting (XSS), protocol abuse and vulnerability defense and other threat scenarios. On the other hand, we have accumulated nearly 4 million real normal access instances with the authorization of cross-industry enterprise partners to ensure the balance and comprehensiveness of model learning.

[0070] (2) Quality control and classification calibration: All collected data is strictly screened by an automated system, and edge cases are manually reviewed to ensure that each piece of training material is accurately classified, thereby improving the accuracy and efficiency of model learning.

[0071] (3) Construction of validation set: In order to scientifically evaluate the performance of the model, we carefully planned the sampling strategy of the validation set. After the attack samples were carefully divided according to their categories, 5% were randomly selected as validation samples; similarly, after the regular access samples were fully shuffled, 5% were extracted as the control group. This process aims to construct a representative test set to unbiasedly test the model's recognition ability.

[0072] (4) Optimize training deployment: After removing the data used for verification, the remaining data is used as a training set and evenly divided into 20 batches. The purpose is to deepen model learning through batch iterative training strategy, which not only accelerates the convergence process, but also improves the model's generalization ability and operational performance. This strategy ensures the efficiency of the training process and the reliability of the results, laying a solid foundation for building a powerful and robust security identification model.

[0073] S1010-3: Model training optimization period:

[0074] (1) The output layer of the model uses the Sigmoid activation function to generate a suspicious coefficient that reflects the threat level of the request packet. This coefficient is directly related to the security assessment result.

[0075] (2) Since the key to Web protection is to effectively block threat attacks (known vulnerabilities and unknown vulnerabilities), precision and false negative rate are selected as the core indicators to measure the effectiveness of the model, aiming to accurately identify each potential threat;

[0076] (3) The training goal is to set the false negative rate to less than 0.1% and ensure that the overall accuracy rate reaches 95%, so as to strictly test the defense effectiveness of the model with such high standards;

[0077] (4) In the binary classification task framework, the model prediction results can be summarized into four basic situations:

[0078] (4-1) TP: The positive sample is predicted as positive by the model, which is called the correct rate of judgment;

[0079] (4-2) TN: Negative samples are predicted as negative by the model, which is called the accuracy rate of false judgments;

[0080] (4-3) FP: Negative samples are predicted as positive by the model, which is called false positive rate;

[0081] (4-4) FN: The positive sample is predicted as negative by the model, which is called the false negative rate;

[0082] (5) The key indicators for evaluating model performance are expressed as:

[0083] (5-1) Precision: reflects the proportion of samples predicted as threats that are actually true threats, calculated as TP / (TP+FP). A high precision means fewer false positives.

[0084] (5-2) Recall: It measures the proportion of all actual threats successfully identified by the model, expressed as TP / (TP+FN). A high recall rate means fewer missed reports and a strong threat capture capability.

[0085] S1010-4: Figure 3 As shown, the model pruning & retraining period:

[0086] Among them, S1010-4-1, model pruning stage:

[0087] (1) Before pruning, we first analyze the internal structure of the model in an advanced way. Through a detailed parameter correlation evaluation, we identify adjacent network layers with high similarity. Such high similarity indicates the existence of functional redundancy.

[0088] (2) Based on the above analysis, carefully select potentially removable layers from the constructed similarity pool for preliminary evaluation and verification;

[0089] (3) This validation relies on carefully selected validation set data to ensure the reliability of the evaluation results. If the initial validation results show a significant performance degradation, indicating that the selected layer is critical to the model performance, we will re-examine the similarity data and select other candidate layers for evaluation until we find a pruning solution that has the least impact on model performance.

[0090] (4) The goal of pruning is to significantly reduce the size of the model and improve its computational efficiency without sacrificing the model's defense effectiveness, that is, maintaining the original high accuracy and low false negative rate;

[0091] (5) Using a structured pruning strategy, compared with traditional methods, this structured pruning strategy can effectively achieve a significant reduction in the number of model parameters by systematically removing some submodules or channels in the entire neural network structure rather than randomly or individually removing weights;

[0092] (6) It not only ensures the structure and logic of the pruning process, but also facilitates the direct mapping of subsequent hardware accelerators, promoting the effective use of computing resources and accelerating execution;

[0093] Among them, S1010-4-2, retraining period:

[0094] (1) Through a specific training procedure for the pruned model, the model is fine-tuned and performance is restored using the initial training dataset or a subset thereof, ensuring that while the model reduces parameters, its ability to identify security threats - accuracy and false negative rate - can maintain or approach the excellent level before pruning;

[0095] (2) Once the initial evaluation shows that the performance degradation is within an acceptable range, that is, the gap with the target performance is small, we will deepen the pruning scheme and fine-tune the model through retraining strategies to further narrow the small gap with the optimization target, and conduct a comprehensive verification and evaluation again;

[0096] (3) The entire pruning optimization process is designed as an iterative cycle, aiming to approach the ideal balance between model compression and performance through gradual and careful adjustments;

[0097] (4) Excessive one-time large-scale pruning may cause the model to fall into a concave bottom, requiring time-consuming and costly additional training to recover, and may even force the abandonment of some pruning work. A delicate and strategic pruning strategy is adopted to ensure that the optimization of the model at each stage can steadily move towards the goal of smaller size and higher efficiency, while adhering to the bottom line of safety protection effectiveness, and ultimately achieving the expected model optimization state.

[0098] Furthermore, in the model application phase of step S20, the following steps are specifically adopted: the trained AI semantic model in step S10 is integrated into the core of the Web application security protection system. The specific implementation steps are as follows:

[0099] S2010: Instant Intelligent Assessment: When a new network request is received, the system immediately activates the AI ​​semantic model, conducts in-depth analysis of the request data packet, calculates the threat coefficient of each request, and accurately classifies it according to the preset risk level to form an instant assessment mechanism; this instant assessment mechanism lays a foundation for fast and accurate decision-making in the subsequent processing process;

[0100] S2010: Refined traffic processing:

[0101] S2010-1: Safe Passage: For request data that the model determines to be risk-free, the system directly releases it to ensure that legitimate traffic can smoothly reach the backend server without affecting user experience and business processing efficiency;

[0102] S2010-2: Grayscale policy re-check: When faced with gray zone requests, i.e. traffic with potential risks but unclear information, the system will direct them to the traditional policy library for secondary inspection. This double insurance mechanism ensures that misjudgments are minimized and resource utilization is optimized without sacrificing security.

[0103] S2010-3: High-risk response strategy: For high-risk requests identified by the AI ​​model, the system activates the emergency response mechanism and takes decisive action - directly discarding potential malicious traffic, or implementing blocking operations and returning clear warning information to the requester, so as to effectively intercept the source of harm;

[0104] S2010-4: The system records every interception action in detail in the attack log, providing valuable data for security analysts to conduct in-depth traceability analysis and strategy optimization, further consolidating the defense system, ensuring the system is safe and effectively resisting external malicious intrusions.

[0105] The working principle of the present invention is specifically described as follows:

[0106] The architecture system of the present invention revolves around two core links: model construction and model application, aiming to bring innovative breakthroughs in the field of Web application security protection.

[0107] Among them, in the model construction stage, the present invention develops a deep learning-driven neural network model, which can efficiently and accurately evaluate potential threats in data request packets through complex multi-level feature extraction and pattern recognition mechanisms. This process not only involves in-depth analysis and learning of massive network traffic data, but also includes intelligent refinement of normal and malicious request features to ensure that the model can capture even tiny abnormal signals. Through a carefully designed architecture and optimization algorithm, the model is able to gradually learn and memorize various complex attack patterns during the training process, thereby demonstrating superior generalization capabilities when faced with novel or deformed attack methods.

[0108] Among them, the model application link is to seamlessly integrate the aforementioned refined AI model into the existing Web application security protection system, making it the intelligent brain for security protection execution. This module (service) not only undertakes the task of real-time monitoring and evaluation, but also can intelligently schedule various types of protection resources according to the threat coefficient output by the model, and dynamically adjust the strictness and response speed of the protection strategy. Specifically, when the model identifies a high-risk request, the system will immediately initiate high-level defense measures, such as enhancing the authentication process, restricting access rights, or directly blocking the connection, while maintaining low intervention for low-risk or normal traffic to ensure that the user experience is not affected.

[0109] 1. Regarding the model construction of the present invention: The AI ​​semantic model construction strategy of the present invention cleverly combines the powerful pre-trained language model (LLM) and the lightweight adapter (LoRA) design concept to jointly create a high-performance protection model architecture. This unique design choice fully utilizes the excellent semantic understanding and outstanding robustness of LLM in a wide range of contexts, laying a solid foundation for the general understanding of the model, enabling it to accurately grasp the deep meaning of various complex information.

[0110] On this basis, by incorporating the ingenious ideas of LoRA, we have achieved an efficient and targeted model fine-tuning strategy. Compared with the large-scale computing requirements of comprehensive retraining, LoRA only needs to make minor adjustments to the model to significantly enhance the semantic recognition accuracy and depth of the model in the specific field of Web security protection. This not only greatly saves computing resources and time costs, but also enables the model to more focus and more accurately identify potential threats in Web protection scenarios, effectively improving the recognition and defense efficiency of high-level security threats such as 0Day attacks.

[0111] (1) Figure 1 , Construction of AI semantic model: Model design overview: Figure 2 As depicted, the left side of the architecture represents the pre-trained LLM model, which forms a solid foundation; the right side represents the domain-specific model parameters to be optimized, aiming to achieve efficient learning through sophisticated design. We introduced a small number of trainable parameters at the selected level of the model. This strategy greatly reduced the amount of training parameters, shortened the training cycle, and significantly reduced resource consumption. This method significantly enhanced the recognition ability in the target segment while ensuring that the overall general performance of the model is comparable to that of a full retraining;

[0112] (2) The specific training mechanism is as follows: When the model parameters on the right are being trained, the pre-trained model on the left plays the role of reasoning guidance. The parameters and algorithm mechanisms of both sides work together to participate in the decision-making process in order to output the most accurate prediction results. After the prediction results are compared and evaluated with the actual situation, the back-propagation mechanism is used to iteratively update only the active training parameters on the right. This collaborative strategy not only makes efficient use of the knowledge accumulation of the pre-trained model, but also ensures that the adaptability and accuracy of the model on specific tasks are continuously improved;

[0113] (3) Data preparation and processing optimization instructions:

[0114] (3.1) Dataset Construction: Our training data is selected from two core materials: attack vector corpus and regular access records (HTTP packets involving user web browsing and API interaction). Among them, the attack sample library gathers about 300,000 records. These valuable data come from the open network attack and defense database and the company's unique security incident accumulation, covering SQL injection, OS command injection, code injection, XXE attack, LDAP injection, cross-site scripting (XSS), protocol abuse and vulnerability defense and other threat scenarios. On the other hand, we have accumulated nearly 4 million real normal access instances by obtaining authorization from cross-industry corporate partners to ensure the balance and comprehensiveness of model learning.

[0115] (3.2) Quality control and classification calibration: All collected data is strictly screened by the automated system, and edge cases are manually reviewed to ensure that each training material is accurately classified, thereby improving the accuracy and efficiency of model learning.

[0116] (3.3) Validation set construction: In order to scientifically evaluate the performance of the model, we carefully planned the sampling strategy of the validation set. After the attack samples were carefully divided according to their categories, 5% were randomly selected as validation samples; similarly, after the regular access samples were fully shuffled, 5% were extracted as the control group. This process aims to construct a representative test set to unbiasedly test the model's recognition ability.

[0117] (3.4) Optimize training deployment: After removing the data used for verification, the remaining data is used as a training set and is evenly divided into 20 batches. The purpose is to deepen model learning through batch iterative training strategy, which not only accelerates the convergence process, but also improves the model's generalization ability and operational performance. This strategy ensures the efficiency of the training process and the reliability of the results, laying a solid foundation for building a powerful and robust security identification model.

[0118] (3.5) Model training optimization description: The output layer of the model uses the Sigmoid activation function, which aims to generate a suspicious coefficient that reflects the threat level of the request packet. This coefficient is directly related to the security assessment result. Given that the key to Web protection is to effectively block threat attacks (known vulnerabilities and unknown vulnerabilities), we have selected precision and false negative rate as the core indicators to measure the effectiveness of the model, aiming to accurately identify every potential threat. The training goal is set to a false negative rate of less than 0.1%, while ensuring that the overall precision reaches 95%, so as to strictly test the defense effectiveness of the model with high standards.

[0119] (3.6) In the binary classification task framework, the model prediction results can be summarized into four basic situations:

[0120] (3.6.1) TP: (True Positive) The positive sample is predicted as positive by the model, which is called the correct rate of judgment;

[0121] (3.6.2)TN: (TrueNegative): Negative samples are predicted as negative by the model, which is called the correct rate of false judgment;

[0122] (3.6.3) FP: (False Positive): Negative samples are predicted as positive by the model, which is called the false positive rate;

[0123] (3.6.4)FN: (FasleNegative): The positive sample is predicted as negative by the model, which is called the false negative rate.

[0124] (3.7) The key indicators for evaluating model performance are expressed as:

[0125] (3.7.1) Precision: reflects the proportion of samples predicted as threats that are actually true threats, calculated as TP / (TP+FP). A high precision means fewer false positives.

[0126] (3.7.2) Recall: It measures the proportion of all actual threats that are successfully identified by the model, expressed as TP / (TP+FN). A high recall rate means fewer missed detections and a strong threat capture capability.

[0127] (3.8) Figure 3As shown, model pruning & retraining: The goal of pruning is to significantly reduce the size of the model and improve its operational efficiency without sacrificing the model's defense effectiveness, that is, maintaining the original high accuracy and low false negative rate. The present invention adopts an innovative structured pruning strategy. Compared with traditional methods, this strategy efficiently achieves a significant reduction in the number of model parameters by systematically removing some sub-modules or channels (rather than random or individual weights) in the entire neural network structure. This method not only ensures the structure and logic of the pruning process, but also facilitates the direct mapping of subsequent hardware accelerators, further promoting the effective use of computing resources and accelerated execution.

[0128] (3.9) After implementing this structured pruning, the model is significantly slimmed down, but it still needs to go through a delicate retraining process. In this stage, a specific training procedure for the pruned model is used to fine-tune the model and restore its performance using the initial training data set or a subset thereof, ensuring that while the model reduces parameters, its ability to identify security threats - accuracy and false negative rate - can maintain or approach the excellent level before pruning.

[0129] 2. For the model application stage: seamlessly integrate the trained AI semantic model into the core of the Web application security protection system to build the first intelligent defense line. This process is shown in detail in Figure 4 In the "Model Application Overview", the specific implementation steps are as follows:

[0130] (1) Instant intelligent assessment: When a new network request is received, the system immediately activates the AI ​​semantic model to conduct in-depth analysis of the request data packet. The model quickly calculates the threat factor of each request (see Figure 5 , AI semantic model coefficient calculation), and accurately classifies it according to the preset risk level. This instant assessment mechanism lays a foundation for fast and accurate decision-making in the subsequent processing process.

[0131] (2) Refined traffic processing:

[0132] (2.1) Safe Passage: For request data that the model determines to be risk-free, the system directly releases it to ensure that legitimate traffic can smoothly reach the backend server without affecting user experience and business processing efficiency.

[0133] (2.2) Grayscale policy re-check: When faced with requests judged as gray areas, that is, traffic with potential risks but unclear, the system will direct them to the traditional policy library for secondary inspection. This double insurance mechanism ensures that misjudgments are minimized and resource utilization is optimized without sacrificing security.

[0134] (2.3) High-risk response strategy: For high-risk requests identified by the AI ​​model, the system activates the emergency response mechanism and takes decisive action - directly discarding potential malicious traffic, or implementing blocking operations and returning clear warning information to the requester, thereby effectively intercepting the source of harm. In addition, the system records every interception action in detail in the attack log, providing security analysts with valuable data for in-depth traceability analysis and strategy optimization, further consolidating the defense system, ensuring the safety of the system, and effectively resisting external malicious intrusions.

[0135] Beneficial effects of the invention: The invention adopts advanced AI semantic analysis technology to replace the traditional rule matching mechanism, significantly improving the efficiency and protection capability of Web application protection, and specifically solving key problems existing in existing technologies such as ModSecurity, which are specifically reflected in the following aspects:

[0136] Efficiency revolution and performance improvement: Compared with ModSecurity's decision tree structure and linear rule matching, this invention uses AI models to determine the risk level of requests at one time, eliminating the tedious process of traversing the rule base layer by layer, and greatly reducing unnecessary computing burden. This not only significantly reduces the processing time for each network request, but also effectively alleviates the performance bottleneck in scenarios with large rule sets or high request frequency, ensuring that Web applications can maintain high-speed response and processing capabilities, and avoiding delays caused by security checks.

[0137] Intelligent identification and active defense against 0day attacks: Given the learning and generalization capabilities of AI models, the present invention can identify abnormal behavior patterns by learning from historical data in the absence of specific preset rules, and can demonstrate a high recognition accuracy even in the face of unseen 0day attacks. This means that even in the absence of targeted defense rules, the system can still proactively discover and effectively block new threats, significantly enhancing the defense capabilities against unknown security vulnerabilities and effectively reducing the risk of Web applications being attacked due to 0day vulnerabilities.

[0138] In summary, the present invention overcomes the shortcomings of traditional security solutions in efficiency and 0day defense through the innovative application of AI semantic analysis, and also brings unprecedented intelligent protection capabilities to the field of Web protection, ensuring that while ensuring application performance, the comprehensive protection level of Web application security is effectively improved.

[0139] The present invention is different from the traditional similar technologies. The key technical points and the points to be protected are summarized as follows:

[0140] (1) AI semantic analysis replaces rule matching: AI semantic analysis technology based on deep learning is creatively applied to Web security protection, replacing the traditional rule base matching mechanism to achieve efficient and intelligent risk assessment of network request packets. This innovation significantly improves the speed and accuracy of security detection, reduces the demand for system resources, and solves the performance bottleneck problem caused by linear rule traversal in existing technologies.

[0141] (2) Dynamically adaptive 0day defense capability: Through the self-learning and generalization capabilities of the AI ​​model, the present invention can identify and defend against new 0day attacks without knowing the specific vulnerability details in advance, making up for the shortcomings of traditional protection systems such as ModSecurity in dealing with unknown threats and enhancing the system's forward-looking and proactive defense capabilities.

[0142] (3) Intelligent traffic diversion and risk classification processing strategy: The system integrates intelligent traffic processing logic and automatically implements differentiated strategies based on the threat assessment results of the AI ​​model, such as directly releasing risk-free requests, reviewing the policy library for grayscale requests, and taking immediate blocking or diversion measures for high-risk requests, thereby improving the flexibility and response speed of overall protection.

[0143] The above description is only a preferred embodiment of the present invention, so all equivalent changes or modifications made according to the features and principles described in the scope of the patent application of the present invention are included in the scope of the patent application of the present invention.

Claims

1. An intelligent Web application protection method based on AI semantics, characterized by: Use the following steps: S10: Model building phase, building AI models; S20: In the model application phase, the AI ​​model in step S10 is seamlessly integrated into the existing Web application security protection system, becoming the intelligent brain module for security protection execution; when the intelligent brain module identifies a high-risk request, the system will immediately initiate high-level defense measures, such as enhancing the authentication process, restricting access rights, or directly blocking the connection, while maintaining low intervention for low-risk or normal traffic.

2. According to claim 1, an intelligent Web application protection method based on AI semantics is characterized by: The steps of building the AI ​​model in step S10 are as follows: S1010: Build deep learning driven neural network models and AI semantic models; S1020: The neural network model in step S1010 can efficiently and accurately evaluate potential threats in the data request packet through a complex multi-level feature extraction and pattern recognition mechanism; S1030: Also includes intelligent extraction of normal and malicious request features.

3. According to claim 2, an intelligent Web application protection method based on AI semantics is characterized in that: The AI ​​semantic model construction in step S1010 adopts the following steps: S1010-1: Model design architecture. The left side of the architecture, Model 1, represents the pre-trained LLM model, forming a pre-trained language model and forming a solid foundation. The right side of the architecture, Model 2, is the model parameter for the specific domain to be optimized. A small number of trainable parameters are introduced at the selected level of the model, which reduces the amount of training parameters and shortens the training cycle. S1010-2: During the training data preparation period, when the model parameters in the specific domain model parameters on the right side of the architecture in step S1010-1 are trained, the pre-trained model on the left side plays the role of reasoning guidance, and the parameters and algorithm mechanisms of both sides work together to participate in the decision-making process; after the above-mentioned prediction results are compared and evaluated with the actual situation, the back propagation mechanism is used to iteratively update only the active training parameters on the right side; S1010-3: Model training optimization period: (1) The output layer of the model uses the Sigmoid activation function to generate a suspicious coefficient that reflects the threat level of the request packet. This coefficient is directly related to the security assessment result. (2) Since the key to Web protection is to effectively block threat attacks, we select precision and false negative rate as the core indicators to measure the effectiveness of the model, aiming to accurately identify every potential threat; (3) The training goal is to set the false negative rate to less than 0.1% and ensure that the overall accuracy rate reaches 95%, so as to strictly test the defense effectiveness of the model with such high standards; (4) In the binary classification task framework, the model prediction results can be summarized into four basic situations: (4-1) TP: The positive sample is predicted as positive by the model, which is called the correct rate of judgment; (4-2) TN: Negative samples are predicted as negative by the model, which is called the accuracy rate of false judgments; (4-3) FP: Negative samples are predicted as positive by the model, which is called false positive rate; (4-4) FN: Positive samples are predicted as negative by the model, which is called false negative rate; (5) The key indicators for evaluating model performance are expressed as: (5-1) Precision: reflects the proportion of samples predicted as threats that are actually true threats, calculated as TP / (TP+FP). A high precision means fewer false positives. (5-2) Recall rate (TP / (TP+FN)) measures the proportion of all actual threats successfully identified by the model, expressed as TP / (TP+FN); a high recall rate means fewer missed reports; S1010-4: Model pruning & retraining period.

4. According to claim 3, an intelligent Web application protection method based on AI semantics is characterized in that: in, Model pruning phase in the model pruning & retraining phase in S1010-4: (1) Before pruning, we first analyze the internal structure of the model in an advanced way. Through a detailed parameter correlation evaluation, we identify adjacent network layers with high similarity. Such high similarity indicates the existence of functional redundancy. (2) Based on the above analysis, carefully select potentially removable layers from the constructed similarity pool for preliminary evaluation and verification; (3) This verification relies on carefully selected validation set data to ensure the reliability of the evaluation results. If the preliminary verification results show a significant performance decline, indicating that the selected layer is critical to the model performance, we will re-examine the similarity data and select other candidate layers for evaluation until we find a pruning solution that has the least impact on model performance. (4) The goal of pruning is to significantly reduce the size of the model and improve its computational efficiency without sacrificing the model's defense effectiveness, that is, maintaining the original high accuracy and low false negative rate; (5) Using a structured pruning strategy, compared with traditional methods, this structured pruning strategy can effectively achieve a significant reduction in the number of model parameters by systematically removing some submodules or channels in the entire neural network structure rather than randomly or individually removing weights; (6) It not only ensures the structural and logical nature of the pruning process, but also facilitates the direct mapping of subsequent hardware accelerators, promoting the effective use of computing resources and accelerating execution.

5. According to claim 3, an intelligent Web application protection method based on AI semantics is characterized in that: in, Retraining phase in model pruning & retraining phase in S1010-4: (1) Through a specific training procedure for the pruned model, the model is fine-tuned and performance is restored using the initial training dataset or a subset thereof, ensuring that while the model reduces parameters, its ability to identify security threats - accuracy and false negative rate - can maintain or approach the excellent level before pruning; (2) Once the initial evaluation shows that the performance degradation is within an acceptable range, that is, the gap with the target performance is small, we will deepen the pruning scheme and fine-tune the model through retraining strategies to further narrow the small gap with the optimization target, and conduct a comprehensive verification and evaluation again; (3) The entire pruning optimization process is designed as an iterative cycle, aiming to approach the ideal balance between model compression and performance through gradual and careful adjustments; (4) Excessive one-time large-scale pruning may cause the model to fall into a concave bottom, requiring time-consuming and costly additional training to recover, and may even force the abandonment of some pruning work. A delicate and strategic pruning strategy is adopted to ensure that the optimization of the model at each stage can steadily move towards the goal of smaller size and higher efficiency, while adhering to the bottom line of safety protection effectiveness, and ultimately achieving the expected model optimization state.

6. The method for intelligent Web application protection based on AI semantics according to claim 1 is characterized in that: In the model application phase of step S20, the following steps are specifically adopted: Integrate the trained AI semantic model in step S10 into the core of the Web application security protection system. The specific implementation steps are as follows: S2010: Instant Intelligent Assessment: When a new network request is received, the system immediately activates the AI ​​semantic model, conducts in-depth analysis of the request data packet, calculates the threat coefficient of each request, and accurately classifies it according to the preset risk level to form an instant assessment mechanism; this instant assessment mechanism lays a foundation for fast and accurate decision-making in the subsequent processing process; S2020: Refined traffic processing: S2020-1: Safe Passage: For request data that the model determines to be risk-free, the system directly releases it to ensure that legitimate traffic can smoothly reach the backend server without affecting user experience and business processing efficiency; S2020-2: Grayscale policy re-check: For requests judged as gray areas, that is, traffic with potential risks but unclear, the system will direct them to the traditional policy library for secondary inspection. This double insurance mechanism ensures that misjudgments are minimized and resource utilization is optimized without sacrificing security. S2020-3: High-risk response strategy: For high-risk requests identified by the AI ​​model, the system activates the emergency response mechanism and takes decisive action - directly discarding potential malicious traffic, or blocking operations and returning clear warning information to the requester, so as to effectively intercept the source of harm; S2020-4: The system records every interception action in detail in the attack log, providing valuable data for security analysts to conduct in-depth traceability analysis and strategy optimization, further consolidating the defense system, ensuring the system is safe and effectively resisting external malicious intrusions.

Citation Information

Cited By

  • Large model training method in network security field based on generative large model

    CN119917851A

  • A network security field large model training method based on a generative large model

    CN119917851B

  • AI protection engine construction method and system based on Web application

    CN120415912A

  • Web application-based ai protection engine construction method and system

    CN120415912B