Network application vulnerability anomaly detection method, system, electronic device and storage medium

Through real-time monitoring and analysis of network traffic, combined with machine learning models for Web application vulnerability detection, it solves the problems of insufficient code coverage and high false alarm rate in traditional methods, achieves efficient and accurate vulnerability detection and real-time threat warning, and improves The security protection level of web applications.

CN118555152BActive Publication Date: 2024-10-29JIANGXI GUANGTOU YOUXUAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411028668.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-10-29
Estimated Expiration
2044-07-30

AI Technical Summary

Technical Problem

In practical applications, traditional web application vulnerability detection methods have problems such as insufficient code coverage, high false positive rate, inability to provide the specific location of the vulnerability, long testing process, difficulty in obtaining data sets, and limited model generalization capabilities.

Method used

By monitoring network traffic in real time, capturing and parsing data packets, conducting URL scanning to identify potential attack vectors and abnormal access patterns, and inputting them into machine learning models for anomaly detection and vulnerability identification, combined with dynamic behavior analysis engines and intelligent anomaly detection algorithms, Provide precise vulnerability location and reporting, and regularly optimize machine learning models.

Benefits of technology

It improves the efficiency and accuracy of vulnerability detection. It can monitor dynamic behavior in real time without affecting the normal operation of web applications, automatically identify and predict potential threats, provide detailed repair suggestions, and enhance the overall security and response efficiency of the system. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118555152B_ABST
    Figure CN118555152B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a network application vulnerability anomaly detection method, system, electronic device and storage medium, including: real-time monitoring of network traffic, capturing data packets entering and leaving network applications, parsing the data packets and converting them into structured data; performing URL scanning on the structured data to identify potential attack vectors and abnormal access patterns; inputting potential attack vectors and abnormal access patterns into a machine learning model for anomaly detection and vulnerability identification, and outputting detection results; determining whether to trigger an alarm based on a login request in the detection results; storing the detection results and regularly analyzing them to optimize the machine learning model. The disclosed method can achieve efficient, accurate and real-time vulnerability anomaly detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of network application vulnerability detection, and in particular to a network application vulnerability anomaly detection method, system, electronic device and storage medium. Background Art

[0002] In the wave of digital transformation, web applications have become the main channel for enterprises to interact with users, carrying key business logic and sensitive data. However, the widespread use of web applications has also made them the main target of cyber attacks. Vulnerabilities such as SQL injection, cross-site scripting (XSS), and cross-site request forgery (CSRF) have emerged in an endless stream, bringing huge security risks to enterprises and users. Traditional security protection measures, such as firewalls, intrusion detection systems (IDS), and intrusion prevention systems (IPS), can resist external attacks to a certain extent, but they are powerless against vulnerabilities within web applications. With the rapid development of artificial intelligence (AI) and machine learning (ML) technologies, their application in the field of network security has gradually become a hot topic of research. AI and ML can process and analyze large amounts of data, identify patterns and anomalies, and thus show great potential in web application vulnerability detection. However, the effective integration of these advanced technologies into the field of web application security still faces many challenges such as data quality, model generalization, and real-time requirements.

[0003] In the field of Web application vulnerability detection, existing technical solutions mainly include the following: static application security testing (SAST), dynamic application security testing (DAST), interactive application security testing (IAST) and machine learning-based vulnerability detection. However, these systems still have the following problems in practical applications: insufficient code coverage and high false positive rate; unable to provide the specific location of the vulnerability and time-consuming testing process; difficult to obtain data sets and limited model generalization capabilities. Therefore, it is necessary to provide an efficient, comprehensive and automated solution to protect Web applications from security threats. Summary of the invention

[0004] The present invention discloses a network application vulnerability anomaly detection method to solve the following problems: traditional Web application vulnerability detection methods have insufficient code coverage and high false positive rate in actual applications, cannot provide the specific location of the vulnerability, the testing process is time-consuming, data set acquisition is difficult, and the model generalization ability is limited.

[0005] According to one aspect of the present disclosure, a method for detecting anomalies in network application vulnerabilities is provided, comprising:

[0006] S10, monitor network traffic in real time, capture data packets entering and leaving network applications, parse the data packets and convert them into structured data;

[0007] S20, performing URL scanning on the structured data to identify potential attack vectors and abnormal access patterns;

[0008] S30, inputting potential attack vectors and abnormal access patterns into the machine learning model for anomaly detection and vulnerability identification, and outputting detection results;

