The CERT Coordination Center publishes incident notes to provide
information about incidents to the Internet community.

<h2>Exploitation of Vulnerabilities in Microsoft SQL Server</h2>

Release Date: May 22, 2002<br/>
Last Updated: May 23, 2002<p>

A complete revision history can be found at the end of this file.

<a name="systems">
<h4>Systems Affected
<ul>
<li>Systems running Microsoft SQL Server or Microsoft SQL
Server 2000 installed with mixed mode security enabled</li>
<li>Systems running Microsoft Data Engine 1.0 (MSDE 1.0) or Microsoft
SQL Server 2000 Desktop Engine (MSDE 2000) installed with mixed mode
security enabled</li>
<li>Systems running Tumbleweed's Secure Mail (MMS) versions 4.3, 4.5,
and 4.6</li>
</ul>
<a name="overview">
<h3>Overview</h3>
<p>The CERT/CC has received reports of systems being compromised
through the automated exploitation of null or weak default <i>sa</i>
passwords in Microsoft SQL Server and Microsoft Data Engine.  This
activity is accompanied by high volumes of scanning, and appears to be
related to recently discovered self-propagating malicious code,
referred to by various sources as Spida, SQLsnake, and Digispid.</p>
<p></p>
<a name="description">
<h3>I. Description</h3>
<p>Reports received by the CERT/CC indicate that the Spida worm scans
for systems listening on port 1433/tcp.  Once connected, it attempts to use the <font face="Courier">xp_cmdshell</font>
utility to enable and set a password for the guest user.
 

<p>If successful, the worm then
<ol>
<li>assigns the guest user to the local Administrator and Domain Admins groups</li>
<li>copies itself to the victim system</li>
<li>disables the guest account</li>
<li>sets the <i>sa</i> password to the same password as the guest account</li>
<li>executes the copy on the victim system</li>
</ol>
</p>
<p>Once the local copy is executing on the victim system, the worm
begins scanning for other systems to infect.  It also attempts to send
a copy of the local password (SAM) database, network configuration
information, and other SQL server configuration information to a fixed
email address (ixtld@postone.com) via email.</p>
<p>The attack used by the Spida worm is similar to that used by the
Kaiten malicious code described in <a href="http://www.cert.org/incident_notes/IN-2001-13.html">IN-2001-13</a>.
Additional information on null default <i>sa</i> passwords in
Microsoft SQL Server can be found in <a href="http://www.kb.cert.org/vuls/id/635463">VU#635463</a>.</p>
<a name="impact">
<h3>II. Impact</h3>
<p>The scanning activity of the Spida worm may cause denial-of-service
conditions on compromised systems, and it has been reported to cause high
traffic volumes even on networks with no compromised hosts.</p>
<p>Information about the victim system's configuration and accounts
may be compromised by the email the worm attempts to send.</p>
<p>By leveraging a default null password, an attacker may execute
arbitrary commands on the system in the security context in which the
Microsoft SQL Server services are running.  While site-specific
configurations may vary, the SQL Server is typically run with
system-level privileges.</p>
<a name="solution">
<h3>III. Solutions</h3>
<h3>Detection</h3>
<p>During the course of the Spida worm's execution, a number of files
are created on the victim system.  These include

<ul>
<li>%SystemRoot%\System32\drivers\services.exe</li>
<li>%SystemRoot%\System32\sqlexec.js</li>
<li>%SystemRoot%\System32\clemail.exe</li>
<li>%SystemRoot%\System32\sqlprocess.js</li>
<li>%SystemRoot%\System32\sqlinstall.bat</li>
<li>%SystemRoot%\System32\sqldir.js</li>
<li>%SystemRoot%\System32\run.js</li>
<li>%SystemRoot%\System32\timer.dll</li>
<li>%SystemRoot%\System32\samdump.dll</li>
<li>%SystemRoot%\System32\pwdump2.exe</li>
</ul>

The presence of any of these files on the system indicates compromise.  
</p>
<p>Scanning for other systems on port 1433/tcp or attempts to send
email to ixtld@postone.com may also indicate a compromised system.</p>
<h3>Response</h3>
<p>If you believe a system under your administrative control
may have been compromised, please refer to

