CVE-2016-2090: freedesktop libbsd heap buffer overflow in fgetwln

CVE-2016-2090 · Severity: critical · CVSS 9.8 · Published 2017-01-13

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.

Quick answers

Is CVE-2016-2090 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2016-2090 being exploited in the wild.
How severe is CVE-2016-2090?
Critical severity, with a CVSS score of 9.8, published 13 January 2017.
Which products and versions are affected?
freedesktop libbsd before 0.8.2.
Is there a fix for CVE-2016-2090?
A patch was published on 2016-01-27: Fixed in libbsd version 0.8.2 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2016-2090 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2016-2090?
Check whether anything you run is named in the advisory. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

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

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.