From 4568fbc1b89e0dd6ff12becc9c7743d2a94a8727 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 24 Nov 2026 17:18:05 +0000 Subject: [PATCH] Keep softmatch on connect error. Fixes #3602. Closes #3487 --- CHANGELOG | 4 ++++ service_scan.cc | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7d9f31469..7c51f8788 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ #Nmap Changelog ($Id$); -*-text-*- +o [GH#3602][GH#3487] Fixed an issue where a connection failure in service scan + would cause Nmap to drop an existing softmatch classification for that + service. [Martin Desrumaux] + o [GH#3603] Fixed the issue where the same source port number was used for all service probes to a given target, resulting in EADDRNOTAVAIL in some cases. diff --git a/service_scan.cc b/service_scan.cc index a4e284718..7b9218cc9 100644 --- a/service_scan.cc +++ b/service_scan.cc @@ -2405,7 +2405,10 @@ static void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *m // and move it to the finished bin. if (o.debugging) error("Got nsock CONNECT response with status %s - aborting this service", nse_status2str(status)); - end_svcprobe(PROBESTATE_INCOMPLETE, SG, svc, nsi); + /* A softmatch from an earlier probe is still valid: a failure to open + a further connection says nothing about what already answered. */ + end_svcprobe(svc->softMatchFound ? PROBESTATE_FINISHED_SOFTMATCHED + : PROBESTATE_INCOMPLETE, SG, svc, nsi); break; case NSE_STATUS_KILL: