Password guessing method and device based on two-dimensional convolution diffusion model

By encoding passwords into two-dimensional tensors and training using two-dimensional convolutional neural networks, combined with PCFG model, the problem that password guessing models in the prior art cannot effectively learn password relationships is solved, and a higher password collision rate and more effective password guessing are achieved.

CN120602199APending Publication Date: 2025-09-05Chinese People's Liberation Army Cyberspace Force Information Engineering University
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510921746.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

When existing password guessing techniques use one-dimensional convolutional neural networks for training, they cannot fully learn the relationship between passwords, resulting in a low collision rate of passwords generated by the password dictionary.

Method used

The two-dimensional convolutional diffusion model is adopted to treat passwords as two-dimensional tensors and train and generate them using two-dimensional convolutional neural networks. By encoding the password set into grayscale images, the two-dimensional convolution kernel is used to learn the connection between passwords, and combined with the password guess model PCFG of the probability context-independent method, a supplementary mode set is generated to improve the password collision rate.

Benefits of technology

Improves the password collision rate of password dictionary, improves the effectiveness and efficiency of password guessing, especially in large-scale data sets, which outperforms traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120602199A_ABST
    Figure CN120602199A_ABST
Patent Text Reader

Abstract

The invention provides a password guessing method and device based on a two-dimensional convolution diffusion model. The method comprises the following steps: selecting a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model; collecting a password set leaked by a target website, and encoding the password set into a plurality of grayscale images; setting control parameters of the total step number and the diffusion degree of diffusion, and training a two-dimensional convolution diffusion model by using the plurality of gray level images; randomly sampling from Gaussian distribution, and inputting data obtained by sampling and the total step number of diffusion into the trained two-dimensional convolution diffusion model to obtain a reconstructed grayscale image; and decoding the reconstructed gray scale to obtain a corresponding password.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of password guessing, and in particular to a password guessing method and device based on a two-dimensional convolution diffusion model. Background Art

[0002] In the current internet age, logging into various smart devices, websites, and software requires authentication. With the continuous advancement of technology, a growing number of authentication methods are available. Password-based authentication has become the most widely used due to its ease of use, ease of modification, and low cost. However, passwords have numerous security and usability flaws. For example, a user will not choose a different password for every device or website requiring a password, and their passwords are likely to be duplicated. This behavior has led to the emergence of password guessing techniques.

[0003] Early password guessing techniques primarily generated password dictionaries based on contextual relationships and semantic features. In 2005, Narayanan et al. proposed a Markov chain-based guessing model, calculating the probability of password generation by using the left-to-right correlation of characters. In 2009, Weir et al. proposed a probabilistic context-free password guessing model (PCFG). Each password is divided into letter, number, and special character segments. The model calculates password pattern frequency tables and character combination frequency tables and generates a set of guess frequencies based on these tables to simulate the probability distribution of real passwords. That same year, hashcat, a well-known tool for brute-forcing passwords based on a given dictionary of characters, was released. In 2016, Wang Ding et al. proposed TarGuess I–IV, an online targeted attack model based on personal information. In 2017, Luo Min et al. proposed E-PCFG, a predictive model that combines natural language processing (NLP) and PCFG.

[0004] Before the emergence of artificial intelligence, password guessing required more professional cryptography knowledge and talent. With the development of artificial intelligence technology, more and more machine learning and deep learning methods have been proposed. People have begun to combine artificial intelligence models with password guessing technology and proposed some new password guessing models. In artificial intelligence technology, the most important thing is the construction of neural networks and the selection of appropriate networks for specific tasks. The document "YU W, YIN Q, YIN H, et al. A Systematic Review on Password Guessing Tasks [J]. Entropy, 2023, 25 (9): 1303" lists 37 password guessing algorithms published from 2016 to 2023, of which 13 use traditional methods and 24 use neural networks. Among them, 16 use recurrent neural networks (RNNs) and 6 use one-dimensional convolutional neural networks (1D-CNNs), such as G-Pass, VAE-Pass, PassGAN, and other models. 1D-CNN was also used in the diffusion model of Guo Sheng et al. The above model treats passwords as one-dimensional sequences and then uses the model for training and generation. This training and generation method is equivalent to splicing multiple passwords into a line. Using one-dimensional convolution for training does not fully learn the relationship between passwords. Therefore, the password collision rate of the generated password dictionary needs to be improved. Summary of the Invention

[0005] To improve the password collision rate of password guessing methods, the present invention provides a password guessing method and device based on a two-dimensional convolutional diffusion model. This method treats passwords as two-dimensional tensors (specifically, grayscale images) and uses a two-dimensional convolutional neural network (2D-CNN) for training and generation. The resulting password dictionary has a high password collision rate.

[0006] In a first aspect, the present invention provides a password guessing method based on a two-dimensional convolution diffusion model, comprising:

[0007] A two-dimensional convolutional neural network is selected as the noise estimation network in the diffusion model to construct a two-dimensional convolutional diffusion model;

[0008] Collecting a password set leaked from a target website, and encoding the password set into a plurality of grayscale images;

[0009] Setting the total number of diffusion steps and control parameters of the diffusion degree, and using the plurality of grayscale images to train a two-dimensional convolution diffusion model;

[0010] Randomly sample from the Gaussian distribution, input the sampled data and the total number of diffusion steps into the trained two-dimensional convolution diffusion model to obtain the reconstructed grayscale image;

