Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 37 ยท Auxiliary and Scanning

Credential Auditing with Login Scanners

How Metasploit login scanners test credentials in an authorized audit, how the creds database stores results, and how lockout and MFA defeat guessing attacks.

Weak, default and reused passwords are among the most common real-world findings. Metasploit has a family of login scanner modules (*_login) that try credentials against a service and record which ones work. In an authorized audit, they answer a precise question: "does any account on this service still use a default or weak password?"

This lesson explains how the modules work and how results are stored, then turns to the defender's side with a lab-safe simulation. No real account is tested anywhere in the examples.

Guessing passwords on systems you do not own is illegal, can lock real users out, and is the first thing a client will ask about in a scope review. Get written permission, agree on lockout limits and test accounts first.

Login scanner modules

Module Service
auxiliary/scanner/ssh/ssh_login SSH
auxiliary/scanner/ftp/ftp_login FTP
auxiliary/scanner/smb/smb_login SMB
auxiliary/scanner/http/http_login HTTP basic authentication
auxiliary/scanner/mysql/mysql_login MySQL
auxiliary/scanner/postgres/postgres_login PostgreSQL

Common options are USERNAME or USER_FILE, PASSWORD or PASS_FILE, USERPASS_FILE (pairs), STOP_ON_SUCCESS, BRUTEFORCE_SPEED (0 to 5) and DB_ALL_CREDS (try everything already in the database). A careful auditor sets a low speed and uses short, targeted lists: a few vendor defaults and a handful of seasonal passwords, not millions of guesses.

TEXT
msf6 > use auxiliary/scanner/ssh/ssh_login
msf6 auxiliary(scanner/ssh/ssh_login) > set RHOSTS 192.0.2.30
msf6 auxiliary(scanner/ssh/ssh_login) > set USERPASS_FILE lab-defaults.txt
msf6 auxiliary(scanner/ssh/ssh_login) > set BRUTEFORCE_SPEED 2
msf6 auxiliary(scanner/ssh/ssh_login) > run
[-] 192.0.2.30:22 - Failed: 'admin:admin'
[+] 192.0.2.30:22 - Success: 'labuser:Summer2024!'
[*] Command shell session 3 opened (192.0.2.10:42134 -> 192.0.2.30:22)

Success may even open a session, which is why scope matters. Set CreateSession false if you only want a yes/no answer.

The credentials database

Every success is stored. creds lists them, creds -u labuser filters, and creds add user:labuser password:... records one by hand. Later modules can reuse stored credentials with DB_ALL_CREDS true, which is how an assessor shows password reuse across systems.

TEXT
msf6 > creds
Credentials
===========
host        service    public   private      realm  private_type
----        -------    ------   -------      -----  ------------
192.0.2.30  22/tcp(ssh) labuser  <redacted>          Password

Treat the credentials table as highly sensitive: encrypt the workspace, redact values in reports, and delete the data when the engagement ends.

A safe simulation

The stand-in below models a login service with a lockout policy, and an audit that tries a short default list against fake accounts in memory. It shows why lockout limits matter: a naive guesser gets locked out before it finishes.

Python Simulate an audit against a lockout policy

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice what the run reveals for the defender: the weak account was found, while the strong account was locked out after three failures. Lockout stops guessing, but it also locks real users, so the client must be told in advance.

Password spraying versus brute force

Brute force tries many passwords against one account and trips per-account lockouts quickly. Spraying tries one or two very common passwords against many accounts, staying under the limit. Defenders therefore look across accounts. The detector below groups failures by source address.

Python Detect spraying across accounts

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Defence

  • Enforce MFA, especially for administrators and remote access.
  • Rate-limit by account, address and globally; use progressive delays.
  • Ban breached and common passwords; require length over complexity rules.
  • Remove default accounts and change vendor passwords at installation.
  • Alert on failures across many accounts and on successful logins that follow many failures.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a login scanner module do?

    It tests supplied credential pairs and stores those that work.
  2. 2. What does DB_ALL_CREDS true do?

    It reuses stored credentials, which reveals password reuse across systems.
  3. 3. Which is password spraying?

    Spraying stays under per-account lockouts by spreading attempts across accounts.
  4. 4. Why discuss lockout policy before an audit?

    Agree limits with the client so the test does not cause an outage.

Summary

  • *_login modules test credentials; keep lists short and speed low.
  • Results go into the creds table, which must be protected and wiped.
  • Lockout stops guessing but can hurt real users; plan it with the client.
  • Spraying evades per-account lockouts; detect by grouping failures across accounts.
  • MFA, rate limits and banned-password lists are the real defences.

Next: Detecting Metasploit Activity