Capsule neural network-based phishing website detection method and system

Through the multi-dimensional feature analysis method based on capsule neural network and combined with the adversarial training mechanism, the problem of difficulty in identifying advanced camouflage phishing websites in the existing technology is solved, and efficient and real-time phishing website detection is achieved.

CN119853971AActive Publication Date: 2025-04-18JIANGSU COLLEGE OF FINANCE & ACCOUNTING
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411864802.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-18
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

Existing phishing website detection methods are difficult to effectively identify phishing websites disguised using advanced technology, and traditional methods have a long processing time, are inefficient, and are difficult to respond in real time.

Method used

A multi-dimensional feature analysis method based on capsule neural network is adopted, combined with URL features, page content and visual representation, and multi-level and multi-dimensional feature extraction and classification are used to enhance the generalization ability and robustness of the model.

Benefits of technology

It improves the accuracy and real-time detection of phishing websites, reduces the false positive rate, enhances the model's adaptability to new phishing strategies, and achieves efficient and real-time detection of phishing websites.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119853971A_ABST
    Figure CN119853971A_ABST
Patent Text Reader

Abstract

The invention discloses a phishing website detection method and system based on a capsule neural network. Segmenting different components of the website URL, and implementing character-level word segmentation, truncation filling and coding to realize fine-grained feature discrimination of the different components; extracting features of the component level and the whole URL; a capsule network is utilized to learn an overall space structure, and normal and phishing URLs are distinguished through a joint classification network. According to the method and the system, an adversarial training mechanism is introduced, independent adversarial training is carried out on multiple embedded layers, the accuracy and F1-Score of the model are improved, the false alarm rate is reduced, and therefore the robustness and generalization ability of the model are enhanced. Experimental results show that the technology exceeds the prior art on a million-level sample data set, and the identification performance of the phishing URL is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of phishing website detection, and in particular to a phishing website detection method and system based on capsule neural network. Background Art

[0002] With the widespread popularity of the Internet, cybersecurity issues have become one of the focuses of global attention, especially the growing threat of phishing attacks. Phishing is a social engineering technique in which attackers create fake websites to deceive users and steal their sensitive information, such as login credentials and credit card information. Since phishing websites can be created quickly and at low cost, they have become a common tool for cybercriminals. In addition, the precise targeting and diverse methods of phishing attacks make it difficult for traditional defense methods to effectively respond.

[0003] FreeLB adversarial training algorithm: a technique that enhances the robustness of a model under unknown attacks by maximizing the adversarial perturbations of the model on the training data. The FreeLB algorithm performs well in improving the generalization ability of natural language processing models and image processing models. Long Short-Term Memory Network (LSTM): a special type of recurrent neural network (RNN) that is capable of learning long-term dependency information. LSTM is particularly effective in processing and predicting key events in time series data. Embedding technology: used to convert large category inputs (such as the vocabulary of a language) into dense vectors of fixed length, which can capture complex relationships between inputs and are widely used in natural language processing and other machine learning tasks.

[0004] Although the prior art provides a variety of phishing website detection methods, the following shortcomings still exist. Methods based on URL text: Although the processing speed is fast, it may not be able to effectively identify phishing websites that are carefully disguised using advanced technology. Methods based on website host information and visual features: These methods rely on the analysis of page content and visual layout, but the rapid changes and diversification of phishing websites make this method vulnerable to the update of phishing technology. Methods based on website content: Although they can identify phishing websites more accurately, they require in-depth analysis of the website, which takes a long time to process, is inefficient, and difficult to respond in real time.

[0005] In the current environment, there is an urgent need for a technology that can achieve efficient, real-time and accurate phishing website detection. This technology should be combined with the latest machine learning algorithms, such as adversarial training and deep learning, to improve the accuracy of detection and reduce false positives. The new technology should be able to automatically adapt to changes in phishing website strategies and improve the flexibility and scalability of the system. In addition, the new invention should simplify the data processing process and reduce the reliance on large-scale data collection and storage to improve the overall efficiency and operability of the system.

[0006] In summary, the invention of a multi-level, multi-dimensional phishing website detection system that integrates the latest machine learning technology can not only effectively improve the detection performance, but also meet the needs of real-time processing, which is of great practical significance for preventing phishing attacks. Summary of the invention

[0007] In view of the shortcomings of the prior art, the present invention provides a phishing website detection method and system based on capsule neural network, aiming to improve the accuracy of phishing website detection, reduce the false alarm rate, and enhance the model's adaptability to new phishing strategies. The present invention proposes a method of combining multi-dimensional feature analysis with capsule network to effectively integrate multiple aspects of information such as URL features, page content and visual performance. Specifically including:

[0008] S1: Segment and parse different components of the URL, including the following steps:

[0009] S1-1: parse the input URL, remove the protocol identifier, and split the remaining URL into host name, path, query parameter and anchor parts, obtain the segmentation result res, and the input locator URL is represented by u;

[0010] S1-2: perform character-level segmentation on each component of res, convert each character into a corresponding numerical code according to a predefined character encoding mapping table, and form a code sequence res1;

[0011] S1-3: Standardize the encoded sequence res1, including truncation and padding; if the sequence length exceeds L, the excess part is truncated; if it is less than L, it is padded with zeros to a length of L, and finally a standardized URL component sequence res is obtained. sequence ;

[0012] S2: Extract features from each component and use the capsule network to further extract the overall spatial structure for classification, which specifically includes the following steps:

[0013] S2-1: The res obtained in step S1 sequence , input to the embedding layer for vectorization, and then through two layers of one-dimensional convolutional networks and a layer of bidirectional long short-term memory network for in-depth feature extraction. The specific calculation expression is as follows:

[0014] res feature =Bi-LSTM(CNN1D(CNN1D(Embedding(res sequence ))))

[0015] S2-2: Extract the features res feature Merge to form a comprehensive URL feature vector URL feature , and its calculation formula is:

[0016] URL feature =concatenate(res feature )

[0017] Among them, CNN1D represents a two-layer one-dimensional convolutional network, and Bi-LSTM represents a one-layer bidirectional long short-term memory network;

[0018] S2-3: Enter URL feature Go to the capsule network for learning, and classify phishing websites and non-phishing websites based on the network output;

[0019] S3: During the model training process, an adversarial learning mechanism is used to independently conduct adversarial training on multiple embedding layers to improve the generalization of the model. The specific steps include:

[0020] S3-1: During model training, the FreeLB algorithm is used to perform independent adversarial training on the embedding layer, adding small perturbations through multiple steps of iteration to enhance the generalization ability of the model;

[0021] S3-2: Use the gradient information to calculate the perturbations of each embedding layer, store these perturbations temporarily, and finally apply them to the original input of each component to generate adversarial samples for training.

[0022] As an alternative solution of the present invention, the protocol identifier in step S1 includes http: / / or https: / / .

[0023] As an alternative solution of the present invention, encoding the URL component in step S1-2 specifically includes:

[0024] Perform character-level segmentation on each component obtained from the URL, and identify and segment the characters in each component independently;

[0025] Each segmented character is converted into a unique numerical code using a predefined character encoding mapping table designed to ensure that common, similarly shaped characters can be encoded into numerical values ​​with similar attributes;

[0026] Through this encoding process, an encoded sequence of each URL component is obtained, which provides input data for subsequent feature extraction and classification steps.

[0027] As an alternative solution of the present invention, the two-layer one-dimensional convolutional network described in step S2-1 has the following specific structure:

[0028] The first convolutional network layer processes the sequence of standardized URL components generated in step S1 using a one-dimensional convolutional layer with 32 filters, each with a filter size of 3 and a stride of 1.

[0029] Activation layer: nonlinear activation function is applied after the first convolution layer;

