== Subject:     Negative idmap cache entries can cause incorrect
==              group entries in the Samba file server process
==              token.
== CVE ID#:     CVE-2021-20254
== Versions:    All versions of the Samba file server since
==              Samba 3.6.0
== Summary:     A coding error converting SIDs to gids could
==              allow unexpected group entries in a process token.
==              This could allow unauthorized access to files.


The Samba smbd file server must map Windows group identities (SIDs)
into unix group ids (gids). The code that performs this had a flaw
that could allow it to read data beyond the end of the array in the
case where a negative cache entry had been added to the mapping
cache. This could cause the calling code to return those values into
the process token that stores the group membership for a user.

Most commonly this flaw caused the calling code to crash, but an alert
user (Peter Eriksson, IT Department, Linköping University) found this
flaw by noticing an unprivileged user was able to delete a file within
a network share that they should have been disallowed access to.

Analysis of the code paths has not allowed us to discover a way for a
remote user to be able to trigger this flaw reproducibly or on demand,
but this CVE has been issued out of an abundance of caution.

Patch Availability

Patches addressing this issue has been posted to:

Additionally, Samba 4.14.4, 4.13.8 and 4.12.15 have been issued as
security releases to correct the defect. Samba administrators are
advised to upgrade to these releases or apply the patch as soon as

CVSSv3 calculation

CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N (6.8)

Workaround and mitigating factors



Reported by Peter Eriksson, IT Department, Linköping University.

Volker Lendecke of SerNet and the Samba Team provided the fix.

Patches backported to supported Samba versions and run though the
Samba security process by Noel Power of SuSE and Andrew Bartlett of

Advisory written by Jeremy Allison of Google.

== Our Code, Our Bugs, Our Responsibility.
== The Samba Team