
CVEScannerV2 is an Nmap NSE script that enriches version detection with HTTP fingerprints and safe probes, then matches services against a local NVD database for authorized vulnerability assessment.
| Tool | scmanjarrez/CVEScannerV2 — Nmap NSE script that maps discovered services to probable CVEs via a local SQLite NVD database |
| Category | Vulnerability identification / Nmap NSE service enrichment |
| Primary Use | Post-discovery CVE correlation during authorized scans, turning nmap -sV output into scored CVE matches with confidence levels |
| Safe Use | Intended for authorized penetration tests, internal security audits, and defensive attack-surface reviews of systems you own or are contracted to assess |
| Telemetry Note | The script performs only read-only probes and HTTP fingerprinting and makes no outbound network calls during scanning; defenders will see the same benign Nmap service probes and HTTP requests as a standard version scan |
CVEScannerV2 attacks one of the oldest problems in network reconnaissance: the gap between what nmap -sV tells you about a service and what a vulnerability database can actually do with that information. The tool is an NSE script, written in Lua, that takes Nmap's service, product, CPE and version detection as raw input, improves that evidence with additional fingerprinting, and looks the result up in a local SQLite copy of the NVD stored at data/cve.db. The output is not just a list of CVEs but a scored assessment: each match carries a confidence level of high, medium or low, plus a list of reasons explaining why the tool believes the match applies. With 229 stars and a GPL-3.0 license, it is a credible community effort in a space where most NSE CVE scripts simply pattern-match version strings.
The architecture is a two-part system. The scanner itself is nmap/src/cvescannerv2.nse plus its companion module directory nmap/src/cvescannerv2/, which must be copied together into the Nmap scripts folder because the script loads its modules relative to its own path, deliberately taking priority over stale copies in nselib/. The second half is db-manager, a Python package built with uv that constructs and incrementally updates the SQLite database the NSE script queries. Separating the corpus builder from the scanner means the scanning side never needs Internet access — the README is explicit that the script performs no downloads during a scan, which is a meaningful property for air-gapped or monitored assessment environments.
What distinguishes CVEScannerV2 from naive version-to-CVE mappers is its evidence enrichment pipeline. When Nmap reports a missing, generic, or range version, the script tries to do better. On web ports it applies HTTP fingerprints borrowed from the nmap-vulners catalogue — four JSON files (vulnerscom-index.json, vulnerscom-fingerprints.json, vulnerscom-paths.json, vulnerscom-probes.json) fetched by scripts/download-catalog.sh and stored with an explicit vulnerscom- prefix so provenance stays clear. For a small set of well-known services — the README names Samba, UnrealIRCd, ntpd, miniupnpd and CUPS — it runs safe, read-only protocol probes to replace empty version strings. This is probing in the fingerprinting sense, not exploitation; the tool never sends attack traffic.
The database itself is where the project shows unusual engineering maturity. Rather than shipping a static dump in the repo, the companion CVEScannerV2DB repository holds dump.pNN files and a build.sh script, while a database.yaml GitHub workflow regenerates the corpus on the 1st and 15th of every month. The importer needs an NVD API key (stored in .api or the NVD_KEY environment variable) and handles NVD's live offset pagination with checkpointed resumption: SQLite stores the original query windows and a per-page checkpoint committed transactionally alongside the records, so interrupted downloads resume rather than restart. Rate limiting is respected throughout — 0.75 seconds between NVD request starts with at most four in flight, one-second spacing for Metasploit references, two-second spacing for Exploit-DB title scraping — with retries honoring Retry-After on HTTP 429 responses.
A detail that matters for result quality: the importer associates a CVE only with NVD CPE entries marked vulnerable: true, rather than every supporting platform entry. Older databases built by previous versions conflated those, inflating false positives. Platform awareness also runs at scan time — CVEs restricted to Windows, Linux, or a specific distribution are checked against the host's detected operating system using data/platform-families.json, and distribution- or platform-specific issues are filtered out when they cannot apply. The conditions table added by the current db-manager powers this; the README warns that scans against older databases silently skip platform checks and log a warning instead.
Version matching is performed in three modes depending on evidence quality: exact matches when a concrete version is known, range containment when the CVE description specifies an affected interval, and — when the version remains unknown — CVEs that affect every version of the product. Product and vendor normalization is handled through versioned alias files, data/product-aliases.json and data/vendor-aliases.json, which smooth over the naming inconsistencies between what Nmap reports and how NVD records CPE entries. This is precisely the glue layer that most homegrown CVE correlation scripts lack, and it is where the majority of false negatives typically hide.
Deployment is offered both locally and through a well-considered Docker workflow. The multi-stage build produces two scratch-based images: scmanjarrez/cvescanner:db with the latest database embedded, and :nodb for a lightweight image where you mount your own data/ directory. The build is layered so the large runtime and database layers remain cache-reusable when only the NSE script or alias files change, with COPY --link and per-architecture APK cache mounts. Versioned tags (4.0.0, 4.0-nodb and so on) snapshot the database at release time, while moving tags like db and v4-db track the twice-monthly database publications — a sensible distinction between reproducibility and freshness.
Running it inside an authorized workflow is straightforward: it hooks into a normal version scan, for example nmap -sV --script cvescannerv2 with optional script arguments such as db= to point at an alternative database path. The minconf argument filters output to a chosen confidence floor, which is the right knob for triage: a penetration tester who only wants defensible findings sets minconf to high and reads the per-CVE reasons to verify the evidence chain before reporting anything. Output is dual-format — a machine-readable JSON report suitable for pipeline ingestion and a human-readable log — which makes it easy to fold into existing reporting tooling.
The README is refreshingly honest about limitations, and that honesty deserves emphasis. The script depends entirely on Nmap's detection: if Nmap misidentifies a service, the CVE output for that service will be wrong or empty, and enrichment reduces but cannot remove that failure mode. This is the correct mental model for any version-based CVE correlation tool — the output is a prioritization signal, not a verified vulnerability finding. The confidence and reasons fields exist precisely because the author understands that unverified version matching is a starting point for manual confirmation, not a substitute for it.
For defenders, the telemetry profile is benign by design. During a scan the script generates the same traffic an ordinary nmap -sV run would — service banners, HTTP requests against fingerprint paths, and read-only protocol queries — plus zero outbound connections, since all lookups hit the local cve.db. That makes it equally useful on both sides of the fence: a blue team can run it against its own inventory to find where exposed versions intersect with known CVEs and Metasploit or Exploit-Db references, treating the exploit-reference annotations as a proxy for how attractive each finding is to an adversary. As an educational and operational tool for authorized assessment, CVEScannerV2 represents the thoughtful end of the NSE ecosystem, and its confidence-scored, evidence-explained output is a pattern worth studying even if you never run it.
scmanjarrez/CVEScannerV2.Educational analysis for authorized security professionals. Use only in controlled, authorized environments.
Related coverage
0 comentários:
Post a Comment
Note: Only a member of this blog may post a comment.