CVE Vulnerabilities

CVE-2018-5816

Integer Overflow or Wraparound

Published: Dec 07, 2018 | Modified: Jan 03, 2019
CVSS 3.x
6.5
MEDIUM
Source:
NVD
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
CVSS 2.x
7.1 HIGH
AV:N/AC:M/Au:N/C:N/I:N/A:C
RedHat/V2
RedHat/V3
4.3 MODERATE
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L
Ubuntu
MEDIUM

An integer overflow error within the identify() function (internal/dcraw_common.cpp) in LibRaw versions prior to 0.18.12 can be exploited to trigger a division by zero via specially crafted NOKIARAW file (Note: This vulnerability is caused due to an incomplete fix of CVE-2018-5804).

Weakness

The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.

Affected Software

Name Vendor Start Version End Version
Libraw Libraw * 0.18.12 (excluding)
Darktable Ubuntu bionic *
Darktable Ubuntu cosmic *
Darktable Ubuntu disco *
Darktable Ubuntu eoan *
Darktable Ubuntu groovy *
Darktable Ubuntu hirsute *
Darktable Ubuntu impish *
Darktable Ubuntu kinetic *
Darktable Ubuntu lunar *
Darktable Ubuntu mantic *
Darktable Ubuntu trusty *
Darktable Ubuntu xenial *
Dcraw Ubuntu bionic *
Dcraw Ubuntu cosmic *
Dcraw Ubuntu disco *
Dcraw Ubuntu eoan *
Dcraw Ubuntu groovy *
Dcraw Ubuntu hirsute *
Dcraw Ubuntu impish *
Dcraw Ubuntu kinetic *
Dcraw Ubuntu lunar *
Dcraw Ubuntu mantic *
Dcraw Ubuntu trusty *
Dcraw Ubuntu xenial *
Exactimage Ubuntu bionic *
Exactimage Ubuntu cosmic *
Exactimage Ubuntu disco *
Exactimage Ubuntu eoan *
Exactimage Ubuntu groovy *
Exactimage Ubuntu hirsute *
Exactimage Ubuntu impish *
Exactimage Ubuntu kinetic *
Exactimage Ubuntu lunar *
Exactimage Ubuntu mantic *
Exactimage Ubuntu trusty *
Exactimage Ubuntu xenial *
Kodi Ubuntu bionic *
Kodi Ubuntu cosmic *
Kodi Ubuntu disco *
Kodi Ubuntu eoan *
Kodi Ubuntu groovy *
Kodi Ubuntu hirsute *
Kodi Ubuntu impish *
Kodi Ubuntu kinetic *
Kodi Ubuntu lunar *
Kodi Ubuntu mantic *
Kodi Ubuntu xenial *
Libraw Ubuntu bionic *
Libraw Ubuntu xenial *
Rawtherapee Ubuntu bionic *
Rawtherapee Ubuntu cosmic *
Rawtherapee Ubuntu disco *
Rawtherapee Ubuntu eoan *
Rawtherapee Ubuntu groovy *
Rawtherapee Ubuntu hirsute *
Rawtherapee Ubuntu impish *
Rawtherapee Ubuntu kinetic *
Rawtherapee Ubuntu lunar *
Rawtherapee Ubuntu mantic *
Rawtherapee Ubuntu trusty *
Rawtherapee Ubuntu xenial *
Ufraw Ubuntu bionic *
Ufraw Ubuntu cosmic *
Ufraw Ubuntu disco *
Ufraw Ubuntu trusty *
Ufraw Ubuntu xenial *
Xbmc Ubuntu trusty *

Potential Mitigations

  • Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
  • If possible, choose a language or compiler that performs automatic bounds checking.
  • Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
  • Use libraries or frameworks that make it easier to handle numbers without unexpected consequences.
  • Examples include safe integer handling packages such as SafeInt (C++) or IntegerLib (C or C++). [REF-106]
  • Perform input validation on any numeric input by ensuring that it is within the expected range. Enforce that the input meets both the minimum and maximum requirements for the expected range.
  • Use unsigned integers where possible. This makes it easier to perform validation for integer overflows. When signed integers are required, ensure that the range check includes minimum values as well as maximum values.
  • Understand the programming language’s underlying representation and how it interacts with numeric calculation (CWE-681). Pay close attention to byte size discrepancies, precision, signed/unsigned distinctions, truncation, conversion and casting between types, “not-a-number” calculations, and how the language handles numbers that are too large or too small for its underlying representation. [REF-7]
  • Also be careful to account for 32-bit, 64-bit, and other potential differences that may affect the numeric representation.

References