A phishing website detection method and system based on a capsule neural network

By using multi-dimensional feature analysis and adversarial training algorithms based on capsule neural networks, the problems of high efficiency, real-time performance, and accuracy in phishing website detection are solved, enabling efficient identification and prevention of phishing websites.

CN119853971BActive Publication Date: 2026-01-23JIANGSU COLLEGE OF FINANCE & ACCOUNTING
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing phishing website detection methods struggle to achieve efficient, real-time, and accurate identification, especially when faced with rapidly changing and diverse phishing websites. Traditional methods are ill-suited to these situations, and they suffer from low data processing efficiency and high false alarm rates.

Method used

We employ a multi-dimensional feature analysis method based on capsule neural networks, combining different component features of the URL, page content, and visual presentation. We enhance the generalization ability of the model through adversarial training algorithms, and use character-level word segmentation and capsule network feature extraction to classify and determine phishing websites.

Benefits of technology

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

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119853971B_ABST
    Figure CN119853971B_ABST
Patent Text Reader

Abstract

The application discloses a phishing website detection method and system based on a capsule neural network. Different components of a website URL are segmented, character-level word segmentation, truncation padding and coding are implemented to realize fine-grained feature discrimination of different components, component-level and URL overall features are extracted, the overall space structure is learned by using a capsule network, and normal and phishing URLs are distinguished by a joint classification network. In the method and system, an adversarial training mechanism is introduced, independent adversarial training is performed on multiple embedding layers, the accuracy, F1-Score of the model is improved, and the false positive rate is reduced, so that the robustness and generalization ability of the model are enhanced. Experimental results show that the technology disclosed by the application surpasses the prior art on a million-level sample data set, and effectively improves the recognition performance of phishing URLs.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of phishing website detection, and particularly relates to a phishing website detection method and system based on a capsule neural network. BACKGROUND

[0002] With the widespread popularity of the Internet, network security issues have become one of the global focuses, especially the threat of phishing attacks is becoming increasingly serious. 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. Because phishing websites can be quickly produced and are low-cost, they have become a common tool for cyber criminals. In addition, the precision of phishing attacks and the diversification of means make it difficult for traditional defense methods to effectively respond.

[0003] FreeLB adversarial training algorithm: a technique that maximizes the model's adversarial perturbations on the training data, thereby enhancing the model's robustness under unknown attacks. 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 can learn long-term dependencies. LSTM is particularly effective in processing and predicting key events in time series data. Embedding technology: used to convert large category inputs (such as language vocabulary) into fixed-length dense vectors that can capture complex relationships between inputs, widely used in natural language processing and other machine learning tasks.

[0004] Although the existing technology provides a variety of phishing website detection methods, there are still the following deficiencies. URL text-based method: although fast in processing speed, it may not be able to effectively identify phishing websites that are carefully disguised using advanced techniques. Website host information and visual feature-based method: 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 updates in phishing technology. Website content-based method: although it can accurately identify phishing websites, it requires in-depth analysis of the website, takes a long time to process, and is less efficient, making it difficult to respond in real time.

[0005] Under the current circumstances, there is an urgent need for a phishing website detection technology that can achieve high efficiency, real-time and accuracy. This technology should combine 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, improving the flexibility and scalability of the system. In addition, the new invention should simplify the data processing process, reduce the dependence on large-scale data collection and storage, and improve the overall efficiency and operability of the system.

[0006] In summary, the application provides a multi-level and multi-dimensional phishing website detection system that integrates the latest machine learning techniques, which can effectively improve detection performance and meet real-time processing needs, and has important practical significance for preventing phishing attacks. SUMMARY

[0007] In view of the deficiencies of the prior art, the application provides a phishing website detection method and system based on a capsule neural network, aiming to improve the accuracy of phishing website detection, reduce the false positive rate, and enhance the adaptability of the model to new phishing strategies. The application proposes a method of multi-dimensional feature analysis combined with a capsule network, which effectively integrates information such as URL features, page content, and visual performance. Specifically, it includes:

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

