Bug 1429472 (CVE-2017-2619) - CVE-2017-2619 samba: symlink race permits opening files outside share directory
Summary: CVE-2017-2619 samba: symlink race permits opening files outside share directory
Status: NEW
Alias: CVE-2017-2619
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
(Show other bugs)
Version: unspecified
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard: impact=moderate,public=20170323,repor...
Keywords: Security
Depends On: 1430260 1435156 1435158 1437741 1469906 1491210 1491211
Blocks: 1429474 1488198
TreeView+ depends on / blocked
 
Reported: 2017-03-06 12:51 UTC by Siddharth Sharma
Modified: 2018-03-12 09:50 UTC (History)
16 users (show)

Fixed In Version: samba 4.6.1, samba 4.5.7, samba 4.4.11
Doc Type: If docs needed, set a value
Doc Text:
A race condition was found in samba server. A malicious samba client could use this flaw to access files and directories in areas of the server file system not exported under the share definitions.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1265 normal SHIPPED_LIVE Moderate: samba security and bug fix update 2017-05-22 14:25:41 UTC
Red Hat Product Errata RHSA-2017:2338 normal SHIPPED_LIVE Moderate: samba security update 2017-08-01 11:46:05 UTC
Red Hat Product Errata RHSA-2017:2778 normal SHIPPED_LIVE Moderate: samba security, bug fix, and enhancement update 2017-09-21 08:16:42 UTC
Red Hat Product Errata RHSA-2017:2789 normal SHIPPED_LIVE Moderate: samba security update 2017-09-21 18:18:01 UTC

Description Siddharth Sharma 2017-03-06 12:51:47 UTC
As per upstream advisory:


All versions of Samba prior to 4.6.1, 4.5.7, 4.4.11 are vulnerable to a malicious client using a symlink race to allow access to areas of the server file system not exported under the share definition.

Samba uses the realpath() system call to ensure when a client requests access to a pathname that it is under the exported share path on the server file system.

Clients that have write access to the exported part of the file system via SMB1 unix extensions or NFS to create symlinks can race the server by renaming a realpath() checked path and then creating a symlink. If the client wins the race it can cause the server to access the new symlink target after the exported share path check has been done. This new symlink target can point to anywhere on the server file system.

This is a difficult race to win, but theoretically possible. Note that the proof of concept code supplied wins the race reliably only when the server is slowed down using the strace utility running on the server. Exploitation of this bug has not been seen in the wild.

Mitigation:

Add the parameter:

unix extensions = no

to the [global] section of your smb.conf and restart smbd. This prevents SMB1 clients from creating symlinks on the exported file system using SMB1.

However, if the same region of the file system is also exported using NFS, NFS clients can create symlinks that potentially can also hit the race condition. For non-patched versions of Samba we recommend only exporting areas of the file system by either SMB or NFS, not both.


Acknowledgements:

Name: the Samba project
Upstream: Jann Horn (Google)

Comment 2 Huzaifa S. Sidhpurwala 2017-03-23 09:51:17 UTC
Created samba tracking bugs for this issue:

Affects: fedora-all [bug 1435156]

Comment 4 Andrej Nemec 2017-03-23 10:28:33 UTC
External References:

https://www.samba.org/samba/security/CVE-2017-2619.html

Comment 6 errata-xmlrpc 2017-05-22 10:26:22 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2017:1265 https://access.redhat.com/errata/RHSA-2017:1265

Comment 9 errata-xmlrpc 2017-08-01 07:47:24 UTC
This issue has been addressed in the following products:

  Red Hat Gluster Storage 3.2 for RHEL 7

Via RHSA-2017:2338 https://access.redhat.com/errata/RHSA-2017:2338

Comment 14 errata-xmlrpc 2017-09-21 04:46:47 UTC
This issue has been addressed in the following products:

  Red Hat Gluster Storage 3.3 for RHEL 6

Via RHSA-2017:2778 https://access.redhat.com/errata/RHSA-2017:2778

Comment 15 errata-xmlrpc 2017-09-21 14:19:18 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6

Via RHSA-2017:2789 https://access.redhat.com/errata/RHSA-2017:2789

Comment 16 Christian Wiese 2018-01-22 15:07:30 UTC
This has caused two regressions:

1. When using "follow symlinks = no", all directories below the top level appear empty.
https://bugzilla.redhat.com/show_bug.cgi?id=1495148 (dupe describing the issue)
https://bugzilla.redhat.com/show_bug.cgi?id=1509455 (non-public)

2. Even with "follow symlinks = yes", following symlinks is no longer possible.
https://bugzilla.samba.org/show_bug.cgi?id=12721


These appear to have been fixed upstream already.
Can you please adopt the upstream fixes, particularly for RHEL 6?


Thank you.

Comment 17 Andreas Schneider 2018-03-12 09:50:21 UTC
This has already been addressed and will be fixed in RHEL 6.10


Note You need to log in before you can comment on or make changes to this bug.