MSSQL attacks examined

Simplified version of the world.

Given the number of attacks reported on mssql, and the data I gathered over the last weeks, I decided to have a look on it.

looking at it

The Tabular Data Stream protocol, which is used by MSSQL Server, provides fields to have the client telling the server his hostname, which application is accessing the database, using which driver. As dionaea can understand the protocol, I decided to log this data as well.

host hostname application driver
122.228.157.82BESTTONE.Net SqlClient Data Provider.Net SqlClient Data Provider
219.139.33.67BXP-4A082E5C0A3 ODBC
222.133.189.12SVCTAG-8GKDF2X.Net SqlClient Data Provider.Net SqlClient Data Provider
58.19.246.245DYSKW ODBC
93.124.98.227CL4Q0HYV3TDVVX0 ODBC
93.84.176.193SCORPIONS ODBC

fingerprints.sql

As you can see, I did not have that many hosts accessing my mssql service, 6 hosts, thats pretty much nothing.

As the authentication is more or less plaintext, it is easy to log usernames & passwords.

no. logins username
2244sa
347root

usernames.sql

I was surprised to see there were only two different usernames, but sa seems to be a 'good default' to use.

I've had 1796 different passwords (passwordcount.sql) which were used to login. The popularity of passwords was not surprising at all:

no. of logins password
21
17123
13sa
13system
111234

passwords.sql

I wanted to know which username received more love,

no. loginsusernameno. passwords
2244sa1795
347root346

userlove.sql

User sa got the lead with more logins and more passwords.

The commands dionaea received were basically … a single command, for all logins.

count command
2465exec sp_server_info 1 exec sp_server_info 2 exec sp_server_info 500 select 501,NULL,1 where 'a'='A' select 504,c.name,c.description,c.definition from master.dbo.syscharsets c,master.dbo.syscharsets c1,master.dbo.sysconfigures f where f.config=123 and f.value=c1.id and c1.csid=c.id set textsize 2147483647 set arithabort on

sqlcommands.sql

I guess they stop exploitation, as dionaea is not able to parse the sql command and compile a proper reply … but as there is only this single query, maybe compile a default reply for this single query ….

I wanted to check if all hosts had similar number of passwords used:

host no. of passwords
93.124.98.2271777
93.84.176.193191
219.139.33.6759
58.19.246.24538
122.228.157.824
222.133.189.124

hostslove.sql

There was one host, taking the lead, and some others doing something.

So, summarizing, it is a limited number of hosts running bruteforce attacks on a large number of hosts.

date hourattackerattacks
2010-08-26 15218.30.64.2548
2010-08-27 13211.154.135.192
2010-08-27 2393.97.222.84327
2010-08-28 1093.124.79.81176
2010-08-29 12219.139.33.6733
2010-08-29 16219.139.33.6737
2010-08-29 1858.19.246.24576
2010-08-29 19219.139.33.6774
2010-08-29 22219.139.33.6775
2010-08-29 2358.19.246.24560
2010-08-30 02219.139.33.6799
2010-08-30 05219.139.33.6799
2010-08-30 05222.133.189.124
2010-08-30 08222.133.189.124
2010-08-31 1393.124.98.22765
2010-08-31 1493.124.98.2271016
2010-08-31 1593.124.98.227824
2010-08-31 1693.124.98.227343
2010-09-01 0093.84.176.193197
2010-09-01 04122.228.157.824
2010-09-01 23122.228.157.824
2010-09-02 19122.228.157.824
2010-09-03 05122.228.157.824

thatsit.sql

Thats it.

SQL queries

In case you want to check your own data, here are the queries I used. If you feel I'm wrong, post your results in the comments, you can use the dokuwiki syntax

fingerprints.sql

SELECT 
	remote_host,
	mssql_fingerprint_hostname,
	mssql_fingerprint_appname,
	mssql_fingerprint_cltintname
FROM 
	mssql_fingerprints 
	NATURAL JOIN connections
WHERE
	local_port = 1433
GROUP BY
	remote_host, mssql_fingerprint_hostname, mssql_fingerprint_appname, mssql_fingerprint_cltintname;

usernames.sql

SELECT
	COUNT(*),
	login_username
FROM
	logins 
GROUP BY
	login_username
ORDER BY
	COUNT(*) DESC;

passwordcount.sql

SELECT
	COUNT(DISTINCT login_password) 
FROM
	logins;

passwords.sql

SELECT
	COUNT(*), 
	login_password
FROM
	logins 
GROUP BY
	login_password 
ORDER BY
	COUNT(*) DESC 
LIMIT
	5;

userlove.sql

SELECT
	COUNT(*),
	login_username,
	COUNT(DISTINCT login_password)
FROM 
	logins 
GROUP BY
	login_username 
ORDER BY 
	COUNT(*) DESC;

sqlcommands.sql

SELECT
	COUNT(*),
	mssql_command_cmd 
FROM
	mssql_commands 
GROUP BY
	mssql_command_cmd;

hostlove.sql

SELECT 
	remote_host,
	COUNT(DISTINCT login_password) 
FROM
	connections 
	NATURAL JOIN logins 
WHERE 
	local_port = 1433 
GROUP BY
	remote_host 
ORDER BY
	COUNT(DISTINCT login_password) DESC;

thatsit.sql

SELECT 
	strftime('%Y-%m-%d %H',connection_timestamp,'unixepoch','localtime') AS date,
	remote_host AS attacker,
	count(*) AS attacks
FROM 
	connections
WHERE
	connection_protocol = 'mssqld' AND connection_type = 'accept'
GROUP BY 
	strftime('%Y-%m-%d %H',connection_timestamp,'unixepoch','localtime'), 
	remote_host
ORDER BY 
	date ASC;

Comments

1

[…] 2010:09:11:mssql_attacks_examined [carnivore news] […]

2010/09/12 02:30


2010/09/11/mssql_attacks_examined.txt · Last modified: 2010/09/12 11:19 by common
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0