Перейти к основному содержимому
Credential Reuse, Spraying Limits & Service Misconfigs
Урок 21 из 26

Credential Reuse, Spraying Limits & Service Misconfigs

Learn how credential reuse and service misconfigurations lead to initial access, how to run lockout-safe password sprays and offline hash or key cracking in a lab, and how defenders detect and prevent both.

Продвинутый 26 мин Пентест
Этого урока пока нет на выбранном языке — показана версия на другом языке. Перевод готовится.
Только в разрешённой среде — Описанные здесь приёмы применяются только в учебных лабораториях и в системах, которые принадлежат вам или на которые есть письменное разрешение.

Цели обучения

  • Explain the difference between brute-force guessing, credential stuffing, and lockout-safe password spraying
  • Enumerate account lockout thresholds before testing credentials so authorised assessments do not disrupt users
  • Recover weak passphrases from captured hashes or encrypted SSH keys offline using John the Ripper and Hashcat
  • Identify and remediate common service misconfigurations such as default credentials, exposed shares, and lax key permissions

Рекомендуется заранее: Методология пентеста, правила взаимодействия (RoE) и этикаPort Scanning & Deep Service Enumeration (HTTP, SMB, SSH, SNMP)Exploitation Basics, Payloads & Reverse/Bind Shells

#Why this matters

Memory-corruption bugs make headlines, yet many real intrusions begin with valid credentials or an exposed service configuration. Users reuse passwords across personal sites and work portals, teams copy SSH keys between staging and production, and internal dashboards often keep default logins after deployment.

Once reconnaissance and enumeration uncover SMB, SSH, or admin panels, controlled credential and configuration testing checks whether weak authentication provides an initial foothold without touching unstable exploits.

#Credential attacks: reuse, stuffing, and spraying

Online credential attacks differ in how they distribute guesses across accounts and passwords. Choosing the wrong pattern either reveals nothing or locks out legitimate users.

Technique Target pattern Lockout risk Primary defensive signal
Brute-force guessing Many passwords against one account Very high Rapid failures on a single username
Credential stuffing Leaked username-password pairs replayed Medium Failures or logins from unusual IPs using breach data
Password spraying One password across many accounts per window Low if paced Single source failing once across many usernames

Credential reuse occurs when the same secret protects multiple systems. If a tester finds a database password in a readable config file in scope, testing it against SSH or admin portals on neighbouring lab hosts checks whether blast radius is isolated. Credential stuffing replays known username-password pairs from prior breaches against another login endpoint.

Password spraying reverses traditional brute force. Instead of hammering one user with thousands of guesses, a tester tries one likely password (such as a seasonal pattern meeting complexity rules) across a list of accounts, then waits for the reset window before trying a second candidate.

Lockout-safe password sprayLockout-safe password sprayTesterTargetTry PasswordA for user1Failure (user1 counter = 1)Try PasswordA for user2Failure (user2 counter = 1)Try PasswordA for user3Success (user3 logged in)Each account sees at most one failure inside the window

#Respecting spraying limits and lockout policies

Before sending guesses in an authorised test, verify the account lockout rules. Two settings govern safe pacing:

  • Account lockout threshold: failed attempts allowed before an account locks (for example, 5; 0 means no automatic lockout).
  • Reset window: minutes that must pass before the failure counter resets to zero.

Leave headroom for normal user typos. If the threshold is 5, sending 4 guesses per account leaves almost no margin. A safer rule is 1 attempt per account per full reset window, logged with timestamps so defenders can distinguish test traffic from real threats. Check nxc smb --help for protocol-specific options before testing other services.

Checking lockout policy and running one controlled spray in lab.local
$ nxc smb 10.10.10.20 -u svc_audit -p 'LabAudit2026!' --pass-pol
SMB         10.10.10.20     445    DC01             [*] Dumping password info for domain: LAB
SMB         10.10.10.20     445    DC01             Minimum password length: 8
SMB         10.10.10.20     445    DC01             Account Lockout Threshold: 5
SMB         10.10.10.20     445    DC01             Reset Account Lockout Counter: 30
$ nxc smb 10.10.10.20 -u users.txt -p 'Autumn2026!'
SMB         10.10.10.20     445    DC01             [-] lab.local\a.ali:Autumn2026! STATUS_LOGON_FAILURE
SMB         10.10.10.20     445    DC01             [-] lab.local\d.sulton:Autumn2026! STATUS_LOGON_FAILURE
SMB         10.10.10.20     445    DC01             [+] lab.local\m.karimov:Autumn2026!