[0009] S1-1: Analyze the input URL, remove the protocol identifier, and segment the remaining URL into hostname, path, query parameter, and anchor point parts to obtain the segmentation result res, and input the locator URL represented as u;

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

[0011] S1-3: Perform standardization processing on the encoding sequence res1, including truncation and padding; if the sequence length exceeds L, truncate the excess part; if it is less than L, pad it to a length of L using zeros, and finally obtain the standardized URL component sequence res sequence ;

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

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

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

[0015] S2-2: Merge the extracted features res feature to form a comprehensive URL feature vector URL feature , with the calculation formula as follows:

[0016] URL feature =concatenate(res feature )

[0017] Wherein, the CNN1D represents two layers of one-dimensional convolution network, and the Bi-LSTM represents one layer of bidirectional long short-term memory network;

[0018] S2-3: input URL feature to the capsule network for learning, and the phishing website and the non-phishing website are classified and determined according to the output of the network;

[0019] S3: in the model training process, an adversarial learning mechanism is used to independently adversarial the multiple embedding layers, and the generalization of the model is improved, and the following steps are specifically included:

[0020] S3-1: in the model training process, the FreeLB algorithm is used for independent adversarial training of the embedding layer, and a plurality of iterations are added to the micro disturbance, so that the generalization ability of the model is enhanced;

[0021] S3-2: the disturbance of each embedding layer is calculated by using gradient information, and the disturbance is temporarily stored, and finally the disturbance is applied to the original input of each component to generate an adversarial sample for training.

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

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

[0024] The character-level segmentation is performed on each component segmented from the URL, and the characters in each component are independently identified and segmented;

[0025] A pre-defined character encoding mapping table is used to convert each segmented character into a unique numerical code, and the mapping table is designed to ensure that common characters with similar shapes can be encoded into numerical values with similar properties;

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

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

[0028] The first layer of convolution network: the standardized URL component sequence generated in step S1 is processed, and a one-dimensional convolution layer with 32 filters is used, and the size of each filter is 3 and the step is 1;

[0029] Activation layer: a non-linear activation function is applied after the first convolution layer;

[0030] Second convolutional network: based on the first layer, another one-dimensional convolutional layer with 64 filters is added, the filter size is 3 and the step is 1;

[0031] Batch normalization layer: batch normalization is used after each convolution operation to speed up the convergence of the network and reduce the internal covariate shift during model training;

[0032] Pooling layer: after two layers of convolution, a max pooling layer is used, the pooling window size is 2 and the step is 2.

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

[0034] Bidirectional processing: the network is configured in bidirectional processing mode, containing two independent direction LSTM networks, so that the network can process the forward and backward information of the sequence data at the same time, and the independent direction includes forward and reverse;

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

[0036] Output merging: the outputs generated by the network from two directions are merged at the last time step to provide global understanding of the entire input sequence;

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

[0038] As an alternative of the present application, in the adversarial training process in step S3-2, the embedding layer of each component calculates the corresponding perturbation based on the current gradient of the model, and 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.

[0039] As an alternative of the present application, the method of adding perturbation to each embedding layer includes the following steps:

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

[0041] Back propagation and perturbation calculation: during the back propagation of the model, the gradient ascent method is used to calculate the perturbation of each embedding layer;

[0042] Disturbance application: add the calculated disturbance to the parameter matrix of each embedding layer, where this modification is temporary and only applies in the current training iteration for generating adversarial samples;

[0043] Adversarial sample training: generate adversarial samples using the embedding layers processed by disturbance, and then use these samples to further train the model.

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