[0030] Second convolutional network layer: Based on the first layer, add another one-dimensional convolutional layer with 64 filters, filter size 3, and stride 1;

[0031] Batch Normalization Layer: Batch normalization is used after each convolution operation to accelerate the convergence of the network and reduce internal covariate shift during model training;

[0032] Pooling layer: A max pooling layer is used after two convolutional layers with a pooling window size of 2 and a stride of 2.

[0033] As an alternative solution of the present invention, the one-layer bidirectional long short-term memory network described in step S2-1 has the following specific structure:

[0034] Bidirectional processing: The network is configured in bidirectional processing mode, including two LSTM networks in independent directions, so that the network can process the forward and backward information of the sequence data simultaneously, and the independent directions include forward and reverse;

[0035] Number of units: 64 LSTM units are set in each direction, for a total of 128 units;

[0036] Output merging: The outputs generated by the network from both directions are merged at the last time step, providing a global understanding of the entire input sequence;

[0037] Connection method: The merged output is connected to the subsequent network layer for further feature fusion and classification processing.

[0038] As an alternative scheme of the present invention, in the adversarial training process described in step S3-2, the embedding layer of each component calculates the corresponding perturbation based on the current gradient of the model. The perturbation amount is first calculated and saved in a temporary array. During the training iteration process, these perturbations are repeatedly added to the original input data of each component to form adversarial samples for further training and optimization of the model.

[0039] As an alternative solution of the present invention, the method of adding disturbance to each embedded layer specifically includes the following steps:

[0040] Forward propagation: First, forward propagate the features of the embedding layer in step S2-1 to obtain the output of the model under the current parameters;

[0041] Backpropagation and perturbation calculation: During the backpropagation of the model, the perturbation of each embedding layer is calculated using the gradient ascent method;

[0042] Perturbation application: The calculated perturbation is added to the parameter matrix of each embedding layer, where this modification is temporary and is only applied in the current training iteration to generate adversarial examples;

[0043] Adversarial training: Use the perturbed embedding layer to generate adversarial examples, and then use these examples to further train the model.

[0044] As an alternative solution of the present invention, a phishing website detection system based on capsule neural network includes:

[0045] The first module is used to segment the URL by components, divide the character set, truncate, fill and encode. This module is responsible for parsing the input URL, removing the protocol identifier, and segmenting the remaining URL into the host name, path, query parameters and anchor parts. It performs character-level segmentation on each component, converts each character into the corresponding numerical code according to the predefined character encoding mapping table, and truncates or fills the encoded sequence as needed to ensure the consistency of the sequence length, in preparation for subsequent feature extraction.

[0046] The second module is used to extract features from the sequence after group encoding, and use the capsule network to further extract the overall spatial structure for classification. This module first uses the embedding layer to convert the character-level encoding into a vector form, and then uses a one-dimensional convolutional network and a bidirectional long short-term memory network to deeply extract features. Finally, these features are combined through the capsule network to learn the spatial relationship of the features and make effective classification decisions;

[0047] The third module: It is used to adopt the adversarial learning mechanism in the model training process, independently adversarial multiple embedding layers, and improve the generalization of the model. This module introduces perturbations to each embedding layer through the FreeLB algorithm, and enhances the robustness of the model to input perturbations through multi-step iterative ascent processing, which is used to improve the accuracy and reliability of phishing website detection.

[0048] Compared with the prior art, the present invention has the following beneficial effects:

[0049] Component-level data processing: By splitting the URL into different components for processing, the present invention allows independent analysis and feature extraction of each URL component; this method takes advantage of the natural segmentation of the URL structure, such as the protocol header, host name, path, etc., each of which may carry different fraudulent intent in a phishing attack. By specifically analyzing each component of the URL, the present invention can more accurately identify common abnormal patterns in phishing websites and effectively use these patterns for identification and protection.