[0011] The reconstructed grayscale is decoded to obtain a corresponding password.

[0012] Furthermore, encoding the password set into a plurality of grayscale images specifically includes:

[0013] Divide the password set into group; where n is the length of the password to be guessed, and N is the total number of passwords contained in the password set;

[0014] For each password group, each password is converted into a one-dimensional vector, thereby converting each password group into a grayscale image.

[0015] Furthermore, the noise estimation network adopts a U-Net network composed of a two-dimensional convolutional neural network.

[0016] In a second aspect, the present invention provides a password guessing method based on a two-dimensional convolution diffusion model, comprising:

[0017] A two-dimensional convolutional neural network is selected as the noise estimation network in the diffusion model to construct a two-dimensional convolutional diffusion model;

[0018] Collecting a set of passwords leaked from a target website, generating a pattern set corresponding to the password set using a probabilistic context-free password guessing model (PCFG), and encoding the pattern set into multiple grayscale images; the pattern set refers to a collection of password patterns;

[0019] Setting the total number of diffusion steps and control parameters of the diffusion degree, and using the plurality of grayscale images to train a two-dimensional convolution diffusion model;

[0020] Randomly sample from the Gaussian distribution, input the sampled data and the total number of diffusion steps into the trained two-dimensional convolution diffusion model to obtain the reconstructed grayscale image;

[0021] Decoding the reconstructed grayscale to obtain a corresponding password pattern;

[0022] A supplementary pattern set of the PCFG is formed based on the obtained password pattern, and then the PCFG is used to guess the password according to the supplemented pattern set.

[0023] Furthermore, the pattern based on the obtained password forms a supplementary pattern set of the PCFG, specifically including:

[0024] The pattern of the command obtained by using the trained two-dimensional convolutional diffusion model is recorded as the generation pattern, and the generation process is repeated to obtain the generation pattern set;

[0025] Removing repeated patterns from the generated pattern set to obtain a deduplicated generated pattern set;

[0026] Performing a difference operation on the generated pattern set after deduplication and the pattern set used in training the two-dimensional convolutional diffusion model to obtain a candidate supplementary pattern set;

[0027] Patterns that meet the format requirements of the PCFG pattern are selected from the candidate supplementary pattern set to form the supplementary pattern set.

[0028] Furthermore, the noise estimation network adopts a U-Net network composed of a two-dimensional convolutional neural network.

[0029] In a third aspect, the present invention provides a password guessing device based on a two-dimensional convolution diffusion model, comprising:

[0030] A model building module, used for selecting a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model;

[0031] A data preprocessing module, configured to collect a set of passwords leaked from a target website and encode the passwords into a plurality of grayscale images;

[0032] a training module, configured to set control parameters for the total number of diffusion steps and the degree of diffusion, and to train a two-dimensional convolution diffusion model using a plurality of the grayscale images;

[0033] The reconstruction module is used to randomly sample from the Gaussian distribution and input the sampled data and the total number of diffusion steps into the trained two-dimensional convolutional diffusion model to obtain a reconstructed grayscale image;

[0034] The decoding module is used to decode the reconstructed grayscale to obtain a corresponding password.

[0035] In a fourth aspect, the present invention provides a password guessing device based on a two-dimensional convolution diffusion model, comprising:

[0036] A model building module, used for selecting a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model;

[0037] A data preprocessing module is used to collect password sets leaked from target websites, generate a pattern set corresponding to the password set using a probabilistic context-free password guessing model (PCFG), and encode the pattern set into multiple grayscale images; the pattern set is a collection of password patterns;

[0038] a training module, configured to set control parameters for the total number of diffusion steps and the degree of diffusion, and to train a two-dimensional convolution diffusion model using a plurality of the grayscale images;

[0039] The reconstruction module is used to randomly sample from the Gaussian distribution and input the sampled data and the total number of diffusion steps into the trained two-dimensional convolutional diffusion model to obtain a reconstructed grayscale image;

[0040] The decoding module is used to decode the reconstructed grayscale to obtain a corresponding password pattern.

[0041] In a fifth aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect and / or the second aspect when executing the program.

[0042] In a sixth aspect, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect and / or the second aspect.

[0043] The beneficial effects of the present invention are:

[0044] (1) This paper combines a 2D-CNN-based diffusion model with password guessing technology to propose a new password guessing method, TDDGuess, and provides two different application methods. One is direct use for password guessing, which directly trains on a set of leaked passwords to obtain a high-quality password dictionary without any prior knowledge. The other is combined with PCFG. By training the PCFG pattern set, more new password PCFG patterns can be mined, thereby achieving the effect of supplementing the training pattern set and thus improving the collision probability of PCFG.

[0045] (2) In order to use the two-dimensional convolution diffusion model as a password guessing model, the present invention converts the password and pattern into grayscale images on the one hand, so that it conforms to the characteristics of the model and is suitable for the input of two-dimensional convolution, thereby realizing the training and generation of the required data; on the other hand, the PCFG pattern set is regarded as a related data set for training, and TDDGuess is used to generate the patterns required by PCFG, creating more new patterns, supplementing the original patterns, expanding the guessing range of PCFG, and increasing the probability of password collision; experiments have shown that TDDGuess has a higher advantage than PassGAN under this data set. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 is the structure of the diffusion model;

[0047] Figure 2One of the flowcharts of a password guessing method based on a two-dimensional convolution diffusion model provided by an embodiment of the present invention;

