CVE Vulnerabilities

CVE-2023-40548

Integer Overflow or Wraparound

Published: Jan 29, 2024 | Modified: Oct 01, 2024
CVSS 3.x
7.4
HIGH
Source:
NVD
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.x
RedHat/V2
RedHat/V3
7.4 MODERATE
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Ubuntu
MEDIUM

A buffer overflow was found in Shim in the 32-bit system. The overflow happens due to an addition operation involving a user-controlled value parsed from the PE binary being used by Shim. This value is further used for memory allocation operations, leading to a heap-based buffer overflow. This flaw causes memory corruption and can lead to a crash or data integrity issues during the boot phase.

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
Shim Redhat * 15.8 (excluding)
Shim Redhat 15.8-rc1 (including) 15.8-rc1 (including)
Red Hat Enterprise Linux 7 RedHat shim-0:15.8-3.el7 *
Red Hat Enterprise Linux 7 RedHat shim-signed-0:15.8-1.el7 *
Red Hat Enterprise Linux 8 RedHat shim-0:15.8-4.el8_9 *
Red Hat Enterprise Linux 8.2 Advanced Update Support RedHat shim-0:15.8-2.el8_2 *
Red Hat Enterprise Linux 8.2 Telecommunications Update Service RedHat shim-0:15.8-2.el8_2 *
Red Hat Enterprise Linux 8.2 Update Services for SAP Solutions RedHat shim-0:15.8-2.el8_2 *
Red Hat Enterprise Linux 8.4 Advanced Mission Critical Update Support RedHat shim-0:15.8-2.el8_4 *
Red Hat Enterprise Linux 8.4 Telecommunications Update Service RedHat shim-0:15.8-2.el8_4 *
Red Hat Enterprise Linux 8.4 Update Services for SAP Solutions RedHat shim-0:15.8-2.el8_4 *
Red Hat Enterprise Linux 8.6 Extended Update Support RedHat shim-0:15.8-2.el8_6 *
Red Hat Enterprise Linux 8.8 Extended Update Support RedHat shim-0:15.8-2.el8 *
Red Hat Enterprise Linux 8.8 Extended Update Support RedHat shim-unsigned-x64-0:15.8-2.el8 *
Red Hat Enterprise Linux 9 RedHat shim-0:15.8-4.el9_3 *
Red Hat Enterprise Linux 9.0 Extended Update Support RedHat shim-0:15.8-3.el9 *
Red Hat Enterprise Linux 9.0 Extended Update Support RedHat shim-unsigned-aarch64-0:15.8-2.el9 *
Red Hat Enterprise Linux 9.0 Extended Update Support RedHat shim-unsigned-x64-0:15.8-2.el9 *
Red Hat Enterprise Linux 9.2 Extended Update Support RedHat shim-0:15.8-3.el9_2 *
Secureboot-db Ubuntu bionic *
Secureboot-db Ubuntu lunar *
Secureboot-db Ubuntu trusty *
Secureboot-db Ubuntu xenial *
Shim Ubuntu bionic *
Shim Ubuntu devel *
Shim Ubuntu esm-infra-legacy/trusty *
Shim Ubuntu esm-infra/xenial *
Shim Ubuntu focal *
Shim Ubuntu jammy *
Shim Ubuntu lunar *
Shim Ubuntu mantic *
Shim Ubuntu noble *
Shim Ubuntu oracular *
Shim Ubuntu trusty *
Shim Ubuntu trusty/esm *
Shim Ubuntu xenial *
Shim-signed Ubuntu bionic *
Shim-signed Ubuntu devel *
Shim-signed Ubuntu esm-infra-legacy/trusty *
Shim-signed Ubuntu esm-infra/xenial *
Shim-signed Ubuntu focal *
Shim-signed Ubuntu jammy *
Shim-signed Ubuntu lunar *
Shim-signed Ubuntu mantic *
Shim-signed Ubuntu noble *
Shim-signed Ubuntu oracular *
Shim-signed Ubuntu trusty *
Shim-signed Ubuntu trusty/esm *
Shim-signed Ubuntu xenial *

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