-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

===========================================================================
             AUSCERT External Security Bulletin Redistribution

           ESB-2004.0782 -- iDEFENSE Security Advisory 12.16.04
       Samba smbd Security Descriptor Integer Overflow Vulnerability
                             17 December 2004

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           Samba smbd 3.0.8 and prior
Publisher:         iDEFENSE
Operating System:  Linux variants
                   UNIX variants
Impact:            Root Compromise
                   Execute Arbitrary Code/Commands
Access:            Existing Account
CVE Names:         CAN-2004-1154

Original Bulletin: http://www.idefense.com/application/poi/display?id=165

- --------------------------BEGIN INCLUDED TEXT--------------------

Samba smbd Security Descriptor Integer Overflow Vulnerability

iDEFENSE Security Advisory 12.16.04
http://www.idefense.com/application/poi/display?id=165
December 16, 2004

I. BACKGROUND

Samba is an open source implementation of the SMB/CIFS protocol which
allows Windows clients to use resources on non-Windows systems. More
information is available at http://www.samba.org/

II. DESCRIPTION

Remote exploitation of an integer overflow vulnerability in all
versions of Samba's smbd prior to and including 3.0.8 could allow an
attacker to cause controllable heap corruption, leading to execution
of arbitrary commands with root privileges.

To open a file on a Samba server, a client sends a sequence of SMB
messages to the smbd process. The message with the information on the
file to open also contains a security descriptor, which is a list of
access controls to apply to the file. The vulnerability specifically
occurs in the allocation of memory to store these descriptors.

   /*
   * Even if the num_aces is zero, allocate memory as there's a
difference
   * between a non-present DACL (allow all access) and a DACL with no
ACE's
   * (allow no access).
   */
   if((psa->ace = (SEC_ACE *)prs_alloc_mem(ps,sizeof(psa->ace[0]) *
(psa->num_aces+1))) == NULL)
          return False;

When more than 38347922 descriptors are requested, an integer
overflow occurs resulting in less memory being allocated than was
requested. sizeof(psa->ace[0]) is 112, or 0x70 in hex.
0x70x(38347922 + 1)=4294967376, or 0x100000050. This number is larger
than can be stored in a 32-bit integer, so the bits that don't fit
are removed, leaving 0x50, or 80 in decimal. As one descriptor is 112
bytes, an overflow of at least 32 bytes will occur.

An attacker could supply data to the server which would cause the
heap to become corrupted in such a way as to cause arbitrary values
to be written to arbitrary locations, eventually leading to code
execution.

III. ANALYSIS

Successful remote exploitation allows an attacker to gain root
privileges on a vulnerable system. In order to exploit this
vulnerability an attacker would need to have credentials allowing
them access to the a share. Unsuccessful exploitation attempts will
cause the process serving the request to crash with signal 11, and
may leave evidence of an attack in logs.

IV. DETECTION

iDEFENSE Labs have confirmed that Samba 3.0.8 and 2.2.9 are
vulnerable.  Checks made against earlier versions of the source code
suggest that all versions from at least 2.0.0 are also vulnerable to
some minor variation of this vulnerability.

V. WORKAROUND

Employ firewalls, access control lists or other TCP/UDP restriction
mechanisms to limit access to systems and services.

VI. VENDOR RESPONSE

Patches for this issue are available at:

http://www.samba.org/samba/ftp/patches/security/samba-3.0.9-CAN-2004-115
4.patch
http://www.samba.org/samba/ftp/patches/security/samba-3.0.9-CAN-2004-115
4.patch.asc

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
names CAN-2004-1154 to these issues. This is a candidate for inclusion
in the CVE list (http://cve.mitre.org), which standardizes names for
security problems.

VIII. DISCLOSURE TIMELINE

12/02/2004  Initial vendor notification
12/02/2004  Initial vendor response
12/16/2004  Coordinated public disclosure

IX. CREDIT

This vulnerability was discovered by Greg MacManus, iDEFENSE Labs.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

X. LEGAL NOTICES

Copyright (c) 2004 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically,
please email customerservice@idefense.com for permission.

Disclaimer: The information in the advisory is believed to be
accurate at the time of publishing based on currently available
information. Use of the information constitutes acceptance for use in
an AS IS condition. There are no warranties with regard to this
information. Neither the author nor the publisher accepts any
liability for any direct, indirect, or consequential loss or damage
arising from use of, or reliance on, this information.

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

If you believe that your computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================

-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBQcIzAyh9+71yA2DNAQJ1sgP9FhNlmJLmZBWJiBQvo2bhIn1+nwO+nFor
9OEXdvtq08l7n/ZSjRqzFZfZwtcCrtrcqfI81P/euFsswzMg7VoEnfvrJnxPwWJx
5X9a6M6+OcNaVel8lOGNkogpiW4hZqj5OMTaXR33v+T+5SzM8NYM+Y0L2ezcoZ2M
UwtCX3k2vWo=
=UPQi
-----END PGP SIGNATURE-----