[0048] Figure 3 Schematic diagram of converting a password into a grayscale image according to an embodiment of the present invention;

[0049] Figure 4 A second flowchart of a password guessing method based on a two-dimensional convolution diffusion model provided by an embodiment of the present invention;

[0050] Figure 5 A schematic diagram of the changes in the training process of the two-dimensional convolutional diffusion model provided by an embodiment of the present invention;

[0051] Figure 6 A schematic diagram of the structure of a password guessing device based on a two-dimensional convolution diffusion model provided by an embodiment of the present invention;

[0052] Figure 7 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0053] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly described below in conjunction with the accompanying drawings. 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 making creative efforts are within the scope of protection of the present invention.

[0054] With the development of artificial intelligence (AI) technology, a large number of intelligent password guessing attack methods have been developed by combining AI with password guessing techniques. Because passwords are typically sequences of random characters, intelligent models typically use sequence-based recurrent neural networks (RNNs) or one-dimensional convolutional neural networks (1D-CNNs) to learn password data. To the best of our knowledge, no intelligent password guessing methods have been found in the public literature that directly utilize two-dimensional convolutional neural networks (2D-CNNs). Therefore, the present invention proposes a password guessing method, TDDGuess, based on a two-dimensional convolutional diffusion model.

[0055] In order to better understand the technical solution of the present invention, the following is a brief introduction to the relevant terms and models involved in the present invention.

[0056] (1) Password guessing attack

[0057] A password guessing attack refers to an attacker generating a password dictionary based on existing password data through different methods and techniques, and then using the password dictionary to collide with the user's password. The purpose of a password guessing attack is to enable the attacker to access certain user accounts, systems, or network resources. The document "Zou Yunkai, Wang Ding. Research Progress in Password Guessing [J]. Journal of Cryptography, 2024(001):011" divides existing password guessing methods into three categories based on different technical routes. The first category is a rule-based guessing attack, such as converting the password "password" into "P@ssword" by capitalizing the first letter and changing the letter "a" to the character "@". The second category is a guessing attack based on statistical methods. This type of method mainly designs a probability model by statistically training the frequency of basic elements in the password dictionary. Typical representatives include Markov chains (Markov) and probabilistic context-free grammars (PCFG). The third category is a guessing attack based on machine learning or deep learning technology. Typical representatives include PassGAN.

[0058] (2)PCFG

[0059] PCFG is a fully automatic, strolling password guessing algorithm based on a rigorous probabilistic context-free method. If PCFG can obtain the combination pattern of a password, then this password can be guessed by PCFG with a high probability.

[0060] (3) PassGAN model

[0061] By training a generative adversarial network (GAN) model on a set of leaked passwords to generate a password dictionary, and then testing for password collisions, they ultimately developed the intelligent password guessing method PassGAN. GANs, or generative adversarial networks, are known for their output, which is closely related to the training set. Therefore, passwords generated by PassGAN are likely to match passwords that have not yet been leaked. Furthermore, PassGAN automatically infers password distribution information from the leaked password set, rather than manually analyzing it. Therefore, PassGAN can effortlessly leverage new password leaks to generate a richer password distribution.

[0062] (4) Diffusion model

[0063] The diffusion model consists of two Markov chains: a forward chain (diffusion process) and a backward chain (reconstruction process). The forward chain is used for data diffusion and noise estimation network training. It adds noise to the original data at a pre-set rate until the distribution of the original data approaches a standard Gaussian distribution. Simultaneously, the noise added at each diffusion step, the diffused data, and the current number of iterations are used as inputs to the noise estimation network, where the loss is calculated and the gradient is updated. The backward chain is used for data generation. It randomly samples from a standard Gaussian distribution and uses the sampled data and the final number of diffusion steps as inputs to the noise estimation network to obtain an estimated noise. The sampled data is then denoised based on the estimated noise to obtain the input for the next reconstruction step. This cycle continues iteratively until reconstruction is complete. Figure 1 This is the specific structure of the diffusion model.

[0064] The diffusion process satisfies the following distribution:

[0065]

[0066] The diffusion process is a Markov process, T is the total number of diffusion steps, usually 1000, x t is the data with noise added after the tth step, β t is a hyperparameter, and the range given in the literature

[11] is 10 -4 ~2×10 -2 According to formula (1) and the re-parameterization technique, we can get the formula for inferring the next step from the previous step in the diffusion process:

[0067]

[0068] where Z t is the added Gaussian noise, Z t ~N(0,1). The reparameterization technique is a technique used when randomly sampling from a Gaussian distribution. Specifically, if x~N(x;μ,σ 2 ), to sample x, let x = μ + σ × Z, where Z ~ N(0,1). The x obtained by this formula satisfies the Gaussian distribution with mean μ and variance σ, and x is differentiable because the randomness is transferred to Z.

[0069] However, during the training process, the model may only use the data of the t-th step, but needs to calculate the data of the previous t-1 steps step by step, which is obviously a waste of time and resources. Therefore, we consider whether it is possible to directly obtain the data after the diffusion of t steps from the original data. Let α t =1-β t , then formula (2) becomes:

[0070]

[0071] Then, by deduction,

[0072]

[0073] in The data of step t can be directly calculated by formula (4), which greatly improves the speed of the diffusion process. The purpose of the diffusion process is to convert the original data into Gaussian noise, that is, x T ~N(0,1), then the selected β can be determined by formula (4), which should be

[0074] The reconstruction process is a reverse Markov process, from Gaussian noise to real data. From formula (4), we can see that and x T Under known conditions, we can sample from the Gaussian distribution to obtain The original data x0 can be obtained from formula (5).

[0075]

[0076] However, this does not utilize the information of each step, and the quality of the generated samples is poor. Therefore, we consider whether it is possible to gradually reconstruct the original data, that is, consider p(x t-1 |x t ). According to formulas (3) and (4),

[0077]

[0078] According to the conditional probability formula and the above equation, let p(x t-1 |x t )=N(x t-1 :μ,σ 2 ),in,

[0079]

[0080] According to formula (5), we can t Predict x0, so replace x0 in the above μ with x t Replace, available, Then we have μ and σ, and then use the reparameterization technique to get

[0081]

[0082] in is the noise of the t-th step predicted by the neural network. According to formula (6), according to α t 、x t and You can restore x0 step by step.

[0083] On the basis of the above, if Figure 2 As shown, an embodiment of the present invention provides a password guessing method based on a two-dimensional convolution diffusion model, comprising the following steps:

[0084] S101: selecting a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model;

[0085] Specifically, in practical applications, the network architecture of the noise estimation network can be determined based on the complexity of the password set to be guessed. Considering the powerful feature extraction capabilities and high generation quality of U-Net, this embodiment uses a U-Net composed of a two-dimensional convolutional neural network as the noise estimation network.

[0086] S102: Collecting a password set leaked from a target website, and encoding the password set into a plurality of grayscale images;

[0087] Specifically, different websites have their own password setting rules, such as password length limits and character composition. Furthermore, different users also have their own password-setting habits. Therefore, when multiple passwords are grouped together, it's easier to discover patterns and connections between them.

[0088] In traditional password guessing models, passwords are converted into one-dimensional vectors and learned using one-dimensional convolution. However, one-dimensional convolution can be understood as sequentially selecting a portion of a line for convolution each time. If multiple passwords are concatenated into a line using this method and trained using one-dimensional convolution, the above-mentioned connection between the passwords cannot be fully learned.

[0089] To overcome the aforementioned issues with traditional password guessing models, the present invention utilizes two-dimensional convolution. Two-dimensional convolution can be understood as sequentially selecting a portion of a surface for convolution. This convolution combines multiple passwords into a single surface, and using a two-dimensional convolution kernel to perform convolution, fully learning the connections between passwords. Based on this, the present invention considers encoding passwords in the form of two-dimensional images. Learning multiple passwords together can better learn the password characteristics of a website or user.

[0090] S103: setting the total number of diffusion steps T and the control parameter β of the diffusion degree, and training the two-dimensional convolution diffusion model using the plurality of grayscale images;

[0091] Specifically, note Z θ is the noise estimation network, Z tThe specific training process is to first input the data x0 and the total number of diffusion steps T, and randomly select the number of steps t, t∈[1,T]. Then x0 is diffused through t steps to obtain x t and Z t , x t and t as Z θ The input is the predicted noise. Finally, Z t and As the input of the loss function, the loss is calculated. This implements a training, and then optimizes the network according to the gradient, and continuously trains until the loss converges.

[0092] S104: Randomly sample from the Gaussian distribution, input the sampled data and the total number of diffusion steps into the trained two-dimensional convolution diffusion model to obtain a reconstructed grayscale image;

[0093] Specifically, after the network is trained, it can be used to predict the noise Z added in step t. t Then, the original data can be reconstructed according to formula (6). Because Gaussian noise is added, it is assumed that when it diffuses to the Tth step, x T ~N(0,1), so when reconstructing, x t Sampling directly from Gaussian distribution. The specific reconstruction process is to first sample x T , then T and x T Enter Z θ In the T-th step, we get the noise added Using formula (6) we can get x T-1 Finally, repeat the above process T times to obtain data close to the original data, which is the generated sample. It is worth noting that according to formula (6), in each step of the reconstruction process, a Gaussian noise will be added, but in the last step of the reconstruction, the data is expected to be clean and without noise, so the Gaussian noise is no longer added in the last step, that is,

[0094] S105: Decode the reconstructed grayscale to obtain a corresponding password.

[0095] Specifically, the data generated by the two-dimensional convolution diffusion model is in image format, but the final desired output is a password, so the obtained data needs to be decoded.

[0096] The password guessing method based on the two-dimensional convolution diffusion model provided by the embodiment of the present invention regards the password as a two-dimensional tensor (specifically expressed as a grayscale image) and uses the two-dimensional convolution diffusion model for password training and generation. The generated password dictionary has a high password collision rate.

[0097] In one embodiment, encoding the password set into a plurality of grayscale images specifically comprises the following steps: dividing the password set into group; where n is the length of the password to be guessed, and N is the total number of passwords contained in the password set; for each password group, each password therein is converted into a one-dimensional vector, thereby converting each password group into a grayscale image.

[0098] Specifically, in practical applications, the length of the password to be guessed can be set based on the results of a statistical analysis of a leaked password collection. For example, a statistical analysis of the lengths of passwords in a collected password collection reveals that most passwords are between 6 and 12 characters long, accounting for approximately 90% of the total number of passwords, and that passwords longer than 16 account for less than 1% of the total number of passwords. In this case, the length of the password to be guessed can be fixed at 16, and passwords longer than 16 can be removed from the password collection. Passwords in the password collection that are shorter than 16 can be padded with zeros.