[0050] Advantages of character-level segmentation: The present invention uses character-level segmentation to process URLs, which is different from traditional word-level segmentation. Character-level segmentation avoids the problem of a large corpus and insufficient processing of rare words that may be generated by word-level segmentation. Since phishing URLs often contain random character combinations and deliberate spelling errors, character-level processing can capture these subtle changes more carefully and effectively identify non-standard words and patterns in phishing websites.

[0051] Improved FreeLB adversarial training mechanism: The introduction of the improved FreeLB adversarial training algorithm enhances the generalization and robustness of the model. By simulating various strategies that attackers may adopt, the model of the present invention can pre-learn and adapt to potential threats in a safe environment, thereby showing higher accuracy and stability in practical applications.

[0052] Application of capsule network: The present invention improves the feature representation capability by using capsule network instead of traditional convolutional neural network to extract features from URL character sequences. Capsule network can not only capture the existence of URL features, but also understand the spatial relationship of these features in URL, such as location and context dependency, which is especially important for identifying complex phishing strategies. The vector output of capsule network contains richer information, enabling the model to understand and classify phishing websites more accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A flowchart of a phishing website detection method based on capsule neural network provided by the present invention;

[0054] Figure 2 A specific flow chart of the use of a phishing website detection system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0055] The present invention is further described below in conjunction with the examples. However, the present invention can be implemented in many different ways and should not be construed as being limited to the examples shown; on the contrary, these examples provide those skilled in the art with implementation methods that meet applicable legal requirements.

[0056] Example 1: This example provides a phishing website detection system based on capsule neural network. The system mainly includes three core modules: data preprocessing module, feature extraction module and classification decision module. The goal of the system design is to detect and classify the input URL in real time to determine whether it is a phishing website. Figure 1 As shown, the phishing website detection method based on capsule neural network described in this system includes the following steps:

[0057] S1: Segment and parse different components of the URL, including the following steps:

[0058] S1-1: Parse the input URL, remove the protocol identifier, and split the remaining URL into host name, path, query parameter and anchor part to obtain the segmentation result res. The input locator URL is represented by u; the protocol identifier includes http: / / or https: / / .

[0059] S1-2: Perform character-level segmentation on each component of res, convert each character into a corresponding numerical code according to a predefined character encoding mapping table, and form a coding sequence res1; wherein encoding the URL component specifically includes:

[0060] Perform character-level segmentation on each component obtained from the URL, and identify and segment the characters in each component independently;

[0061] Each segmented character is converted into a unique numerical code using a predefined character encoding mapping table designed to ensure that common, similarly shaped characters can be encoded into numerical values ​​with similar attributes;

[0062] Through this encoding process, an encoded sequence of each URL component is obtained, which provides input data for subsequent feature extraction and classification steps.

[0063] S1-3: Standardize the encoded sequence res1, including truncation and padding; if the sequence length exceeds L, the excess part is truncated; if it is less than L, it is padded with zeros to a length of L, and finally a standardized URL component sequence res is obtained. sequence ;

[0064] S2: Extract features from each component and use the capsule network to further extract the overall spatial structure for classification, which specifically includes the following steps:

[0065] S2-1: The res obtained in step S1 sequence , input to the embedding layer for vectorization, and then through two layers of one-dimensional convolutional networks and a layer of bidirectional long short-term memory network for in-depth feature extraction. The specific calculation expression is as follows:

[0066] res feature =Bi-LSTM(CNN1D(CNN1D(Embedding(res sequence ))))

[0067] The two-layer one-dimensional convolutional network has the following specific structure:

[0068] The first convolutional network layer processes the sequence of standardized URL components generated in step S1 using a one-dimensional convolutional layer with 32 filters, each with a filter size of 3 and a stride of 1.

[0069] Activation layer: nonlinear activation function is applied after the first convolution layer;

[0070] Second convolutional network layer: Based on the first layer, add another one-dimensional convolutional layer with 64 filters, filter size 3, and stride 1;

[0071] Batch Normalization Layer: Batch normalization is used after each convolution operation to accelerate the convergence of the network and reduce internal covariate shift during model training;

