Searching for Modules
Overview
One of the most critical skills in the OSCP exam is quickly finding the right exploit module for a given target. Metasploit Framework contains thousands of modules, and knowing how to efficiently search, filter, and identify the correct module can save valuable time during an exam. This guide covers everything you need to know about searching within Metasploit and using external tools like searchsploit.
1. The search Command
Basic Syntax
The search command is the primary way to find modules within msfconsole. It performs a case-insensitive search across multiple fields of every module in the framework.
search <keyword>
How Search Matches
When you run search <keyword>, Metasploit searches across the following fields:
- Module name — The short name of the module (e.g.,
smb_ms17_010) - Module path — The full path in the module tree (e.g.,
exploit/windows/smb/smb_ms17_010) - Module description — The text description of what the module does
- Module references — URLs, CVEs, and other references associated with the module
- Module tags — Tags like
post_exploit,intrusive,exploit, etc.
The search is case-insensitive and returns partial matches. This means searching for smb will return all modules that contain “smb” anywhere in the above fields.
Result Columns Explained
The search command returns results in a tabular format with the following columns:
| Column | Description | Example |
|---|---|---|
| Matching | Whether the match is exact or partial | exp, tpl, aux, pos, evasion, nop, payload, enc |
| # | Sequential result number | 0, 1, 2, … |
| Name | Full module path | exploit/windows/smb/smb_ms17_010 |
| Disclosure Date | Date the vulnerability was publicly disclosed | 2017-03-14 |
| Rank | Module reliability ranking | Great, Normal, Average, Manual |
| CVE | Associated CVE identifier(s) | CVE-2017-0144 |
| Description | Brief description of the module | MS17-010 EternalRomance/EternalSynergy/EternalChampion |
Module Type Indicators
The “Matching” column uses abbreviations to indicate module type:
| Abbreviation | Module Type | Description |
|---|---|---|
exploit |
Exploit | Active exploitation modules |
aux |
Auxiliary | Scanning, brute force, dos modules |
post |
Post | Post-exploitation modules |
payload |
Payload | Shellcode/stagers delivered after exploitation |
evasion |
Evasion | Modules to bypass security controls |
enc |
Encoder | Payload encoding modules |
nop |
NOP Generator | NOP sled generators |
Rank Values
The Rank column indicates how reliable a module is expected to be:
| Rank | Meaning |
|---|---|
| Great | Highly reliable, works consistently across many targets |
| Normal | Generally reliable, may have edge cases |
| Average | Works sometimes, may require tuning |
| Manual | Requires manual verification; reliability unknown |
OSCP Tip: Prioritize modules ranked
GreatorNormalduring the exam.Manualrank modules may work but often require additional research and tuning.
2. Search Filters
Metasploit supports powerful search filters that let you narrow results by specific criteria. Filters use the filter: syntax and can be combined.
Available Filters
| Filter | Description | Example |
|---|---|---|
type: |
Filter by module type | type:exploit, type:auxiliary, type:post |
platform: |
Filter by target platform | platform:windows, platform:linux |
service: |
Filter by service name | service:smb, service:ssh |
name: |
Filter by module name (substring match) | name:ms17_010 |
author: |
Filter by module author | author:bhdresh |
app: |
Filter by application name | app:apache, app:iis |
Filter Examples
Filter by Type
# Find all exploit modules related to SMB
search smb type:exploit
# Find all auxiliary (scanning/brute force) modules for SSH
search ssh type:auxiliary
# Find all post-exploitation modules for Linux
search linux type:post
Filter by Platform
# Find Windows SMB exploits
search smb platform:windows
# Find Linux kernel exploits
search kernel platform:linux
Filter by Name
# Find modules with "ms17" in the name
search name:ms17
# Find modules with "eternal" in the name
search name:eternal
Filter by Author
# Find all modules by a specific author
search author:bhdresh
Filter by Application
# Find Apache-related modules
search app:apache
# Find IIS-related modules
search app:iis
Combined Filters
You can combine multiple filters for precise results:
# Windows SMB exploits only
search smb type:exploit platform:windows
# Linux post-exploitation privilege escalation
search privesc type:post platform:linux
# Apache web server exploits
search apache type:exploit app:apache
Getting Module Details
After finding a module with search, use use followed by the module path or number to load it, then show options to see its configuration:
search smb_ms17_010
use 0
show options
show targets
info
The info command provides the most comprehensive module details, including full description, authors, references, and known vulnerabilities.
3. Practical Search Examples for OSCP
Below are the most common search patterns you will encounter during the OSCP exam.
Finding SMB Exploits
SMB is one of the most frequently exploited services on OSCP targets.
# Search for all SMB-related modules
search smb
# Narrow down to exploit modules only
search smb type:exploit
# Search for specific SMB vulnerabilities
search ms17_010
search ms08_067
search bluekeep
search zerologon
search samr
# Search for EternalBlue specifically
search eternalblue
Finding Linux Post-Exploitation Modules
After gaining initial access on a Linux machine, you’ll need post-exploitation modules.
# All Linux post modules
search linux type:post
# Privilege escalation on Linux
search privesc type:post platform:linux
search linux_exploit_suggester
search kernel_exploit
# Enumerate system information
search sysinfo type:post
search getuid type:post
# Credential harvesting on Linux
search hashdump type:post
search credentials type:post platform:linux
SSH Brute Force
# Find SSH auxiliary modules
search ssh type:auxiliary
# Specifically find the SSH login scanner
search ssh_login
# Load and configure
use auxiliary/scanner/ssh/ssh_login
show options
Meterpreter Payloads
# Search for Meterpreter payloads
search meterpreter
# Reverse TCP Meterpreter
search meterpreter_reverse_tcp
# Reverse HTTPS Meterpreter (for evading basic firewalls)
search meterpreter_reverse_https
# Meterpreter via DNS (for restricted networks)
search meterpreter_reverse_dns
Privilege Escalation Modules
# Windows privilege escalation
search privesc type:post platform:windows
search win_priv
search bypass_uac
search getsystem
# Linux privilege escalation
search privesc type:post platform:linux
search linux_priv
search linux_exploit_suggester
CVE-Specific Modules
# Search by CVE number
search CVE-2017-0144
search CVE-2019-0708
search CVE-2021-44228
# Search by MS bulletin
search ms17_010
search ms08_067
search ms14_068
Web Exploits
# Search for web application exploits
search type:exploit app:apache
search type:exploit app:tomcat
search type:exploit app:jboss
search type:exploit app:struts
# Specific web exploits common in OSCP
search jenkins
search weblogic
search coldfusion
search phpmyadmin
search django
search rails
4. searchsploit External Tool
What Is searchsploit?
searchsploit is a command-line tool that searches the Exploit-DB database locally. Exploit-DB is maintained by Offensive Security (the same organization behind OSCP) and contains thousands of publicly disclosed exploits, shellcode, and vulnerable application proofs-of-concept.
Key distinction: searchsploit is NOT part of Metasploit. It is a standalone tool that ships with Kali Linux and searches a local copy of the Exploit-DB database. The Metasploit search command searches Metasploit’s own module database. While there is overlap (many Metasploit modules are based on Exploit-DB exploits), the two databases are different.
Exploit-DB Relationship
- Exploit-DB is available online at
https://www.exploit-db.com searchsploitmaintains a local mirror of this database- Update your local database regularly:
searchsploit -u - Metasploit modules often wrap Exploit-DB exploits with additional functionality
Basic Syntax
searchsploit <keyword>
Common Flags
| Flag | Description | Example |
|---|---|---|
-m |
Copy the exploit to the current directory | searchsploit -m 45010 |
-t |
Display results as a text table (no colors) | searchsploit -t smb |
-w |
Wildcard search (searches Exploit-DB online) | searchsploit -w "exchange remote code execution" |
-p |
Print only the file path | searchsploit -p ms17-010 |
-j |
Output in JSON format | searchsploit -j smb |
-m |
Mirror (copy) the exploit file locally | searchsploit -m 45010.py |
-u |
Update the local Exploit-DB database | searchsploit -u |
-x |
Open the exploit file in the default text editor | searchsploit -x 45010 |
Practical searchsploit Examples
# Basic search
searchsploit ms17-010
searchsploit samba
searchsploit apache 2.4.49
# Copy exploit to current directory for use
searchsploit -m 45010
searchsploit -m 14894
# Wildcard search (searches online Exploit-DB)
searchsploit -w "exchange rce"
searchsploit -w "tomcat manager authentication bypass"
# Update local database
searchsploit -u
# View exploit in editor
searchsploit -x 45010
searchsploit vs. Metasploit search
| Feature | searchsploit |
Metasploit search |
|---|---|---|
| Database | Exploit-DB (raw exploits, PoCs) | Metasploit modules (structured, tested) |
| Format | Raw source code (Python, C, Ruby, etc.) | Structured Ruby modules with options |
| Usability | May require manual modification | Ready to use with set and exploit |
| Coverage | Broader (includes non-Metasploit exploits) | Subset (only exploits with MSF modules) |
| Update | searchsploit -u |
msfupdate or framework console |
| Best for | When no MSF module exists | First choice during OSCP exam |
| Execution | Run directly (Python, etc.) | Requires msfconsole |
When to Use Each
Use Metasploit search when:
- A Metasploit module exists for the vulnerability (check first!)
- You want a reliable, well-tested exploit with built-in payload options
- You need Meterpreter sessions or advanced post-exploitation
- You are under time pressure during the exam
Use searchsploit when:
- No Metasploit module exists for the vulnerability
- You need a proof-of-concept exploit that hasn’t been wrapped in Metasploit
- You want to read the raw exploit code to understand the vulnerability
- The Metasploit module is unreliable or missing
- You need to modify the exploit for a specific target
5. Search Strategies for OSCP Exam
Quick Module Finding Under Time Pressure
During the OSCP exam, time is your most valuable resource. Follow this systematic approach:
Step 1: Identify the Target Information
Before searching, gather key information:
- Operating system (Windows/Linux, version)
- Service name and version (from Nmap)
- Vulnerability/CVE (if known)
Step 2: Search in Metasploit First
# Start with the most specific search
search <service> <version>
# Example: Apache 2.4.49 on Linux
search apache 2.4.49
# If too specific, broaden the search
search apache type:exploit
Step 3: Filter and Evaluate Results
# Filter to exploit type
search <keyword> type:exploit
# Check the Rank column - prefer "Great" and "Normal"
# Check the Disclosure Date - newer may be more relevant
Step 4: Verify the Module
use <module_path>
show options # Check required options
show targets # Verify your target is supported
info # Read full description and references
Step 5: Fall Back to searchsploit
If no suitable Metasploit module exists:
searchsploit <keyword>
searchsploit -m <exploit_number>
# Review and potentially modify the exploit
python3 <exploit_file>.py
Keyword Strategies
| Target Info | Search Keywords |
|---|---|
| SMB v1, Windows | smb, ms17_010, eternalblue, ms08_067 |
| Apache, specific version | apache <version>, httpd |
| Tomcat | tomcat, manager, ajp |
| SSH brute force | ssh_login, ssh |
| MySQL | mysql, udf, mysql_auth |
| Jenkins | jenkins, script, groovy |
| Exchange | exchange, proxylogon, proxyshell |
| Linux kernel | linux kernel, <kernel_version> |
| Windows privesc | privesc, ms<bulletin>, sedebug |
Filtering Results Effectively
# Narrow by type first, then keyword
search type:exploit <keyword>
# Combine platform and service
search <service> platform:<os> type:exploit
# Use name filter for exact module matching
search name:<partial_name>
Verifying Module Reliability
Before committing to an exploit during the exam:
- Check the Rank —
Great>Normal>Average>Manual - Read the Description — Does it match your target exactly?
- Check
show targets— Is your specific OS/version listed? - Check References — Look at CVE links and original advisories
- Set a Time Limit — If an exploit isn’t working after 5-10 minutes of configuration, move on and try the next one
6. Common Search Pitfalls
Pitfall 1: Searching Too Broadly
# BAD: Returns hundreds of results
search windows
# GOOD: Specific and actionable
search smb_ms17_010
search ms17_010 type:exploit platform:windows
Lesson: Always narrow your search with filters. A broad search wastes time sifting through irrelevant results.
Pitfall 2: Ignoring the Rank Column
A module ranked Manual may not work reliably. Always check the rank before investing time in configuration.
# Check rank before using
search <keyword>
# Look at the Rank column in results
Pitfall 3: Not Checking show targets
Many exploits support multiple targets. If you don’t select the correct target, the exploit will fail.
use exploit/windows/smb/smb_ms17_010
show targets
set TARGET <number>
Pitfall 4: Confusing searchsploit with Metasploit Search
searchsploit searches Exploit-DB, not Metasploit modules. A result from searchsploit gives you raw exploit code, not a Metasploit module. You cannot use a searchsploit result inside msfconsole.
Pitfall 5: Not Updating Databases
Both databases need regular updates to include the latest exploits:
# Update Metasploit
msfupdate
# Update Exploit-DB
searchsploit -u
Pitfall 6: Overlooking Auxiliary Modules
Not every attack requires an exploit module. Auxiliary modules can be just as effective:
# Brute force credentials
search ssh_login type:auxiliary
# Scan for vulnerable services
search scanner type:auxiliary
# Denial of service (use carefully on exam!)
search dos type:auxiliary
Pitfall 7: Not Reading the Module Info
Always read the full module information before using it:
use <module>
info # Full details
show options # Required and optional parameters
show targets # Supported targets
show payloads # Compatible payloads
Skipping this step leads to misconfigured exploits and wasted time.
Quick Reference Cheat Sheet
Metasploit Search Commands
search <keyword> # Basic search
search <keyword> type:exploit # Filter by type
search <keyword> platform:windows # Filter by platform
search <keyword> app:apache # Filter by application
search name:<partial> # Name filter
search <kw1> <kw2> # Multiple keywords
searchsploit Commands
searchsploit <keyword> # Basic search
searchsploit -m <number> # Copy exploit locally
searchsploit -x <number> # Open in editor
searchsploit -w "<query>" # Wildcard online search
searchsploit -u # Update database
OSCP Search Workflow
1. Nmap → Identify service and version
2. search <service> <version> type:exploit
3. Evaluate Rank, targets, and description
4. use <module> → show options → configure → exploit
5. If fails → try next module or searchsploit
6. If no MSF module → searchsploit -m <number>
Summary
Mastering Metasploit search is fundamental to OSCP success. The key takeaways are:
- Always start with Metasploit’s
searchcommand — it provides structured, tested modules - Use filters (
type:,platform:,name:) to narrow results quickly - Check the Rank column — prioritize
GreatandNormalmodules - Always run
show targetsandshow optionsbefore exploiting - Fall back to
searchsploitwhen no Metasploit module exists - Keep both databases updated for the latest exploits
- Set a time limit — if an exploit isn’t working after 5-10 minutes, move on
Practice these search patterns before the exam so they become second nature. The faster you can find and configure the right module, the more time you have for post-exploitation and documentation.