[0099] In practical applications, passwords are typically composed of a random combination of 95 printable characters and have a variable length. This embodiment assumes that the password length is fixed at 16. If one-hot encoding is used, a password can be encoded as a tensor of dimension [16, 95], where each element in the tensor is either 0 or 1, and there are only 16 1s. This tensor is clearly too sparse and does not conform to the characteristics of the model of the present invention. Therefore, the present invention numbers each of the 95 printable characters and converts a password into a one-dimensional vector whose elements are within {-47, ..., 0, ..., 47}.

[0100] At the same time, considering that the diffusion model has a better effect in image generation, this embodiment considers integrating the encoded password into the format of an image. Figure 3 The 16 passwords are converted into grayscale images. Furthermore, because the password guessing model used in this invention is constructed using a 2D-CNN, which can learn features from multiple dimensions, multiple passwords are combined into one input, allowing the 2D-CNN to learn the correlations between the passwords.

[0101] For the password, assume that it has been encoded as a one-dimensional vector containing 16 elements, then the 16 passwords are grouped into a [16,16] tensor, and then the total number of passwords in the entire password set N is divided into groups by 16, then the entire password set can be encoded as Because the password corresponds to a grayscale image, we need to add a layer of channels. The number of channels is 1, so we only need to add a layer of meaningless dimensions, which can be encoded as The four-dimensional tensor is used as training data for the two-dimensional convolutional diffusion model.

[0102] It should be noted that when performing two-dimensional encoding, passwords can be randomly selected for encoding, that is, 16 passwords can be randomly selected and combined into a grayscale image; passwords with the same pattern can also be encoded together to further increase the correlation between passwords, thereby improving the password guessing effect.

[0103] Corresponding to the above encoding process, the decoding process is the inverse process of the above encoding process. In one embodiment, the password decoding method specifically includes the following steps: first, rounding the elements in the tensor into integers, and then decoding each element according to the dimension to obtain the corresponding semantic characters. The table lookup method is used instead of the dictionary loop search method to improve the decoding speed. Finally, the obtained password is stored in the specified file.

[0104] Specifically, the rounding method does not discard the information learned by the model. The model itself is a continuous model, that is, the input and output data are all floating-point types. However, when encoding the password, the present invention uses integer encoding, and then forcibly converts it into floating-point type as data input to the model for learning. Moreover, the experimental part in the following text of the present invention also verifies this point, that is: during the learning process, as the loss continues to decrease, by observing the output data, it can be found that the digits after the decimal point of the output data gradually decrease. It can be understood that as the model is trained, the data will converge to the integer closest to it. Therefore, the rounding method does not discard the information learned by the model. Instead, it uses the information learned by the model at this stage to round the data. At the same time, the rounding method also reduces the training time of the model, which facilitates the decoding of the data generated by the model.

[0105] like Figure 4 As shown, another password guessing method based on a two-dimensional convolution diffusion model provided by an embodiment of the present invention includes the following steps:

[0106] S201: selecting a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model;

[0107] S202: Collecting a password set leaked from a target website, generating a pattern set corresponding to the password set using a probabilistic context-free password guessing model (PCFG), and encoding the pattern set into multiple grayscale images; the pattern set refers to a collection of password patterns;

[0108] S203: Setting the total number of diffusion steps and control parameters of the diffusion degree, and using the plurality of grayscale images to train a two-dimensional convolution diffusion model;

[0109] S204: Randomly sample from the Gaussian distribution, input the sampled data and the total number of diffusion steps into the trained two-dimensional convolution diffusion model to obtain a reconstructed grayscale image;

[0110] S205: Decode the reconstructed grayscale to obtain a corresponding password pattern;

[0111] S206: Forming a supplementary pattern set of the PCFG based on the obtained password pattern, and then using the PCFG to guess the password according to the supplemented pattern set.

[0112] The password guessing method based on the two-dimensional convolution diffusion model provided by the embodiment of the present invention encodes the pattern set into a grayscale image and combines the two-dimensional convolution diffusion model with PCFG to realize the training of the patterns defined by PCFG. It can mine more new password PCFG patterns, and then perform password guessing based on PCFG, thereby improving the password collision rate of the generated password dictionary.

[0113] In one embodiment, similar to the password encoding method in the above embodiment, through studying the PCFG code and observing the pattern set generated by it, it is found that the maximum length of a PCFG pattern does not exceed 15. Therefore, during the encoding process of this embodiment, the length of the pattern to be guessed is also fixed to 16, and the patterns in the pattern set that are insufficient in length are padded with 0.

[0114] As for the patterns of PCFG, the present invention found that there are mainly 7 types, namely letter A, word mask C, number D, keyboard input K, other O, context X, year Y, followed by the corresponding length. Each pattern is a combination of these characters. Therefore, there is a high degree of similarity between each pattern, and they can be converted to each other through a few simple steps of adding and deleting operations. Therefore, the pattern set is a data set with high correlation, which meets the characteristics of the model of the present invention. Its encoding can be imitated from the encoding of passwords, and the characters corresponding to the 7 patterns and 0 to 9 are numbered, but the pattern of PCFG is variable, and patterns can be added and reduced artificially. Therefore, in order to make the encoding more widely applicable, the present invention numbers the 26 uppercase English characters and 0 to 9, converts a pattern into a one-dimensional vector, and then integrates the encoded pattern set into the format of a picture.