[0009] S40, determining whether to trigger an alarm according to the login request in the detection result;

[0010] S50: Store the detection results and analyze them regularly to optimize the machine learning model.

[0011] Preferably, the real-time monitoring of network traffic and capturing of data packets entering and leaving network applications are specifically: the network traffic obtained from the traffic platform is used as input, a sniffer tool is used to monitor the network traffic of a specified network interface in real time, and the Scapy library is used to realize data packet capture.

[0012] Preferably, parsing the data packet and converting it into structured data is specifically as follows:

[0013] Each captured data packet is analyzed through a callback function; wherein, in the callback function, it is determined whether the data packet contains IP header information;

[0014] If the IP header information is included, the source IP, destination IP, protocol type, source port number, and destination port number are extracted, and the information is converted into JSON format data and output as structured data.

[0015] Preferably, step S10 further includes:

[0016] By collecting, de-dusting and labeling structured data, we obtain page sample data. After introducing information entropy to remove interference factors in the page sample data, we use word2vec technology to preprocess the page sample data to obtain training data sets and test data sets. We use the training data sets to train the selected machine learning model, and use known traffic types to adjust the machine learning model parameters during the training process. We use the test data sets to evaluate the trained machine learning model. After the training is completed, we deploy the machine learning model to the network application entrance for anomaly detection and vulnerability identification.

[0017] Preferably, the structured data is scanned by URL to identify potential attack vectors and abnormal access patterns, specifically: a URL scanning algorithm is used to scan the structured data by URL, URLs are extracted from hypertext transfer protocol requests and normalized, redundancy in the URLs is deleted to obtain normalized URLs, features are extracted from the normalized URLs to obtain URL features, the URL features are classified using a trained machine learning model, and it is determined whether they are malicious URLs to identify potential attack vectors and abnormal access patterns.

[0018] Preferably, potential attack vectors and abnormal access patterns are input into a machine learning model for anomaly detection and vulnerability identification, and the detection results are output, specifically:

[0019] The management backend is detected from the page through the trained machine learning model, and the detected management backend is secondary verified. Through the secondary verification, behaviors that deviate from the normal mode are detected, anomalies or loopholes are identified, and the identification results are confirmed, and the detection results are output based on the identification results.

[0020] Preferably, judging whether to trigger an alarm according to the login request in the detection result specifically includes:

[0021] Analyze the username and password information in the login request, set a password dictionary and a list of common weak passwords, and issue an alarm if the password appears in them; check whether there are weak passwords in the login interface. When weak passwords are found in the management background, determine the sensitivity threshold of anomaly detection based on historical data, and conduct real-time monitoring. Once abnormal behavior is detected or predefined rule conditions are met, an alarm message is immediately generated.

[0022] According to one aspect of the present disclosure, a network application vulnerability anomaly detection system is provided, comprising:

[0023] The data packet parsing and conversion module monitors network traffic in real time, captures data packets entering and leaving network applications, parses the data packets and converts them into structured data;

[0024] A website scanning module performs website scanning on the structured data to identify potential attack vectors and abnormal access patterns;

[0025] The anomaly detection and vulnerability identification module inputs potential attack vectors and abnormal access patterns into the machine learning model for anomaly detection and vulnerability identification, and outputs the detection results;

[0026] An alarm triggering module determines whether to trigger an alarm according to the login request in the detection result;

[0027] The machine learning model optimization module stores the detection results and regularly analyzes them to optimize the machine learning model.

[0028] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to: execute the above-mentioned network application vulnerability anomaly detection method.

[0029] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above-mentioned network application vulnerability anomaly detection method is implemented.

[0030] Compared with the prior art, the beneficial effects of the present disclosure are:

[0031] 1) The present disclosure integrates a dynamic behavior analysis engine and an intelligent anomaly detection algorithm, so that the system can not only improve the efficiency of vulnerability detection, but also greatly improve the accuracy of detection without affecting the normal operation of Web applications, thereby effectively protecting Web applications from attacks.

[0032] 2) The present disclosure uses a precise vulnerability location and reporting mechanism. The vulnerability location algorithm can accurately map abnormal behaviors to specific code locations, and the intelligent reporting system can automatically generate detailed repair suggestions. The combination of the two not only reduces the workload of developers, but also speeds up the security update of Web applications and enhances the overall security of the system.