[0072] Pooling layer: A max pooling layer is used after two convolutional layers with a pooling window size of 2 and a stride of 2.

[0073] The one-layer bidirectional long short-term memory network has the following specific structure:

[0074] Bidirectional processing: The network is configured in bidirectional processing mode, including two LSTM networks in independent directions, so that the network can process the forward and backward information of the sequence data simultaneously, and the independent directions include forward and reverse;

[0075] Number of units: 64 LSTM units are set in each direction, for a total of 128 units;

[0076] Output merging: The outputs generated by the network from both directions are merged at the last time step, providing a global understanding of the entire input sequence;

[0077] Connection method: The merged output is connected to the subsequent network layer for further feature fusion and classification processing.

[0078] S2-2: Extract the features res feature Merge to form a comprehensive URL feature vector URL feature , and its calculation formula is:

[0079] URL feature =concatenate(res feature )

[0080] Among them, CNN1D represents a two-layer one-dimensional convolutional network, and Bi-LSTM represents a one-layer bidirectional long short-term memory network;

[0081] S2-3: Enter URL feature Go to the capsule network for learning, and classify phishing websites and non-phishing websites based on the network output;

[0082] S3: During the model training process, an adversarial learning mechanism is used to independently conduct adversarial training on multiple embedding layers to improve the generalization of the model. The specific steps include:

[0083] S3-1: During the model training process, the FreeLB algorithm is used to perform independent adversarial training on the embedding layer, and small perturbations are added through multiple iterations to enhance the generalization ability of the model. During the adversarial training process, the embedding layer of each component calculates the corresponding perturbation based on the current gradient of the model. The perturbation is first calculated and saved in a temporary array. During the training iteration process, these perturbations are repeatedly added to the original input data of each component to form adversarial samples for further training and optimization of the model.

[0084] S3-2: Use the gradient information to calculate the perturbation of each embedding layer, store these perturbations temporarily, and finally apply them to the original input of each component to generate adversarial samples for training. The method of adding perturbations to each embedding layer specifically includes the following steps:

[0085] Forward propagation: First, forward propagate the features of the embedding layer in step S2-1 to obtain the output of the model under the current parameters;

[0086] Backpropagation and perturbation calculation: During the backpropagation of the model, the perturbation of each embedding layer is calculated using the gradient ascent method;

[0087] Perturbation application: The calculated perturbation is added to the parameter matrix of each embedding layer, where this modification is temporary and is only applied in the current training iteration to generate adversarial examples;

[0088] Adversarial training: Use the perturbed embedding layer to generate adversarial examples, and then use these examples to further train the model.

[0089] Example 2: Figure 2 As shown, in order to verify the effectiveness of the present invention, the experimental design of this embodiment includes widely collecting reliable data from the Internet and constructing four data sets to simulate the actual detection environment.

[0090] Table 1: Dataset composition

[0091]

[0092] As shown in Table 1, the specific data of the present invention are as follows:

[0093] Dataset 1: includes legitimate and phishing URLs collected from Kaggle, Google Search, PhishTank, and Github, totaling 939,512 normal URLs and 794,692 phishing URLs.

[0094] Dataset 2: From ISCX-URL2016, containing 35,378 legitimate URLs and 9,965 phishing URLs.

[0095] Dataset 3: Phishing Site URLs from Kaggle, containing 392,924 legitimate URLs and 156,422 phishing URLs.

[0096] Dataset 4: From the PhishStorm project, containing 48,009 legitimate URLs and 47,902 phishing URLs.

[0097] As shown in Table 2, each dataset was divided into training set, validation set and test set before the experiment, with a ratio of 7:1:2. The experiment used multiple evaluation indicators, including accuracy, recall, false alarm rate and F1-Score, and all evaluation indicators were obtained on the test set. The phishing website detection method (CS-PUD) proposed in the present invention was compared with other latest deep learning methods, including the research of Al-Alyan, AliAljofey, Ren, Huang, Yuan J and others. The experimental results show that the present invention has shown superior performance on each dataset.

