CVE-2021-20316: Race Condition

Published Oct 1, 2021
·
Updated

A flaw was found in the way Samba handled file/directory metadata. This flaw allows an authenticated attacker with permissions to read or modify share metadata, to perform this operation outside of the share.

Other sources

As per upstream report:

All versions of Samba prior to 4.15.0 are vulnerable to a malicious client using an SMB1 or NFS symlink race to allow filesystem metadata to be accessed in an area of the server file system not exported under the share definition. Note that SMB1 has to be enabled, or the share also available via NFS in order for this attack to succeed.

Clients that have write access to the exported part of the file system under a share via SMB1 unix extensions or NFS can create symlinks that can race the server by renaming an existing path and then replacing it with a symlink. If the client wins the race it can cause the server to read or modify file or directory metadata on the symlink target.

The authenticated user must have permissions to read or modify the metadata of the target of the symlink in order to perform the operation outside of the share.

Filesystem metadata includes such attributes as timestamps, extended attributes, permissions, and ownership.

Red Hat

Affected Software

12 affected componentsFixes available
redhat/samba<0:4.15.5-5.el8
0:4.15.5-5.el8
redhat/samba<0:4.15.5-100.el8
0:4.15.5-100.el8
redhat/samba<4.15.0
4.15.0
Samba Samba<4.15.0
Debian Debian Linux=10.0
Debian Debian Linux=11.0
redhat Virtualization Host=4.0
redhat Enterprise Linux=8.0
redhat Enterprise Linux Aus=8.6
redhat Enterprise Linux Eus=8.6
redhat Enterprise Linux Tus=8.6
debian/samba<=2:4.13.13+dfsg-1~deb11u6, <=2:4.13.13+dfsg-1~deb11u7
2:4.17.12+dfsg-0+deb12u32:4.17.12+dfsg-0+deb12u12:4.22.6+dfsg-0+deb13u12:4.23.5+dfsg-1

Remediation

Information

Do not enable SMB1 (please note SMB1 is disabled by default in Samba from version 4.11.0 and onwards). This prevents the creation of symbolic links via SMB1. If SMB1 must be enabled for backward compatibility then 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. 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 SMB2 or NFS, not both.

Event History

Jan 10, 2022
CVE Published
12:00 AM
Aug 23, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionWeakness
Feb 24, 2026
Data Sourced
via Debian·04:08 PM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2021-20316?

CVE-2021-20316 is a vulnerability in Samba that allows an authenticated attacker to perform operations outside of a shared directory.

2

How severe is CVE-2021-20316?

CVE-2021-20316 has a severity score of 6.8, which is considered medium.

3

Which software is affected by CVE-2021-20316?

Samba versions up to 4.15.0, Debian Linux 10.0 and 11.0, Redhat Virtualization Host 4.0, Redhat Enterprise Linux 8.0, 8.6, and samba package versions up to 2:4.13.13+dfsg-1~deb11u5 are affected by CVE-2021-20316.

4

How can I fix CVE-2021-20316?

To fix CVE-2021-20316, update to Samba version 4.15.0 or later, Debian Linux 10.0 or 11.0, Redhat Virtualization Host 4.0, or Redhat Enterprise Linux 8.0 or 8.6, and update the samba package to 2:4.17.9+dfsg-0+deb12u3, 2:4.17.10+dfsg-0+deb12u1, or 2:4.19.0+dfsg-1.

5

Where can I find more information about CVE-2021-20316?

You can find more information about CVE-2021-20316 on the Red Hat Security Advisory and Samba bugzilla pages: https://access.redhat.com/security/cve/CVE-2021-20316, https://bugzilla.redhat.com/show_bug.cgi?id=2009673, https://bugzilla.samba.org/show_bug.cgi?id=14842.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203