[NT] BULK INSERT Buffer Overflow

From: support@securiteam.com
Date: 07/11/02


From: support@securiteam.com
To: list@securiteam.com
Date: Thu, 11 Jul 2002 22:03:41 +0200 (CEST)

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.
- - - - - - - - -

  BULK INSERT Buffer Overflow
------------------------------------------------------------------------

SUMMARY

Microsoft's SQL Server 2000 contains functionality that allows a database
owner to populate a table with data with one fell swoop using the 'BULK
INSERT' query. This functionality contains a remotely exploitable buffer
overrun vulnerability that can be exploited by an attacker to run
arbitrary code.

DETAILS

The 'BULK INSERT' query will take a user supplied file name and insert the
contents of this file into a specified table. By supplying an overly long
filename to the query, a buffer is overflowed and the saved return address
stored on the stack is overwritten. This allows the attacker to gain
control over the process' execution. SQL Server 2000 can be run in the
security context of a domain account or LOCAL SYSTEM, so depending upon
the particular setup, an attacker may be able to gain complete control
over the vulnerable system.

To be able to use the 'BULK INSERT' query one must have the privileges of
the database owner or 'dbo'. Note this does not necessarily imply 'sa'
equivalence.

Another point to note is that whilst this overflow is 'UNICODE' in nature
by supplying code as a UNICODE string exploitation is made easier.

Fix Information:
NGSSoftware alerted Microsoft to this problem on 28 May 2002. Microsoft
has created a patch. Please see their bulletin for more details:
<http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-034.asp> http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-034.asp

Whilst NGSSoftware rate this as a medium risk issue, we still urge
customers to apply the patch as soon as is possible as it contains fixes
for other issues such as a buffer overflow in the pwdencrypt() function.

ADDITIONAL INFORMATION

The information has been provided by <mailto:nisr@nextgenss.com>
NGSSoftware Insight Security Research.

========================================

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

====================
====================

DISCLAIMER:
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.



Relevant Pages

  • lame server messages in named.log
    ... Mar 30 05:42:30.526 security: info: client 202.52.250.176#1052: ... query (cache) denied ...
    (RedHat)
  • lame server messages in named.log
    ... Mar 30 05:42:30.526 security: info: client 202.52.250.176#1052: ... query (cache) denied ...
    (RedHat)
  • Re: restricted user level security
    ... All of my queries and macros are built off the Supervisor name, ... query, the query includes all of the fields and the CurrentUsercriteria. ... I changed the Run Permissions to Owner. ... you can set up user level security. ...
    (microsoft.public.access.security)
  • [NEWS] IBM Informix Web DataBlade Vulnerable to Auto-decoding of HTML Entities
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... HTML encoded strings are automatically being decoded when used in SQL ... When a string has been ... $'ed it should thus be safe to use it in an SQL query, ...
    (Securiteam)
  • [NEWS] IBM Informix Web DataBlade Vulnerability Allows SQL Injection
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... When a user makes a page request, webdriver executes a query that will ... This query is vulnerable to SQL injection ... returns some processed HTML. ...
    (Securiteam)