Nmap smtp-vuln-cve2010-4344 NSE Script


This page contains detailed information about how to use the smtp-vuln-cve2010-4344 NSE script. For list of all NSE scripts, visit the Nmap NSE Library.

Select:
Overview
Error Messages

Script Overview


Script source code: https://github.com/nmap/nmap/tree/master/scripts/smtp-vuln-cve2010-4344.nse
Script categories: exploit, intrusive, vuln
Target service / protocol: smtp, smtps, submission
Target network port(s): 25, 465, 587
List of CVEs: CVE-2010-4344, CVE-2010-4345

Script Description


The smtp-vuln-cve2010-4344.nse script checks for and/or exploits a heap overflow within versions of Exim prior to version 4.69 (CVE-2010-4344) and a privilege escalation vulnerability in Exim 4.72 and prior (CVE-2010-4345).

The heap overflow vulnerability allows remote attackers to execute arbitrary code with the privileges of the Exim daemon (CVE-2010-4344). If the exploit fails then the Exim smtpd child will be killed (heap corruption).

The script also checks for a privilege escalation vulnerability that affects Exim version 4.72 and prior. The vulnerability allows the exim user to gain root privileges by specifying an alternate configuration file using the -C option (CVE-2010-4345).

The smtp-vuln-cve2010-4344.exploit script argument will make the script try to exploit the vulnerabilities, by sending more than 50MB of data, it depends on the message size limit configuration option of the Exim server. If the exploit succeed the exploit.cmd or smtp-vuln-cve2010-4344.cmd script arguments can be used to run an arbitrary command on the remote system, under the Exim user privileges. If this script argument is set then it will enable the smtp-vuln-cve2010-4344.exploit argument.

To get the appropriate debug messages for this script, please use -d2.

Some of the logic of this script is based on the metasploit exim4_string_format exploit.

Reference:

Smtp-vuln-cve2010-4344 NSE Script Arguments


This is a full list of arguments supported by the smtp-vuln-cve2010-4344.nse script:

exploit.cmd

Or smtp-vuln-cve2010-4344.cmd An arbitrary command to run under the Exim user privileges on the remote system. If this argument is set then, it will enable the smtp-vuln-cve2010-4344.exploit argument.

smtp-vuln-cve2010-4344.exploit

The script will force the checks, and will try to exploit the Exim SMTP server.

smtp-vuln-cve2010-4344.mailfrom

Define the source email address to be used.

smtp-vuln-cve2010-4344.mailto

Define the destination email address to be used.

smbdomain

The domain to log in with. If you aren't in a domain environment, then anything will (should?) be accepted by the server.

smbhash

A password hash to use when logging in. This is given as a single hex string (32 characters) or a pair of hex strings (both 32 characters, optionally separated by a single character). These hashes are the LanMan or NTLM hash of the user's password, and are stored on disk or in memory. They can be retrieved from memory using the fgdump or pwdump tools.

smbnoguest

Use to disable usage of the 'guest' account.

smbpassword

The password to connect with. Be cautious with this, since some servers will lock accounts if the incorrect password is given. Although it's rare that the Administrator account can be locked out, in the off chance that it can, you could get yourself in trouble. To use a blank password, leave this parameter off altogether.

smbtype