[0045] The first module is used for splitting the URL by component, and performing character set division, truncation and padding, and encoding, which is responsible for parsing the input URL, removing the protocol identifier, and splitting the remaining URL into hostname, path, query parameter and anchor point part, performing character-level segmentation on each component, converting each character to corresponding numerical code according to the pre-defined character encoding mapping table, and truncating or padding the encoding sequence as needed to ensure the sequence length is consistent, preparing for subsequent feature extraction;

[0046] The second module is used for feature extraction of the grouped and encoded sequence, and further extracts the overall spatial structure using the capsule network for classification, which first converts the character-level encoding to vector form using the embedding layer, then deeply extracts the features through one-dimensional convolution network and bidirectional long short-term memory network, and finally learns the spatial relationship of the features through the capsule network and makes effective classification decision;

[0047] The third module is used for independent adversarial training of multiple embedding layers during model training to improve the generalization of the model, which introduces disturbance to each embedding layer through the FreeLB algorithm, enhances the robustness of the model to input disturbance through multi-step iterative rising processing, and is used to improve the accuracy and reliability of phishing website detection.

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

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

[0050] Character-level tokenization advantage: The application uses character-level tokenization to process URLs, unlike traditional word-level tokenization. Character-level tokenization avoids the problems of large corpus and insufficient processing of rare words that may arise from word-level tokenization. Since phishing URLs often contain random character combinations and intentional 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 improved FreeLB adversarial training algorithm enhances the generalization ability and robustness of the model. By simulating various strategies that attackers may use, the model of the application can learn and adapt to potential threats in a safe environment, thereby exhibiting higher accuracy and stability in actual applications.

[0052] Application of capsule network: The capsule network is used instead of the traditional convolutional neural network to extract features from the character sequence of the URL. The application improves the representation ability of the features in this way. The capsule network not only captures the existence of URL features, but also understands the spatial relationship of these features in the URL, such as position and context dependence, which is particularly important for identifying complex phishing strategies. The vector output of the capsule network contains more rich information, enabling the model to more accurately understand and classify phishing websites. BRIEF DESCRIPTION OF DRAWINGS

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

[0054] Figure 2 A specific flowchart of a phishing website detection system of an embodiment provided by the application. DETAILED DESCRIPTION

[0055] The application will be further described below in conjunction with the embodiments. However, the application can be implemented in many different ways, and should not be understood as being limited to the embodiments shown; on the contrary, these embodiments provide those skilled in the art with an implementation that meets the applicable legal requirements.

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

[0057] S1: Segmentation and analysis of different components of the URL, including the following steps:

[0058] S1-1: Analyze the input URL, remove the protocol identifier, and split the remaining URL into hostname, path, query parameters, and anchor parts to obtain the split result res, and input the locator URL represented as u; the protocol identifier includes http: / / or https: / / .

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

[0060] Character-level segmentation is performed on each component obtained by splitting the URL, and each character in each component is independently identified and segmented;

[0061] Using a predefined character encoding mapping table, each segmented character is converted into a unique numerical code, and the mapping table is designed to ensure that common characters with similar shapes can be encoded into numerical values with similar properties;

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

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

[0064] S2: Extract features from each component and further extract overall spatial structure using a capsule network for classification, specifically including the following steps:

[0065] S2-1: Input res sequence obtained in step S1 to the embedding layer for vectorization, then through two layers of one-dimensional convolution network and one 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 layers of one-dimensional convolution network have the following specific structure:

[0068] First layer convolutional network: process the normalized URL component sequence generated in step S1 using a one-dimensional convolutional layer with 32 filters, each filter of size 3 with a step of 1;

[0069] Activation layer: apply a nonlinear activation function after the first layer of convolution;

[0070] Second layer convolutional network: add another one-dimensional convolutional layer with 64 filters on top of the first layer, filter size of 3 with a step of 1;

[0071] Batch normalization layer: use batch normalization after each convolutional operation to speed up the convergence of the network and reduce the internal covariate shift during model training;

