diff --git a/CHANGELOG b/CHANGELOG index 5e9c6517c..2017ce6a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,10 @@ o Upgraded included libraries: libpcap 1.10.7, pcre2 10.48, lua 5.4.9 +o [NSE][GH#3492] vulners API queries for versions like 4.100 were being + truncated on the server, resulting in false positives. Fixed by encoding as + string. [huuyafwww] + o [Ncat][GH#3489][GH#3498] Ncat in listen mode no longer sends termination signals to its process group. Ncat inherits the group of whatever launched it, so a SIGINT, SIGTERM, SIGHUP, or SIGQUIT could also terminate the diff --git a/scripts/vulners.nse b/scripts/vulners.nse index 41bc2c25e..75668d3e7 100644 --- a/scripts/vulners.nse +++ b/scripts/vulners.nse @@ -60,6 +60,7 @@ local string = require "string" local table = require "table" local nmap = require "nmap" local stdnse = require "stdnse" +local url = require "url" local api_version="1.2" local mincvss=stdnse.get_script_args("vulners.mincvss") @@ -132,6 +133,16 @@ function get_results(what, vers, type) any_af = true, } + -- numeric versions are type-inferred to be numbers and trailing zeroes are + -- truncated. Submit as a string explicitly. + vers = url.escape(json.generate(vers)) + + -- Service rejects uri-encoded CPE strings, + -- but also rejects software names with non-uri-encoded spaces. + if type ~= "cpe" then + what = url.escape(what) + end + local response = http.get_url(('%s?software=%s&version=%s&type=%s'):format(api_endpoint, what, vers, type), option) local status = response.status