[0115] Correspondingly, the decoding process of the pattern is the inverse process of the encoding process. For the pattern, the decoding method is the same as the password. After that, the generated pattern needs to be converted into the format of the pattern set that can be used by PCFG, and invalid patterns must be removed.

[0116] For the pattern, assume that it has been encoded as a one-dimensional vector containing 16 elements, then the 16 patterns are grouped into a [16,16] tensor, and then the total number of patterns N in the entire pattern set is divided into groups by 16, then the entire pattern set can be encoded as Because the password corresponds to a grayscale image, we need to add a layer of channels. The number of channels is 1, so we only need to add a layer of meaningless dimensions, which can be encoded as The four-dimensional tensor is used as training data for the two-dimensional convolutional diffusion model. As can be seen, the training data of the pattern is formed in the same way as the password, except that the value space of the elements in the tensor is different.

[0117] In one embodiment, forming a supplementary pattern set of the PCFG based on the obtained password pattern specifically includes the following steps:

[0118] S301: Record the pattern of the command obtained by using the trained two-dimensional convolutional diffusion model as a generation pattern, and repeat the generation process to obtain a generation pattern set;

[0119] S302: removing repeated patterns from the generated pattern set to obtain a deduplicated generated pattern set;

[0120] Specifically, statistics are generated on the total number of patterns in the pattern set and the frequency of occurrence of each pattern, the probability of occurrence of each pattern is calculated, the patterns are arranged from large to small according to their probability, and the files are output to a file in which the patterns are sorted by probability but do not contain the probability.

[0121] S303: performing a difference operation on the generated pattern set after deduplication and the pattern set used in training the two-dimensional convolution diffusion model to obtain a candidate supplementary pattern set;

[0122] Specifically, the generated pattern set file and the training pattern set file are read respectively, and the difference set of the two sets, ie, the candidate supplementary pattern set, is obtained according to the list operation and output to the file.

[0123] S304: Selecting patterns that meet the format requirements of the PCFG pattern from the candidate supplementary pattern set to form the supplementary pattern set.

[0124] Specifically, the candidate supplementary pattern set file is read and a series of judgments are performed on it. For example, there are seven main PCFG patterns, namely A, C, D, K, O, X, and Y, and their corresponding lengths are 1 to 15, 1 to 15, 1 to 15, 4 to 12, 1 to 3, 1, and 1, respectively. The pattern category is followed by the length, and the last character of the pattern must be a number, etc. The patterns that do not meet the above conditions are removed to obtain the final supplementary pattern set.

[0125] In order to verify the effectiveness of the solution of the present invention, the present invention also carried out the following experiments.

[0126] (1) Experimental setup

[0127] In this experiment, the total number of diffusion steps was set to T = 1000, the diffusion control parameter β varied from 0.0001 to 0.02, and the noise estimation network was a U-Net composed of 2D-CNN. Other parameters selected during model training were mainly determined based on experimentation. In this experiment, the batch size was 80, the sampling steps were 20, and the dataset was a set of 12,306 passwords. The ratio of the training set to the test set was 8:2. The changes in the data in the U-Net network during training are shown below. Figure 5 As shown. The input is a 1×16×16 tensor, corresponding to Figure 3 The image format in .

[0128] (2) Result evaluation

[0129] This section compares and analyzes the experimental results with the classic PassGAN model.

[0130] For the generated dictionary, it is collided with the test set to evaluate the performance of TDDGuess. Because the present invention is the first to use 2D-CNN for password training and generation, the object of comparison of the present invention is the classic deep learning model PassGAN using 1D-CNN. This experiment was compared on two data sets, namely the 12306 password set and the pattern set generated by PCFG based on the 12306 password set. According to the data comparison in Table 1, although the collision rate of TDDGuess is slightly lower than that of PassGAN on small-scale data, the collision rate of TDDGuess is significantly better than that of PassGAN on other scale data, which shows that using 2D-CNN for password guessing can achieve the same effect as 1D-CNN. Moreover, the training of TDDGuess has not reached the optimal level, so if there is enough time to obtain the optimal model, the collision rate of TDDGuess will be greatly improved.

[0131] Table 1 12306 password set

[0132]

[0133] Before conducting the experiment shown in Table 2, the present invention first collided the training pattern set generated by PCFG based on the 12306 training set with the test pattern set generated from the 12306 test set. The collision probability reached over 90%, which is one of the reasons why PCFG is so effective in password guessing. Based on this, the present invention considered that increasing the pattern collision probability could achieve the goal of improving the PCFG password collision probability. Therefore, this experiment first trained and generated the training pattern set to obtain a generated pattern set. The generated pattern set was then subtracted from the training pattern set to remove identical patterns and eliminate patterns that did not conform to the pattern format, ultimately obtaining a supplemented pattern set. The test pattern set was then subtracted from the training pattern set to obtain a target pattern set that truly improved the collision rate. Finally, the supplemented pattern set was collided with the target pattern set and the collision probability was calculated. If the collision probability is non-zero, it indicates that the supplemented pattern set contains patterns from the target pattern set. In other words, by adding the supplemented pattern set to the existing PCFG training pattern set, the password dictionary generated by the PCFG can be expanded.

[0134] Table 2 12306 pattern set

[0135]

