Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 37 ยท Auxiliary and Scanning

Auxiliary Modules

Learn what Metasploit auxiliary modules are, how they differ from exploits, how to find, configure and run them, and how their output ends up in the database.

Not everything in the Metasploit Framework is an exploit. Auxiliary modules perform tasks that do not deliver a payload: scanning, fingerprinting, fuzzing, brute-force checks, protocol clients and servers, and denial-of-service tests. They are the workhorses of the early phases of an assessment, and the safest place to start learning the console.

This chapter focuses on the auxiliary family. First we cover how they are organized and run; the following lessons look at port scanning, service version detection and credential auditing.

Scanning a network you do not own can be treated as an attack. Use only your own lab or systems named in a written scope.

The auxiliary tree

Auxiliary modules live under auxiliary/ and are grouped by purpose:

Path What lives there
auxiliary/scanner/portscan TCP and SYN port scanners
auxiliary/scanner/http Web server checks (title, headers, directories)
auxiliary/scanner/smb SMB version and share checks
auxiliary/scanner/ssh SSH version and login checks
auxiliary/scanner/discovery Host discovery (ARP, UDP)
auxiliary/server Services the framework offers (capture servers, proxies)
auxiliary/fuzzers Protocol fuzzers
auxiliary/dos Denial-of-service tests (labs only)

The scanner modules share a common design: they take RHOSTS (a range) and a THREADS number, and they run against many hosts in parallel.

Finding and using one

TEXT
msf6 > search type:auxiliary name:http_version
msf6 > use auxiliary/scanner/http/http_version
msf6 auxiliary(scanner/http/http_version) > show options
   Name     Current Setting  Required  Description
   RHOSTS                    yes       The target host(s)
   RPORT    80               yes       The target port
   THREADS  1                yes       The number of concurrent threads
msf6 auxiliary(scanner/http/http_version) > set RHOSTS 192.0.2.0/28
msf6 auxiliary(scanner/http/http_version) > set THREADS 8
msf6 auxiliary(scanner/http/http_version) > run
[+] 192.0.2.5:80 Apache/2.4.58 (Ubuntu)
[*] Scanned 16 of 16 hosts (100% complete)
[*] Auxiliary module execution completed

Notice run (the older exploit keyword also works for exploits, while run is the usual word for auxiliary). The prompt shows the module path so you always know what is loaded.

The RHOSTS option accepts many forms: a single address, a CIDR block (192.0.2.0/28), a range (192.0.2.1-20), a comma list, or a file (file:targets.txt).

Global options and workspaces

Setting RHOSTS for each module is tedious. setg RHOSTS 192.0.2.0/28 sets it globally for the session. Results are written into the database (see Information Gathering): hosts, services and notes hold what scanners found. Use a separate workspace per engagement (workspace -a client-lab) so results do not mix.

flowchart LR
    S["Scanner module"] --> H["hosts table"]
    S --> V["services table"]
    S --> N["notes / vulns tables"]
    H --> R["Report"]
    V --> R
    N --> R

Scanner results flow into the database and then into the report.

Expanding RHOSTS yourself

Understanding RHOSTS helps you plan scans and estimate how long they take. The stand-in below expands CIDR blocks with Python's standard library, as the framework does.

Python Expand an RHOSTS value

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.

Threads and timing

More threads finish faster but are noisier and can overload fragile devices (printers, industrial controllers). A rough time estimate is hosts times ports times per-probe time, divided by threads:

Python Estimate scan time

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.

The defender's view

Scanner modules are loud. Defenders see many connection attempts from one source to many hosts or ports. They can detect it with firewall logs, intrusion detection rules and honeypot addresses that no legitimate user should touch. You will build a detector in Writing Detection Signatures.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. How do auxiliary modules differ from exploit modules?

    Auxiliary modules perform tasks such as scanning and fingerprinting without delivering a payload.
  2. 2. Which value is a valid RHOSTS?

    RHOSTS accepts single addresses, CIDR blocks, ranges, comma lists and file: references.
  3. 3. What does setg RHOSTS ... do?

    setg stores a global value that every module in the console session inherits.
  4. 4. Why use a workspace per engagement?

    Each workspace has its own hosts, services and notes tables.

Summary

  • Auxiliary modules scan, fingerprint, fuzz and serve; they deliver no payload.
  • Scanner modules share RHOSTS and THREADS options.
  • Results land in the database, organised by workspace.
  • More threads are faster but noisier and riskier for fragile devices.
  • Scanning is easily detected, and only legal with authorization.

Next: Port Scanning with Auxiliary Modules