CVE-2021-3999
glibc: Off-by-one buffer overflow/underflow in getcwd()
Severity
ModerateRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · January 11, 2022
Updated · December 3, 2025
Description
A flaw was found in glibc. An off-by-one buffer overflow and underflow in getcwd() may lead to memory corruption when the size of the buffer is exactly 1. A local attacker who can control the input buffer and size passed to getcwd() in a setuid program could use this flaw to potentially execute arbitrary code and escalate their privileges on the system.
Statement
This issue was rated as having Moderate impact because of the prerequisites required for successful exploitation. To the best of our knowledge, there is no actual setuid exposure to the vulnerable getcwd() usage pattern.
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.
CVSS / CWE
CVSS 3.1 · 7.4CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CWE-193 · Off-by-one Error