[0136] Table 2 shows that this experiment generated 1.28 million and 12.8 million pattern sets, respectively. The target pattern set obtained by subtracting the training and test pattern sets contained 41 patterns. TDDGuess generated 1,126 and 5,620 supplementary pattern sets, respectively, with 19 and 29 patterns colliding. PassGAN generated 3,046 and 9,915 supplementary pattern sets, respectively, with 19 and 24 patterns colliding. This demonstrates TDDGuess's superiority on similar datasets and suggests that 2D-CNNs may be effective for targeted password guessing. Previous research has used LSTM to train PCFG patterns. After generating new patterns, instead of reusing PCFG for password generation, a new method, GENPass, achieved excellent results. This suggests that the emergence of new patterns can increase the probability of password collisions. To verify this idea, the present invention conducted the following experiment: First, when using PCFG to generate passwords, passwords corresponding to patterns that do not exist in the pattern set will not be generated. That is to say, if only the newly generated patterns are used to generate passwords and a collision is performed, if a password is collided with, then the password will not be collided with the password generated by the original pattern set. Secondly, in order to simplify the experiment, the 19 newly generated patterns by PassGAN are regarded as uniformly distributed in the experiment, and then constructed into a new pattern set, which is put into PCFG for password generation. Finally, 2 new passwords are obtained by collision from the 100,000 passwords generated using these 19 newly generated pattern sets. That is to say, if these 19 pattern sets are added to the original pattern set and then 100,000 passwords are generated, the collision probability can be increased by at least 0.008%.

[0137] For a password, conventional guessing involves generating a large dictionary and performing a collision search. If a collision is found, the password is guessed; if not, the dictionary must be regenerated. However, if the password's pattern is first guessed, the pattern's complexity is lower than that of the password itself, making it easier to guess. Once the password's pattern is determined, a password dictionary generated from that pattern can be used to perform another collision search. This reduces the complexity of password guessing, narrows the search range, and increases the probability of a collision. Based on this concept, the present invention improves the collision rate of most password guessing models by summarizing patterns from various password guessing models and then using a generative model to generate supplementary patterns.

[0138] Based on the same inventive concept, the present invention also provides two password guessing devices based on a two-dimensional convolution diffusion model, both of which have the same structure. Figure 6 As shown, they all include a model building module, a data preprocessing module, a training module, a reconstruction module and a decoding module.

[0139] In one of the password guessing devices, a model construction module is used to select a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model; a data preprocessing module is used to collect a password set leaked from a target website and encode the password set into multiple grayscale images; a training module is used to set control parameters for the total number of diffusion steps and the degree of diffusion, and use multiple of the grayscale images to train the two-dimensional convolutional diffusion model; a reconstruction module is used to randomly sample from a Gaussian distribution, input the sampled data and the total number of diffusion steps into the trained two-dimensional convolutional diffusion model, and obtain a reconstructed grayscale image; and a decoding module is used to decode the reconstructed grayscale to obtain the corresponding password.

[0140] In another password guessing device, the model construction module is used to select a two-dimensional convolutional neural network as the noise estimation network in the diffusion model to construct a two-dimensional convolutional diffusion model; the data preprocessing module is used to collect a password set leaked from a target website, and use a password guessing model PCFG based on the probabilistic context-free method to generate a pattern set corresponding to the password set, and encode the pattern set into multiple grayscale images; the pattern set refers to a collection of password patterns; the training module is used to set the control parameters of the total number of diffusion steps and the degree of diffusion, and use multiple grayscale images to train the two-dimensional convolutional diffusion model; the reconstruction module is used to randomly sample from a Gaussian distribution, and input the sampled data and the total number of diffusion steps into the trained two-dimensional convolutional diffusion model to obtain a reconstructed grayscale image; the decoding module is used to decode the reconstructed grayscale to obtain the corresponding password pattern.

[0141] It should be noted that the password guessing device provided in the embodiment of the present invention is intended to implement the above-mentioned password guessing methods. The functions can be referred to the above-mentioned method embodiments and will not be described in detail here.

[0142] Figure 7 An example of a physical structure diagram of an electronic device is shown below. Figure 7As shown, the electronic device may include: a processor 701, a communications interface 702, a memory 703, and a communication bus 704, wherein the processor 701, the communications interface 702, and the memory 703 communicate with each other via the communication bus 704. The processor 701 may call logic instructions in the memory 703 to execute a password guessing method based on a two-dimensional convolutional diffusion model, the method comprising: selecting a two-dimensional convolutional neural network as a noise estimation network in the diffusion model to construct a two-dimensional convolutional diffusion model; collecting a set of passwords leaked from a target website and encoding the password set into multiple grayscale images; setting control parameters for the total number of diffusion steps and the degree of diffusion, and training the two-dimensional convolutional diffusion model using the multiple grayscale images; randomly sampling from a Gaussian distribution, inputting the sampled data and the total number of diffusion steps into the trained two-dimensional convolutional diffusion model to obtain a reconstructed grayscale image; and decoding the reconstructed grayscale to obtain the corresponding password. And / or, a two-dimensional convolutional neural network is selected as the noise estimation network in the diffusion model to construct a two-dimensional convolutional diffusion model; a password set leaked from a target website is collected, and a password guessing model PCFG based on a probabilistic context-free method is used to generate a pattern set corresponding to the password set, and the pattern set is encoded into multiple grayscale images; the pattern set refers to a collection of password patterns; control parameters of the total number of diffusion steps and the degree of diffusion are set, and the two-dimensional convolutional diffusion model is trained using multiple grayscale images; random sampling is performed from a Gaussian distribution, and the sampled data and the total number of diffusion steps are input into the trained two-dimensional convolutional diffusion model to obtain a reconstructed grayscale image; the reconstructed grayscale is decoded to obtain the corresponding password pattern; a supplementary pattern set of the PCFG is formed based on the obtained password pattern, and then the PCFG is used to guess the password according to the supplemented pattern set.