[0072] Pooling layer: use a max-pooling layer after the two layers of convolution, with a pooling window size of 2 and a step 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, containing two independent direction LSTM networks, enabling the network to process forward and backward information of sequence data simultaneously, the independent direction including forward and reverse;

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

[0076] Output merging: the outputs generated by the network from the two 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 The calculation formula is:

[0079] URL feature = concatenate(res feature )

[0080] Where 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: input the URL feature to the capsule network for learning, and make phishing website and non-phishing website classification and determination according to the output of the network;

[0082] S3: In the model training process, an adversarial learning mechanism is adopted to independently antagonize the multiple embedding layers, thereby improving the model generalization, and the specific steps include the following steps:

[0083] S3-1: In the model training process, the FreeLB algorithm is used to independently antagonize the embedding layers, and through multiple iterations, a small perturbation is added to enhance the generalization ability of the model. During the adversarial training process, the embedding layers of each component are calculated 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: Calculate the perturbation of each embedding layer using gradient information and temporarily store it. Finally, apply it to the original input of each component to generate adversarial samples for training. The method of adding perturbation to each embedding layer includes the following steps:

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

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

[0087] Perturbation application: Add the calculated perturbation to the parameter matrix of each embedding layer. This modification is temporary and only applies to the current training iteration to generate adversarial samples;

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

[0089] Embodiment 2: As shown in Figure 2 To verify the effectiveness of the present application, the experimental design includes widely collecting credible data from the Internet, and constructing four data sets to simulate the detection environment in reality.

[0090] Table 1: Data set composition

[0091]

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

[0093] Data set 1: includes legitimate and phishing URLs collected from Kaggle, Google Search, PhishTank, and Github, totaling 939512 normal URLs and 794692 phishing URLs.

[0094] Dataset 2: From ISCX-URL 2016, contains 35378 legitimate URLs and 9965 phishing URLs.

[0095] Dataset 3: Phishing Site URLs from Kaggle, contains 392924 legitimate URLs and 156422 phishing URLs.

[0096] Dataset 4: From PhishStorm project, contains 48009 legitimate URLs and 47902 phishing URLs.

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

[0098] Table 2: Length statistics of each component in each dataset

[0099]

[0100] The effectiveness of the method of the present application is verified, since the survival time of phishing websites is extremely short, and there are various evading analysis behaviors, it is difficult to conduct a comparative experiment on the deep learning method using other features containing URL. Finally, the method of the present application is compared 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 URL. 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 algorithm, and have achieved better effect than traditional machine learning methods, they are not compared with traditional machine learning methods here.

[0101] The comparative experiment results on different data sets are shown in Tables 3-6, and it can be found that, compared with the detection method based on the phishing URL, the CS-PUD method proposed in the present application achieves the best detection effect in accuracy, recall rate, false positive rate and F1-Score. Even in the data set 1 of one million, the prediction accuracy is 98.43%, and the F1-Score is 98.18%, which are higher than those of other methods. The false positive rate is also significantly lower than that of other methods, which shows that the CS-PUD method proposed in the present application can effectively detect the phishing website URL.

[0102] Table 3: Comparative experiment results on data set 1

[0103]

[0104] Table 4: Comparative experiment results on data set 2

[0105]

[0106] Table 5: Comparative experiment results on data set 3

[0107]

[0108] Table 6: Comparative experiment results on data set 4

[0109]

[0110] In order to further illustrate the effectiveness of the method of the present application, the latest URLs identified as phishing websites in Phishtank are selected as analysis samples, as shown in Table 7. The samples 1, 2 and 3 have IDs of 8109188, 8109186 and 8109185 in the Phishtank community, respectively, and are identified as phishing websites. The sample 5 is the registration login page. According to the comparative prediction results of the samples 1, 2 and 3 with the sample 4, it can be found that the model can accurately identify the "abnormal" character sequence in the URL, and detect the features of the phishing URL according to the results of multiple training of a large amount of data. According to the prediction results of the sample 3, the sample 4 and the sample 5, it can be found that the model is sensitive to the combination of letters and numbers, and is not aimed at the character "zimbra". Although the sample 6 is predicted by the model to be a phishing website with a probability of 40.63%, it is still within the range of normal websites. Based on the above result analysis, it can be seen that the model basically has the ability of practical application.