[0033] 3) This disclosure integrates AI technology and machine learning to build a highly intelligent Web application vulnerability detection system that can not only monitor the dynamic behavior of Web applications in real time, but also automatically identify and predict potential security threats by learning historical data and patterns. This enables the system to issue early warnings before attacks occur, thereby greatly improving the security protection level of Web applications.

[0034] 4) The present disclosure builds a real-time monitoring and response system, which can automatically execute a series of response actions according to predefined response strategies when abnormal behavior or potential threats are detected, greatly improving response efficiency, reducing human errors, and ensuring that security incidents can be handled promptly and correctly.

[0035] 5) By building a diverse data set and applying data enhancement technology, this disclosure can train more robust and generalized models that can not only identify known attack patterns, but also effectively identify unknown attack methods. In addition, the design of the model generalization performance evaluation framework ensures that the system can regularly evaluate and optimize the performance of the model, ensuring that the system is always in the best working state.

[0036] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

[0037] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.

[0039] Figure 1 A flow chart of a method for detecting anomalies of network application vulnerabilities is shown;

[0040] Figure 2 shows the machine learning model processing flow chart;

[0041] Figure 3 The XGBoost model call flow chart is shown;

[0042] Figure 4 The structural block diagram of the network application vulnerability anomaly detection system is shown. DETAILED DESCRIPTION

[0043] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0044] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0045] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.

[0046] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0047] It can be understood that the above-mentioned network application vulnerability anomaly detection method and system embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not go into details.

[0048] Although traditional Web application vulnerability detection methods can detect security vulnerabilities to a certain extent, they have insufficient code coverage and high false positive rates in actual applications. They cannot provide the specific location of the vulnerability, and the testing process is time-consuming and difficult to obtain data sets. In addition, machine learning models require a large amount of labeled data for training, and the generalization ability of the model cannot be guaranteed. In order to solve these problems, a network application vulnerability anomaly detection method is proposed to achieve efficient, accurate and real-time vulnerability anomaly detection.

[0049] Based on the above ideas, the present invention proposes a method for detecting anomalies of network application vulnerabilities. Figure 1 A flow chart showing a method for detecting abnormal network application vulnerabilities is shown. The method comprises:

[0050] S10, monitor network traffic in real time, capture data packets entering and leaving network applications, parse the data packets and convert them into structured data;

[0051] S20, performing URL scanning on the structured data to identify potential attack vectors and abnormal access patterns;

[0052] S30, inputting potential attack vectors and abnormal access patterns into the machine learning model for anomaly detection and vulnerability identification, and outputting detection results;

[0053] S40, determining whether to trigger an alarm according to the login request in the detection result;

[0054] S50: Store the detection results and analyze them regularly to optimize the machine learning model.

[0055] The specific steps are as follows:

[0056] S10. Monitor network traffic in real time, capture data packets entering and leaving network applications, parse the data packets and convert them into structured data.

[0057] In the embodiments of the present disclosure and other possible embodiments, the real-time monitoring of network traffic and the capture of data packets entering and leaving network applications are specifically: the network traffic obtained from the traffic platform is used as input, the network traffic of the specified network interface is monitored in real time using a sniffer tool, and the Python programming language is combined with the third-party Scapy library to achieve data packet capture and analysis. In the embodiments of the present disclosure, a configurable real-time monitoring platform is set up, which allows users to customize monitoring strategies according to different Web applications and security requirements, including monitoring frequency, monitoring range, and alarm threshold, etc.

[0058] Furthermore, the Scapy library is used to capture network packets, and each captured packet is analyzed through the callback function capture_and_analyze_traffic. In the callback function, it is first determined whether the packet contains IP header information; if it contains IP header information, key information such as source IP, destination IP, protocol type, source port number and destination port number are extracted, and this information is converted into JSON format data and output as structured data.

[0059] The details are as follows:

[0060] from scapy.all import *

[0061] import json

[0062] def capture_and_analyze_traffic(packet):

[0063] if IP in packet:

[0064] #Extract IP header information

[0065] src_ip = packet[IP].src

[0066] dst_ip = packet[IP].dst

[0067] # Determine the protocol type

[0068] if TCP in packet:

[0069] protocol = "TCP"

[0070] src_port = packet[TCP].sport

[0071] dst_port = packet[TCP].dport

[0072] elif UDP in packet:

[0073] protocol = "UDP"

[0074] src_port = packet[UDP].sport

[0075] dst_port = packet[UDP].dport

[0076] else:

[0077] protocol = "Other"

[0078] src_port = None

[0079] dst_port = None

[0080] #Construct JSON format data