[0143] In addition, when the logic instructions in the above-mentioned memory 703 are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0144] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a password guessing method based on a two-dimensional convolution diffusion model provided by the above-mentioned method embodiments.

[0145] An embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements a password guessing method based on a two-dimensional convolution diffusion model provided by the above-mentioned method embodiments.

[0146] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A password guessing method based on a two-dimensional convolution diffusion model, characterized in that: include: A two-dimensional convolutional neural network is selected as the noise estimation network in the diffusion model to construct a two-dimensional convolutional diffusion model; Collecting a password set leaked from a target website, and encoding the password set into a plurality of grayscale images; Setting the total number of diffusion steps and control parameters of the diffusion degree, and using the plurality of grayscale images to train a two-dimensional convolution diffusion model; Randomly sample from the Gaussian distribution, input the sampled data and the total number of diffusion steps into the trained two-dimensional convolution diffusion model to obtain the reconstructed grayscale image; The reconstructed grayscale is decoded to obtain a corresponding password.

2. A password guessing method based on a two-dimensional convolution diffusion model according to claim 1, characterized in that: The step of encoding the password set into a plurality of grayscale images specifically includes: Divide the password set into group; where n is the length of the password to be guessed, and N is the total number of passwords contained in the password set; For each password group, each password is converted into a one-dimensional vector, thereby converting each password group into a grayscale image.

3. The password guessing method based on the two-dimensional convolution diffusion model according to claim 1, characterized in that: The noise estimation network adopts a U-Net network composed of a two-dimensional convolutional neural network.

4. A password guessing method based on a two-dimensional convolution diffusion model, characterized in that: include: A two-dimensional convolutional neural network is selected as the noise estimation network in the diffusion model to construct a two-dimensional convolutional diffusion model; Collecting a set of passwords leaked from a target website, generating a pattern set corresponding to the password set using a probabilistic context-free password guessing model (PCFG), and encoding the pattern set into multiple grayscale images; the pattern set refers to a collection of password patterns; Setting the total number of diffusion steps and control parameters of the diffusion degree, and using the plurality of grayscale images to train a two-dimensional convolution diffusion model; Randomly sample from the Gaussian distribution, input the sampled data and the total number of diffusion steps into the trained two-dimensional convolution diffusion model to obtain the reconstructed grayscale image; Decoding the reconstructed grayscale to obtain a corresponding password pattern; A supplementary pattern set of the PCFG is formed based on the obtained password pattern, and then the PCFG is used to guess the password according to the supplemented pattern set.

5. The password guessing method based on the two-dimensional convolution diffusion model according to claim 4, characterized in that: The pattern based on the obtained password forms the supplementary pattern set of the PCFG, specifically including: The pattern of the command obtained by using the trained two-dimensional convolutional diffusion model is recorded as the generation pattern, and the generation process is repeated to obtain the generation pattern set; Removing repeated patterns from the generated pattern set to obtain a deduplicated generated pattern set; Performing a difference operation on the generated pattern set after deduplication and the pattern set used in training the two-dimensional convolutional diffusion model to obtain a candidate supplementary pattern set; Patterns that meet the format requirements of the PCFG pattern are selected from the candidate supplementary pattern set to form the supplementary pattern set.

6. The password guessing method based on a two-dimensional convolution diffusion model according to claim 4, characterized in that: The noise estimation network adopts a U-Net network composed of a two-dimensional convolutional neural network.

7. A password guessing device based on a two-dimensional convolution diffusion model, characterized in that: include: A model building module, used for selecting a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model; A data preprocessing module, configured to collect a set of passwords leaked from a target website and encode the passwords into a plurality of grayscale images; a training module, configured to set control parameters for the total number of diffusion steps and the degree of diffusion, and to train a two-dimensional convolution diffusion model using a plurality of the grayscale images; The reconstruction module is used to randomly sample from the Gaussian distribution and input the sampled data and the total number of diffusion steps into the trained two-dimensional convolutional diffusion model to obtain a reconstructed grayscale image; The decoding module is used to decode the reconstructed grayscale to obtain a corresponding password.

8. A password guessing device based on a two-dimensional convolution diffusion model, characterized in that: include: A model building module, used for selecting a two-dimensional convolutional neural network as a noise estimation network in a diffusion model to construct a two-dimensional convolutional diffusion model; A data preprocessing module is used to collect password sets leaked from target websites, generate a pattern set corresponding to the password set using a probabilistic context-free password guessing model (PCFG), and encode the pattern set into multiple grayscale images; The pattern set refers to a set of password patterns; a training module, configured to set control parameters for the total number of diffusion steps and the degree of diffusion, and to train a two-dimensional convolution diffusion model using a plurality of the grayscale images; The reconstruction module is used to randomly sample from the Gaussian distribution and input the sampled data and the total number of diffusion steps into the trained two-dimensional convolutional diffusion model to obtain a reconstructed grayscale image; The decoding module is used to decode the reconstructed grayscale to obtain a corresponding password pattern.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.