Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP digest auth crash when auth header is missing #1665

Closed
nnposter opened this issue Jul 24, 2019 · 0 comments

Comments

@nnposter
Copy link

commented Jul 24, 2019

NSE encounters an error if the code prescribes HTTP digest authentication but the target server does not supply header WWW-Authenticate:

/usr/bin/../share/nmap/nselib/sasl.lua:121: attempt to concatenate a nil value (field 'nonce')
stack traceback:
        /usr/bin/../share/nmap/nselib/sasl.lua:121: in method 'calcDigest'
        /usr/bin/../share/nmap/nselib/http.lua:1416: in function 'http.generic_request'
        /usr/bin/../share/nmap/nselib/http.lua:1766: in function 'http.get'
        (...tail calls...)

The following patch rectifies the issue:

--- a/nselib/http.lua
+++ b/nselib/http.lua
@@ -1404,7 +1404,7 @@
     options_with_auth_removed["auth"] = nil
     local r = generic_request(host, port, method, path, options_with_auth_remov
     local h = r.header['www-authenticate']
-    if not r.status or (h and not string.find(h:lower(), "digest.-realm")) then
+    if not (r.status and h and string.find(h:lower(), "digest.-realm")) then
       stdnse.debug1("http: the target doesn't support digest auth or there was 
       return http_error("The target doesn't support digest auth or there was an
     end

The patch will be applied after August 1, 2019, unless concerns are raised.

@nnposter nnposter self-assigned this Jul 24, 2019

@nmap-bot nmap-bot closed this in f513575 Aug 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.