Executive brief
libbsd is a software library that provides common BSD system functions to other operating systems like Linux. A flaw in how it handles memory when reading wide-character strings could allow an attacker to crash applications using this library or potentially execute unauthorized code. This impact depends on how a specific application utilizes the affected library function.
Technical details
An off-by-one vulnerability exists in the fgetwln() function within libbsd versions prior to 0.8.2. The root cause is an incorrect boundary check in a while loop: the code checks if 'wused > fb->len' before reallocating memory, but fails to account for the case where 'wused == fb->len', leading to an out-of-bounds write of 4 bytes (a wide character) to the heap. While the attack vector is listed as network-reachable, exploitation requires an application to use fgetwln() to process attacker-controlled input. Successful exploitation could result in a heap buffer overflow, potentially leading to arbitrary code execution or a denial-of-service condition. The issue was fixed in libbsd version 0.8.2.
Affected products
- freedesktop libbsd before 0.8.2
Timeline
- 2016-01-27: disclosed: Vulnerability reported by Hanno Böck
- 2016-01-27: patched: Fixed in libbsd version 0.8.2
- 2017-01-13: advisory: NVD published CVE-2016-2090
References
- http://www.openwall.com/lists/oss-security/2016/01/28/5
- https://blog.fuzzing-project.org/36-Heap-buffer-overflow-in-fgetwln-function-of-libbsd.html
- https://bugs.freedesktop.org/show_bug.cgi?id=93881
- https://cgit.freedesktop.org/libbsd/commit/?id=c8f0723d2b4520bdd6b9eb7c3e7976de726d7ff7
- https://lists.debian.org/debian-lts-announce/2019/12/msg00036.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7KJE5SPSX7HEKLZ34LUTZLXWPEL2K353/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DIQKQ42Z7553D46QY3IMIQKS52QTNIHY/