A phishing email detection method and system based on feature extraction
By extracting multi-faceted features from URL links, web page screenshots and page source codes in emails, we generate feature vectors for phishing email detection, which solves the problem of misjudgment and missed judgment risks in the existing technology, and realizes the detection of phishing emails in an offline environment. Highly accurate detection.
Patent Information
- Application Number
- CN202210046781.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-14
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-01-14
AI Technical Summary
Existing phishing email detection methods have risks of misjudgment and missed identification when identifying phishing websites. In particular, feature extraction cannot be completed in an offline environment, and it is difficult to identify counterfeit portals, and the feature processing of existing methods is time-consuming or The cost is high.
Using a method based on feature extraction, the crawler system obtains URL links, web page screenshots and page source codes in emails, combines feature engineering with feature extraction, generates feature vectors, and inputs the detection model for phishing email detection, including URL features. , Multi-faceted extraction of page image features and source code features.
It reduces the risk of misjudgment and omission, improves detection accuracy, can complete feature extraction in an offline environment, and determines whether an email is a phishing email through multiple types of features, which enhances detection accuracy.
Smart Images

Figure CN114465780B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security, and in particular to a phishing email detection method and system based on feature extraction. Background Art
[0002] Email is one of the most commonly used communication methods in modern society and is also a globally recognized electronic forensic material. Email services are necessary and widespread, and are often regarded as regular attack targets by black industry organizations. In recent years, email is often used as the first stop for new attack methods such as APT, and fraudulent activities using email as a carrier are also emerging in an endless stream. Among the more sophisticated phishing emails, a large proportion of them contain URL links to phishing websites, or URL links to normal websites that have been installed with Trojans or backdoors.
[0003] However, there have been many studies in the academic community on how to identify whether a website is a phishing website, which are mainly divided into three types: detection based on URL link character features, image recognition based on HTML pages, and malicious website detection based on web page source code. First, although the detection method based on URL link character features does not require actual access to the URL and better protects the machine where the detection program is deployed, it involves network communication features, such as AlexaRank, the number of responses returned by DNS queries, domain name whois query results, etc. Once in an offline environment, feature extraction cannot be completed; and fewer features are used in the feature engineering stage, and more levels of information are not utilized. Secondly, in order to obtain a better model, the existing image recognition method based on HTML pages usually requires a deeper network structure, which will increase the time spent on feature processing. In addition, for phishing websites that imitate portal websites and disguise themselves as genuine websites, it is difficult to correctly distinguish such phishing websites because they are visually very different from portal websites or even have no difference. Finally, the existing malicious website detection methods for web page source code process page structure features, JS code features and Web session features separately, but a single link uses fewer features, and tracking Web session activities requires a large cost, which is not easy to deploy in practice. Summary of the invention
[0004] The present invention provides a phishing email detection method and system based on feature extraction, which reduces the risk of misjudgment and missed judgment and improves detection accuracy.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a phishing email detection method based on feature extraction, comprising:
[0006] When a URL link is detected in the email, the URL link is transmitted to the crawler system, and the landing URL, webpage screenshot and page source code fed back by the crawler system are received;
[0007] According to a preset feature extraction algorithm, feature extraction is performed on the landing URL, the webpage screenshot and the page source code respectively to obtain URL features, page image features and source code features;
[0008] Extracting the email content feature of the email, and combining the URL feature, the page image feature and the source code feature to generate a feature vector corresponding to the email;
[0009] The feature vector is input into a preset detection model, and a phishing email detection result of the email is output.
[0010] Furthermore, according to the preset feature extraction algorithm, feature extraction is performed on the landing URL, the webpage screenshot and the page source code respectively to obtain URL features, page image features and source code features, specifically:
[0011] Using feature engineering to extract features from the landing URL and output the URL features; wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features, and word vector features;
[0012] Decoding the webpage screenshot to obtain a corresponding first image, performing resizing, format conversion, and normalization preprocessing on the first image, and then inputting the first image into a preset image feature extraction model to output the page image features; wherein the image feature extraction model is obtained by training a preset initial image feature extraction model using a first training set, and the first training set includes a plurality of the first images that have undergone resizing, format conversion, and normalization preprocessing;
[0013] The page source code is segmented to obtain a number of corresponding code segmentations, and all the code segmentations are encoded and converted to obtain a source code matrix, and the source code matrix is input into a preset code feature extraction model to output the source code features.
[0014] Furthermore, the feature engineering is used to extract features of the landing URL and output the URL features, wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features and word vector features, specifically:
[0015] Using feature engineering, extracting the domain name features and the intuitive features corresponding to the landing URL;
[0016] Performing 3-gram processing on the landing URL, and calculating an average score of the 3-gram tuples in the landing URL as the 3-gram feature;
[0017] The landing URL is segmented to obtain several text segments, and a preset word vector model is used to determine whether each of the text segments contains a word vector. If so, the current word vector is output; if not, a zero vector is output, and all outputs of the word vector model are used as the word vector features.
[0018] Furthermore, the page source code is segmented to obtain a number of corresponding code segmentations, and all the code segmentations are encoded and converted to obtain a source code matrix, and the source code matrix is input into a preset code feature extraction model to output the source code features, specifically:
[0019] Performing word segmentation processing on the page source code to obtain a number of corresponding code word segments, and encoding all the code word segments to obtain a word segmentation set;
[0020] The word segmentation set is converted by a preset word embedding model to obtain the corresponding source code matrix;
[0021] The source code matrix is input into a preset TextCNN network model, and the source code features are output.
[0022] Furthermore, the feature vector is input into a preset detection model to output the phishing email detection result of the email, specifically:
[0023] Inputting the pre-stored second training set into a preset initial detection model, training the initial detection model, and obtaining the detection model; wherein the second training set includes a plurality of normal emails, a plurality of feature vectors corresponding to the normal emails, a plurality of phishing emails, and a plurality of feature vectors corresponding to the phishing emails;
[0024] The feature vector is input into the detection model, and the phishing email detection result of the email is output.
[0025] Furthermore, when a URL link is detected in an email, the URL link is transmitted to the crawler system, and the landing URL, webpage screenshot and page source code fed back by the crawler system are received, specifically:
[0026] When detecting that the email contains a URL link, transmitting the URL link to the crawler system;
[0027] Perform a simulated access to the URL link, and when the access is successful, jump to obtain the corresponding landing page, then use the URL corresponding to the landing page as the landing URL, take a screenshot of the landing page to obtain a second image, encode the second image to obtain the webpage screenshot, and extract the source code of the landing page as the page source code;
[0028] When the access fails, the URL link is used as the landing URL, the preset first empty string is used as the webpage screenshot, and the preset second empty string is used as the page source code.
[0029] In order to solve the same technical problem, the present invention also provides a phishing email detection system based on feature extraction, comprising:
[0030] An information acquisition module, which is used to transmit the URL link to the crawler system when a URL link is detected in the email, and receive the landing URL, webpage screenshot and page source code fed back by the crawler system;
[0031] A feature extraction module is used to extract features of the landing URL, the webpage screenshot and the page source code respectively according to a preset feature extraction algorithm to obtain URL features, page image features and source code features;
[0032] An extraction and summarization module, used for extracting the email content features of the email, and combining the URL features, the page image features and the source code features to generate a feature vector corresponding to the email;
[0033] The result output module is used to input the feature vector into a preset detection model and output the phishing email detection result of the email.
[0034] Furthermore, the feature extraction module further includes:
[0035] A first feature extraction unit is used to extract features from the landing URL by feature engineering, and output the URL features; wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features, and word vector features; the 3-gram features are obtained by performing 3-gram processing on the landing URL, calculating the average score of 3-gram tuples in the landing URL, and serving as the 3-gram features; the word vector features are obtained by performing word segmentation processing on the landing URL to obtain a number of text word segments, and using a preset word vector model to determine whether each of the text word segments contains a word vector, and if so, outputting the current word vector, and if not, outputting a zero vector, and using all outputs of the word vector model as the word vector features;
[0036] A second feature extraction unit is used to decode the webpage screenshot to obtain a corresponding first image, and perform resizing, format conversion, and normalization preprocessing on the first image, and then input the first image into a preset image feature extraction model to output the page image features; wherein the image feature extraction model is obtained by training a preset initial image feature extraction model using a second training set, and the second training set includes a plurality of the first images that have completed resizing, format conversion, and normalization preprocessing;
[0037] The third feature extraction unit is used to perform word segmentation processing on the page source code to obtain a corresponding number of code word segments, encode all the code word segments to obtain a word segmentation set, and then transform the word segmentation set through a preset word embedding model to obtain the corresponding source code matrix, and input the source code matrix into a preset TextCNN network model to output the source code features.
[0038] Furthermore, the result output module further includes:
[0039] A model training unit, configured to input a pre-stored first training set into a preset initial detection model, train the initial detection model, and obtain the detection model; wherein the first training set includes a plurality of normal emails, a plurality of feature vectors corresponding to the normal emails, a plurality of phishing emails, and a plurality of feature vectors corresponding to the phishing emails;
[0040] The result output unit is used to input the feature vector into the detection model and output the phishing email detection result of the email.
[0041] Furthermore, the information acquisition module further includes:
[0042] An information transmission unit, configured to transmit the URL link to the crawler system when detecting that the email contains a URL link;
[0043] A first information acquisition unit is used to simulate access to the URL link, and when the access is successful, jump to obtain a corresponding landing page, then use the URL corresponding to the landing page as the landing URL, take a screenshot of the landing page to obtain a second image, encode the second image to obtain the webpage screenshot, and extract the source code of the landing page as the page source code;
[0044] The second information acquisition unit is used to use the URL link as the landing URL when the access fails, and use the preset first empty string as the webpage screenshot, and use the preset second empty string as the page source code.
[0045] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0046] The present invention provides a phishing email detection method and system based on feature extraction, which performs multi-faceted feature extraction on URL links and email contents detected in emails, including URL features in landing URLs, page image features, source code features and email content features, enriches the types of extracted features and reduces the risks of misjudgment and missed judgment; then, based on a feature vector composed of URL features, page image features, source code features and email content features, determines whether the email corresponding to the feature vector is a phishing email, outputs a phishing email detection result in combination with multiple types of features, and improves the accuracy of detection.
[0047] Furthermore, the present invention extracts URL features from the landing URL through feature engineering, and does not involve the features of network communication, so it can complete the feature extraction of the landing URL in an offline environment. In addition, the present invention also determines whether the text segmentation of the landing URL contains a word vector to distinguish between domain names with standardized names and randomly generated domain names, thereby improving the accuracy of phishing email detection results. At the same time, the initial image feature extraction model and the initial detection model are pre-trained using the pre-stored training set to enhance the performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 : A flow chart of an embodiment of a phishing email detection method based on feature extraction provided by the present invention;
[0049] Figure 2 : A flow chart of another embodiment of a phishing email detection method based on feature extraction provided by the present invention;
[0050] Figure 3 : A structural schematic diagram of a phishing email detection system based on feature extraction provided by the present invention;
[0051] Figure 4 : A structural schematic diagram of a feature extraction module of a phishing email detection system based on feature extraction provided by the present invention;
[0052] Figure 5 : A schematic diagram of the structure of a result output module of a phishing email detection system based on feature extraction provided by the present invention;
[0053] Figure 6 : A structural schematic diagram of an information acquisition module of a phishing email detection system based on feature extraction provided by the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] Embodiment 1:
[0056] Please refer to Figure 1 , a phishing email detection method based on feature extraction provided by an embodiment of the present invention, the method includes steps S1 to S4, each step is specifically as follows:
[0057] Step S1: When a URL link is detected in an email, the URL link is transmitted to the crawler system, and the landing URL, web page screenshot and page source code fed back by the crawler system are received.
[0058] Furthermore, step S1 specifically includes step S11 to step S13, and each step is specifically as follows:
[0059] Step S11: When it is detected that the email contains a URL link, the URL link is transmitted to the crawler system.
[0060] In this embodiment, the regular expression of the mail system is used to determine whether the email contains a URL link, and the detection range includes the body content of the email and the QR code image attachment. For the body content, the regular expression can be directly used to match the URL link; for the QR code image attachment, the QR code parsing library is called to parse the QR code image, and the same regular expression is used to match the URL link in the string contained in the parsing result.
[0061] Step S12: simulate access to the URL link. When the access is successful, jump to the corresponding landing page, then use the URL corresponding to the landing page as the landing URL, take a screenshot of the landing page to obtain a second image, encode the second image to obtain a screenshot of the web page, and extract the source code of the landing page as the page source code.
[0062] In this embodiment, when the URL link is transmitted to the crawler system, the received URL link is recorded as the incoming URL, and the browser is simulated to access the incoming URL through the web crawler. If the access is successful, the corresponding URL landing page is obtained after a certain jump, and the URL actually displayed on the URL landing page at this time is used as the landing URL, and the URL landing page is screenshotted to obtain a second image, and the second image is encoded into a string through base64 as a webpage screenshot, and the source code of the landing page is extracted as the page source code.
[0063] Step S13: When the access fails, the URL link is used as the landing URL, the preset first empty string is used as the webpage screenshot, and the preset second empty string is used as the page source code.
[0064] In this embodiment, if the access fails, the URL link is used as the landing URL, and an empty string is returned as the web page screenshot and page source code.
[0065] Step S2: According to a preset feature extraction algorithm, feature extraction is performed on the landing URL, web page screenshot and page source code respectively to obtain URL features, page image features and source code features.
[0066] Further, step S2 specifically includes step S21 to step S23, and each step is specifically as follows:
[0067] Step S21: feature engineering is used to extract features of the landing URL and output URL features; wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features and word vector features.
[0068] Further, step S21 specifically includes step S211 to step S213, and each step is specifically as follows:
[0069] Step S211: Use feature engineering to extract domain name features and intuitive features corresponding to the landing URL.
[0070] In this embodiment, the domain name features and intuitive features corresponding to the landing URL extracted by feature engineering include but are not limited to the following:
[0071] Whether the domain name contains an IP address;
[0072] The landing URL contains the "@" symbol;
[0073] The landing URL has been redirected;
[0074] Whether the incoming URL uses a shortened URL;
[0075] The length of the landing URL;
[0076] The depth of the landing URL;
[0077] The number of times the path part of the landing URL hits the phishing vocabulary;
[0078] The number of unique characters, special characters, and numeric characters contained in the landing URL;
[0079] The number of vowels, the number of consonants, and the maximum interval length between vowels in the domain name;
[0080] The length of the domain name part;
[0081] The number of FQDNs in the domain name portion and the length of the longest FQDN element;
[0082] The information entropy of domain names and landing URL characters.
[0083] In this embodiment, feature engineering is used to complete feature extraction, which gets rid of the dependence on network queries and will not be disturbed by factors such as unstable whois queries and inconsistent results of multiple DNS queries, so that all feature extraction work can be completed in an offline environment.
[0084] Step S212: Perform 3-gram processing on the landing URL and calculate the average score of the 3-gram tuple in the landing URL as the 3-gram feature.
[0085] In this embodiment, please refer to Figure 2 , using the tuples (Ngram x) whose occurrence frequency reaches the offline threshold, the probability of the tuple appearing in normal URL samples and phishing URL samples is counted, and the properties of logarithmic operation are used to make the tuples with a higher probability of appearing in normal URLs get a positive score, and vice versa, a negative score is obtained. The score is used as the 3-gram feature.
[0086] Step S213: Perform word segmentation processing on the landing URL to obtain several text segmentations, and use the preset word vector model to determine whether each text segmentation contains a word vector. If so, output the current word vector; if not, output a zero vector, and use all outputs of the word vector model as word vector features.
[0087] In this embodiment, the landing URL is segmented, and the segmentation standard is standard English punctuation marks, so as to obtain several tokens (text segmentation), and then the open source Twitter pre-trained glove model is used as the word vector model to determine whether each text segmentation contains a word vector. If so, the current word vector is output, if not, a zero vector is output, and all the outputs of the model are used as word vector features. For example, common tokens such as google and cat have word vectors, while randomly generated tokens such as sahdhoasd do not have word vectors.
[0088] Step S22: Decode the webpage screenshot to obtain the corresponding first image, and perform resizing, format conversion, and normalization preprocessing on the first image, and then input it into a preset image feature extraction model to output page image features; wherein the image feature extraction model is obtained by training a preset initial image feature extraction model using a first training set, and the first training set includes multiple first images that have completed resizing, format conversion, and normalization preprocessing.
[0089] In this embodiment, the preset VGG16 network is trained using the imagenet dataset as the first training set, and then the webpage screenshot is decoded through base64 to obtain the corresponding first image, and the first image is preprocessed by resizing, RGB / BGR format conversion, and normalization, and then the preprocessed first image is input into the trained VGG16 network, and the page image features are output in the convolution layer of the trained VGG16 network without using a fully connected layer.
[0090] Step S23: perform word segmentation processing on the page source code to obtain a number of corresponding code word segments, encode and convert all the code word segments to obtain a source code matrix, and input the source code matrix into a preset code feature extraction model to output source code features.
[0091] In this embodiment, for the extraction of source code features, the page source code is only regarded as text, and the parsing of elements such as JS code and PHP code of the page is not considered. Therefore, in actual applications, there is no need to use modules such as Java virtual machine to extract JS / PHP abstract syntax tree, which achieves a certain degree of lightweight.
[0092] Further, step S23 specifically includes step S231 to step S233, and each step is specifically as follows:
[0093] Step S231: perform word segmentation processing on the page source code to obtain a number of corresponding code word segments, and encode all the code word segments to obtain a word segmentation set.
[0094] In this embodiment, a word segmenter is used to segment the page source code, wherein the page source code text is cut into several code words with reference to the expression "!#¥%&()*+,-. / :;<=>?@[\\]^_`{|}~\t\n", and then each code word is encoded into an integer number using the Hash Trick method, and all the integer numbers are combined to obtain a word set.
[0095] Step S232: convert the word segmentation set through a preset word embedding model to obtain a corresponding source code matrix.
[0096] In this embodiment, the deep learning framework Keras is used to train the Embedding model as a word embedding model, and the word segmentation set is converted into a source code matrix, where the size of the source code matrix is the maximum length of the specified sequence x the Embedding dimension.
[0097] Step S233: input the source code matrix into a preset TextCNN network model and output source code features.
[0098] In this embodiment, a TextCNN network with fully connected layers removed is used to extract source code features in a source code matrix.
[0099] Step S3: extracting the email content features of the email, and combining the URL features, page image features and source code features to generate a feature vector corresponding to the email.
[0100] In this embodiment, the body content of the email is input into a fine-tuned Chinese pre-trained BERT model, and the email content features are output. The internal parameters of the Chinese pre-trained BERT model are fine-tuned so that the pre-trained model can better meet the needs of actual business.
[0101] In this embodiment, the URL feature, the page image feature, the source code feature, and the email content feature are concatenated into a feature vector in a specified order.
[0102] Step S4: Input the feature vector into a preset detection model and output the phishing email detection result of the email.
[0103] Furthermore, step S4 is specifically as follows:
[0104] Step S41: Input the pre-stored second training set into the preset initial detection model, train the initial detection model, and obtain the detection model; wherein the second training set includes multiple normal emails, feature vectors corresponding to multiple normal emails, multiple phishing emails, and feature vectors corresponding to multiple phishing emails.
[0105] In this embodiment, the LightGBM algorithm is used to form an initial detection model, and a large amount of sample data is used to train the initial detection model to verify and improve the detection capability of the model.
[0106] Among them, the LightGBM algorithm, as an algorithm with fast training speed and high classification accuracy among decision tree algorithms, has strong anti-noise ability and can handle scenarios where URL crawler access fails.
[0107] Step S42: Input the feature vector into the detection model and output the phishing email detection result of the email.
[0108] Embodiment 2:
[0109] Please refer to Figure 3 In order to solve the same technical problem, the present invention also provides a phishing email detection system based on feature extraction, comprising:
[0110] Information acquisition module 1, used for transmitting the URL link to the crawler system when detecting that the email contains a URL link, and receiving the landing URL, webpage screenshot and page source code fed back by the crawler system;
[0111] Feature extraction module 2, used to extract features from the landing URL, webpage screenshot and page source code respectively according to a preset feature extraction algorithm to obtain URL features, page image features and source code features;
[0112] Extraction and aggregation module 3, used to extract the email content features of the email, and combine the URL features, page image features and source code features to generate a feature vector corresponding to the email;
[0113] The result output module 4 is used to input the feature vector into a preset detection model and output the phishing email detection result of the email.
[0114] For further information, please refer to Figure 4 , the feature extraction module 2 further includes:
[0115] The first feature extraction unit is used to extract features from the landing URL by feature engineering and output URL features; wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features and word vector features; the 3-gram features are obtained by performing 3-gram processing on the landing URL and calculating the average score of the 3-gram tuple in the landing URL as the 3-gram feature; the word vector feature is obtained by performing word segmentation processing on the landing URL to obtain a number of text word segments, and using a preset word vector model to determine whether each text word segment contains a word vector, if yes, output the current word vector, if no, output a zero vector, and all outputs of the word vector model are obtained as word vector features;
[0116] A second feature extraction unit is used to decode the webpage screenshot to obtain a corresponding first image, and perform resizing, format conversion, and normalization preprocessing on the first image, and then input it into a preset image feature extraction model to output page image features; wherein the image feature extraction model is obtained by training a preset initial image feature extraction model using a second training set, and the second training set includes a plurality of first images that have completed resizing, format conversion, and normalization preprocessing;
[0117] The third feature extraction unit is used to perform word segmentation on the page source code to obtain a number of corresponding code word segments, encode all the code word segments to obtain a word segmentation set, and then transform the word segmentation set through a preset word embedding model to obtain a corresponding source code matrix, and input the source code matrix into a preset TextCNN network model to output source code features.
[0118] For further information, please refer to Figure 5 , the result output module 4 further includes:
[0119] A model training unit, used to input a pre-stored first training set into a preset initial detection model, train the initial detection model, and obtain a detection model; wherein the first training set includes a plurality of normal emails, feature vectors corresponding to the plurality of normal emails, a plurality of phishing emails, and feature vectors corresponding to the plurality of phishing emails;
[0120] The result output unit is used to input the feature vector into the detection model and output the phishing email detection result of the email.
[0121] For further information, please refer to Figure 6 , the information acquisition module 1 further includes:
[0122] An information transmission unit, for transmitting the URL link to the crawler system when detecting that the email contains a URL link;
[0123] The first information acquisition unit is used to simulate access to the URL link. When the access is successful, the corresponding landing page is jumped to, and then the URL corresponding to the landing page is used as the landing URL, and a screenshot of the landing page is taken to obtain a second image, and the second image is encoded to obtain a webpage screenshot, and the source code of the landing page is extracted as the page source code;
[0124] The second information acquisition unit is used to use the URL link as the landing URL when the access fails, and use the preset first empty string as the webpage screenshot, and use the preset second empty string as the page source code.
[0125] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0126] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0127] The present invention provides a phishing email detection method and system based on feature extraction, which performs multi-faceted feature extraction on URL links and email contents detected in emails, including URL features in landing URLs, page image features, source code features and email content features, enriches the types of extracted features and reduces the risks of misjudgment and missed judgment; then, based on a feature vector composed of URL features, page image features, source code features and email content features, determines whether the email corresponding to the feature vector is a phishing email, outputs a phishing email detection result in combination with multiple types of features, and improves the accuracy of detection.
[0128] Furthermore, the present invention extracts URL features from the landing URL through feature engineering, and does not involve the features of network communication, so it can complete the feature extraction of the landing URL in an offline environment. In addition, the present invention also determines whether the text segmentation of the landing URL contains a word vector to distinguish between domain names with standardized names and randomly generated domain names, thereby improving the accuracy of phishing email detection results. At the same time, the initial image feature extraction model and the initial detection model are pre-trained using the pre-stored training set to enhance the performance of the model.
[0129] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A phishing email detection method based on feature extraction, characterized in that: include: When a URL link is detected in the email, the URL link is transmitted to the crawler system, and the landing URL, webpage screenshot and page source code fed back by the crawler system are received; According to a preset feature extraction algorithm, feature extraction is performed on the landing URL, the webpage screenshot and the page source code respectively to obtain URL features, page image features and source code features; Extracting the email content feature of the email, and combining the URL feature, the page image feature and the source code feature to generate a feature vector corresponding to the email; Inputting the feature vector into a preset detection model, and outputting a phishing email detection result of the email; Among them, according to the preset feature extraction algorithm, feature extraction is performed on the landing URL, the webpage screenshot and the page source code respectively to obtain URL features, page image features and source code features, specifically: Using feature engineering to extract features from the landing URL and output the URL features; wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features, and word vector features; Decoding the webpage screenshot to obtain a corresponding first image, performing resizing, format conversion, and normalization preprocessing on the first image, and then inputting the first image into a preset image feature extraction model to output the page image features; wherein the image feature extraction model is obtained by training a preset initial image feature extraction model using a first training set, and the first training set includes a plurality of the first images that have undergone resizing, format conversion, and normalization preprocessing; Performing word segmentation processing on the page source code to obtain a number of corresponding code word segments, encoding and converting all the code word segments to obtain a source code matrix, and inputting the source code matrix into a preset code feature extraction model to output the source code features; The page source code is segmented to obtain a number of corresponding code segmentations, and all the code segmentations are encoded and converted to obtain a source code matrix, and the source code matrix is input into a preset code feature extraction model to output the source code features, specifically: Performing word segmentation processing on the page source code to obtain a number of corresponding code word segments, and encoding all the code word segments to obtain a word segmentation set; The word segmentation set is converted by a preset word embedding model to obtain the corresponding source code matrix; The source code matrix is input into a preset TextCNN network model, and the source code features are output.
2. A phishing email detection method based on feature extraction as claimed in claim 1, characterized in that: The feature engineering is used to extract features of the landing URL and output the URL features, wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features and word vector features, specifically: Using feature engineering, extracting the domain name features and the intuitive features corresponding to the landing URL; Performing 3-gram processing on the landing URL, and calculating an average score of the 3-gram tuples in the landing URL as the 3-gram feature; The landing URL is segmented to obtain several text segments, and a preset word vector model is used to determine whether each of the text segments contains a word vector. If so, the current word vector is output; if not, a zero vector is output, and all outputs of the word vector model are used as the word vector features.
3. A phishing email detection method based on feature extraction as claimed in claim 1, characterized in that: The step of inputting the feature vector into a preset detection model and outputting the phishing email detection result of the email is specifically as follows: Inputting the pre-stored second training set into a preset initial detection model, training the initial detection model, and obtaining the detection model; wherein the second training set includes a plurality of normal emails, a plurality of feature vectors corresponding to the normal emails, a plurality of phishing emails, and a plurality of feature vectors corresponding to the phishing emails; The feature vector is input into the detection model, and the phishing email detection result of the email is output.
4. A phishing email detection method based on feature extraction as claimed in claim 1, characterized in that: When a URL link is detected in an email, the URL link is transmitted to the crawler system, and the landing URL, webpage screenshot and page source code fed back by the crawler system are received, specifically: When detecting that the email contains a URL link, transmitting the URL link to the crawler system; Perform a simulated access to the URL link, and when the access is successful, jump to obtain the corresponding landing page, then use the URL corresponding to the landing page as the landing URL, take a screenshot of the landing page to obtain a second image, encode the second image to obtain the webpage screenshot, and extract the source code of the landing page as the page source code; When the access fails, the URL link is used as the landing URL, the preset first empty string is used as the webpage screenshot, and the preset second empty string is used as the page source code.
5. A phishing email detection system based on feature extraction, characterized in that: include: An information acquisition module, which is used to transmit the URL link to the crawler system when a URL link is detected in the email, and receive the landing URL, webpage screenshot and page source code fed back by the crawler system; A feature extraction module is used to extract features of the landing URL, the webpage screenshot and the page source code respectively according to a preset feature extraction algorithm to obtain URL features, page image features and source code features; An extraction and summarization module, used for extracting the email content features of the email, and combining the URL features, the page image features and the source code features to generate a feature vector corresponding to the email; A result output module, used for inputting the feature vector into a preset detection model and outputting the phishing email detection result of the email; Wherein, the feature extraction module further includes: A first feature extraction unit is used to extract features of the landing URL by feature engineering and output the URL features; wherein the URL features include domain name features, intuitive features of the landing URL, 3-gram features and word vector features; A second feature extraction unit is used to decode the webpage screenshot to obtain a corresponding first image, and perform resizing, format conversion, and normalization preprocessing on the first image, and then input the first image into a preset image feature extraction model to output the page image features; wherein the image feature extraction model is obtained by training a preset initial image feature extraction model using a second training set, and the second training set includes a plurality of the first images that have completed resizing, format conversion, and normalization preprocessing; The third feature extraction unit is used to perform word segmentation processing on the page source code to obtain a corresponding number of code word segments, encode all the code word segments to obtain a word segmentation set, and then transform the word segmentation set through a preset word embedding model to obtain a corresponding source code matrix, and input the source code matrix into a preset TextCNN network model to output the source code features.
6. A phishing email detection system based on feature extraction as claimed in claim 5, characterized in that: The 3-gram feature is obtained by performing 3-gram processing on the landing URL and calculating the average score of the 3-gram tuple in the landing URL as the 3-gram feature; the word vector feature is obtained by performing word segmentation processing on the landing URL to obtain a number of text segmentations, and using a preset word vector model to determine whether each of the text segmentations contains a word vector, and if so, outputting the current word vector, if not, outputting a zero vector, and all outputs of the word vector model are obtained as the word vector feature.
7. A phishing email detection system based on feature extraction as claimed in claim 5, characterized in that: The result output module further includes: A model training unit, configured to input a pre-stored first training set into a preset initial detection model, train the initial detection model, and obtain the detection model; wherein the first training set includes a plurality of normal emails, a plurality of feature vectors corresponding to the normal emails, a plurality of phishing emails, and a plurality of feature vectors corresponding to the phishing emails; The result output unit is used to input the feature vector into the detection model and output the phishing email detection result of the email.
8. A phishing email detection system based on feature extraction as claimed in claim 5, characterized in that: The information acquisition module further includes: An information transmission unit, for transmitting the URL link to the crawler system when detecting that the email contains a URL link; A first information acquisition unit is used to simulate access to the URL link, and when the access is successful, jump to obtain a corresponding landing page, then use the URL corresponding to the landing page as the landing URL, take a screenshot of the landing page to obtain a second image, encode the second image to obtain the webpage screenshot, and extract the source code of the landing page as the page source code; The second information acquisition unit is used to use the URL link as the landing URL when the access fails, and use the preset first empty string as the webpage screenshot, and use the preset second empty string as the page source code.
Citation Information
Patent Citations
Phishing website detection method and device and storage medium
CN111107048A
Phishing link detection method and system
CN111181922A
