After the nmap scan: from open port to the right exploit
Updated November 11, 2026. Author: Manuel, security engineer.
After an nmap scan, the next step is not to look for an exploit, it is to verify. An open port with a detected version is a hypothesis, not a confirmed vulnerability. The workflow that holds up under review is this: read the version results carefully, cross-check the nmap XML against Exploit-DB using searchsploit, rule out the false positives, and only then, within the scope authorized in writing, take the case to Metasploit. Treating the nmap output as a list of ready-to-run exploits is the fastest way to waste time on matches that do not hold up.
This guide is written for pentesters who have already scanned and want to reach the right exploit without drowning in false positives. Written by Manuel, founder of NODO. You can see how we approach scope and authorization on our ethics page. Everything that follows applies only to systems you have express written authorization to test.
What does the version scan actually tell me?
Port scanning only suggests a service based on the port number. Version detection, enabled with the -sV option, connects to each open port and determines the application name and its version number where available. According to the Nmap version detection reference guide, this lets you assess what is actually running on the host, not just which port numbers are open.
The key point is a warning from Nmap itself: you cannot rely on the version number alone to conclude that a service is vulnerable, because vendors backport patches. A version that a CVE listing marks as vulnerable may already have the flaw fixed in the distribution's build. That is why the version number opens the investigation, it does not close it.
Before searching for anything, read the entire nmap table. Note the state of each port, the application, the version, and whatever appears in parentheses in the version column, which usually indicates the distribution or a build detail. That parenthesis is often what distinguishes a real hit from a backported one.
How do I search for exploits with searchsploit from the nmap XML?
First, save the scan as XML. A scan with version detection and XML output gives you the file that searchsploit can read. Then cross-check that file against the local Exploit-DB database. According to the official searchsploit reference, these are the options that matter at this point in the workflow:
--nmap [file.xml]checks the services in the Nmap XML against Exploit-DB versions. It is how you turn the scan into a list of candidates in one pass.--cve [CVE]searches the database for a specific CVE identifier and shows you the published exploit code.-x,--examine [EDB-ID]opens the exploit in the pager so you can read it before touching it.-m,--mirror [EDB-ID]copies the exploit to the current directory.-u,--updateupdates the local Exploit-DB database. If you do not update it, you cross-check against an outdated catalog.
The --nmap option gives you volume of candidates, but it is noisy: it matches by version and knows nothing about your host. The --cve option is more precise when you already have an identifier you want to confirm. Use the first to open up the field and the second to narrow it down on a single case.
How do I rule out a false positive before launching anything?
This is where a defensible report is separated from a list of hits. Each candidate goes through a verification funnel before you consider it exploitable. The table below maps what you see in nmap to the concrete next step.
| Nmap result | What it means | Next verification step |
|---|---|---|
open port with exact application and version | Strongest hypothesis, but the version may carry a backported patch | Read the distribution parenthesis. Compare the version with the vendor advisory before searching for the exploit |
| Version with distribution detail in parentheses | The vendor may have fixed the flaw without changing the version number | Check the package changelog of that distribution for that CVE. If it is patched, discard it |
open|filtered port | Nmap cannot confirm whether it is open. A filter or firewall may be in between | Rescan the port in a targeted way. Do not look for an exploit until you confirm it is open |
open port without version or with a generic service | There is no version to cross-check. A version-based exploit does not apply | Probe the service manually to obtain a version before continuing |
| Hit from an NSE script in the vuln category | It is a signal, not proof. The script infers, it does not exploit | Read the exploit with --examine and confirm that the conditions it requires match your host |
The rule that summarizes the table: a candidate only stops being a false positive when you have confirmed that the version does not carry the patch and that the conditions the exploit requires are present on the host. Until then, it is a line in your notebook, not a command you run.
When do I import the scan into Metasploit?
When you have verified candidates and want to work through them in order, not before. Metasploit stores hosts, services and findings in a database, which gives you traceability for the case. According to the OffSec Metasploit Unleashed documentation, you have two ways to populate that database:
db_nmapruns nmap from inside msfconsole and records the output automatically, with no import step.db_importloads a scan results file, detecting the file type. It is the route when you already scanned outside Metasploit and saved the XML.
Once loaded, the hosts and services commands let you review what is stored without scanning again. From there you select the module and configure the target. Order matters: importing a dirty scan fills the database with services you are not going to touch, so import the scan already filtered through the verification funnel, not the raw dump.
What must I confirm about scope and authorization before exploiting?
Technical verification does not replace authorization. Before launching an exploit, confirm these four things and record them in the case:
- The target host is within the scope defined in writing in the engagement. An IP that responded to the scan but is not listed in the scope is out of bounds.
- The authorized testing window is in effect. Outside it, you do not exploit.
- The action is permitted. Some scopes authorize discovery and verification but exclude active exploitation or denial of service.
- You know who to notify if something breaks. A client contact and an agreed stop procedure.
We work with deny-by-default scope: whatever is not expressly authorized is blocked. A scan that touches a host outside scope, or an exploit launched outside the window, is not a finding, it is an incident that you caused. Written authorization is what separates a pentest from unauthorized access, and that is not decided by the quality of your technical verification.
Frequently asked questions
Can I pass the nmap XML directly to searchsploit?
Yes. The --nmap option of searchsploit reads the Nmap XML file and compares the services and versions it contains with Exploit-DB versions. Save the scan with version detection as XML and pass it with that option. The result is a list of candidates by version, which you still need to verify one by one.
Are nmap vuln scripts reliable?
They are a useful signal, not proof. A hit from an NSE script in the vuln category infers the vulnerability from the service's response, it does not exploit it. Read it as a candidate that enters the verification funnel, confirm it against the actual version and the vendor advisory, and remember that the version number may carry a backported patch.
What do I do if there are several candidate versions?
Probe the service manually to pin down the exact version before searching for exploits, and read the distribution detail that nmap shows in parentheses. If several remain, treat each one as a separate hypothesis and verify the most likely first, launching nothing until the doubt is resolved.
How do I verify that the exploit worked?
Confirm the concrete effect you expected, not just that the module finished without error. Depending on the target, that is an open session, a command that returns the identity or the host name, or the specific condition the exploit was supposed to trigger. Record the proof in the case, because a pentest report stands on what you can demonstrate.
If you want the step from scan to exploit to be organized by CVE with verification built in, you can try GRIMZ, the pentest console for Linux that runs nmap, builds the host map and sorts exploits by CVE before opening Metasploit.