A multi-dimensional feature extraction and dynamic weight fusion method and system for power grid web attacks
By employing a multi-dimensional feature extraction and dynamic weight fusion method, and utilizing a self-attention mechanism to dynamically adjust weights, the problem of single feature extraction dimensions and poor robustness of static fusion in power grid web attacks is solved, achieving efficient and low-latency attack detection.
Patent Information
- Application Number
- CN202610569532.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-28
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies, when facing web attacks on power grids, suffer from limited feature extraction dimensions, poor robustness of static fusion, high false alarm rates, and excessive computational overhead, making them ineffective in dealing with polymorphic attacks in complex power grid business scenarios.
A multi-dimensional feature extraction and dynamic weight fusion method is adopted. A shallow attention network is constructed through a self-attention mechanism. The attention scores of each dimension feature are calculated and the weights are dynamically adjusted to generate a fused feature vector. This vector is then combined with a classification network for attack detection.
It improves the recall rate of advanced persistent threats and variant attacks, reduces the false alarm rate, ensures the safe, stable and continuous operation of critical power grid business systems, and meets the requirements for low-latency detection.
Smart Images

Figure CN123184867A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of power Internet of Things (IoT) security, and in particular to a method and system for multi-dimensional feature extraction and dynamic weight fusion for power grid web attacks. Background Technology
[0002] Power grid web traffic is characterized by highly complex protocols, high concurrency, and low latency requirements. Faced with advanced persistent threat attacks, zero-day vulnerability exploits, and covert data theft targeting power grid infrastructure, existing methods primarily rely on manually extracted attack signature databases for serial matching and filtering, lacking semantic understanding of the web message context and exhibiting a significant semantic gap. Traditional rules lack semantic understanding of the web message context. Attackers can easily bypass such static defenses using advanced evasion techniques such as HTTP request smuggling, chunked transfer encoding, or AST multiple obfuscation mutations. Power grid business traffic often contains extremely long serialized data or measurement point identifiers with special symbols. Traditional WAFs are prone to large-scale false positives due to regular expression matching conflicts, severely disrupting the continuity of core power grid operations; simultaneously, they completely lose the ability to detect logical vulnerability attacks without obvious malicious signature strings. To overcome the limitations of rule matching, recent research has introduced natural language processing techniques, using models such as TextCNN and SVM to extract single-dimensional features from message content. However, new attacks targeting the power grid are often polymorphic. For example, in slow resource exhaustion attacks targeting power grid dispatching systems or low-frequency credential stuffing attacks targeting power grid user data, the payload of a single request is completely legitimate, and the malicious behavior only lurks in the time-series or protocol dimensions. Single-dimensional feature extraction methods will experience feature space collapse when faced with such anomalous behavior that does not involve malicious code injection, leading to model failure.
[0003] To address the shortcomings of single features, existing technologies generally employ early or late fusion when performing multi-feature fusion. The fundamental characteristic of this approach is that the contribution weights of different feature dimensions to the final decision are statically fixed. However, the traffic baselines of different subsystems within the power grid vary significantly, and different attack types require different discriminative features. The one-size-fits-all approach of static fusion cannot adapt to environmental changes and is prone to conceptual drift, leading to a significant drop in model accuracy when migrating across systems or facing combined attacks. In summary, existing technologies suffer from significant technical bottlenecks in the comprehensiveness of feature dimensions, particularly the environmental adaptability of multi-source feature fusion. There is an urgent need for a novel detection mechanism capable of comprehensively depicting a multi-dimensional profile of power grid web traffic and intelligently adjusting weights based on the dynamic threat environment. Summary of the Invention
[0004] In view of the aforementioned existing problems, this invention is proposed. Therefore, this invention provides a multi-dimensional feature extraction and dynamic weight fusion method and system for power grid web attacks, which solves the problems of existing technologies in dealing with complex power grid business scenarios, such as single feature extraction dimension, poor robustness of static fusion, high false alarm rate, and excessive computational overhead.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, embodiments of the present invention provide a method for multi-dimensional feature extraction and dynamic weight fusion for web attacks targeting power grids, including: Collect HTTP / HTTPS request messages from the power grid business system and preprocess the messages; Multi-dimensional feature vectors are extracted from preprocessed single session requests, and the feature vectors of each dimension are mapped to a unified hidden layer space through the corresponding mapping network to construct a multi-dimensional unified feature set. A shallow attention network is constructed based on the self-attention mechanism. The attention scores of each dimension of the features in the multidimensional unified feature set are calculated and normalized into dynamic weight coefficients. The features are then weighted and summed to generate a fused feature vector. The fused feature vector is input into the classification network to calculate the probability distribution of normal traffic and various types of Web attacks. When the probability value of an attack category exceeds a preset confidence threshold, it is determined to be a Web attack and a blocking command is triggered.
[0006] As a preferred embodiment of the multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks described in this invention, the step of extracting multi-dimensional feature vectors from a preprocessed single session request includes: Perform character-level statistical analysis on the Uniform Resource Locator (URL) and request body of the request to extract the total payload length, special character frequency, Shannon entropy, longest consecutive character length, and keyword hit count, and construct a statistical feature vector. Analyze the compliance of the Hypertext Transfer Protocol (HTTP) request header, and extract the compliance of the HTTP method, user agent anomaly, source domain name, field missing status, and content type consistency to form a protocol feature vector; Based on the access behavior of the source IP address within the sliding time window, the total number of requests, the mean and variance of the time interval, the proportion of error status codes, and the new IP identifier are statistically analyzed to form a time-series feature vector. The payload is segmented and embedded, and a pre-trained word vector model is used to map the text sequence into a dense word vector matrix, preserving the contextual logical relationship, and forming a semantic feature matrix.
[0007] As a preferred embodiment of the multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks described in this invention, the feature vectors of each dimension are mapped to a unified hidden space through corresponding mapping networks to construct a multi-dimensional unified feature set, including: The statistical feature vector is input into a first multilayer perceptron and its dimensions are mapped to a preset hidden layer dimension through a network structure containing fully connected layers, activation functions and dropout layers to obtain a first alignment vector. The protocol feature vector is input into the second multilayer perceptron, and a network structure that is the same as or adapted to the first multilayer perceptron is used to map its dimension to the preset hidden layer dimension to obtain the second alignment vector. The temporal feature vector is input into the third multilayer perceptron, and the same or adapted network structure as the first multilayer perceptron is used to map its dimension to the preset hidden layer dimension to obtain the third alignment vector. The semantic feature matrix is input into a bidirectional long short-term memory network. By concatenating the bidirectional hidden states and mapping them to the fully connected layer, its dimension is transformed to the preset hidden layer dimension to obtain the fourth alignment vector. The first alignment vector, the second alignment vector, the third alignment vector, and the fourth alignment vector are stacked in a preset order to form a multi-dimensional unified feature set.
[0008] As a preferred embodiment of the multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks described in this invention, the method includes: constructing a shallow attention network based on a self-attention mechanism, calculating the attention scores of each dimension feature in the multi-dimensional unified feature set, and normalizing them into dynamic weight coefficients, including: Construct a shallow attention network, which contains trainable weight parameters and bias terms; Each feature vector in the multidimensional unified feature set is input into the shallow attention network, and the corresponding unnormalized attention score is calculated through the activation function. The unnormalized attention scores of all feature vectors are processed using the Softmax normalization function to generate dynamic weight coefficients for each feature dimension.
[0009] As a preferred embodiment of the multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks described in this invention, the method involves weighted summation of features to generate a fused feature vector, including: The dynamic weight coefficients are multiplied element-wise with the aligned feature vector to obtain the weighted features of each dimension; the weighted features of all dimensions are summed to generate a fused feature vector.
[0010] As a preferred embodiment of the multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks described in this invention, the fused feature vector is input into a classification network to calculate and output the probability distributions of normal traffic and various web attacks, including: The fused feature vector is input into a classification network, which sequentially includes a first fully connected layer, a Dropout layer, a batch normalization layer, a second fully connected layer, and a Softmax output layer. Through forward propagation calculation, the fused features are mapped to a K-dimensional prediction vector, where K is the total number of classification categories, including 1 category of normal traffic and K-1 categories of web attack types; The Softmax function is applied to the prediction vector to generate a probability distribution vector, which contains the predicted probabilities of normal traffic, Structured Query Language (SQL) injection, cross-site scripting (XSS), path traversal, and command execution attacks.
[0011] As a preferred embodiment of the multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks described in this invention, it further includes: using a multi-class cross-entropy loss function and an L2 regularization term to form a joint loss function, and synchronously updating the classification network and module parameters through a backpropagation algorithm; When the maximum probability value of an attack category in the probability distribution vector output during the inference phase exceeds a preset confidence threshold, a security alert is generated and the perimeter firewall is activated to execute IP blocking or TCP reset commands.
[0012] Secondly, this invention provides a multi-dimensional feature extraction and dynamic weight fusion system for web attacks targeting power grids, comprising: The traffic acquisition and processing module is used to collect HTTP / HTTPS request messages from the power grid business system and preprocess the messages. The multi-dimensional feature construction module is used to extract multi-dimensional feature vectors from a preprocessed single session request and map the feature vectors of each dimension to a unified hidden layer space to construct a multi-dimensional unified feature set. The dynamic weight fusion module is used to construct a shallow attention network based on the self-attention mechanism, calculate the attention scores of each dimension of the features in the multidimensional unified feature set, and map the feature vectors of each dimension to a unified hidden space through the corresponding mapping network to construct a multidimensional unified feature set. The blocking decision module is used to input the fused feature vector into the classification network, calculate the probability distribution of normal traffic and various types of Web attacks, and when the probability value of the attack category exceeds the preset confidence threshold, it is determined to be a Web attack and a blocking command is triggered.
[0013] Thirdly, the present invention provides an electronic device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks.
[0014] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the method for multi-dimensional feature extraction and dynamic weight fusion for power grid Web attacks.
[0015] Compared with existing technologies, the beneficial effects of this invention are as follows: This invention targets a four-dimensional holographic feature extraction architecture for power grid web traffic, which includes statistics, protocols, time series, and semantics. By introducing time series variance analysis and network protocol micro-feature analysis, it can improve the recall rate of advanced persistent threats and variant attacks, and completely eliminate defense blind spots.
[0016] This invention utilizes a shallow attention network based on a self-attention mechanism, endowing the model with strong environmental adaptability and robustness, enabling it to maintain stable detection performance across different power grid business systems. The network possesses powerful context awareness capabilities, autonomously calculating and dynamically adjusting the decision weights of four feature dimensions based on the real-time feature distribution of each input traffic. This invention employs a dynamic weight fusion mechanism to achieve adaptive fault tolerance for legitimate traffic. When complex, legitimate, and strong business messages are ingested, even if statistical or semantic features exhibit attack-like fluctuations, the attention network can intelligently suppress the decision weights of vulnerable dimensions by recognizing the high legitimacy of the protocol and temporal dimensions. This mechanism, without sacrificing detection sensitivity, effectively filters false alarms caused by power grid-specific business data, keeping the false alarm rate at an extremely low level and ensuring the safe, stable, and continuous operation of critical power grid business systems.
[0017] This invention adopts an architecture design that combines front-end feature decoupling with back-end lightweight integration, enabling ultra-fast inference at the microsecond to millisecond level in high-concurrency, high-traffic environments of the power grid. It balances detection accuracy and real-time performance, meeting the engineering requirements of power system boundary defense for low latency and zero lag. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1This is a schematic diagram of the method flow for a multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks according to an embodiment of the present invention; Figure 2 This is an overall flowchart of a method for multi-dimensional feature extraction and dynamic weight fusion for power grid web attacks according to an embodiment of the present invention; Figure 3 This is a detailed diagram of the construction of a four-dimensional feature extraction matrix for a multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks according to an embodiment of the present invention; Figure 4 This is a schematic diagram of a dynamic weight feature fusion model based on a self-attention mechanism, which is a method for multi-dimensional feature extraction and dynamic weight fusion for power grid Web attacks according to an embodiment of the present invention. Figure 5 This is a shallow attention network structure diagram of a multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks according to an embodiment of the present invention; Figure 6 This is a real-world diagram illustrating the dynamic weight allocation against a variant of SQL injection attacks, as described in an embodiment of the multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks according to an embodiment of the present invention. Figure 7 This is a real-world diagram illustrating the dynamic weight allocation for a low-frequency, slow-speed crawler without load, as described in an embodiment of the present invention, which employs a multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks. Detailed Implementation
[0019] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0020] Example 1, referring to Figures 1-5 This is one embodiment of the present invention, which provides a method for multi-dimensional feature extraction and dynamic weight fusion for web attacks targeting power grids, such as... Figure 1 As shown, it includes: S100: Collects HTTP / HTTPS request messages from the power grid business system and preprocesses the messages; S200: Extract multi-dimensional feature vectors from a preprocessed single session request, and map the feature vectors of each dimension to a unified hidden space through the corresponding mapping network to construct a multi-dimensional unified feature set; S300: Construct a shallow attention network based on the self-attention mechanism, calculate the attention scores of each dimension of the features in the multidimensional unified feature set, normalize them into dynamic weight coefficients, perform weighted summation on the features, and generate a fused feature vector. S400: Input the fused feature vector into the classification network, calculate the probability distribution of normal traffic and various Web attacks, and when the probability value of the attack category exceeds the preset confidence threshold, it is determined to be a Web attack and a blocking command is triggered.
[0021] It should be noted that existing methods based on signatures or single deep features have severely limited detection dimensions. When attacks against the power grid system no longer rely on explicit malicious code injection—for example, slow CC attacks using legitimate business interfaces, low-frequency brute-force enumeration, or HTTP protocol-based request smuggling attacks—their payload feature space completely overlaps with normal business traffic, rendering traditional single-dimensional detection methods ineffective. Even when existing technologies employ multi-source features, the attention given to each feature dimension by their fusion strategy during the model inference stage is rigid and fixed. Fixed weights easily lead to a sharp drop in the model's generalization ability when crossing different power grid business systems. Power grid business systems frequently exchange massive amounts of serialized long text messages, which often contain measurement point identifiers with special symbols. Traditional regular expressions are prone to generating high false positives due to matching conflicts, severely interfering with the normal operation of core power grid business. If the raw massive amounts of messages are directly input into a large-scale deep neural network for implicit feature mining, the huge number of parameters and complex floating-point operations will lead to severe inference delays, making it impossible to deploy in the power grid's real-time blocking gateway.
[0022] like Figure 2As shown, this invention constructs a four-dimensional holographic feature extraction matrix covering structural statistics, network protocols, time series, and contextual semantics to achieve a comprehensive and accurate profile of power grid web session requests, from microscopic message structure to macroscopic interaction timing, eliminating blind spots in the detection of payload-free attacks launched using legitimate business logic. Furthermore, a dynamic weight allocation and nonlinear feature fusion network based on a self-attention mechanism is designed and introduced. This enables the model to autonomously calculate and dynamically adjust the contribution weights of each dimension according to the real-time input multidimensional feature distribution environment, overcoming the generalization bottleneck caused by static fusion and improving the model's robustness against new variant attacks. Through parallel multidimensional feature extraction and dynamic attention optimization, when facing normal traffic with strong business interference, the model can automatically reduce the weights of susceptible statistical / semantic dimensions and instead accurately determine its legitimacy by comparing it with the normal baseline of the protocol / time series dimension, thereby reducing the false alarm rate and ensuring the high availability of the power grid's core business system. A lightweight, decoupled feature extraction and efficient dynamic fusion network architecture is proposed. The front-end leverages expert prior knowledge to perform rapid, lightweight feature reduction and vectorization across statistical, temporal, and protocol dimensions; the back-end utilizes only an attention network for low-dimensional, precise weighted fusion. While ensuring high detection accuracy, this approach reduces the overall computational complexity of the model, meeting the millisecond-level real-time response and blocking requirements of power grid security equipment under high concurrency traffic.
[0023] Furthermore, in step S100 of this embodiment of the invention, HTTP / HTTPS request messages from the power grid business system are collected and preprocessed, including: For the URL and Body fields in the message, perform URL decoding, Base64 decoding, Unicode decoding and Hex decoding in sequence until decoding can no longer be performed; Use preset regular expressions to strip strong business feature data from the message and replace it with uniform placeholders to reduce noise in feature extraction; Convert all English characters to lowercase and remove consecutive whitespace and newline characters.
[0024] Specifically, traffic probes are deployed at the border gateways or core switches of power grid business systems, such as power grid marketing systems and distribution network SCADA system web interfaces. HTTP / HTTPS request messages are collected in a bypass manner using port mirroring technology. Key extracted fields include: source IP, destination IP, request timestamp, request method, Uniform Resource Locator (URL), request headers (including User-Agent, Referer, Cookie, etc.), and request body.
[0025] Furthermore, considering the strong business characteristics unique to power grid data, pre-defined regular expressions are used to remove sensitive and useless information from the messages, such as long strings of meter asset numbers, user ID numbers, and timestamp parameters, replacing them with uniform placeholders, such as... <id> 、 <time>This reduces noise in subsequent feature extraction.
[0026] In this embodiment of the invention, step S200 involves extracting multi-dimensional feature vectors from the preprocessed single session request, including: Perform character-level statistical analysis on the Uniform Resource Locator (URL) and request body of the request to extract the total payload length, special character frequency, Shannon entropy, longest consecutive character length, and keyword hit count, and construct a statistical feature vector. Analyze the compliance of the Hypertext Transfer Protocol (HTTP) request header, and extract the compliance of the HTTP method, user agent anomaly, source domain name, field missing status, and content type consistency to form a protocol feature vector; Based on the access behavior of the source IP address within the sliding time window, the total number of requests, the mean and variance of the time interval, the proportion of error status codes, and the new IP identifier are statistically analyzed to form a time-series feature vector. The payload is segmented and embedded, and a pre-trained word vector model is used to map the text sequence into a dense word vector matrix, preserving the contextual logical relationship, and forming a semantic feature matrix.
[0027] Furthermore, such as Figure 3 As shown, a single preprocessed session request and its associated context are decomposed into a feature vector with four independent dimensions.
[0028] Specifically, dimension one involves performing character-level statistical analysis on the URL and body of the current request, outputting a one-dimensional feature vector f1∈R^N1 (preset parameter N1=15); where: Total payload length: This is the total number of characters after concatenating the URL string and the Body string, serving as a fundamental characteristic for measuring message size.
[0029] Special character frequency: The total number of occurrences of 12 special characters, including single quotes ('), double quotes ("), angle brackets (<>), parentheses (()), semicolons (;), percent signs (%), equal signs (=), and hyphens (-), are counted in the load and then normalized by dividing by the total number of characters to obtain the percentage of special characters.
[0030] Shannon entropy: The character-level information entropy of the payload is calculated using the formula H = -Σp(c)·log2p(c), where p(c) is the probability of character c appearing in the payload. A higher entropy value indicates stronger randomness in the payload, making it more likely to be encrypted or obfuscated malicious code; a lower entropy value indicates a more concentrated distribution of characters in the payload, potentially representing normal business keywords.
[0031] Longest consecutive English letter length: Using a sliding window to scan the payload, record the maximum length of a consecutive English letter sequence. Extremely long consecutive letter strings are often SQL keywords, such as WAITFORDELAY or Base64 encoded features.
[0032] Longest consecutive number length: The maximum length of a consecutive number sequence in the statistical payload, used to identify delay parameters or port numbers in path traversal during time-blind injection.
[0033] Numeric character percentage: Total number of numeric characters divided by total payload length.
[0034] URL-encoded character percentage: The number of URL-encoded sequences in the "%XX" format in the statistical payload, divided by the total number of characters, is used to detect multi-encoding obfuscation attacks.
[0035] Keyword hit count: Perform exact matching in the preset attack keyword dictionary (containing about 200 keywords such as select, union, script, eval, exec, cmd, passwd, etc.) and count the number of hits.
[0036] Path depth: Counts the number of forward slashes ( / ) in the URL path, used to detect path traversal attacks, such as .. / .. / etc / passwd.
[0037] Number of parameters: Count the number of parameter pairs separated by "&" in the URL query string. Too many parameters may be a characteristic of parameter pollution attacks.
[0038] The above statistical values constitute the original statistical feature vector. Finally, all values are standardized by zero mean normalization: x_norm=(x-μ) / σ, where μ is the mean of the training set and σ is the standard deviation of the training set. After eliminating the influence of dimensions, the final feature vector f1 is output.
[0039] Specifically, dimension two analyzes the compliance and anomaly degree of the HTTP request protocol header, outputting a one-dimensional feature vector f2∈R^N2 (preset parameter N2=10); where: HTTP method compliance: Determine whether the request method belongs to the standard method set {GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH}. Non-standard methods, such as TRACE, CONNECT, or custom methods, are encoded as 1, otherwise 0.
[0040] User-Agent Anomaly Assessment: The User-Agent field in the request is compared with the UA signature strings of a pre-built known vulnerability scanning tool signature library, which includes tools such as sqlmap, nmap, nikto, masscan, and burpsuite (approximately 50 tools). The edit distance is calculated, and the minimum edit distance value is taken as the feature. The smaller the edit distance, the closer it is to a known scanning tool.
[0041] Referer domain compliance: Extract the domain name portion from the Referer field and perform an exact match with the trusted domain name whitelist of the power grid business system. If the Referer is empty or the domain name is not in the whitelist, it is encoded as 0; if it is in the whitelist, it is encoded as 1.
[0042] Missing Accept-Language field: Normal browser requests typically include the Accept-Language field, but automated attack scripts often omit this field. An empty field is encoded as 1, otherwise as 0.
[0043] Cookie field length anomaly: The total byte length of the cookie field is counted. If it exceeds a preset threshold, such as 2048 bytes, it is encoded as 1; otherwise, it is encoded as 0. An excessively long cookie may be a characteristic of session hijacking or cookie injection attacks.
[0044] Content-Type and Body Content Consistency: Check if the data format declared in the Content-Type, such as application / json or application / x-www-form-urlencoded, matches the actual content format of the Body. A mismatch is encoded as 1, otherwise 0.
[0045] Host field compliance: Check whether the Host field is a valid power grid business domain name or IP address. An invalid Host, such as an IP address that directly accesses the internal network, is encoded as 1.
[0046] X-Forwarded-For field presence: Detects the presence of the X-Forwarded-For field, which is often used by attackers to forge source IPs to bypass IP blacklists. If present, it is encoded as 1.
[0047] Total number of fields in the request header: This counts the total number of fields in the HTTP request header. An unusually low or high number of fields may be a characteristic of automation tools.
[0048] Protocol version: HTTP / 1.0 is encoded as 0, HTTP / 1.1 as 1, and HTTP / 2 as 2, to identify abnormal requests using older protocols.
[0049] The above feature values are also standardized by Z-score to output the final protocol feature vector f2.
[0050] Specifically, Dimension 3, based on the source IP address, statistically analyzes the access behavior of that IP within a preset sliding time window (T=60 seconds), outputting a one-dimensional feature vector f3∈R^N3 (preset parameter N3=8); where: Total number of requests within the time window: Count the total number of HTTP requests originating from the same source IP within a sliding window that extends backward by 60 seconds from the current request timestamp. An abnormally high request frequency is a typical characteristic of CC attacks or brute-force enumeration.
[0051] Mean request time interval: Calculates the arithmetic mean (in milliseconds) of the differences between two consecutive request timestamps within the sliding window. A very small mean indicates an extremely high request rate.
[0052] Request time interval variance: Calculates the variance of the sequence of adjacent request time intervals within a sliding window. A variance approaching 0 indicates a highly regular request interval, a strong characteristic of automated scripts such as web crawlers and scanners; the variance of time intervals from human operations is usually larger.
[0053] Frequency of access to the same interface: Within a sliding window, count the number of times the URL path of the current request, after removing query parameters, is accessed by the same source IP, and then normalized by dividing by the total number of requests. High-frequency access to the same interface is a characteristic of interface enumeration or brute-force attacks.
[0054] HTTP 4xx error status code ratio: This counts the percentage of HTTP 4xx responses triggered by the same source IP address within a sliding window, out of the total number of requests. A high percentage of 4xx errors is characteristic of path traversal probing or privilege circumvention attempts.
[0055] HTTP 5xx error status code ratio: This counts the percentage of HTTP 5xx responses triggered by the same source IP address within a sliding window, out of the total number of requests. A high percentage of 5xx errors may be a characteristic of server anomalies caused by injection attacks.
[0056] URL path diversity: This counts the number of different URL paths accessed by the same source IP within a sliding window, and normalizes this by dividing by the total number of requests. High path diversity indicates a directory scan is in progress; low path diversity may indicate a targeted attack.
[0057] New IP identifier: If the source IP appears in the access log of the power grid business system for the first time in the past 24 hours, it is encoded as 1; otherwise, it is 0. High-frequency requests initiated by new IPs are of higher risk.
[0058] After Z-score standardization, the above statistical values are output as the final temporal feature vector f3.
[0059] Specifically, dimension four captures the contextual logic relationships within the payload, outputting a two-dimensional feature matrix f4∈R^(L×D); where: Tokenization and Truncation: After concatenating the URL path, query parameter values, and Body text, tokenize the data according to non-alphanumeric characters, including spaces, forward slashes, equal signs, and quotation marks, to obtain a token sequence. The maximum sequence length is set to L=200; any exceeding this length is truncated, and any insufficient length is padded with zeros at the end.
[0060] Word embedding: Using a Word2Vec or GloVe model pre-trained on a mixed dataset of massive web attack payloads and normal power grid business messages, each token in the vocabulary is mapped to a dense word vector of dimension D=128. For tokens outside the vocabulary, the mean vector of all word vectors in the training set is used as a replacement. The final output is a semantic feature matrix f4∈R^(L×D), where each row corresponds to a 128-dimensional word vector representation of a token, fully preserving the sequence context information of the payload for subsequent deep semantic modeling by a bidirectional long short-term memory network.
[0061] In this embodiment of the invention, step S200 maps the feature vectors of each dimension to a unified hidden layer space through the corresponding mapping network to construct a multi-dimensional unified feature set, including: The statistical feature vector is input into the first multilayer perceptron. Through a network structure containing fully connected layers, activation functions and dropout layers, its dimensions are mapped to the preset hidden layer dimensions to obtain the first alignment vector. The protocol feature vector is input into the second multilayer perceptron, and the same or adapted network structure as the first multilayer perceptron is used to map its dimension to the preset hidden layer dimension to obtain the second alignment vector. The temporal feature vector is input into the third multilayer perceptron, and the same or adapted network structure as the first multilayer perceptron is used to map its dimension to the preset hidden layer dimension to obtain the third alignment vector. The semantic feature matrix is input into a bidirectional long short-term memory network. By concatenating the bidirectional hidden states and mapping them to the fully connected layer, its dimension is transformed to the preset hidden layer dimension to obtain the fourth alignment vector. The first alignment vector, the second alignment vector, the third alignment vector, and the fourth alignment vector are stacked in a preset order to form a multi-dimensional unified feature set.
[0062] It should be noted that the dynamic weight feature fusion based on the self-attention mechanism in this embodiment of the invention breaks the limitations of traditional hard feature splicing and allows the model to adaptively find the optimal decision dimension according to the context of the current traffic.
[0063] In one feasible approach, such as Figure 4 and Figure 5 As shown, in order to perform attention calculations in the same space, features of different dimensions need to be mapped to a unified hidden layer dimension d_model, with a preset d_model=64. The specific implementation process is as follows: Alignment mapping of statistical feature f1 (dimension N1=15): Input f1 into a two-layer multilayer perceptron (MLP1) with the following network structure: fully connected layer (15→32, ReLU activation) → Dropout (dropout rate 0.3) → fully connected layer (32→64, ReLU activation), and output alignment vector v1∈R^64.
[0064] Alignment mapping of protocol feature f2 (dimension N2=10): Input f2 into a two-layer multilayer perceptron (MLP2), the network structure is: fully connected layer (10→32, ReLU activation) → Dropout (dropout rate 0.3) → fully connected layer (32→64, ReLU activation), output alignment vector v2∈R^64.
[0065] Alignment mapping of temporal feature f3 (dimension N3=8): f3 is input into a two-layer multilayer perceptron (MLP3) with the following network structure: fully connected layer (8→32, ReLU activation) → Dropout (dropout rate 0.3) → fully connected layer (32→64, ReLU activation), and the output alignment vector v3∈R^64.
[0066] Alignment mapping of semantic feature f4 (dimension L×D=200×128): f4 is input into a bidirectional long short-term memory network, specifically structured as follows: Bi-LSTM layer (input dimension 128, hidden layer dimension 64, bidirectional, i.e., forward LSTM hidden layer 64 dimensions + backward LSTM hidden layer 64 dimensions, concatenated output dimension 128) → take the hidden state of the last time step (dimension 128) → fully connected layer (128→64, ReLU activation), output alignment vector v4∈R^64.
[0067] The four alignment vectors are stacked into a matrix V=[v1;v2;v3;v4]∈R^(4×64), which serves as the input for attention computation.
[0068] In this embodiment of the invention, step S300, which involves constructing a shallow attention network based on a self-attention mechanism, calculating the attention scores of each dimension of the multidimensional unified feature set, and normalizing them into dynamic weight coefficients, includes: Construct a shallow attention network, which contains trainable weight parameters and bias terms; Each feature vector in the multidimensional unified feature set is input into a shallow attention network, and the corresponding unnormalized attention score is calculated through the activation function. The unnormalized attention scores of all feature vectors are processed using the Softmax normalization function to generate dynamic weight coefficients for each feature dimension.
[0069] Specifically, each feature vector from the multidimensional unified feature set is input into a shallow attention network, and the corresponding unnormalized attention score is calculated using the hyperbolic tangent activation function, as follows: Among them, W a ∈R^(64×64) and b a ∈R^64, Indicates the first Each feature vector is mapped to an aligned vector after passing through the corresponding feature extraction network to the preset hidden layer dimension. Furthermore, the unnormalized attention scores of all feature vectors are normalized using the Softmax function to generate dynamic weight coefficients for each feature dimension. , represented as: , i∈{1,2,3,4}, where, For the first An exponential function of input values Σ is the sum of the exponents of all four input values. i α i =1, α i The range of its value is between (0,1).
[0070] Furthermore, shallow attention networks include MLP1~MLP3, Bi-LSTM, fully connected alignment layers, and attention network W. a / b a The subsequent classification network is trained using an end-to-end joint training method. The specific training process is as follows: Historical HTTP traffic logs from the power grid business system were collected and manually labeled to construct a labeled dataset containing normal traffic and K types of attack samples, including SQL injection, XSS cross-site scripting, path traversal, command execution, and malicious crawlers. The training set, validation set, and test set were divided into three sets in a 7:1.5:1.5 ratio, and oversampling (SMOTE algorithm) was performed on the number of samples in each class to solve the class imbalance problem.
[0071] The multi-class cross-entropy loss function is used: L = -Σ k y k ·log( k ), where y k One-hot encoding for the real label. k This represents the predicted probability output by the model.
[0072] The Adam optimizer was used, with an initial learning rate of 1×10⁻⁶. -3 In addition, a cosine annealing learning rate scheduling strategy is used to dynamically reduce the learning rate during training. The batch size is set to 128, the maximum number of training rounds is 100, and an early stopping strategy is adopted: training is stopped if the validation set loss does not decrease for 10 consecutive rounds to prevent overfitting.
[0073] Dropout (dropout rate 0.3) and L2 weight regularization (regularization coefficient λ = 1 × 10⁻⁶) are added between the layers of the MLP. -4 This is to improve the model's generalization ability.
[0074] The macro-average F1 score on the validation set is used as the model selection metric, and the model weight parameters corresponding to the highest Macro-F1 score on the validation set are saved as the final deployment model.
[0075] In this embodiment of the invention, step S300, which involves weighted summation of the features to generate a fused feature vector, includes: The dynamic weight coefficients are multiplied element-wise with the aligned feature vector to obtain the weighted features of each dimension; the weighted features of all dimensions are summed to generate the fused feature vector.
[0076] Specifically, the calculated dynamic weights are multiplied element-wise with the aligned feature vectors and then summed to generate the final integrated context-aware fused feature vector: F_fused = Σ i α i ·v i , i∈{1,2,3,4}; Here, F_fused∈R^64 is a context-aware feature vector that integrates information from four dimensions and is dynamically weighted by an attention mechanism.
[0077] It should be noted that the fused feature vectors are input into the final classification network. The classification network in this embodiment is adaptively designed for multi-classification tasks involving power grid web attacks, and is jointly trained end-to-end with the aforementioned feature extraction and fusion modules.
[0078] In this embodiment of the invention, step S400 involves inputting the fused feature vector into the classification network and calculating the probability distribution of normal traffic and various types of Web attacks, including: The fused feature vector is input into the classification network, which consists of a first fully connected layer, a Dropout layer, a batch normalization layer, a second fully connected layer, and a Softmax output layer. Through forward propagation calculation, the fused features are mapped to a K-dimensional prediction vector, where K is the total number of classification categories, including 1 category of normal traffic and K-1 categories of web attack types; The Softmax function is applied to the prediction vector to generate a probability distribution vector, which contains the predicted probabilities of normal traffic, Structured Query Language (SQL) injection, cross-site scripting (XSS), path traversal, and command execution attacks.
[0079] In this embodiment of the invention, step S400 further includes: using a multi-class cross-entropy loss function and an L2 regularization term to form a joint loss function, and synchronously updating the classification network and module parameters through a backpropagation algorithm; When the maximum probability value of an attack category in the probability distribution vector output during the inference phase exceeds a preset confidence threshold, a security alert is generated and the perimeter firewall is activated to execute IP blocking or TCP reset commands.
[0080] In one possible implementation, the classification network consists of the following layers: The first layer is a fully connected layer with an input dimension of 64 and an output dimension of 32. The activation function is ReLU. It is followed by a Dropout layer with a dropout rate of 0.3 and a batch normalization layer, which are used to further extract higher-order nonlinear representations of the fused features.
[0081] The second fully connected layer has an input dimension of 32 and an output dimension of 16. The activation function is ReLU, followed by a Dropout layer with a dropout rate of 0.2.
[0082] Output layer: Fully connected layer, with 16 input dimensions and K output dimensions, where K is the total number of categories, including 1 category of normal traffic and K-1 categories of attack types, and the activation function is Softmax.
[0083] The output layer has K nodes, corresponding to normal traffic and various common web attack types affecting the power grid, such as SQL injection, cross-site scripting (XSS), path traversal, command execution, and malicious crawling. The output value is a probability distribution vector, calculated as follows: Let the input of the output layer, i.e. the output of Dense2, be a vector z∈R^K, where the k-th element is z. k The output layer then uses the Softmax function to transform it into a probability distribution vector P∈R^K: P = Softmax(z) = [p1, p2, ..., p k ,...,pᴷ]ᵀ The predicted probability for class k is: p k =exp(z k ) / Σ j=1 ᴷexp(z j k∈{1,2,...,K} Satisfy the constraint condition: Σ k=1 ᴷp k =1, and p k ∈(0,1).
[0084] Where p1 corresponds to the predicted probability of normal traffic, and p2 to pᴷ correspond to the predicted probabilities of various attack types, respectively. The final predicted category is the category with the highest probability. =argmax k p k .
[0085] Furthermore, the classification network is integrated with the aforementioned feature extraction modules (MLP1~MLP3, Bi-LSTM) and attention fusion module (W). a / b a End-to-end joint training is performed, and the training process is as follows: Step 1: Parameter initialization. The weights of each layer of the MLP are initialized with He, which is suitable for the ReLU activation function. The weights of the Bi-LSTM are initialized with orthogonality, and the bias term is initialized to zero.
[0086] Step 2: The overall training objective of the network is to minimize the multi-class cross-entropy loss: L_total = L_CE + λ·L_L2, where L_CE is the cross-entropy loss, L_L2 is the L2 regularization term for all trainable parameters, and λ = 1 × 10^2. -4 This is the regularization coefficient.
[0087] Step 3: The loss gradient is passed from the output layer to the classification network, attention network, dimension-aligned MLP and Bi-LSTM through the backpropagation algorithm. The parameters of all modules are updated synchronously in the same optimization step to ensure that the modules are optimized together.
[0088] Step 4: After training is complete, evaluate the model's precision, recall, F1 score, and confusion matrix on an independent test set. After confirming that the detection performance of each attack category meets the requirements of power grid security protection, export the model weights in ONNX format and deploy them to the inference engine of the power grid boundary security gateway to achieve millisecond-level real-time inference.
[0089] When the category corresponding to the maximum probability value is not normal traffic and the probability exceeds the preset confidence threshold, such as Th=0.85, the system immediately generates a security alarm and links the power grid boundary firewall to issue an IP blocking or TCP reset command.
[0090] The above is an illustrative scheme of a multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks according to this embodiment. It should be noted that the technical solution of this multi-dimensional feature extraction and dynamic weight fusion system for power grid web attacks belongs to the same concept as the technical solution of the aforementioned multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks. Details not described in detail in this embodiment can be found in the description of the aforementioned multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks.
[0091] This embodiment presents a multi-dimensional feature extraction and dynamic weight fusion system for web attacks targeting power grids, comprising: The traffic acquisition and processing module is used to collect HTTP / HTTPS request messages from the power grid business system and preprocess the messages. The multi-dimensional feature construction module is used to extract multi-dimensional feature vectors from a preprocessed single session request and map the feature vectors of each dimension to a unified hidden layer space to construct a multi-dimensional unified feature set. The dynamic weight fusion module is used to construct a shallow attention network based on the self-attention mechanism, calculate the attention scores of each dimension of the features in the multidimensional unified feature set, and map the feature vectors of each dimension to the unified hidden space through the corresponding mapping network to construct the multidimensional unified feature set. The blocking decision module is used to input the fused feature vector into the classification network, calculate the probability distribution of normal traffic and various types of Web attacks, and determine the Web attack when the probability value of the attack category exceeds the preset confidence threshold and triggers the blocking command.
[0092] This embodiment also provides an electronic device applicable to the multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks, including: The system includes a memory and a processor. The memory stores computer-executable instructions, and the processor executes these instructions to implement the multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks proposed in the above embodiments.
[0093] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the method for multi-dimensional feature extraction and dynamic weight fusion for web attacks targeting power grids, as proposed in the above embodiments.
[0094] The storage medium proposed in this embodiment and the method for multi-dimensional feature extraction and dynamic weight fusion for power grid Web attacks proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0095] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0096] Example 2, refer to Figures 6-7 This is one embodiment of the present invention. Unlike the first embodiment, this embodiment is based on different power grid business scenarios to verify the beneficial effects of the present invention.
[0097] Example 1: Detection of variant SQL injection attacks in power grid marketing systems, such as... Figure 6 As shown, when faced with a high-intensity malicious code payload, the model automatically shifts its weights significantly towards semantic and statistical dimensions to accurately capture code logic anomalies.
[0098] In this embodiment, the attack scenario involves an attacker using automated tools to launch a variant of time-based blind SQL injection against the user electricity bill query interface of the power grid marketing system. To bypass traditional WAFs, the attacker used double-encoded URLs and fragmented the malicious payload through chunked transmission.
[0099] The preprocessing module successfully reassembled and decoded it, exposing the payload id=1'waitfordelay'0:0:5'. The feature extraction module found an extremely high proportion of single quotes and special symbols in dimension one; in dimension four, the Word2Vec word embedding layer accurately captured strong database control command semantics such as waitfor and delay; while dimensions two and three both exhibited the characteristics of a normal single-access session by an ordinary user.
[0100] The attention network detected extremely high variance activation values in the first and fourth dimension vectors, and the dynamically calculated weight distribution was: α1=0.35, α2=0.05, α3=0.05, α4=0.55.
[0101] The system autonomously allocated the majority of decision weight to semantic and statistical features, ignoring the seemingly normal temporal spoofing. The classifier accurately alerted and blocked the SQL variant attack with a confidence level of 98.5%.
[0102] Example 2: Malicious scraping of low-frequency, slow data from power grid distribution SCADA systems, such as... Figure 7 As shown, traditional detection devices are prone to missing detections when faced with slow attacks that have no malicious code but have highly automated behavior. However, the model of this invention automatically shifts the weights to the time series and protocol dimensions, successfully filling the detection blind spots.
[0103] In this embodiment, the attack scenario involves an attacker using a custom Python web crawler script to repeatedly request historical load data interfaces of the power distribution SCADA system at an extremely low fixed frequency of once every 45 seconds, attempting to steal power grid operation data. All parameters in each request are valid, and there is no SQL or XSS code involved.
[0104] In Dimension 1, the features are completely consistent with the operations of the power grid's internal dispatcher, indicating that the behavior is legitimate; in Dimension 2, the User-Agent exhibits characteristics of a non-mainstream browser; in Dimension 3, it was found that within a 10-minute sliding window, the variance of the request time interval of this source IP is close to 0.
[0105] The attention network found no anomalies in the semantic and statistical vectors, but the temporal vectors deviated significantly from the baseline of normal human operation. The dynamically calculated weight distribution was instantly adjusted to: α1=0.05, α2=0.25, α3=0.65, α4=0.05.
[0106] The system abandons the worthless payload semantic judgment and greatly amplifies the weight of time-series variance anomalies and protocol anomalies. The classifier successfully identifies and alerts to low-frequency malicious crawler / abnormal enumeration attacks. Devices that traditionally rely solely on payload inspection will miss 100% of these attacks in this scenario.
[0107] Example 3: Suppression of high false alarm rates in the legitimate massive telemetry messages of power grid metering terminals: The business scenario involves metering terminals at a substation in a certain area sending daily end-of-day reports back to the main station in batches. The messages use a complex SOAP / XML format, containing a large number of angle brackets <>, single quotes, and special measurement point identifiers, which can easily trigger command execution or XSS cross-site interception rules in traditional WAFs.
[0108] The extracted statistical features show extremely long message lengths and numerous special symbols, indicating a certain level of risk. However, protocol and timing characteristics reveal that the source IP belongs to a high-confidence internal network segment, and the traffic exhibits inherent baseline characteristics of periodicity and high concurrency.
[0109] The model learns a specific baseline pattern, and when calculating the weights, it actively suppresses statistical dimensions that are prone to false alarms: α1=0.10, α2=0.40, α3=0.40, α4=0.10.
[0110] By leveraging the legality of the protocol and the high-confidence time-series baseline characteristics, the classifier ultimately determines the traffic as normal business traffic with a high probability, avoiding business interruption caused by special characters and solving the pain point of high false alarms that plagues power grid safety operation and maintenance.
[0111] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.< / time> < / id>
Claims
1. A method for multi-dimensional feature extraction and dynamic weight fusion for web attacks targeting power grids, characterized in that, include: Collect HTTP / HTTPS request messages from the power grid business system and preprocess the messages; Multi-dimensional feature vectors are extracted from preprocessed single session requests, and the feature vectors of each dimension are mapped to a unified hidden layer space through the corresponding mapping network to construct a multi-dimensional unified feature set. A shallow attention network is constructed based on the self-attention mechanism. The attention scores of each dimension of the features in the multidimensional unified feature set are calculated and normalized into dynamic weight coefficients. The features are then weighted and summed to generate a fused feature vector. The fused feature vector is input into the classification network to calculate the probability distribution of normal traffic and various types of Web attacks. When the probability value of an attack category exceeds a preset confidence threshold, it is determined to be a Web attack and a blocking command is triggered.
2. The method for multi-dimensional feature extraction and dynamic weight fusion for power grid Web attacks as described in claim 1, characterized in that, The step of extracting multi-dimensional feature vectors from preprocessed single session requests includes: Perform character-level statistical analysis on the Uniform Resource Locator (URL) and request body of the request to extract the total payload length, special character frequency, Shannon entropy, longest consecutive character length, and keyword hit count, and construct a statistical feature vector. Analyze the compliance of the Hypertext Transfer Protocol (HTTP) request header, and extract the compliance of the HTTP method, user agent anomaly, source domain name, field missing status, and content type consistency to form a protocol feature vector; Based on the access behavior of the source IP address within the sliding time window, the total number of requests, the mean and variance of the time interval, the proportion of error status codes, and the new IP identifier are statistically analyzed to form a time-series feature vector. The payload is segmented and embedded, and a pre-trained word vector model is used to map the text sequence into a dense word vector matrix, preserving the contextual logical relationship, and forming a semantic feature matrix.
3. The multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks as described in claim 2, characterized in that, The feature vectors of each dimension are mapped to a unified hidden layer space through corresponding mapping networks to construct a multi-dimensional unified feature set, including: The statistical feature vector is input into a first multilayer perceptron and its dimensions are mapped to a preset hidden layer dimension through a network structure containing fully connected layers, activation functions and dropout layers to obtain a first alignment vector. The protocol feature vector is input into the second multilayer perceptron, and a network structure that is the same as or adapted to the first multilayer perceptron is used to map its dimension to the preset hidden layer dimension to obtain the second alignment vector. The temporal feature vector is input into the third multilayer perceptron, and the same or adapted network structure as the first multilayer perceptron is used to map its dimension to the preset hidden layer dimension to obtain the third alignment vector. The semantic feature matrix is input into a bidirectional long short-term memory network. By concatenating the bidirectional hidden states and mapping them to the fully connected layer, its dimension is transformed to the preset hidden layer dimension to obtain the fourth alignment vector. The first alignment vector, the second alignment vector, the third alignment vector, and the fourth alignment vector are stacked in a preset order to form a multi-dimensional unified feature set.
4. The method for multi-dimensional feature extraction and dynamic weight fusion for power grid Web attacks as described in claim 3, characterized in that, A shallow attention network is constructed based on the self-attention mechanism. The attention scores of each dimension of the features in the multidimensional unified feature set are calculated and normalized into dynamic weight coefficients, including: Construct a shallow attention network, which contains trainable weight parameters and bias terms; Each feature vector in the multidimensional unified feature set is input into the shallow attention network, and the corresponding unnormalized attention score is calculated through the activation function. The unnormalized attention scores of all feature vectors are processed using the Softmax normalization function to generate dynamic weight coefficients for each feature dimension.
5. The multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks as described in claim 4, characterized in that, The features are weighted and summed to generate a fused feature vector, including: The dynamic weight coefficients are multiplied element-wise with the aligned feature vector to obtain the weighted features of each dimension; the weighted features of all dimensions are summed to generate a fused feature vector.
6. The multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks as described in claim 5, characterized in that, The fused feature vector is input into a classification network to calculate the probability distribution of normal traffic and various web attacks, including: The fused feature vector is input into a classification network, which sequentially includes a first fully connected layer, a Dropout layer, a batch normalization layer, a second fully connected layer, and a Softmax output layer. Through forward propagation calculation, the fused features are mapped to a K-dimensional prediction vector, where K is the total number of classification categories, including 1 category of normal traffic and K-1 categories of web attack types; The Softmax function is applied to the prediction vector to generate a probability distribution vector, which contains the predicted probabilities of normal traffic, Structured Query Language (SQL) injection, cross-site scripting (XSS), path traversal, and command execution attacks.
7. The multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks as described in claim 6, characterized in that, It also includes: using a multi-class cross-entropy loss function and an L2 regularization term to form a joint loss function, and updating the classification network and module parameters synchronously through the backpropagation algorithm; When the maximum probability value of an attack category in the probability distribution vector output during the inference phase exceeds a preset confidence threshold, a security alert is generated and the perimeter firewall is activated to execute IP blocking or TCP reset commands.
8. A multi-dimensional feature extraction and dynamic weight fusion system for power grid web attacks, applied to the method described in any one of claims 1-7, characterized in that, include: The traffic acquisition and processing module is used to collect HTTP / HTTPS request messages from the power grid business system and preprocess the messages. The multi-dimensional feature construction module is used to extract multi-dimensional feature vectors from a preprocessed single session request and map the feature vectors of each dimension to a unified hidden layer space to construct a multi-dimensional unified feature set. The dynamic weight fusion module is used to construct a shallow attention network based on the self-attention mechanism, calculate the attention scores of each dimension of the features in the multidimensional unified feature set, and map the feature vectors of each dimension to a unified hidden space through the corresponding mapping network to construct a multidimensional unified feature set. The blocking decision module is used to input the fused feature vector into the classification network, calculate the probability distribution of normal traffic and various types of Web attacks, and when the probability value of the attack category exceeds the preset confidence threshold, it is determined to be a Web attack and a blocking command is triggered.
9. An electronic device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the multi-dimensional feature extraction and dynamic weight fusion method for power grid Web attacks as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the multi-dimensional feature extraction and dynamic weight fusion method for power grid web attacks as described in any one of claims 1 to 7.
