Your Guide to Broadband SG Chat SG Security Scan  

Go Back   SpeedGuide.net Broadband Community > Broadband & Networking > Network Security

Reply
 
Thread Tools Display Modes
Old 01-25-03, 08:19 AM   #1
Jon
Advanced Member
 
Jon's Avatar
 
Join Date: Jun 2000
Location: 3rd rock from the sun
Posts: 885
Jon has disabled reputation
port 1434 scans

I've got almost 300 scans from various IP's to port 1434 in just the past hour. Started at 7am est.

What gives????

I am not running an sql server.

tia
Jon
Jon is offline   Reply With Quote
Old 01-25-03, 11:31 AM   #2
greEd
Security Specialist
 
greEd's Avatar
 
Join Date: May 2001
Location: Maryland
Posts: 806
greEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura about
Send a message via AIM to greEd
scanning.

Summary
Microsoft's database server SQL Server 2000 exhibits two buffer-overrun vulnerabilities that can be exploited by a
remote attacker without ever having to authenticate to the server. What further exacerbates these issues is that the
attack is channeled over UDP. Whether the SQL Server process runs in the security context of a domain user or the local
SYSTEM account, successful exploitation of these security holes will mean a total compromise of the target server and
its data.


Details
SQL Server can be configured to listen for incoming client connections in several different ways. It can be configured
such that clients can use named pipes over a NetBIOS session (TCP port 139/445) or sockets with clients connecting to
TCP port 1433 or both. Whichever method is used the SQL Server will always listen on UDP port 1434. This port is
designated as the Microsoft SQL Monitor port and clients will send a message to this port to dynamically discover how
the client should connect to the Server. This message is a single byte packet, the byte being 0x02.

There are other messages that can be sent to this port and these can be worked out with simple experimentation.

Stack Based Buffer Overflow:
When SQL Server receives a packet on UDP port 1434 with the first byte set to 0x04, the SQL Monitor thread takes the
remaining data in the packet and attempts to open a registry key using this user supplied information. For example, by
sending \x04\x41\x41\x41\x41 (0x04 followed by 4 upper case 'A's) SQL Server attempts to open

HKLM\Software\Microsoft\Microsoft SQL Server\AAAA\MSSQLServer\CurrentVersion

By appending a large number of bytes to the end of this packet, whilst preparing the string for the registry key to
open, a stack-based buffer is overflowed and the saved return address is overwritten. This allows an attacker to gain
complete control of the SQL Server process and its path of execution. By overwriting the saved return address on the
stack with an address that contains a "jmp esp" or "call esp" instruction, when the
vulnerable procedure returns the processor will start executing code of the attacker's choice. At no stage does the
attacker need to authenticate.

