Title: Server Response To SMTP Client EHLO Command Results In Buffer Overrun (Q326322) Date: 24 July 2002 Software: Microsoft Exchange 5.5 Impact: Ability to run arbitrary code Max Risk: Medium Bulletin: MS02-037
Microsoft encourages customers to review the Security Bulletin at: http://www.microsoft.com/technet/security/bulletin/MS02-037.asp.
The Internet Mail Connector (IMC) enables Microsoft Exchange Server to communicate with other mail servers via SMTP. When the IMC receives an SMTP extended Hello (EHLO) protocol command from a connecting SMTP server, it responds by sending a status reply that starts with the following: 250-<Exchange server ID>Hello<Connecting server ID>
Where: <Exchange server ID> is the fully-qualified domain name (FQDN) of the Exchange server <Connecting server ID> is either the FQDN or the IP address of the server that initiated the connection.
The FQDN would be used if the Exchange5.5 IMC is able to resolve this information through a reverse DNS lookup; the IP address would be used if a reverse DNS lookup was not possible or failed to resolve the connecting servers IP address.
A security vulnerability results because of an unchecked buffer In the IMC code that generates the response to the EHLO protocol command. If the total length of the message exceeds a particular value, the data would overrun the buffer. If the buffer were overrun with random data, it would result in the failure of the IMC. If, however, the buffer were overrun with carefully chosen data, it could be possible for the attacker to run code in the security context of the IMC, which runs as Exchange5.5 Service Account.
It is important to note that the attacker could not simply send Data to the IMC in order to overrun the buffer. Instead, the Attacker would need to create a set of conditions that would cause the IMC to overrun its own buffer when it generated the EHLO response. Specifically, the attacker would need to ensure that a reverse DNS lookup would not only succeed, but would provide an FQDN whose length was sufficient to result in the buffer overrun.
Creating an environment in which the IMC's reverse DNS lookup would not only succeed but also result in the buffer being overrun would be difficult. The attacker could set up a rogue DNS server and manually populate the bogus FQDN information on it, but in this would require that the attacker have some means of forcing the IMC to consult the rogue DNS server when performing the reverse DNS lookup.
The IMC can be disabled for cases where SMTP support is not needed. If this has been done, the vulnerability could not be exploited.
Customers can disable Reverse DNS lookup on EHLO by setting a registry key as defined in Q190026. The vulnerability could not be exploited on a system configured in such a way.
If the buffer overrun caused the IMC to fail, normal service Could be restored by restarting the Exchange 5.5 IMC service.
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.