Once a valid pair succeeds, stop spraying that account immediately and document it. Also check whether MFA blocks interactive access even when the password is right.

#Offline cracking of hashes and SSH keys

Online guessing is slow and noisy because every attempt crosses the network and increments failure counters. Offline cracking removes both limits: once an authorised tester recovers a password hash or encrypted private key in scope, guesses run locally at hardware speed with zero network traffic.

Hash algorithm choice sets the attacker's cost. Fast digests such as NTLM (Hashcat mode 1000) or raw SHA-256 allow billions of guesses per second on GPUs, whereas memory-hard functions such as Argon2id or high-cost bcrypt slow each guess dramatically.

Encrypted SSH keys (id_rsa, id_ed25519) are another offline target. Instead of brute-forcing SSH over port 22, convert the key with ssh2john, crack it locally with John the Ripper or Hashcat, and log in once with the recovered passphrase.

Extracting an SSH key passphrase and cracking NTLM hashes offline
$ ssh2john dev_id_rsa > dev_id_rsa.hash
$ john --wordlist=/usr/share/wordlists/rockyou.txt dev_id_rsa.hash
Using default input encoding: UTF-8
Loaded 1 password hash (SSH, SSH private key [RSA/DSA/EC/OPENSSH 32/64])
summer2024       (dev_id_rsa)
1g 0:00:00:01 DONE (2026-11-19 05:40) 0.8928g/s 14200p/s 14200c/s 14200C/s
$ hashcat -m 1000 -a 0 ntlm.hashes /usr/share/wordlists/rockyou.txt

Here -m 1000 selects NTLM hashes and -a 0 runs a straight dictionary attack; check hashcat --help for other modes and rule files (-r).

#Service misconfigurations that hand over access

Strong passwords cannot protect a host if surrounding services expose secrets or skip authentication:

Misconfiguration Safe verification Remediation
Default vendor logins Test documented default once on in-scope UI Set unique admin passwords at install
Open SMB, FTP, or NFS shares List shares with nxc smb ... --shares Apply least-privilege ACLs; remove secrets
Lax key or config permissions Inspect modes (0644 vs 0600) on .ssh/ Restrict private keys to 0600
Unauthenticated admin ports Check dashboards, Redis, or Docker APIs Bind to localhost or VPN with auth
Shared SSH keys across tiers Check staging keys in prod authorized_keys Issue unique keys per tier and rotate

#Defending and common mistakes

Common tester mistakes include spraying before checking lockout rules, running user=password checks on top of earlier sprays, and leaving recovered keys on shared jump hosts.

Defenders should combine preventive hygiene with spray-aware detection:

  • Enforce phishing-resistant MFA (FIDO2/WebAuthn) on remote access and admin portals; if push prompts remain in use, enable number matching to stop MFA fatigue.
  • Screen against breached passwords: per NIST SP 800-63B, block known-compromised passwords instead of forcing periodic rotations that push users into predictable SeasonYear! patterns.
  • Harden hashes, keys, and shares: store passwords with Argon2id or bcrypt, keep private keys at 0600, remove secrets from shares, and separate staging keys from production.
  • Detect sprays without lockouts: alert in your SIEM when one source IP triggers Windows Event ID 4625 or Linux sshd Failed password entries across many usernames in a short window, even if Event ID 4740 (lockout) never fires.

#Summary

  • Credential reuse, stuffing, and spraying exploit human and operational habits rather than software memory bugs.
  • Check lockout thresholds and reset windows before any online spray, and stay well below the limit to prevent disabling accounts.
  • Offline cracking with ssh2john, John the Ripper, and Hashcat tests captured hashes and encrypted keys locally with no lockout risk.
  • Restricting shares, removing default logins, enforcing 0600 key permissions, requiring phishing-resistant MFA, and alerting on cross-account failures close both credential and configuration paths.

Проверка знаний

Войдите, чтобы проходить тест, завершать уроки и сохранять прогресс. Войти в систему

Практика: проверьте свои знания