Heap Based Buffer Overflow:
When SQL Server receives a packet on UDP port 1434 with the first byte set to 0x08 followed by an overly long string,
followed by a colon character ( and number a heap based buffer is overflowed. As this corrupts the structures used to
keep track of the heap, an attacker can overwrite any location in memory with 4 bytes of their own choosing. This can
be used to gain remote control of the processes execution. If the colon and number are missing, the SQL Server process
access violates before the heap is corrupted as the code in the SQL Monitor thread fails to handle exceptions.

For example the code calls the C function strtok(). The strtok() functions looks for a given token in a string, in this
case a colon, and if found returns a pointer to it. If the colon is missing in the string being searched then no
pointer is returned. This is one of the reasons why the SQL Server process access violates if the colon is missing. The
code does not check to see if a valid pointer has been returned before passing it to another function call, atoi():

char *ptr=NULL;
int num=0;
..
ptr = strtok(string,":");
num = atoi(ptr); // ptr is used without being validated

Failure to check return values and handle exceptions leads to the process dying, leading to a simple Denial of Service
attack. That said, in the light of the overflows, the DoS is the least of the problems.

Network Based Denial of Service:
When an SQL Server receives a single byte packet, 0x0A, on UDP port 1434 it will reply to the sender with 0x0A. A
problem arises as SQL Server will respond, sending a 'ping' response to the source IP address and source port.
This 'ping' is a single byte UDP packet - 0x0A. By spoofing a packet from one SQL Server, setting the UDP port to
1434, and sending it a second SQL Server, the second will respond to the first's UDP port 1434. The first will then
reply to the second's UDP port 1434 and so on. This causes a storm of single byte pings between the two servers.
Only when one of the servers is disconnected from the network or its SQL service is stopped will the storm stop. This
is a simple network based DoS, reminiscent of the echo and chargen DoSes discussed back in 1996
(http://www.cert.org/advisories/CA-1996-01.html). When in this state, the load on each SQL Server is raised to c. 40 -
60 % CPU time.

Considerations for protection against these vulnerabilities:
Exploitation of these security holes goes over UDP, a connection-less communications protocol. As such, it makes the
task of bypassing the protection offered by a firewall considerably easier. The spoofing of an IP address in a UDP
packet is also considerably easier.

It is trivial for an attacker to send an attack through the firewall, setting the source IP address to that of the
target's DNS Server and the source port to 53. Most firewalls will allow this packet through, as it will look like a
response to a query to resolve a domain name.

It is strongly recommended that a rule be added to each organization's firewall such that any packet destined for
UDP port 1434 on the 'clean' side of the firewall be dropped and logged. No host, even DNS Servers, should be
allowed to send traffic to this port.

It is also recommend that firewall administrators ensure that any packet received on the 'dirty' interface with a
source IP address set to an address on the clean side is also dropped and logged.

Fix Information:
NGSSoftware alerted Microsoft to this problem on 17 May 2002 and they have produced a patch that resolves these issues.
NGSSoftware urge all customers of SQL Server 2000 to test then apply these fixes as soon as possible.

http://www.microsoft.com/technet/tre...n/MS02-039.asp

Where possible, NGSSoftware also recommend running the SQL Server as low privileged local account and not SYSTEM or a
domain account.


Additional information
The information has been provided by NGSSoftware Insight Security Research.
__________________
Quote:
"I'm doing a (free) operating system (just a hobby, won't be big and professional...) for AT clones... It's not portable and it probably [won't ever] support anything other than AT hard disks, as thats all I have :-(." --Posted on Usenet August 1991 by Linus Trovalds
http://www.computerglitch.net
curiosity builds security | dd if=/dev/zero of=/dev/hda bs=512 count=100
EOF
greEd is offline   Reply With Quote
Old 01-26-03, 11:01 AM   #3
blebs
Demented
 
blebs's Avatar
 
Join Date: Dec 2000
Location: North Canton, Ohio
Posts: 11,568
blebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond reputeblebs [4000+] has a reputation beyond repute
Simple terms-Internet is being attacked.
You can read more here if you'd like.

http://63.217.30.71/showthread.php?s=&threadid=104299
blebs is online now   Reply With Quote
Old 01-27-03, 08:21 AM   #4
greEd
Security Specialist
 
greEd's Avatar
 
Join Date: May 2001
Location: Maryland
Posts: 806
greEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura aboutgreEd [500+] has a spectacular aura about
Send a message via AIM to greEd
Quote:
Originally posted by blebs99
Simple terms-Internet is being attacked.
You can read more here if you'd like.

http://63.217.30.71/showthread.php?s=&threadid=104299
or you could explain sum it up like that
__________________
Quote:
"I'm doing a (free) operating system (just a hobby, won't be big and professional...) for AT clones... It's not portable and it probably [won't ever] support anything other than AT hard disks, as thats all I have :-(." --Posted on Usenet August 1991 by Linus Trovalds
http://www.computerglitch.net
curiosity builds security | dd if=/dev/zero of=/dev/hda bs=512 count=100
EOF
greEd is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:01 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.