[0111] Table 7: Detection analysis of specific cases

[0112]

[0113] The results on Dataset 1, which is the largest and contains phishing and legitimate URLs from multiple sources, are particularly striking. The high accuracy and F1-Score on this dataset indicate that the CS-PUD system can effectively handle large-scale and diverse URL data, which is crucial for real-world applications. Furthermore, the low false positive rate (1.07%) of the system on this dataset provides confidence for practical deployment, as false positives are an important consideration in phishing website detection systems, and high false positive rates can lead to decreased user trust. The experimental results on Datasets 2, 3, and 4 also show similar trends, with the CS-PUD system maintaining high accuracy and F1-Score despite the smaller dataset sizes. The results on Dataset 4 are especially noteworthy, as it contains nearly equal numbers of phishing and legitimate URLs, making it a more challenging dataset. The high accuracy of the CS-PUD system on this dataset further validates its generalization capabilities.

[0114] Compared to existing techniques such as the method of Al-Alyan and Aljofey, the CS-PUD system outperforms these methods on all datasets. For example, Al-Alyan achieves an accuracy of 96.43% on Dataset 1, while the CS-PUD system reaches 98.43%. This significant performance improvement is attributed to the capsule network's ability to capture complex feature relationships and the enhanced model robustness brought about by adversarial training. The analysis of the latest labeled phishing URLs from Phishtank shows that the CS-PUD system can identify phishing websites with near-100% accuracy. This result indicates that the model has high sensitivity to the latest and active phishing strategies. Furthermore, the model can also give relatively accurate predictions for legitimate websites and websites under boundary conditions, demonstrating its good discriminative ability to distinguish between real phishing websites and only seemingly suspicious websites.

[0115] Through detailed experiments and analysis, the phishing website detection system of the present application shows excellent performance in handling complex and diverse URL datasets. The introduction of the capsule network and the application of adversarial training significantly improve the accuracy and robustness of the system, making it not only suitable for current phishing website detection tasks, but also adaptable to the evolution of future phishing techniques. 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 of the present application, and the description is more specific and detailed, but it cannot be understood as a limitation on the scope of the application. It should be noted that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which are within the scope of protection of the present application.

Claims

1. A phishing website detection method based on capsule neural networks, characterized in that: Includes the following steps: S1: Segment and parse the different components of the URL, specifically including the following steps: S1-1: Parse the input URL, remove the protocol identifier, and split the remaining URL into hostname, path, query parameters, and anchor parts to obtain the segmentation result. The input locator URL is represented as ; S1-2: To Each component performs character-level word segmentation, converting each character into its corresponding numerical code according to a predefined character encoding mapping table, forming an encoding sequence. ; Specifically, it includes: Each component obtained from the URL is segmented at the character level, and the characters in each component are independently identified and segmented. Using a predefined character encoding mapping table, each segmented character is converted into a unique numerical code; This encoding process yields the encoded sequence for each URL component; S1-3: For the encoded sequence Standardization processing is performed, including truncation and padding; if the sequence length exceeds... If the value is less than 1, then the excess portion will be truncated; if the value is less than 1, then the Then use zero padding up to a length of This ultimately yields a standardized sequence of URL components. ; S2: Extract features from each component and further extract the overall spatial structure using capsule networks for classification. This includes the following steps: S2-1: The result obtained in step S1 The input is vectorized into the embedding layer, and then deep feature extraction is performed through two layers of one-dimensional convolutional networks and one layer of bidirectional long short-term memory network. The specific calculation expression is as follows: ; S2-2: Extracted features The features are merged to form a comprehensive URL feature vector. The calculation formula is as follows: ; in, Represents a one-dimensional convolutional network. Represents a single-layer bidirectional long short-term memory network; S2-3: Input Learn from the capsule network and classify and determine phishing websites and non-phishing websites based on the network's output; S3: During model training, an adversarial learning mechanism is used to independently challenge multiple embedding layers, improving the model's generalization ability. This includes the following steps: S3-1: During model training, the FreeLB algorithm is used to perform independent adversarial training on the embedding layer. Small perturbations are added through multiple iterations to enhance the model's generalization ability. S3-2: Calculate the perturbation of each embedding layer using gradient information, temporarily store these perturbations, and finally apply them to the original input of each component to generate adversarial examples for training.