The type of SMB authentication to use. These are the possible options:

  • v1: Sends LMv1 and NTLMv1.
  • LMv1: Sends LMv1 only.
  • NTLMv1: Sends NTLMv1 only (default).
  • v2: Sends LMv2 and NTLMv2.
  • LMv2: Sends LMv2 only.
  • NTLMv2: Doesn't exist; the protocol doesn't support NTLMv2 alone. The default, NTLMv1, is a pretty decent compromise between security and compatibility. If you are paranoid, you might want to use v2 or lmv2 for this. (Actually, if you're paranoid, you should be avoiding this protocol altogether!). If you're using an extremely old system, you might need to set this to v1 or lm, which are less secure but more compatible. For information, see smbauth.lua.

smbusername

The SMB username to log in with. The forms "DOMAIN\username" and "username@DOMAIN" are not understood. To set a domain, use the smbdomain argument.

smtp.domain

The domain to be returned by get_domain, overriding the target's own domain name.

- - -
To use these script arguments, add them to the Nmap command line using the --script-args arg1=value,[arg2=value,..] syntax. For example:

nmap --script=smtp-vuln-cve2010-4344 --script-args exploit.cmd=value,smtp-vuln-cve2010-4344.exploit=value <target>

Smtp-vuln-cve2010-4344 NSE Script Example Usage


Here's an example of how to use the smtp-vuln-cve2010-4344.nse script:

nmap --script=smtp-vuln-cve2010-4344 --script-args="smtp-vuln-cve2010-4344.exploit" -pT:25,465,587 <host>

nmap --script=smtp-vuln-cve2010-4344 --script-args="exploit.cmd='uname -a'" -pT:25,465,587 <host>

Smtp-vuln-cve2010-4344 NSE Script Example Output


Here's a sample output from the smtp-vuln-cve2010-4344.nse script:

PORT   STATE SERVICE
25/tcp open  smtp
| smtp-vuln-cve2010-4344:
| Exim heap overflow vulnerability (CVE-2010-4344):
|   Exim (CVE-2010-4344): VULNERABLE
|     Shell command 'uname -a': Linux qemu-ubuntu-x32 2.6.38-8-generic #42-Ubuntu SMP Fri Jan 21 17:40:48 UTC 2011 i686 GNU/Linux
| Exim privileges escalation vulnerability (CVE-2010-4345):
|   Exim (CVE-2010-4345): VULNERABLE
|     Before 'id': uid=121(Debian-exim) gid=128(Debian-exim) groups=128(Debian-exim),45(sasl)
|_    After  'id': uid=0(root) gid=128(Debian-exim) groups=0(root)

Smtp-vuln-cve2010-4344 NSE Script Example XML Output


There is no sample XML output for this module. However, by providing the -oX <file> option, Nmap will produce a XML output and save it in the file.xml file.

Author


  • Djalal Harouni

References


See Also


Related NSE scripts to the smtp-vuln-cve2010-4344.nse script:

Visit Nmap NSE Library for more scripts.

The smtp-vuln-cve2010-4344.nse script may fail with the following error messages. Check for the possible causes by using the code snippets highlighted below found in the script source code. This can often times help in identifying the root cause of the problem.

failed to send hdrs.


Here is a relevant code snippet related to the "failed to send hdrs." error message:

229:	  stdnse.debug1("sending forged mail, size: %.fMB", msg_len / (1024*1024))
230:	
231:	  -- use low socket level functions.
232:	  status, ret = socket:send(hdrs)
233:	  if not status then
234:	    return clean(socket, status, "failed to send hdrs.")
235:	  end
236:	
237:	  status, ret = socket:send(hdrx)
238:	  if not status then
239:	    return clean(socket, status, "failed to send hdrx.")

failed to send hdrx.


Here is a relevant code snippet related to the "failed to send hdrx." error message:

234:	    return clean(socket, status, "failed to send hdrs.")
235:	  end
236:	
237:	  status, ret = socket:send(hdrx)
238:	  if not status then
239:	    return clean(socket, status, "failed to send hdrx.")
240:	  end
241:	
242:	  status, ret = socket:send("\r\n")
243:	  if not status then
244:	    return clean(socket, status, "failed to terminate headers.")

failed to terminate headers.


Here is a relevant code snippet related to the "failed to terminate headers." error message:

239:	    return clean(socket, status, "failed to send hdrx.")
240:	  end
241:	
242:	  status, ret = socket:send("\r\n")
243:	  if not status then
244:	    return clean(socket, status, "failed to terminate headers.")
245:	  end
246:	
247:	  local body_size = 0
248:	  filler = string.rep(string.rep("Nmap", 63).."XX\r\n", 1024)
249:	  while body_size < msg_len do

failed to send body.


Here is a relevant code snippet related to the "failed to send body." error message:

248:	  filler = string.rep(string.rep("Nmap", 63).."XX\r\n", 1024)
249:	  while body_size < msg_len do
250:	    body_size = body_size + #filler
251:	    status, ret = socket:send(filler)
252:	    if not status then
253:	      return clean(socket, status, "failed to send body.")
254:	    end
255:	  end
256:	
257:	  status, response = smtp.query(socket, "\r\n.")
258:	  if not status then

failed to terminate the message.


Here is a relevant code snippet related to the "failed to terminate the message." error message:

258:	  if not status then
259:	    if string.match(response, "connection closed") then
260:	      -- the child was killed (heap corruption).
261:	      return true, "heap"
262:	    else
263:	      return status, "failed to terminate the message."
264:	    end
265:	  end
266:	
267:	  status, ret = smtp.check_reply("DATA", response)
268:	  if not status then

failed to read the SMTP banner.


Here is a relevant code snippet related to the "failed to read the SMTP banner." error message:

347:	      return smtp_finish(socket, true,
348:	        'The SMTP server is not Exim: NOT VULNERABLE')
349:	    end
350:	  else
351:	    return smtp_finish(socket, false,
352:	      'failed to read the SMTP banner.')
353:	  end
354:	
355:	  if not smtp_opts.exploit then
356:	    table.insert(out, 3, exim_heap_result)
357:	    table.insert(out, 5, exim_priv_result)

Version


This page has been created based on Nmap version 7.92.

Go back to menu.