[0081] data={

[0082] "src_ip": src_ip,

[0083] "dst_ip": dst_ip,

[0084] "protocol": protocol,

[0085] "src_port": src_port,

[0086] "dst_port": dst_port

[0087] }

[0088] #Print JSON format data

[0089] print(json.dumps(data))

[0090] #Start capturing data packets of network applications

[0091] sniff(prn=capture_and_analyze_traffic, count=10)

[0092] In this embodiment, the original captured binary data packet is converted into a structured JSON data format, including information such as source IP, destination IP, port number, protocol type, data packet size, etc. The data structuring formula is: the data packet (p) is converted into JSON format, where (p={header, payload}) is parsed into ({IP_src, IP_dst, Port_src, Port_dst, Timestamp, Data}).

[0093] The classifier deployed at the network entry point uses a machine learning model to analyze the preprocessed data. The classifier refers to a trained machine learning model, which is the same as the machine learning model in step S30. It distinguishes normal, abnormal, and potentially malicious traffic. This process includes in-depth analysis of the content of the data packet, such as parsing HTTP header information and payload to identify potential attacks, such as SQL injection, cross-site scripting attacks, etc.

[0094] Specifically, a signature-based approach is used to identify the content of data packets, and a machine learning model is combined to perform traffic classification.

[0095] C(f) =\text{arg max}c\sum{i=1}^n w_i\cdot\delta(f_i, S_{c,i})

[0096] Among them, (C(f)) is the traffic classification function, (f) is the feature set of specific traffic, (S_{c,i}) is the signature database under category (c), (w_i) is the weight, and (\delta) is the matching function.

[0097] The specific process of the classifier deployed at the network application entry point is as follows:

[0098] S101. Use the support vector machine (SVM) supervised learning algorithm to separate data points of different categories by constructing a separating hyperplane.

[0099] S102. Use Pandas to preprocess the captured network traffic data, including feature extraction, data cleaning, normalization, etc.

[0100] S103: Select appropriate features from the network traffic data, such as source IP, destination IP, port number, protocol type, etc. This can further help the classifier distinguish different types of traffic.

[0101] S104: Use the training data set to train the selected machine learning model. During the training process, known traffic types (normal, abnormal, malicious, etc.) are used to adjust the parameters of the machine learning model so that it can correctly classify the traffic data.

[0102] S105. Use the test data set to evaluate the trained machine learning model and evaluate the performance indicators of the classifier, such as accuracy, recall, F1 score, etc.

[0103] S106. Deploy the trained machine learning model to the traffic classifier at the network application entry point to analyze and classify the traffic in real time.

[0104] S107. Regularly update and optimize machine learning models to adapt to changing network environments and threats. This may include using new training data, adjusting model parameters, etc.

[0105] S20: Scan the structured data for URLs to identify potential attack vectors and abnormal access patterns.

[0106] In the embodiments of the present disclosure and other possible embodiments, the structured data is scanned by URL to identify potential attack vectors and abnormal access patterns, specifically: an efficient URL scanning algorithm is developed, the URL scanning algorithm is used to scan the structured data, URLs are extracted from the hypertext transfer protocol request and normalized; after deleting the redundancy in the URL, a normalized URL is obtained, such as session ID, tracking parameters, etc., and feature extraction is performed on the normalized URL to obtain URL features, such as domain name length, path depth, protocol used, whether it contains an IP address, etc.; the URL features are classified using a trained machine learning model to determine whether it is a malicious URL to identify potential attack vectors and abnormal access patterns. At the same time, matching queries can also be performed in conjunction with a known malicious URL database.

[0107] The formula of the URL scanning algorithm is:

[0108] \text{Malicious}(url) =\sigma(\textbf{w}\cdot\phi(url)+b)

[0109] Among them, (\sigma) is the sigmoid activation function, (\phi(url)) is the URL feature extraction function, (\textbf{w}) and (b) are model parameters.

[0110] S30. Input potential attack vectors and abnormal access patterns into the machine learning model for anomaly detection and vulnerability identification, and output the detection results.

[0111] In the embodiments of the present disclosure and other possible embodiments, a variety of machine learning models are trained and deployed, including but not limited to deep learning, anomaly detection models, etc., to improve the accuracy of vulnerability identification. A large number of page samples are collected, including various management backends, high-risk pages, etc., to provide rich and diverse data support for model training. At the same time, the online model will be updated regularly to ensure that the model always maintains good discrimination ability, and introduce positive and negative feedback mechanisms to cooperate with AI model training, and conduct targeted adjustments based on the situation identified by the model to further improve the model accuracy.

