diff --git a/CHANGELOG b/CHANGELOG index 6f4cd3a82..4705e7466 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,17 @@ o [GH#3565][GH#3573] Fixed an issue with addrset: When a CIDR spec was added after a narrower one, its prefix exactly the common prefix of the two, the addrset trie did not cover the whole broader range. [Dennys Kaluzny Pereira] +o [Windows][GH#149] The "Network Performance Improvements" installer option + and nmap_performance.reg no longer set MaxUserPort, and instead delete any + existing MaxUserPort value, whoever set it, whenever that option is + selected. The value raised the ephemeral port limit on Windows 2000/XP/2003, + none of which Nmap has supported since 7.25BETA1. On Windows Vista and later + it instead widens the TCP dynamic port range from the default 49152-65535 to + 1024-65534, which fragments the port space and breaks software that reserves + contiguous port ranges, such as WSL2 mirrored networking + (microsoft/WSL#13454). The TIME_WAIT reduction (TcpTimedWaitDelay, + StrictTimeWaitSeqCheck) is unchanged. [yuu61] + Nmap 7.993 [2026-10-23] o [NSE][GH#3557] Fixed a regression which prevented most scripts in the version diff --git a/docs/nmap-install.xml b/docs/nmap-install.xml index 4c3643c05..8461a24d6 100644 --- a/docs/nmap-install.xml +++ b/docs/nmap-install.xml @@ -757,23 +757,45 @@ in the nmap-version directory of the Windows binary zip file (for Nmap OEM customers), and nmap-version/mswin32 in the source tarball (where version is the -version number of the specific release). These changes increase -the number of ephemeral ports reserved for user applications (such as -Nmap) and reduce the time delay before a closed connection can -be reused. Most people simply check the box to apply these changes in the executable Nmap installer, but you can also apply them by double-clicking on +version number of the specific release). These changes reduce the +time delay before the port of a closed connection can be reused, so +that version detection and NSE scripts, which open many short-lived +connections, do not run out of ephemeral ports while old connections +linger in the TIME_WAIT state. Most people simply check the box to apply these changes in the executable Nmap installer, but you can also apply them by double-clicking on nmap_performance.reg, or by running the command -regedt32 nmap_performance.reg. To make the changes by hand, add these three Registry DWORD values to +regedt32 nmap_performance.reg. To make the changes by hand, add these two Registry DWORD values to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters: - MaxUserPort - Set a large value such as 65534 (0x0000fffe). See MS KB 196271. TCPTimedWaitDelay Set the minimum value (0x0000001e). See MS KB 149532. StrictTimeWaitSeqCheck Set to 1 so TCPTimedWaitDelay is checked. +Earlier Nmap releases also set +MaxUserPort to 65534. Applying +nmap_performance.reg now deletes that value +(the "MaxUserPort"=- line) whether Nmap or +something else set it; the dynamic range changes after the next +reboot. The value raised the ephemeral port limit on Windows +2000, XP and Server 2003, whose default dynamic range was only +1025–5000; Nmap has not supported those systems since 7.25BETA1. +Windows Vista and later already use 49152–65535 (16384 ports), +and on those systems MaxUserPort instead widens the +dynamic range to 1024–65534. That spreads outgoing connections +over the whole port space and breaks software which needs to reserve a +contiguous block of ports, such as WSL2 mirrored networking. If you do +not re-run the installer, delete MaxUserPort from the +Registry key above; the default range returns after the next reboot. +To restore it immediately as well, run +netsh int ipv4 set dynamicport tcp start=49152 num=16384 +(and the same for ipv6) after deleting the value. If a very fast connect scan +really needs more than 16384 ephemeral ports, widen the range with +netsh from a high starting port instead, for example +start=32768 num=32768, which leaves the lower half of +the port space untouched. + I would like to thank Ryan PermehPermeh, Ryan of eEye, Andy LutomirskiLutomirski, Andy, and Jens VogtVogt, Jens for their hard work on the Nmap Windows port. For many years, Nmap was a Unix-only tool, and it would likely still be that diff --git a/mswin32/nmap_performance.reg b/mswin32/nmap_performance.reg index 49602fbb5..8eeb95723 100644 --- a/mswin32/nmap_performance.reg +++ b/mswin32/nmap_performance.reg @@ -1,6 +1,10 @@ REGEDIT4 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] -"MaxUserPort"=dword:0000fffe +; Earlier Nmap releases set MaxUserPort=0xfffe. On Windows Vista and later +; that widens the TCP dynamic port range to 1024-65534 and breaks software +; that needs a contiguous block of ports (e.g. WSL2 mirrored networking). +; Remove it if an older installer left it behind. +"MaxUserPort"=- "TcpTimedWaitDelay"=dword:0000001e "StrictTimeWaitSeqCheck"=dword:00000001