Bug 1915052 (CVE-2021-23239) - CVE-2021-23239 sudo: possible directory existence test due to race condition in sudoedit
Summary: CVE-2021-23239 sudo: possible directory existence test due to race condition ...
Alias: CVE-2021-23239
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On: 1927460 1915055 1916434 1916655
Blocks: 1915059
TreeView+ depends on / blocked
Reported: 2021-01-11 20:24 UTC by Pedro Sampaio
Modified: 2022-04-17 21:05 UTC (History)
6 users (show)

Fixed In Version: sudo 1.9.5
Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in sudoedit. A race condition vulnerability and improper symbolic link resolution could be used by a local unprivileged user to test for the existence of directories and files not normally accessible to the user. This flaw cannot be used to read the content or write to arbitrary files on the file system. The highest threat from this vulnerability is to data confidentiality.
Clone Of:
Last Closed: 2021-05-18 14:37:38 UTC

Attachments (Terms of Use)

Description Pedro Sampaio 2021-01-11 20:24:02 UTC
A flaw was found in sudo before version 1.9.5. A potential race condition in sudoedit could be used to test for the existence of directories not normally accessible to the user in certain circumstances.


Comment 1 Pedro Sampaio 2021-01-11 20:30:43 UTC
Created sudo tracking bugs for this issue:

Affects: fedora-all [bug 1915055]

Comment 2 Mauro Matteo Cascella 2021-01-14 17:24:00 UTC
External References:


Comment 3 Mauro Matteo Cascella 2021-01-14 17:24:46 UTC
Upstream fix:

Comment 6 Mauro Matteo Cascella 2021-01-19 16:03:44 UTC

This flaw has been rated as having a security impact of Low. The symbolic link protection is enabled by default in Red Hat Enterprise Linux 7 and 8, preventing this issue from being exploited.

Comment 7 Mauro Matteo Cascella 2021-01-19 16:09:52 UTC
From upstream 1.9.5 changelog: "[..] When creating a new file, sudoedit checks to make sure the parent directory of the new file exists before running the editor. However, a race condition exists if the invoking user can replace (or create) the parent directory. If a symbolic link is created in place of the parent directory, sudoedit will run the editor as long as the target of the link exists. If the target of the link does not exist, an error message will be displayed. The race condition can be used to test for the existence of an arbitrary directory. However, it cannot be used to write to an arbitrary location."

Comment 8 Mauro Matteo Cascella 2021-01-19 16:27:45 UTC

Enabling the symbolic link protection (/proc/sys/fs/protected_symlinks set to 1) is sufficient to mitigate this flaw.

Comment 12 errata-xmlrpc 2021-05-18 14:32:28 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:1723 https://access.redhat.com/errata/RHSA-2021:1723

Comment 13 Product Security DevOps Team 2021-05-18 14:37:38 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):


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