2. The phishing website detection method based on capsule neural network according to claim 1, characterized in that: The protocol identifier in step S1 includes or .

3. The phishing website detection method 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: First convolutional network: The normalized URL component sequence generated in step S1 is processed using a one-dimensional convolutional layer with 32 filters, each filter having a size of 3 and a stride of 1; Activation layer: A non-linear activation function is applied after the first convolutional layer; The second convolutional network: Based on the first layer, another one-dimensional convolutional layer with 64 filters is added. The filter size is 3 and the stride is 1. Batch normalization layer: Batch normalization is used after each convolution operation to accelerate network convergence 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.

4. The phishing website detection method based on capsule neural network according to claim 1, characterized in that: The specific structure of the one-layer bidirectional long short-term memory network in step S2 is as follows: Bidirectional processing: The network is configured in a bidirectional processing mode, containing two independent LSTM networks, enabling the network to process forward and backward information of sequence data simultaneously. The independent directions include forward and backward directions. Number of elements: 64 LSTM elements are set in each direction, for a total of 128 elements; 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 subsequent network layers for further feature fusion and classification processing.

5. The phishing website detection method based on capsule neural network according to claim 1, characterized in that: In 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 is first calculated and stored in a temporary array. During the training iteration, the perturbation is repeatedly added to the original input data of each component to form adversarial examples for further training and optimization of the model.

6. The phishing website detection method based on capsule neural network according to claim 5, characterized in that: The method for adding perturbations to each embedding layer specifically includes the following steps: Forward propagation: First, the features of the embedding layer in step S2-1 are forward propagated 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. This modification is temporary and is applied only in the current training iteration to generate adversarial examples. Adversarial example training: Adversarial examples are generated using perturbed embedding layers, and then these examples are used to further train the model.

7. A phishing website detection system based on capsule neural networks, characterized in that: The system is used to implement the phishing website detection method based on capsule neural networks as described in any one of claims 1-6, specifically including: The first module is used to segment the URL by components, and perform character set division, truncation, padding, and encoding. This module is responsible for parsing the input URL, removing protocol identifiers, and segmenting the remaining URL into hostname, path, query parameters, and anchor parts. It performs character-level word segmentation on each component, converts each character into the corresponding numerical code according to a predefined character encoding mapping table, and truncates or pads the encoded sequence as needed to ensure consistent sequence length, thus preparing for subsequent feature extraction. The second module is used to extract features from the grouped encoded sequences and further extract the overall spatial structure for classification using capsule networks. This module first uses an embedding layer to convert character-level encoding into vector form, then uses a one-dimensional convolutional network and a bidirectional long short-term memory network to extract features in depth, and finally uses capsule networks to combine these features to learn the spatial relationships of features and make effective classification decisions. The third module is used to employ an adversarial learning mechanism during model training, independently adversarially challenging multiple embedding layers to improve model generalization. This module introduces perturbations into each embedding layer using the FreeLB algorithm and enhances the model's robustness to input perturbations through multi-step iterative ascent processing, thereby improving the accuracy and reliability of phishing website detection.

Citation Information

Patent Citations

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

    CN111985680A

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

    CN116471096A