From d5edc49016d735f4e00a955330f689d5b6c16ac5 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 10 Aug 2010 19:54:30 +0000 Subject: [PATCH] Add patch from Ange Gutek and Tom Sellers to make http-php-version only consider responses with a 200 status. --- scripts/http-php-version.nse | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/http-php-version.nse b/scripts/http-php-version.nse index b67b5afe9..9ecf3ab5f 100644 --- a/scripts/http-php-version.nse +++ b/scripts/http-php-version.nse @@ -18,6 +18,10 @@ The script also checks if any header field value starts with -- | Versions from credits query (more accurate): 5.0.5 -- |_Version from header x-powered-by: PHP/5.0.5 +-- 08/10/2010: +-- * Added a check on the http status when querying the server: +-- if the http code is 200 (ok), proceed. (thanks to Tom Sellers who has reported this lack of check) + author = "Ange Gutek" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"discovery", "safe"} @@ -81,14 +85,14 @@ action = function(host, port) -- 1st pass : the "special" PHP-logo test response = http.get(host, port, LOGO_QUERY) - if response.body then + if response.body and response.status == 200 then logo_hash = stdnse.tohex(openssl.md5(response.body)) logo_versions = LOGO_HASHES[logo_hash] end -- 2nd pass : the PHP-credits test response = http.get(host, port, CREDITS_QUERY) - if response.body then + if response.body and response.status == 200 then credits_hash = stdnse.tohex(openssl.md5(response.body)) credits_versions = CREDITS_HASHES[credits_hash] end