Bug 1126010 (CVE-2014-3560)

Summary: CVE-2014-3560 samba: remote code execution in nmbd
Product: [Other] Security Response Reporter: Vincent Danen <vdanen>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: aavati, abokovoy, asn, bressers, gdeschner, jlayton, jrusnack, jsmith.fedora, nlevinki, rfortier, rhs-bugs, sbose, shaines, smohan, ssaha, ssorce, vbellur
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: samba 4.1.11, samba 4.0.21 Doc Type: Bug Fix
Doc Text:
A heap-based buffer overflow flaw was found in Samba's NetBIOS message block daemon (nmbd). An attacker on the local network could use this flaw to send specially crafted packets that, when processed by nmbd, could possibly lead to arbitrary code execution with root privileges.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-05 20:13:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1126011, 1126012, 1126013, 1126014, 1126015, 1126022, 1126023    
Bug Blocks: 1126016    

Description Vincent Danen 2014-08-01 15:16:57 UTC
As reported in the upstream advisory and bugzilla [1]:

All current versions of Samba 4.x.x are vulnerable to a remote code execution vulnerability in the nmbd NetBIOS name services daemon.

A malicious browser can send packets that may overwrite the heap of the target nmbd NetBIOS name services daemon. It may be possible to use this to generate a remote code execution vulnerability as the superuser (root).

Patches are available for 4.1.x [2] and 4.0.x [3].

[1] https://bugzilla.samba.org/show_bug.cgi?id=10735
[2] https://git.samba.org/?p=samba.git;a=commitdiff;h=e6a848630da3ba958c442438ea131c99fa088605
[3] https://git.samba.org/?p=samba.git;a=commitdiff;h=fb1d325d96dfe9bc2e9c4ec46ad4c55e8f18f4a2


External References:

https://www.samba.org/samba/security/CVE-2014-3560


Statement:

This issue did not affect the versions of samba or samba3x as shipped with Red Hat Enterprise Linux 5, and the versions of samba as shipped with Red Hat Enterprise Linux 6, as it only affected Samba 4.0.0 and higher.

Comment 3 Vincent Danen 2014-08-01 15:18:29 UTC
Created samba tracking bugs for this issue:

Affects: fedora-all [bug 1126015]

Comment 5 Josh Bressers 2014-08-01 17:10:33 UTC
We are rating this issue as Important.

To exploit this issue the following conditions must be met:
nmbd must be running on the target host and listening to the network.
An attacker must have local network access.
An attacker must be able to run a fake SMB master on the network.

If a host is running nmbd on the public internet, this cannot be exploited by network traffic from a different subnet.

Comment 6 Tomas Hoger 2014-08-04 06:12:41 UTC
This issue was introduced via the following upstream commit:

https://git.samba.org/?p=samba.git;a=commitdiff;h=d25370fb477dd733fae6c1ee1a67e32a78236779

Comment 7 Tomas Hoger 2014-08-04 07:39:49 UTC
Note that the commit linked in comment 6 introduced the same bug in both unstrcpy() and nstrcpy() macros.  Only unstrcpy() was corrected by patches linked in comment 0.  The nstrcpy() bug has not security impact, as that macro is not used anywhere in the Samba source code.

Comment 8 Tomas Hoger 2014-08-04 11:14:42 UTC
(In reply to Tomas Hoger from comment #7)
> Note that the commit linked in comment 6 introduced the same bug in both
> unstrcpy() and nstrcpy() macros.  Only unstrcpy() was corrected by patches
> linked in comment 0.  The nstrcpy() bug has not security impact, as that
> macro is not used anywhere in the Samba source code.

nstrcpy() was removed upstream via:

https://git.samba.org/?p=samba.git;a=commitdiff;h=fb9d8c402614556d7a36f9e9efb72b3f4afe838a

Comment 9 Martin Prpič 2014-08-05 08:42:27 UTC
IssueDescription:

A heap-based buffer overflow flaw was found in Samba's NetBIOS message block daemon (nmbd). An attacker on the local network could use this flaw to send specially crafted packets that, when processed by nmbd, could possibly lead to arbitrary code execution with root privileges.

Comment 10 errata-xmlrpc 2014-08-05 18:58:19 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2014:1009 https://rhn.redhat.com/errata/RHSA-2014-1009.html

Comment 11 errata-xmlrpc 2014-08-05 20:01:23 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 7

Via RHSA-2014:1008 https://rhn.redhat.com/errata/RHSA-2014-1008.html