[0112] The process of training and deploying multiple machine learning models is as follows: by collecting, cleaning and labeling structured data, page sample data is obtained, information entropy is introduced to remove interference factors in the page sample data, and the page sample data is preprocessed using word2vec technology to obtain training data sets and test data sets, and the selected machine learning model is trained using the training data sets, and the machine learning model parameters are adjusted using known traffic types during the training process, and the trained machine learning model is evaluated using the test data sets. After the training is completed, the machine learning model is deployed to the network application entrance for anomaly detection and vulnerability identification. The machine learning model can use a convolutional neural network (CNN), a recurrent neural network (RNN), etc.

[0113] The processing flow of the machine learning model is as follows Figure 2 As shown, the specific steps are as follows:

[0114] S301, data preprocessing: After a long period of data collection, de-duplication, and labeling, sufficient web page source code samples have been accumulated, but the source code of the page needs to be preprocessed before it can be converted into a form that the model can understand and calculate. Information entropy is introduced to remove useless codes, symbols and other interference factors in the page, and then the page is segmented to remove all special symbols in the text, including Chinese and English punctuation, emoji expressions, special characters (such as emoticons), etc. Remove tag names in HTML, such as div, td, etc.; remove comments in HTML, etc.; split English long sentences, split Chinese long sentences, etc.; calculate the information entropy of text other than tags, etc. Since web applications are generally simpler than ordinary user login pages, information entropy is introduced to remove relatively complex pages, such as false positives caused by login boxes in some news pages, and other steps are mainly to remove interfering texts, and finally obtain a series of English words and Chinese words. Next, we use word2vec technology to preprocess the page sample data. Word2vec reflects the relationship between words by calculating the distance between vectors. Word2vec converts text content into vectors composed of fixed-length numbers. These vectors with text features are used as inputs for machine learning models. This process not only reduces the input dimension and saves computing overhead, but also increases semantic information, which is beneficial to the feature learning of subsequent models.

[0115] S302, Algorithm selection and model training: In the algorithm selection stage, a variety of algorithm tests were conducted in combination with the applicable scenarios and sample characteristics of each algorithm, and finally XGBoost with the highest accuracy and efficiency was selected as the core algorithm. XGBoost is an engineering implementation of GBDT. Parallel computing, approximate tree construction, effective processing of sparse data, and memory usage optimization make XGBoost more accurate and efficient. After word2vec preprocessing, page words are converted into digital vectors and input into the XGBoost model, and Python is used in combination with deep learning frameworks TensorFlow and PyTorch to implement the training and deployment of deep learning models. During the training process, the model parameters are adjusted by optimizing the loss function so that it can more accurately predict the compound risks that may be caused by a combination of vulnerabilities.

[0116] The specific process is as follows:

[0117] Model Training

[0118] #Build a CNN model using TensorFlow

[0119] import tensorflow as tf

[0120] #Define CNN model

[0121] model = tf.keras.Sequential([

[0122] tf.keras.layers.Embedding(input_dim=vocab_size, output_dim=embedding_dim, input_length=max_length),

[0123] tf.keras.layers.Conv1D(128, 5, activation='relu'),

[0124] tf.keras.layers.GlobalAveragePooling1D(),

[0125] tf.keras.layers.Dense(64, activation='relu'),

[0126] tf.keras.layers.Dense(1, activation='sigmoid') ])

[0128] # Compile the model

[0129] model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

[0130] #Train model

[0131] model.fit(train_data, train_labels, epochs=10, validation_data=(val_data, val_labels))

[0132] #Save model

[0133] model.save('vulnerability_detection_model.h5')

[0134] Model deployment

[0135] #Load the model using TensorFlow

[0136] loaded_model = tf.keras.models.load_model('vulnerability_detection_model.h5')

[0137] def analyze_traffic(page_content):

[0138] #Preprocess the page

[0139] preprocessed_content=preprocess_page(page_content)

[0140] #Use the loaded model to make predictions

[0141] prediction = loaded_model.predict(preprocessed_content)

[0142] if prediction>0.5:

[0143] print("Vulnerability found!")

[0144] else:

[0145] print("The page is normal.")

[0146] page_content = "..."

[0147] analyze_traffic(page_content)

[0148] Furthermore, graph neural networks (GNNs) are used to model system components, vulnerabilities, and attack paths to identify complex associations between vulnerabilities and potential attack chains. Through GNN analysis, the compound risks that may be caused by a combination of vulnerabilities can be predicted, thereby taking more accurate preventive measures in vulnerability management.

[0149] S303, deployment and tuning: A maturely trained XGBoost model has the ability to recognize pages and can distinguish the management backend from a messy page. The management backend is detected from the page through a trained machine learning model. The detected management backend will undergo a manual secondary verification, using a model learned from normal behavior to detect behaviors that deviate from normal patterns, effectively identifying anomalies or vulnerabilities, and finally determining the recognition result, which is then output based on the recognition result. If the recognition result is correct, the detection result will be used to trigger an alarm, and the manually confirmed false positives will be input into the feedback module for subsequent updates to the machine learning model. The XGBoost model calling process is as follows: Figure 3 shown.

[0150] For example, it can be implemented as the following code:

[0151] \text{min}\frac{1}{2}|\textbf{w}|^2+C\sum\xi_i

[0152] \text{subject to}(\textbf{w}\cdot\phi(x_i))\geq\rho-\xi_i, ;\xi_i\geq0

[0153] Among them, (\phi(x_i)) is the data point mapped to the high-dimensional space, (\textbf{w},\rho) is the model parameter, and (\xi_i) is the slack variable.

[0154] S40: Determine whether to trigger an alarm based on the login request in the detection result.

[0155] In the embodiments of the present disclosure and other possible embodiments, a real-time alarm system is constructed to ensure that the security team can respond to security incidents in a timely manner. The URL identified as a Web application will enter the alarm module. In addition to direct alarms, the alarm module is also responsible for weak password detection. Use Python programming language combined with regular expressions and other technologies to implement weak password detection. Analyze the username and password information in the login request, set a password dictionary and a list of common weak passwords, and alarm for situations where the password appears in them. In addition, the strength of the password is judged by setting password complexity requirements, such as password length, types of characters included, etc. The alarm module checks whether there is a weak password for the login interface. When a weak password is found in the management background, one is to attach the weak password to the alarm, and the second is to perform targeted graded operations.

[0156] Furthermore, the sensitivity threshold of anomaly detection is determined based on historical data, and real-time monitoring is performed through a real-time monitoring system. Once abnormal behavior is detected or predefined rule conditions are met, an alarm message is immediately generated. In this embodiment, a threshold setting method based on statistical learning is developed, which can dynamically adjust the threshold of anomaly detection according to historical data to improve the accuracy and efficiency of detection.

[0157] Alert information is sent to relevant security teams through multiple channels (email, SMS, system logs), and can trigger automatic response measures such as blocking the attack source IP, suspending abnormal account operations, etc.

[0158] The implementation process can be as follows:

[0159] import re

[0160] #Define a password dictionary and a list of common weak passwords

[0161] password_dictionary=["password","123456","qwerty","abcdef"]

[0162] weak_passwords=set(password_dictionary)

[0163] #Define regular expression pattern to match username and password

[0164] username_pattern = re.compile(r'username=(.*?)&')

[0165] password_pattern = re.compile(r'password=(.*?)&')

[0166] def check_weak_passwords(username, password):

[0167] if password in weak_passwords:

[0168] print(f"Weak password warning: Username '{username}' uses a weak password '{password}'")

[0169] #Analyze the username and password information in the traffic

[0170] def analyze_traffic(traffic):

[0171] matches_username = username_pattern.findall(traffic)

[0172] matches_password = password_pattern.findall(traffic)

[0173] for username, password in zip(matches_username, matches_password):

[0174] check_weak_passwords(username, password)

[0175] #Simulation traffic analysis

[0176] traffic="POST / login HTTP / 1.1\r\nHost: example.com\r\nContent-Type:application / x-www-form-urlencoded\r\nContent-Length: 28\r\n\r\nusername=admin&password=123456&\r\n"

[0177] analyze_traffic(traffic)

[0178] In this embodiment, a password dictionary and a list of common weak passwords are defined, and a regular expression pattern is set to match usernames and passwords. Then, the analyze_traffic function is used to analyze the username and password information in the traffic, and the check_weak_passwords function is called to detect whether there are weak passwords.

[0179] S50: Store the detection results and analyze them regularly to optimize the machine learning model.

[0180] In this embodiment, a large-capacity time series database is used to store all monitoring data to ensure data writing speed and query efficiency. The database is regularly maintained, including data cleaning, deduplication and storage structure optimization to improve data processing efficiency.