[0098] Table 2: Statistics of the length of each component of the URL in each dataset

[0099]

[0100] The effectiveness of the method of the present invention is verified. Since phishing websites have a very short survival time and there are many parsing avoidance behaviors, it is difficult to conduct comparative experiments with deep learning methods that use features other than URLs. Finally, this paper chooses to compare the method of the present invention with the methods of Al-Alyan, AliAljofe, Ren, Huang, Yuan J, etc. These studies are the latest deep learning detection methods that only extract relevant features from URLs. At the same time, since the comparative methods of Al-Alyan, Yuan J, etc. have been compared with traditional machine learning methods such as random forest algorithms, and have achieved better results than traditional machine learning methods, they will not be compared with traditional machine learning methods here.

[0101] The comparative experimental results on different data sets are shown in Tables 3 to 6. It can be found that compared with similar detection methods based only on phishing URLs, the CS-PUD method proposed in this paper has achieved the best detection effect in terms of accuracy, recall, false alarm rate and F1-Score. Even in a million-level data set1, the prediction accuracy reached 98.43% and the F1-Score reached 98.18%, both higher than other methods; and the false alarm rate was also significantly lower than other methods, which shows that the CS-PUD method proposed in this paper can effectively detect phishing website URLs.

[0102] Table 3: Comparative experimental results on dataset 1

[0103]

[0104] Table 4: Comparative experimental results on dataset 2

[0105]

[0106] Table 5: Comparative experimental results on dataset 3

[0107]

[0108] Table 6: Comparative experimental results on dataset 4

[0109]

[0110] To further illustrate the effectiveness of the method of the present invention, the URLs that have been recently identified as phishing websites in Phishtank are selected as analysis samples, as shown in Table 7. Samples 1, 2, and 3 have IDs of 8109188, 8109186, and 8109185 in the Phishtank community, respectively, and are all identified as phishing websites, which are the registration and login pages of sample 5. According to the comparative prediction results of samples 1, 2, 3 and sample 4, it can be found that the model can accurately identify the "abnormal" character sequence in the URL, and detect the characteristics of the phishing URL based on the results of multiple training of a large amount of data. According to the prediction results of samples 3, 4, and 5, it can be found that the model is more sensitive to the combination of letters and numbers, and is not targeted at the zimbra character segment. Although the probability of sample 6 being predicted as a phishing website by the model is as high as 40.63%, it is still within the range of normal websites. Based on the above results analysis, it can be seen that the model basically has the ability to be applied in practice.

[0111] Table 7: Specific case detection analysis

[0112]

[0113] The results on Dataset 1 are particularly outstanding, as this dataset is the largest and contains both phishing and legitimate URLs from multiple sources. The high accuracy and F1-Score on this dataset demonstrate that the CS-PUD system is able to effectively handle large-scale and diverse URL data, which is critical for real-world applications. In addition, the system's low false alarm rate (1.07%) on this dataset provides confidence for actual deployment, as false alarms are an important consideration in phishing website detection systems, as excessive false alarm rates can lead to a decrease in user trust. The experimental results on Datasets 2, 3, and 4 also show similar trends. Although the datasets are smaller, the CS-PUD system still maintains high accuracy and F1-Score. The results on Dataset 4 are particularly noteworthy because it contains almost equal numbers of phishing and legitimate URLs. This balanced dataset is usually considered more challenging, and the high accuracy of the CS-PUD system on this dataset further verifies its generalization ability.

[0114] Compared to existing techniques, such as the method of Al-Alyan and Aljofey, CS-PUD outperforms these methods on all datasets. For example, Al-Alyan achieved an accuracy of 96.43% on dataset 1, while CS-PUD achieved 98.43%. This significant performance improvement is attributed to the ability of capsule networks to capture complex feature relationships and the enhanced model robustness brought about by adversarial training. Among them, analyzing the latest marked phishing URLs in Phishtank, the CS-PUD system is able to identify phishing websites with an accuracy of nearly 100%. This result shows that the model is highly sensitive to the latest and active phishing strategies. In addition, the model can also give relatively accurate predictions for legitimate websites and websites under boundary conditions, which shows that the model has good discriminative ability and can distinguish between real phishing websites and websites that only look suspicious.

[0115] Through detailed experiments and analysis, the phishing website detection system of the present invention shows excellent performance when processing complex and diverse URL data sets. The introduction of capsule networks and the application of adversarial training significantly improve the accuracy and robustness of the system, making the system not only suitable for current phishing website detection tasks, but also adaptable to the evolution of future phishing technologies. These characteristics make the CS-PUD system an innovative tool with important application value and potential in the field of network security.

[0116] The above embodiments only express the implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention. It should be pointed out that, for those of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention.

Claims

1. A phishing website detection method based on capsule neural network, characterized by: The following steps are involved: S1: Segment and parse different components of the URL, including the following steps: S1-1: parse the input URL, remove the protocol identifier, and split the remaining URL into host name, path, query parameter and anchor parts, obtain the segmentation result res, and the input locator URL is represented by u; S1-2: perform character-level segmentation on each component of res, convert each character into a corresponding numerical code according to a predefined character encoding mapping table, and form a code sequence res1; S1-3: Standardize the encoded sequence res1, including truncation and padding; if the sequence length exceeds L, the excess part is truncated; if it is less than L, it is padded with zeros to a length of L, and finally a standardized URL component sequence res is obtained. sequence ; S2: Extract features from each component and use the capsule network to further extract the overall spatial structure for classification, which specifically includes the following steps: S2-1: The res obtained in step S1 sequence , input to the embedding layer for vectorization, and then through two layers of one-dimensional convolutional networks and a layer of bidirectional long short-term memory network for in-depth feature extraction. The specific calculation expression is as follows: res feature =Bi-LSTM(CNN1D(CNN1D(Embedding(res sequence )))) S2-2: Extract the features res feature Merge to form a comprehensive URL feature vector URL feature , and its calculation formula is: URL feature =concatenate(res feature ) Among them, CNN1D represents a two-layer one-dimensional convolutional network, and Bi-LSTM represents a one-layer bidirectional long short-term memory network; S2-3: Enter URL feature Go to the capsule network for learning, and classify phishing websites and non-phishing websites based on the network output; S3: During the model training process, an adversarial learning mechanism is used to independently conduct adversarial training on multiple embedding layers to improve the generalization of the model. The specific steps include: S3-1: During model training, the FreeLB algorithm is used to perform independent adversarial training on the embedding layer, adding small perturbations through multiple steps of iteration to enhance the generalization ability of the model; S3-2: Use the gradient information to calculate the perturbations of each embedding layer, store these perturbations temporarily, and finally apply them to the original input of each component to generate adversarial samples for training.

2. The method for detecting phishing websites based on capsule neural network according to claim 1, characterized in that: The protocol identifier in step S1 includes http: / / or https: / / .

3. The method for detecting phishing websites based on capsule neural network according to claim 1, characterized in that: The encoding of the URL component in step S1 specifically includes: Perform character-level segmentation on each component obtained from the URL, and identify and segment the characters in each component independently; Each segmented character is converted into a unique numerical code using a predefined character encoding mapping table designed to ensure that common, similarly shaped characters can be encoded into numerical values ​​with similar attributes; Through this encoding process, an encoded sequence of each URL component is obtained, which provides input data for subsequent feature extraction and classification steps.

