SkipNavigation
US-CERT
American Flag
  Vulnerability
Notes
Database

Search Vulnerability Notes

Vulnerability Notes Help Information


 
 View Notes By
  Name

ID Number

CVE Name

Date Public

Date Published

Date Updated

Severity Metric



 Other Documents
  Technical Alerts

Technical Bulletins

Alerts

Security Tips

Vulnerability Note VU#267873

Samba contains multiple buffer overflows

Overview

Samba contains several buffer overflow vulnerabilitites. At least one of these vulnerabilities could allow an unauthenticated, remote attacker to execute arbitrary code or cause a denial of service.

I. Description

Samba is a widely used open-source implementation of Server Message Block (SMB)/Common Internet File System (CIFS). Samba-TNG is a forked development branch of Samba. SMB/CIFS is used in Microsoft Windows to provide file and print services. Samba versions prior to 2.2.8a and Samba-TNG versions prior to 0.3.2 contain several buffer overflow vulnerabilities.

A stack overflow in the function trans2open() (in trans2.c) has been assigned CAN-2003-0201. An exploit for this vulnerability has been publicly released.

After the trans2open() issue was reported, the Samba Team discovered and fixed several other buffer overflow vulnerabilities (in statcache.c, reply.c, and password.c). These vulnerabilities have been assigned CAN-2003-0196.

These vulnerabilities are different than the packet fragment re-assembly problem discussed in VU#298233 (CAN-2003-0085).

II. Impact

An unauthenticated, remote attacker could execute arbitrary code or cause a denial of service. The Samba daemon (smbd) runs with root privileges, so an attacker could gain complete control of a vulnerable system.

III. Solution

Patch or Upgrade

    Upgrade or apply a patch as specified by your vendor.
    Upgrade or patch to Samba 2.2.8a or Samba-TNG 0.3.2.
Block or Restrict Access
    Block or restrict access to Samba services from untrusted networks such as the Internet. The Samba Team announcement for version 2.2.8 contains excellent recommendations for restricting access to Samba servers:

    ************************************
    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.

Systems Affected

VendorStatusDate NotifiedDate Updated
Apple Computer Inc.Vulnerable11-Apr-2003
ConectivaVulnerable9-Apr-2003
Cray Inc.Unknown10-Apr-2003
Data GeneralUnknown10-Apr-2003
DebianVulnerable9-Apr-2003
FreeBSDVulnerable9-Apr-2003
FujitsuUnknown9-Apr-2003
Gentoo LinuxVulnerable10-Apr-2003
Guardian Digital Inc. Unknown10-Apr-2003
Hewlett-Packard CompanyVulnerable10-Apr-2003
IBMVulnerable10-Apr-2003
Ingrian NetworksNot Vulnerable10-Apr-2003
MandrakeSoftVulnerable9-Apr-2003
MontaVista SoftwareVulnerable10-Apr-2003
NEC CorporationUnknown9-Apr-2003
NetBSDUnknown9-Apr-2003
NokiaUnknown9-Apr-2003
OpenBSDVulnerable14-Apr-2003
OpenPKGVulnerable9-Apr-2003
Openwall GNU/*/LinuxUnknown9-Apr-2003
Red Hat Inc.Vulnerable10-Apr-2003
Samba-TNGVulnerable10-Apr-2003
Samba TeamVulnerable10-Apr-2003
SCOVulnerable15-May-2003
SequentUnknown9-Apr-2003
SGIVulnerable9-Apr-2003
SlackwareVulnerable10-Apr-2003
Sony CorporationUnknown9-Apr-2003
Sorceror LinuxVulnerable9-Apr-2003
Sun Microsystems Inc.Vulnerable3-Jul-2003
SuSE Inc.Vulnerable9-Apr-2003
TrustixVulnerable9-Apr-2003
UnisysUnknown10-Apr-2003
Wind River Systems Inc.Unknown9-Apr-2003
WirexVulnerable9-Apr-2003

References

VU#298233
http://lists.samba.org/pipermail/samba-announce/2003-April/000065.html
http://lists.samba.org/pipermail/samba-announce/2003-March/000063.html
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2003-0201
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2003-0196
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2003-0085
http://www.kb.cert.org/vuls/id/298233
http://archives.neohapsis.com/archives/vulnwatch/2003-q2/0008.html
http://www.samba-tng.org/download/tng/announcement-0.3.2.txt
http://www.samba-tng.org/
http://www.samba.org/
http://www.securityfocus.com/bid/7294

Credit

This vulnerability was publicly reported by Erik Parker of Digital Defense Inc.

This document was written by Art Manion.

Other Information

Date Public:2003-04-07
Date First Published:2003-04-10
Date Last Updated:2003-07-10
CERT Advisory: 
CVE-ID(s):CAN-2003-0201
NVD-ID(s):CAN-2003-0201
US-CERT Technical Alerts: 
Metric:20.48
Document Revision:22

If you have feedback, comments, or additional information about this vulnerability, please send us email.
 

 
Page Corner Image
Copyright 2003 Carnegie Mellon University
Disclaimers and copyright information
Get Adobe Reader Get Adobe Reader