[0181] It can be proved from the above that the network application vulnerability anomaly detection method designed in the embodiment of the present disclosure overcomes the problems of low efficiency and insufficient accuracy of traditional vulnerability detection methods, and can achieve efficient, accurate and real-time vulnerability anomaly detection.

[0182] As another aspect of the embodiment of the present disclosure, a network application vulnerability anomaly detection system 100 is also provided. Figure 4 As shown, including:

[0183] The data packet parsing and conversion module 1 monitors network traffic in real time, captures data packets entering and leaving network applications, parses the data packets and converts them into structured data;

[0184] URL scanning module 2, performs URL scanning on the structured data to identify potential attack vectors and abnormal access patterns;

[0185] Anomaly detection and vulnerability identification module 3, which inputs potential attack vectors and abnormal access patterns into the machine learning model for anomaly detection and vulnerability identification, and outputs the detection results;

[0186] An alarm triggering module 4 determines whether to trigger an alarm according to the login request in the detection result;

[0187] The machine learning model optimization module 5 stores the detection results and regularly analyzes them to optimize the machine learning model.

[0188] Based on the description of the above embodiments, it can be seen that the embodiments of the present disclosure can achieve the following technical effects:

[0189] 1) The present disclosure integrates a dynamic behavior analysis engine and an intelligent anomaly detection algorithm, so that the system can not only improve the efficiency of vulnerability detection, but also greatly improve the accuracy of detection without affecting the normal operation of Web applications, thereby effectively protecting Web applications from attacks.

[0190] 2) The present disclosure uses a precise vulnerability location and reporting mechanism. The vulnerability location algorithm can accurately map abnormal behaviors to specific code locations, and the intelligent reporting system can automatically generate detailed repair suggestions. The combination of the two not only reduces the workload of developers, but also speeds up the security update of Web applications and enhances the overall security of the system.

[0191] 3) This disclosure integrates AI technology and machine learning to build a highly intelligent Web application vulnerability detection system that can not only monitor the dynamic behavior of Web applications in real time, but also automatically identify and predict potential security threats by learning historical data and patterns. This enables the system to issue early warnings before attacks occur, thereby greatly improving the security protection level of Web applications.

[0192] 4) The present disclosure builds a real-time monitoring and response system, which can automatically execute a series of response actions according to predefined response strategies when abnormal behavior or potential threats are detected, greatly improving response efficiency, reducing human errors, and ensuring that security incidents can be handled promptly and correctly.

[0193] 5) By building a diverse data set and applying data enhancement technology, this disclosure can train more robust and generalized models that can not only identify known attack patterns, but also effectively identify unknown attack methods. In addition, the design of the model generalization performance evaluation framework ensures that the system can regularly evaluate and optimize the performance of the model, ensuring that the system is always in the best working state.

[0194] The embodiment of the present disclosure also proposes an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above-mentioned network application vulnerability anomaly detection method. The electronic device can be provided as a terminal, a server, or other forms of equipment.

[0195] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above-mentioned network application vulnerability anomaly detection method is implemented. The computer-readable storage medium may be a non-volatile computer-readable storage medium.

[0196] Those skilled in the art will appreciate that, in the above-mentioned network application vulnerability anomaly detection method and system of the specific implementation mode, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0197] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0198] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A network application vulnerability anomaly detection method, characterized in that: The steps include: S10, real-time monitoring of network traffic, capturing data packets entering and leaving network applications, parsing the data packets and converting them into structured data; S20, performing URL scanning on the structured data to identify potential attack vectors and abnormal access patterns; S30, inputting potential attack vectors and abnormal access patterns into the machine learning model for anomaly detection and vulnerability identification, and outputting detection results; S40, determining whether to trigger an alarm according to the login request in the detection result; S50, storing the detection results and regularly analyzing them to optimize the machine learning model; The real-time monitoring of network traffic and capturing of data packets entering and leaving the network application are specifically as follows: the network traffic obtained from the traffic platform is used as input, a sniffer tool is used to monitor the network traffic of a specified network interface in real time, and a Scapy library is used to realize data packet capture; Parse the data packet and convert it into structured data, specifically: Each captured data packet is analyzed through a callback function; wherein, in the callback function, it is determined whether the data packet contains IP header information; If IP header information is included, the source IP, destination IP, protocol type, source port number, and destination port number are extracted, and the information is converted into JSON format data and output as structured data; Step S10 also includes: By collecting, cleaning and labeling structured data, we get page sample data. After introducing information entropy to remove interference factors in the page sample data, we use word2vec technology to preprocess the page sample data to get training data sets and test data sets. We use the training data sets to train the selected machine learning model, and use known traffic types to adjust the machine learning model parameters during the training process. We use the test data sets to evaluate the trained machine learning model. After the training is completed, we deploy the machine learning model to the network application entrance for anomaly detection and vulnerability identification. Scanning the structured data by URL to identify potential attack vectors and abnormal access patterns, specifically: using a URL scanning algorithm to scan the structured data by URL, extracting URLs from hypertext transfer protocol requests and performing normalization processing, deleting redundancy in the URLs to obtain normalized URLs, extracting features from the normalized URLs to obtain URL features, and using a trained machine learning model to classify the URL features to determine whether they are malicious URLs to identify potential attack vectors and abnormal access patterns; Potential attack vectors and abnormal access patterns are input into the machine learning model for anomaly detection and vulnerability identification, and the detection results are output, specifically: The management backend is detected from the page through the trained machine learning model, and the detected management backend is secondary verified. Through the secondary verification, behaviors that deviate from the normal mode are detected, anomalies or loopholes are identified, and the identification results are confirmed, and the detection results are output based on the identification results.