4. The method for detecting phishing websites based on capsule neural network according to claim 1, characterized in that: The two-layer one-dimensional convolutional network in step S2 has the following specific structure: The first convolutional network layer processes the sequence of standardized URL components generated in step S1 using a one-dimensional convolutional layer with 32 filters, each with a filter size of 3 and a stride of 1. Activation layer: nonlinear activation function is applied after the first convolution layer; Second convolutional network layer: Based on the first layer, add another one-dimensional convolutional layer with 64 filters, filter size 3, and stride 1; Batch Normalization Layer: Batch normalization is used after each convolution operation to accelerate the convergence of the network and reduce internal covariate shift during model training; Pooling layer: A max pooling layer is used after two convolutional layers with a pooling window size of 2 and a stride of 2.

5. The method for detecting phishing websites based on capsule neural network according to claim 1, characterized in that: The one-layer bidirectional long short-term memory network in step S2 has the following specific structure: Bidirectional processing: The network is configured in bidirectional processing mode, including two LSTM networks in independent directions, so that the network can process the forward and backward information of the sequence data simultaneously, and the independent directions include forward and reverse; Number of units: 64 LSTM units are set in each direction, for a total of 128 units; Output merging: The outputs generated by the network from both directions are merged at the last time step, providing a global understanding of the entire input sequence; Connection method: The merged output is connected to the subsequent network layer for further feature fusion and classification processing.

6. The method for detecting phishing websites based on capsule neural network according to claim 1, characterized in that: During the adversarial training process in step S3, the embedding layer of each component calculates the corresponding perturbation based on the current gradient of the model. The perturbation amount is first calculated and saved in a temporary array. During the training iteration process, the perturbation is repeatedly added to the original input data of each component to form an adversarial sample for further training and optimization of the model.

7. The method for detecting phishing websites based on capsule neural network according to claim 6, characterized in that: The method of adding perturbations to each embedding layer specifically includes the following steps: Forward propagation: First, forward propagate the features of the embedding layer in step S2-1 to obtain the output of the model under the current parameters; Backpropagation and perturbation calculation: During the backpropagation of the model, the perturbation of each embedding layer is calculated using the gradient ascent method; Perturbation application: The calculated perturbation is added to the parameter matrix of each embedding layer, where this modification is temporary and is only applied in the current training iteration to generate adversarial examples; Adversarial training: Use the perturbed embedding layer to generate adversarial examples, and then use these examples to further train the model.

8. A phishing website detection system based on capsule neural network, characterized by: The system is used to implement the phishing website detection method based on capsule neural network according to any one of claims 1 to 7, specifically comprising: The first module is used to segment the URL by components, divide the character set, truncate, fill and encode. This module is responsible for parsing the input URL, removing the protocol identifier, and segmenting the remaining URL into the host name, path, query parameters and anchor parts. It performs character-level segmentation on each component, converts each character into the corresponding numerical code according to the predefined character encoding mapping table, and truncates or fills the encoded sequence as needed to ensure the consistency of the sequence length, in preparation for subsequent feature extraction. The second module is used to extract features from the sequence after group encoding, and use the capsule network to further extract the overall spatial structure for classification. This module first uses the embedding layer to convert the character-level encoding into a vector form, and then uses a one-dimensional convolutional network and a bidirectional long short-term memory network to deeply extract features. Finally, these features are combined through the capsule network to learn the spatial relationship of the features and make effective classification decisions; The third module: It is used to adopt the adversarial learning mechanism in the model training process, independently adversarial multiple embedding layers, and improve the generalization of the model. This module introduces perturbations to each embedding layer through the FreeLB algorithm, and enhances the robustness of the model to input perturbations through multi-step iterative ascent processing, which is used to improve the accuracy and reliability of phishing website detection.

Citation Information

Patent Citations

  • Hierarchical phishing website detection method based on deep learning

    CN110602113A

  • Depth video fingerprint algorithm based on capsule network

    CN111325169A

  • Criminal multi-criminal-name prediction method based on capsule network and time sequence

    CN111985680A

  • Deep learning method for detecting malicious traffic of mobile APP

    CN115018046A

  • Malicious URL detection and classification method based on capsule neural network

    CN116471096A