mirror of
https://github.com/nmap/nmap.git
synced 2025-12-13 19:29:04 +00:00
Fixed a bug where MSRPC would try to sign messages using OpenSSL, even if it wasn't available
This commit is contained in:
@@ -197,6 +197,10 @@ end
|
|||||||
--@param challenge The server's challenge.
|
--@param challenge The server's challenge.
|
||||||
--@return (status, response) If status is true, the response is returned; otherwise, an error message is returned.
|
--@return (status, response) If status is true, the response is returned; otherwise, an error message is returned.
|
||||||
function ntlm_create_response(ntlm, challenge)
|
function ntlm_create_response(ntlm, challenge)
|
||||||
|
if(have_ssl ~= true) then
|
||||||
|
return false, "SMB: OpenSSL not present"
|
||||||
|
end
|
||||||
|
|
||||||
return lm_create_response(ntlm, challenge)
|
return lm_create_response(ntlm, challenge)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -207,6 +211,9 @@ end
|
|||||||
--@param ntlm_response The NTLM response.
|
--@param ntlm_response The NTLM response.
|
||||||
--@param is_extended Should be set if extended security negotiations are being used.
|
--@param is_extended Should be set if extended security negotiations are being used.
|
||||||
function ntlm_create_mac_key(ntlm_hash, ntlm_response, is_extended)
|
function ntlm_create_mac_key(ntlm_hash, ntlm_response, is_extended)
|
||||||
|
if(have_ssl ~= true) then
|
||||||
|
return false, "SMB: OpenSSL not present"
|
||||||
|
end
|
||||||
if(is_extended) then
|
if(is_extended) then
|
||||||
return openssl.md4(ntlm_hash)
|
return openssl.md4(ntlm_hash)
|
||||||
else
|
else
|
||||||
@@ -221,6 +228,10 @@ end
|
|||||||
--@param ntlm_response The NTLM response.
|
--@param ntlm_response The NTLM response.
|
||||||
--@param is_extended Should be set if extended security negotiations are being used.
|
--@param is_extended Should be set if extended security negotiations are being used.
|
||||||
function lm_create_mac_key(lm_hash, lm_response, is_extended)
|
function lm_create_mac_key(lm_hash, lm_response, is_extended)
|
||||||
|
if(have_ssl ~= true) then
|
||||||
|
return false, "SMB: OpenSSL not present"
|
||||||
|
end
|
||||||
|
|
||||||
if(is_extended) then
|
if(is_extended) then
|
||||||
return string.sub(lm_hash, 1, 8) .. string.rep(string.char(0), 8)
|
return string.sub(lm_hash, 1, 8) .. string.rep(string.char(0), 8)
|
||||||
else
|
else
|
||||||
@@ -264,6 +275,10 @@ end
|
|||||||
--@param challenge The server challenge.
|
--@param challenge The server challenge.
|
||||||
--@return (status, response) If status is true, the response is returned; otherwise, an error message is returned.
|
--@return (status, response) If status is true, the response is returned; otherwise, an error message is returned.
|
||||||
function lmv2_create_response(ntlm, username, domain, challenge)
|
function lmv2_create_response(ntlm, username, domain, challenge)
|
||||||
|
if(have_ssl ~= true) then
|
||||||
|
return false, "SMB: OpenSSL not present"
|
||||||
|
end
|
||||||
|
|
||||||
return ntlmv2_create_response(ntlm, username, domain, challenge, 8)
|
return ntlmv2_create_response(ntlm, username, domain, challenge, 8)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -644,7 +659,11 @@ end
|
|||||||
-- sent, except with the signature slot replaced with the sequence number.
|
-- sent, except with the signature slot replaced with the sequence number.
|
||||||
--@return The 8-byte signature. The signature is equal to the first eight bytes of md5(mac_key .. smb_data)
|
--@return The 8-byte signature. The signature is equal to the first eight bytes of md5(mac_key .. smb_data)
|
||||||
function calculate_signature(mac_key, data)
|
function calculate_signature(mac_key, data)
|
||||||
|
if(have_ssl) then
|
||||||
return string.sub(openssl.md5(mac_key .. data), 1, 8)
|
return string.sub(openssl.md5(mac_key .. data), 1, 8)
|
||||||
|
else
|
||||||
|
return string.rep(string.char(0), 8)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user