Bug 1915052 (CVE-2021-23239)

Summary: CVE-2021-23239 sudo: possible directory existence test due to race condition in sudoedit
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: alakatos, dapospis, kzak, mattdm, rsroka, zfridric
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 14:37:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1927460, 1915055, 1916434, 1916655    
Bug Blocks: 1915059    

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.

References:
https://www.openwall.com/lists/oss-security/2021/01/11/2

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:

https://www.sudo.ws/stable.html#1.9.5

Comment 3 Mauro Matteo Cascella 2021-01-14 17:24:46 UTC
Upstream fix:
https://www.sudo.ws/repos/sudo/rev/ea19d0073c02

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

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
Mitigation:

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):

https://access.redhat.com/security/cve/cve-2021-23239