Bug 1553553 (CVE-2018-1057) - CVE-2018-1057 samba: Authenticated users can change other users password in an AD DC configuration
Summary: CVE-2018-1057 samba: Authenticated users can change other users password in a...
Keywords:
Status: CLOSED NOTABUG
Alias: CVE-2018-1057
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1554756
Blocks: 1553554
TreeView+ depends on / blocked
 
Reported: 2018-03-09 03:38 UTC by Huzaifa S. Sidhpurwala
Modified: 2021-02-17 00:39 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the way Samba AD DC validated user permissions. An authenticated attacker could use this flaw to change any other users passwords, including administrative users.
Clone Of:
Environment:
Last Closed: 2018-03-13 10:16:25 UTC
Embargoed:


Attachments (Terms of Use)

Description Huzaifa S. Sidhpurwala 2018-03-09 03:38:58 UTC
As per samba upstream advisory:

On a Samba 4 AD DC the LDAP server in all versions of Samba from 4.0.0 onwards incorrectly validates permissions to modify passwords over LDAP allowing authenticated users to change any other users passwords, including administrative users.

Comment 3 Huzaifa S. Sidhpurwala 2018-03-09 03:45:51 UTC
Upstream describes the following workaround:

Rewoke the change passwords right for everyone from all user objects (including
computers) in the directory. Note that this will prevent users from being able
to change their own expired passwords, so the maximum password age should be set
to a value that prevents user passwords from expiring while the workaround is in
place.

The change password right in AD is an extended object access right with the GUID
ab721a53-1e2f-11d0-9819-00aa0040529b. By default every user and computer object
in the directory grants the change password right to self and everyone.

The corresponding ACEs are

self:  (OA;;CR;ab721a53-1e2f-11d0-9819-00aa0040529b;;PS)
world: (OA;;CR;ab721a53-1e2f-11d0-9819-00aa0040529b;;WD)

in SDDL. The components of these ACEs are

OA: object access allowed
CR: extended rights
PS,WD: trustee: self, everyone

Of these, the ACE granting the right to everyone (world, WD) must be removed.

The ACL of any object in the Samba directory can be shown as SDDL with

# ldbsearch -H /var/lib/samba/private/sam.ldb cn=USER ntSecurityDescriptor

Alternatively, the ACL can be shown in NDR dump format by appending
"--show-binary":

# ldbsearch -H /var/lib/samba/private/sam.ldb \
  cn=USER ntSecurityDescriptor --show-binary
...
aces: struct security_ace
    type                     : SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT (5)
    flags                    : 0x00 (0)
           0: SEC_ACE_FLAG_OBJECT_INHERIT
           0: SEC_ACE_FLAG_CONTAINER_INHERIT
           0: SEC_ACE_FLAG_NO_PROPAGATE_INHERIT
           0: SEC_ACE_FLAG_INHERIT_ONLY
           0: SEC_ACE_FLAG_INHERITED_ACE
        0x00: SEC_ACE_FLAG_VALID_INHERIT (0)
           0: SEC_ACE_FLAG_SUCCESSFUL_ACCESS
           0: SEC_ACE_FLAG_FAILED_ACCESS
    size                     : 0x0028 (40)
    access_mask              : 0x00000100 (256)
    object                   : union security_ace_object_ctr(case 5)
    object: struct security_ace_object
        flags                    : 0x00000001 (1)
               1: SEC_ACE_OBJECT_TYPE_PRESENT
               0: SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
        type                     : union security_ace_object_type(case 1)
        type                     : ab721a53-1e2f-11d0-9819-00aa0040529b
        inherited_type           : union security_ace_object_inherited_type(case 0)
    trustee                  : S-1-1-0
...

To temporarily remove this ACE you can use ldbedit:

# ldbedit -H /var/lib/samba/private/sam.ldb cn=USER ntSecurityDescriptor

This invokes the configured editor. In the editor search for the string

  (OA;;CR;ab721a53-1e2f-11d0-9819-00aa0040529b;;WD)

and remove it (be careful about line wraps). Saving and exiting the editor will
apply the change to the directory.

Comment 4 Huzaifa S. Sidhpurwala 2018-03-09 03:47:05 UTC
Mitigation:

Revoke the change passwords right for everyone from all user objects (including computers) in the directory. Note that this will prevent users from being able to change their own expired passwords, so the maximum password age should be set to a value that prevents user passwords from expiring while the workaround is in place. For more information please refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1553553#c3

Comment 6 Huzaifa S. Sidhpurwala 2018-03-09 06:07:43 UTC
Acknowledgments:

Name: the Samba project
Upstream: Björn Baumbach (Sernet)

Comment 7 Huzaifa S. Sidhpurwala 2018-03-12 09:38:41 UTC
Statement:

The versions of samba shipped with Red Hat Enterprise Linux 6 and 7 do not support Active Directory Domain Controller (AD-DC) mode. Therefore this flaw does not affect Red Hat Enterprise Linux 6 and 7.

Comment 8 Huzaifa S. Sidhpurwala 2018-03-13 10:14:14 UTC
External References:

https://www.samba.org/samba/security/CVE-2018-1057.html

Comment 9 Huzaifa S. Sidhpurwala 2018-03-13 10:14:55 UTC
Created samba tracking bugs for this issue:

Affects: fedora-all [bug 1554756]


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