2. The method according to claim 1, characterized in that Determining whether to trigger an alarm according to the login request in the detection result specifically includes: Analyze the username and password information in the login request, set a password dictionary and a list of common weak passwords, and issue an alarm if the password appears in them; check whether there are weak passwords in the login interface. When weak passwords are found in the management background, determine the sensitivity threshold of anomaly detection based on historical data, and conduct real-time monitoring. Once abnormal behavior is detected or predefined rule conditions are met, an alarm message is immediately generated.

3. The network application vulnerability anomaly detection system is characterized by: include: The data packet parsing and conversion module monitors network traffic in real time, captures data packets entering and leaving network applications, parses the data packets and converts them into structured data; obtains page sample data by collecting, removing dirt and marking structured data, introduces information entropy to remove interference factors in the page sample data, and uses word2vec technology to pre-process the page sample data to obtain training data sets and test data sets. The training data sets are used to train the selected machine learning model, and the machine learning model parameters are adjusted using known traffic types during the training process. The trained machine learning model is evaluated using the test data set. After the training is completed, the machine learning model is deployed to the network application entrance for anomaly detection and vulnerability identification; A website scanning module performs website scanning on the structured data to identify potential attack vectors and abnormal access patterns; The anomaly detection and vulnerability identification module inputs potential attack vectors and abnormal access patterns into the machine learning model for anomaly detection and vulnerability identification, and outputs the detection results; An alarm triggering module determines whether to trigger an alarm according to the login request in the detection result; A machine learning model optimization module stores the detection results and regularly analyzes them to optimize the machine learning model; The real-time monitoring of network traffic and capturing of data packets entering and leaving the network application are specifically as follows: the network traffic obtained from the traffic platform is used as input, a sniffer tool is used to monitor the network traffic of a specified network interface in real time, and a Scapy library is used to realize data packet capture; Parse the data packet and convert it into structured data, specifically: Each captured data packet is analyzed through a callback function; wherein, in the callback function, it is determined whether the data packet contains IP header information; If IP header information is included, the source IP, destination IP, protocol type, source port number, and destination port number are extracted, and the information is converted into JSON format data and output as structured data; Scanning the structured data by URL to identify potential attack vectors and abnormal access patterns, specifically: using a URL scanning algorithm to scan the structured data by URL, extracting URLs from hypertext transfer protocol requests and performing normalization processing, deleting redundancy in the URLs to obtain normalized URLs, extracting features from the normalized URLs to obtain URL features, and using a trained machine learning model to classify the URL features to determine whether they are malicious URLs to identify potential attack vectors and abnormal access patterns; Potential attack vectors and abnormal access patterns are input into the machine learning model for anomaly detection and vulnerability identification, and the detection results are output, specifically: The management backend is detected from the page through the trained machine learning model, and the detected management backend is secondary verified. Through the secondary verification, behaviors that deviate from the normal mode are detected, anomalies or loopholes are identified, and the identification results are confirmed, and the detection results are output based on the identification results.

4. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the network application vulnerability anomaly detection method according to any one of claims 1 to 2 is implemented.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the network application vulnerability anomaly detection method according to any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • Computer network security intrusion detection system

    CN112953966A

  • Information safety monitoring facility for heating station

    CN118300852A