TUCoPS :: Networks :: n-055.txt

Samba smdb Buffer Overrun Vulnerability (CIAC N-055)

             __________________________________________________________

                       The U.S. Department of Energy
                   Computer Incident Advisory Capability
                           ___  __ __    _     ___
                          /       |     /_\   /
                          \___  __|__  /   \  \___
             __________________________________________________________

                             INFORMATION BULLETIN

                    Samba smbd Buffer Overrun Vulnerability
                             [Samba 2.2.8 Upgrade]

March 17, 2003 19:00 GMT                                          Number N-055
[REVISED June 2, 2003]
______________________________________________________________________________
PROBLEM:       A buffer overrun condition exists in the SMB/CIFS packet 
               fragment re-assembly code in Samba's smbd which would allow an 
               attacker to cause smbd to overwrite arbitrary areas of memory 
               in its own process address space. This could allow a skilled 
               attacker to inject binary specific exploit code into smbd. 
PLATFORM:      Samba 2.0.x to 2.2.7a inclusive. 
DAMAGE:        An external attacker could remotely and anonymously gain Super 
               User (root) privileges. 
SOLUTION:      If you are running Samba 2.2.7 or above apply the appropriate 
               patch. If you are running an earlier version of Samba, upgrade 
               to version 2.2.8 or prohibit external access to TCP ports 139 
               and 445. 
______________________________________________________________________________
VULNERABILITY  The risk is HIGH. The SMB/CIFS protocol implemented by Samba is 
ASSESSMENT:    vulnerable to many attacks, even without specific security 
               holes. The details of this vulnerability have been distributed 
               via the Internet. 
______________________________________________________________________________
LINKS: 
 CIAC BULLETIN:      http://www.ciac.org/ciac/bulletins/n-055.shtml 
 ORIGINAL BULLETIN:  http://www.samba.org/samba/whatsnew/samba-2.2.8.html 
 ADDITIONAL          Sun Alert #53580 - patches for Solaris 9
 INFORMATION:        http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsalert%
                          2F53580&zone_32=category%3Asecurity
______________________________________________________________________________

Revision History
6/2/03 - added link to Sun Alert #53580 for information on Solaris 9 patches.


[***** Start Samba 2.2.8 Upgrade *****]


The Samba Team announces Samba 2.2.8

****************************************
* IMPORTANT: Security bugfix for Samba *
****************************************

This release provides an important security fix outlined in the
release notes that follow. This is the latest stable release of
Samba and the version that all production Samba servers should be
running for all current bug-fixes.

The source code can be downloaded from :

http://download.samba.org/samba/ftp/

in the file samba-2.2.8.tar.gz or samba-2.2.8.tar.bz2.
Both archives have been signed using the Samba Distribution Key.

Binary packages will be released shortly for major platforms and
can be found at

http://download.samba.org/samba/ftp/Binary_Packages/

As always, all bugs are our responsibility.

--Sincerely
The Samba Team


Summary
-------

The SuSE security audit team, in particular Sebastian 
Krahmer, has found a flaw in the Samba main smbd code which
could allow an external attacker to remotely and anonymously gain
Super User (root) privileges on a server running a Samba server.

This flaw exists in previous versions of Samba from 2.0.x to 2.2.7a
inclusive.  This is a serious problem and all sites should either
upgrade to Samba 2.2.8 immediately or prohibit access to TCP ports 139
and 445. Advice created by Andrew Tridgell, the leader of the Samba Team,
on how to protect an unpatched Samba server is given at the end of this
section.

The SMB/CIFS protocol implemented by Samba is vulnerable to many
attacks, even without specific security holes.  The TCP ports 139 and
the new port 445 (used by Win2k and the Samba 3.0 alpha code in
particular) should never be exposed to untrusted networks.

Description
-----------

A buffer overrun condition exists in the SMB/CIFS packet fragment
re-assembly code in smbd which would allow an attacker to cause smbd
to overwrite arbitrary areas of memory in its own process address
space. This could allow a skilled attacker to inject binary specific
exploit code into smbd.

This version of Samba adds explicit overrun and overflow checks on
fragment re-assembly of SMB/CIFS packets to ensure that only valid
re-assembly is performed by smbd.

In addition, the same checks have been added to the re-assembly
functions in the client code, making it safe for use in other
services.

Credit
------

This security flaw was discovered and reported to the Samba Team by
Sebastian Krahmer  of the SuSE Security Audit Team.
The fix was prepared by Jeremy Allison and reviewed by engineers from
the Samba Team, SuSE, HP, SGI, Apple, and the Linux vendor engineers
on the Linux Vendor security mailing list.

The Samba Team would like to thank SuSE and Sebastian Krahmer for
their excellent auditing work and for drawing attention to this flaw.

Patch Availability
-----------------

As this is a security issue, patches for this flaw specific to earlier
versions of Samba will be posted on the samba-technical@samba.org
mailing list as requested.


************************************
Protecting an unpatched Samba server
************************************

Samba Team, March 2003

This is a note on how to provide your Samba server some
protection against the recently discovered remote security
hole if you are unable to upgrade to the fixed version
immediately. Even if you do upgrade you might like to think
about the suggestions in this note to provide you with
additional levels of protection.


Using host based protection
---------------------------

In many installations of Samba the greatest threat comes for
outside your immediate network. By default Samba will accept
connections from any host, which means that if you run an
insecure version of Samba on a host that is directly
connected to the Internet you can be especially vulnerable.

One of the simplest fixes in this case is to use the 'hosts
allow' and 'hosts deny' options in the Samba smb.conf
configuration file to only allow access to your server from a
specific range of hosts. An example might be:


hosts allow = 127.0.0.1 192.168.2.0/24 192.168.3.0/24
hosts deny = 0.0.0.0/0

The above will only allow SMB connections from 'localhost'
(your own computer) and from the two private networks
192.168.2 and 192.168.3. All other connections will be
refused connections as soon as the client sends its first
packet. The refusal will be marked as a 'not listening on
called name' error.


Using interface protection
--------------------------

By default Samba will accept connections on any network
interface that it finds on your system. That means if you
have a ISDN line or a PPP connection to the Internet then
Samba will accept connections on those links. This may not be
what you want.

You can change this behavior using options like the
following:

interfaces = eth* lo
bind interfaces only = yes

that tells Samba to only listen for connections on interfaces
with a name starting with 'eth' such as eth0, eth1, plus on
the loopback interface called 'lo'. The name you will need to
use depends on what OS you are using. In the above I used the
common name for ethernet adapters on Linux.

If you use the above and someone tries to make a SMB
connection to your host over a PPP interface called 'ppp0',
they will get a TCP connection refused reply. In that
case no Samba code is run at all as the operating system has
been told not to pass connections from that interface to any
process.


Using a firewall
----------------

Many people use a firewall to deny access to services that
they don't want exposed outside their network. This can be a
very good idea, although I would recommend using it in
conjunction with the above methods so that you are protected
even if your firewall is not active for some reason.

If you are setting up a firewall then you need to know what
TCP and UDP ports to allow and block. Samba uses the
following:

                     UDP/137    - used by nmbd
                     UDP/138    - used by nmbd
                     TCP/139    - used by smbd
                     TCP/445    - used by smbd

The last one is important as many older firewall setups may
not be aware of it, given that this port was only added to
the protocol in recent years.


Using a IPC$ share deny
-----------------------

If the above methods are not suitable, then you could also
place a more specific deny on the IPC$ share that is used in
the recently discovered security hole. This allows you to
offer access to other shares while denying access to IPC$
from potentially untrustworthy hosts.

To do that you could use:

  [ipc$]
  hosts allow = 192.168.115.0/24 127.0.0.1
  hosts deny = 0.0.0.0/0

this would tell Samba that IPC$ connections are not allowed
from anywhere but the two listed places (localhost and a
local subnet). Connections to other shares would still be
allowed. As the IPC$ share is the only share that is always
accessible anonymously this provides some level of protection
against attackers that do not know a username/password for
your host.


If you use this method then clients will be given a 'access
denied' reply when they try to access the IPC$ share. That
means that those clients will not be able to browse shares,
and may also be unable to access some other resources.

I don't recommend this method unless you cannot use one of
the other methods listed above for some reason.


Upgrading Samba
---------------

Of course the best solution is to upgrade Samba to a version
where the bug has been fixed. If you wish to also use one of
the additional measures above then that would certainly be a
good idea.

Please check regularly on http://www.samba.org/ for updates
and important announcements.


****************************************
****************************************


[***** End Samba 2.2.8 Upgrade *****]
_______________________________________________________________________________

CIAC wishes to acknowledge the contributions of Samba for the 
information contained in this bulletin.
_______________________________________________________________________________


CIAC, the Computer Incident Advisory Capability, is the computer
security incident response team for the U.S. Department of Energy
(DOE) and the emergency backup response team for the National
Institutes of Health (NIH). CIAC is located at the Lawrence Livermore
National Laboratory in Livermore, California. CIAC is also a founding
member of FIRST, the Forum of Incident Response and Security Teams, a
global organization established to foster cooperation and coordination
among computer security teams worldwide.

CIAC services are available to DOE, DOE contractors, and the NIH. CIAC
can be contacted at:
    Voice:    +1 925-422-8193 (7x24)
    FAX:      +1 925-423-8002
    STU-III:  +1 925-423-2604
    E-mail:   ciac@ciac.org

Previous CIAC notices, anti-virus software, and other information are
available from the CIAC Computer Security Archive.

   World Wide Web:      http://www.ciac.org/
   Anonymous FTP:       ftp.ciac.org

PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing
communities receive CIAC bulletins.  If you are not part of these
communities, please contact your agency's response team to report
incidents. Your agency's team will coordinate with CIAC. The Forum of
Incident Response and Security Teams (FIRST) is a world-wide
organization. A list of FIRST member organizations and their
constituencies can be obtained via WWW at http://www.first.org/.

This document was prepared as an account of work sponsored by an
agency of the United States Government. Neither the United States
Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any
legal liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process
disclosed, or represents that its use would not infringe privately
owned rights. Reference herein to any specific commercial products,
process, or service by trade name, trademark, manufacturer, or
otherwise, does not necessarily constitute or imply its endorsement,
recommendation or favoring by the United States Government or the
University of California. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the United States
Government or the University of California, and shall not be used for
advertising or product endorsement purposes.

LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC)

N-045: Red Hat Updated PAM packages fix bug in pam_xauth Module
N-046: Multiple Vulnerabilities in Oracle Servers
N-047: Microsoft Windows ME Help and Support Center Vulnerability
N-048: SendMail MTA Vulnerability
N-049: Snort RPC Preprocessing Vulnerability
N-050: Sun sendmail(1M) ".forward" Constructs Vulnerability
N-051: Red Hat Updated OpenSSL Packages Fix Timing Attack
N-052: PeopleSoft PeopleTools Remote Command Execution Vulnerability
N-053: Increased Activity Targeting Microsoft Windows Shares
N-054: Unchecked Buffer in Windows Component Could Cause Web Server Compromise




TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH