diff --git a/CHANGELOG b/CHANGELOG index 10be98039..4641f1003 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o [NSE] Added telnet-ntlm-info for extracting hostname and sometimes OS version + from NTLM-auth-enabled Telnet services. [Justin Cacak] + o [NSE] Added smtp-ntlm-info for extracting hostname and sometimes OS version from NTLM-auth-enabled SMTP and submission services. [Justin Cacak] diff --git a/scripts/script.db b/scripts/script.db index c6bf4bc60..cef85d4cc 100644 --- a/scripts/script.db +++ b/scripts/script.db @@ -493,6 +493,7 @@ Entry { filename = "targets-xml.nse", categories = { "safe", } } Entry { filename = "teamspeak2-version.nse", categories = { "version", } } Entry { filename = "telnet-brute.nse", categories = { "brute", "intrusive", } } Entry { filename = "telnet-encryption.nse", categories = { "discovery", "safe", } } +Entry { filename = "telnet-ntlm-info.nse", categories = { "default", "discovery", "safe", } } Entry { filename = "tftp-enum.nse", categories = { "discovery", "intrusive", } } Entry { filename = "tls-nextprotoneg.nse", categories = { "default", "discovery", "safe", } } Entry { filename = "tor-consensus-checker.nse", categories = { "external", "safe", } } diff --git a/scripts/telnet-ntlm-info.nse b/scripts/telnet-ntlm-info.nse new file mode 100644 index 000000000..3a2cfbec4 --- /dev/null +++ b/scripts/telnet-ntlm-info.nse @@ -0,0 +1,134 @@ +local bin = require "bin" +local comm = require "comm" +local shortport = require "shortport" +local stdnse = require "stdnse" +local smbauth = require "smbauth" +local string = require "string" + + +description = [[ +This script enumerates information from remote Microsoft Telnet services with NTLM +authentication enabled. + +Sending a MS-TNAP NTLM authentication request with null credentials will cause the +remote service to respond with a NTLMSSP message disclosing information to include +NetBIOS, DNS, and OS build version. +]] + + +--- +-- @usage +-- nmap -p 23 --script telnet-ntlm-info +-- +-- @output +-- 23/tcp open telnet +-- | telnet-ntlm-info: +-- | Target_Name: ACTIVETELNET +-- | NetBIOS_Domain_Name: ACTIVETELNET +-- | NetBIOS_Computer_Name: HOST-TEST2 +-- | DNS_Domain_Name: somedomain.com +-- | DNS_Computer_Name: host-test2.somedomain.com +-- | DNS_Tree_Name: somedomain.com +-- |_ Product_Version: 5.1 (Build 2600) +-- +--@xmloutput +-- ACTIVETELNET +-- ACTIVETELNET +-- HOST-TEST2 +-- somedomain.com +-- host-test2.somedomain.com +-- somedomain.com +-- 5.1 (Build 2600) + + +author = "Justin Cacak" +license = "Same as Nmap--See https://nmap.org/book/man-legal.html" +categories = {"default", "discovery", "safe"} + + +local _, ntlm_auth_blob = smbauth.get_security_blob( + nil, nil, nil, nil, nil, nil, nil, + 0x00000001 + -- Negotiate Unicode + 0x00000002 + -- Negotiate OEM strings + 0x00000004 + -- Request Target + 0x00000200 + -- Negotiate NTLM + 0x00008000 + -- Negotiate Always Sign + 0x00080000 + -- Negotiate NTLM2 Key + 0x20000000 + -- Negotiate 128 + 0x80000000 -- Negotiate 56 + ) + +-- +-- Create MS-TNAP Login Packet (Option Command IS) +-- Ref: http://msdn.microsoft.com/en-us/library/cc247789.aspx +local tnap_login_packet = bin.pack(" 0 then + output.NetBIOS_Domain_Name = ntlm_decoded.netbios_domain_name + end + + if ntlm_decoded.netbios_computer_name and #ntlm_decoded.netbios_computer_name > 0 then + output.NetBIOS_Computer_Name = ntlm_decoded.netbios_computer_name + end + + if ntlm_decoded.dns_domain_name and #ntlm_decoded.dns_domain_name > 0 then + output.DNS_Domain_Name = ntlm_decoded.dns_domain_name + end + + if ntlm_decoded.fqdn and #ntlm_decoded.fqdn > 0 then + output.DNS_Computer_Name = ntlm_decoded.fqdn + end + + if ntlm_decoded.dns_forest_name and #ntlm_decoded.dns_forest_name > 0 then + output.DNS_Tree_Name = ntlm_decoded.dns_forest_name + end + + if ntlm_decoded.os_major_version then + output.Product_Version = string.format("%d.%d.%d", + ntlm_decoded.os_major_version, ntlm_decoded.os_minor_version, ntlm_decoded.os_build) + end + + return output + +end