PassGAN: A Deep Learning Approach for Password Guessing

Briland Hitaj, Paolo Gasti, Giuseppe Ateniese, Fernando Pérez-CruzACNS 2017 · OpenReview

Abstract

State-of-the-art password guessing tools, such as HashCat and John the Ripper, enable users to check billions of passwords per second against password hashes. In addition to performing straightforward dictionary attacks, these tools can expand password dictionaries using password generation rules, such as concatenation of words and leet speak. Although these rules work well in practice, creating and expanding them to model further passwords is a labor-intensive task that requires specialized expertise. To address this issue, we introduce PassGAN, a novel approach that replaces human-generated password rules with theory-grounded machine learning algorithms. Instead of relying on manual password analysis, PassGAN uses a Generative Adversarial Network (GAN) to autonomously learn the distribution of real passwords from actual password leaks and generate high-quality password guesses. Our experiments show that PassGAN can surpass rule-based and state-of-the-art machine learning password guessing tools without any a-priori knowledge of common password structures. Additionally, when combined with HashCat, PassGAN matched 51%–73% more passwords than HashCat alone, demonstrating its ability to extract properties that current state-of-the-art rules do not encode.

Introduction

Password cracking has traditionally relied on two pillars: dictionary attacks and rule-based mangling. Tools like HashCat and John the Ripper use expert-crafted rules to transform common words (e.g., changing "password" to "P@ssw0rd123"). While effective, these rules are limited by human intuition and require significant manual effort to update as user habits evolve. On the statistical side, Markov models have been used to predict character sequences, but they are often constrained by "n-gram" limitations—they only look at a small window of characters at a time, missing broader structural patterns. PassGAN seeks to overcome these limitations by autonomously learning complex, non-linear structures of human-generated passwords without manual rule-setting.

Methodology

The PassGAN architecture utilizes an Improved Wasserstein GAN (IWGAN). GANs consist of two neural networks locked in a competitive process:

  1. The Generator (G): Takes random noise as input and attempts to create "fake" passwords that mimic the distribution of real ones.
  2. The Discriminator (D): Analyzes both real passwords from a leak and the "fake" ones from the Generator, trying to distinguish between them.

Both the Generator and Discriminator utilize five residual layers (ResNets). This architecture allows for deeper networks by using "shortcut connections," which help prevent the vanishing gradient problem and allow the model to capture more complex features. Unlike models that look at words, PassGAN operates at the character level, allowing it to learn everything from common suffixes to complex "leet speak" substitutions.

PassGAN Generator and Discriminator Architectures

Experimental Setup and Datasets

The study primarily utilizes two massive, real-world datasets:

  • RockYou: A 2009 leak containing over 32 million passwords. A subset (length ≤ 10) was used for training (80%) and testing (20%).
  • LinkedIn: A leak containing over 43 million unique passwords, used as a cross-domain test set to evaluate the model's ability to generalize to different user bases.

Results and Performance Analysis

PassGAN matched 34.2% of the passwords in the RockYou test set. Crucially, it outperformed state-of-the-art Markov models and Probabilistic Context-Free Grammars (PCFGs) when given a sufficient number of attempts. On the LinkedIn dataset, PassGAN also matched 34.2% of unique passwords, proving it was not merely memorizing the training set but learning universal human patterns in password construction.

Comparison of PassGAN with traditional password guessing approaches

One of the most significant findings was the synergy between PassGAN and traditional tools. Combining PassGAN's output with HashCat's Best64 rules allowed researchers to crack 48% of the RockYou test set, a massive jump over using either tool in isolation. This suggests that PassGAN captures a different subset of the password space than human-written rules.

Discussion and Future Work

PassGAN excels as a "long game" tool. While traditional rule-based tools are faster at prioritizing the most obvious patterns (fewer than $10^6$ guesses), PassGAN's performance scales better as the number of attempts grows. However, the GAN's density estimation is most accurate for high-frequency passwords; as passwords become rarer and more complex, the quality of guesses begins to deteriorate.

Future research directions include moving toward Conditional GANs, which could allow attackers to feed the model "hints" (like a user's pet name) to generate targeted guesses. Additionally, PassGAN could be used defensively to generate "Honeywords"—decoy passwords that are indistinguishable from real ones to help detect database breaches.

Summary updated

Abstract

State-of-the-art password guessing tools, such as HashCat and John the Ripper, enable users to check billions of passwords per second against password hashes. In addition to performing straightforward dictionary attacks, these tools can expand password dictionaries using password generation rules, such as concatenation of words (e.g., "password123456") and leet speak (e.g., "password" becomes "p4s5w0rd"). Although these rules work well in practice, expanding them to model further passwords is a laborious task that requires specialized expertise. To address this issue, in this paper we introduce PassGAN, a novel approach that replaces human-generated password rules with theory-grounded machine learning algorithms. Instead of relying on manual password analysis, PassGAN uses a Generative Adversarial Network (GAN) to autonomously learn the distribution of real passwords from actual password leaks, and to generate high-quality password guesses. Our experiments show that this approach is very promising. When we evaluated PassGAN on two large password datasets, we were able to surpass rule-based and state-of-the-art machine learning password guessing tools. However, in contrast with the other tools, PassGAN achieved this result without any a-priori knowledge on passwords or common password structures. Additionally, when we combined the output of PassGAN with the output of HashCat, we were able to match 51%-73% more passwords than with HashCat alone. This is remarkable, because it shows that PassGAN can autonomously extract a considerable number of password properties that current state-of-the art rules do not encode.
BibTeX
@inproceedings{hitaj2017passgan,
  author = {Briland Hitaj and Paolo Gasti and Giuseppe Ateniese and Fernando Pérez-Cruz},
  title = {{PassGAN: A Deep Learning Approach for Password Guessing}},
  booktitle = {ACNS},
  year = {2017},
  url = {https://openreview.net/forum?id=0lnl4iW-jt},
}
Figure