<dl>
<dd><a href="http://www.cert.org/tech_tips/win-UNIX-system_compromise.html">Steps
for Recovering from a UNIX or NT System Compromise</a>
</dd>
</dl>
<h3>Protection</h3>
<h4>Set a password on the <i>sa</i> account</h4>
<p>Following best practices, passwords should never be left with a
null or easily guessed value.  Ensure that a password has been
assigned to the <i>sa</i> account on Microsoft SQL Servers under your
control.</p>
<p>Note that when installing Microsoft SQL 2000 Server, the
application prompts for an <i>sa</i> password. If a null password is
entered, a warning will be displayed, but the application will permit a
null password to be used.</p>
<p>Instructions to change the SQL Server password are located at <br/>
<dl>
<dd><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modadmin/html/deconchangingsqlserveradministratorlogin.asp">
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/</a> <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modadmin/html/deconchangingsqlserveradministratorlogin.asp">modadmin/html/deconchangingsqlserveradministratorlogin.asp</a></dd>
<br/><br/>
<dd><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_1_server_5un8.asp">
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/</a> <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_1_server_5un8.asp">adminsql/ad_1_server_5un8.asp</a></dd>
</dl>
<p>Instructions to change the MSDE password can be found at</p>
<dl>
<dd><a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322336">http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322336</a></dd>
</dl>
<p>Additional information on securing Microsoft SQL Server can be found at<br/>
<dl>
<dd><a href=" http://www.microsoft.com/sql/techinfo/administration/2000/security.asp"> http://www.microsoft.com/sql/techinfo/administration/2000/security.asp</a>
</dd>
</dl>
<h4>Limit access to the SQL Server port</h4>

Packet filtering should be performed at network borders to prohibit
externally initiated inbound connections to non-authorized services.
With regards to SQL Server, ingress filtering of port 1433/tcp could
prevent attackers outside of your network from scanning or infecting
vulnerable Microsoft SQL servers in the local network that are not explicitly
authorized to provide public SQL services.

<p>Filtering packets destined for other services that are not
explicitly required can also prevent intruders from connecting to
backdoors on compromised systems.

<h4>Egress filtering</h4>

Egress filtering manages the flow of traffic as it leaves a network
under your administrative control.  There is typically limited need
for machines providing public services to initiate outbound
connections to the Internet. In the case of the Spida worm, employing egress
filtering to disallow outbound connections to port 1433/tcp at your network
border can help prevent systems on your network from attacking systems elsewhere.
This is only effective against systems that are already infected with the Spida worm.


<h4>Block outgoing email to ixtld@postone.com</h4>
<p>As mentioned in the <a href="#description">Description</a> section
above, the worm attempts to send configuration information and the
local password database to ixtld@postone.com.  Blocking email to this
address can reduce the risk of confidential information being exposed
by the Spida worm.  However, as with the egress filtering
recommendation above, this only blocks systems that are already
infected, so it is not sufficient to block the email without taking
other precautionary steps as described above.</p>
<h3>IV. Additional protection</h3>
<h4>Apply a patch from Microsoft</h4>
<p> Microsoft Corporation has released Microsoft Security Bulletin
MS02-020, which announces the availability of a cumulative patch to
address a variety of problems.  While this patch does not address null
<i>sa</i> passwords, it does fix a number of serious security issues.
We strongly encourage you to read this bulletin and take the
appropriate corrective measures. MS02-020 is available at

<dl><dd>
<a href="http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-020.asp">http://www.microsoft.com/technet/</a> <a href="http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-020.asp">treeview/default.asp?url=/technet/security/bulletin/MS02-020.asp</a>
</dd></dl>
<h2>Reporting</h2>
<p>The CERT/CC is interested in receiving reports of this activity.
If machines under your administrative control are compromised, please
send mail to <a href="mailto:cert@cert.org?Subject=[CERT%2338873]">cert@cert.org</a>
with the following text included in the subject line:
"[CERT#38873]".</p>
<p>
<hr noshade="" width="100%"/>
<b>Author(s)</b>: Chad Dougherty and Allen Householder<br/>
<!--#include virtual="/include/footer_nocopyright.html" -->
<p>Copyright 2002 Carnegie Mellon University.</p>
<p>Revision History
<pre>
May 22, 2002: Initial release
May 23, 2002: Updated systems affected, added link for MSDE password change to Solutions
</pre>
</p></p></p></p></p></p></p></a></a></p></a></a></h4></a></p>