[NT] Another SQL Server 7 Buffer Overflow (xp_dirtree)

From: support@securiteam.com
Date: 03/10/02

From: support@securiteam.com
To: list@securiteam.com
Date: Sun, 10 Mar 2002 01:11:49 +0100 (CET)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  Another SQL Server 7 Buffer Overflow (xp_dirtree)


The extended stored procedure xp_dirtree allows all users to retrieve the
subdirectory structure of a given drive or folder. A security
vulnerability in this stored procedure allows attackers to overflow an
internal buffer used by the function and execute arbitrary code.


System affected:
 * Microsoft SQL Server 7 all service packs and fixes, version 7.00.1021

The buffer overflow occurs when a long string is supplied:
xp_dirtree 'XXXXXX...X'

In this form it is hard to exploit due to a string conversion. However, if
you pass the parameter as Unicode:

xp_dirtree N'XXXXXX...X'

Then there is no string conversion, and you can crash the server and
exploit the buffer overflow. Unicode buffer overflows are a bit harder to
exploit but not impossible.

Drop the extended store procedure and its DLL.

Vendor status:
Microsoft was not contacted.


The information has been provided by <mailto:cesarc56@yahoo.com> c c.


This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com


The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.