Bug 1895379 (CVE-2020-28241) - CVE-2020-28241 libmaxminddb: improper initialization in dump_entry_data_list() in maxminddb.c
Summary: CVE-2020-28241 libmaxminddb: improper initialization in dump_entry_data_list(...
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2020-28241
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1895380 1895381 1900503 1900504 1910599
Blocks: 1895382
TreeView+ depends on / blocked
 
Reported: 2020-11-06 14:31 UTC by Guilherme de Almeida Suckevicz
Modified: 2024-04-04 21:33 UTC (History)
5 users (show)

Fixed In Version: libmaxminddb 1.4.3
Doc Type: If docs needed, set a value
Doc Text:
An improper initialization issue was found in libmaxminddb. A remote user could exploit this flaw by sending a specially crafted MaxMind DB file that, when parsed by an application linked to libmaxminddb, would possibly crash the application, resulting in a denial of service condition.
Clone Of:
Environment:
Last Closed: 2021-10-28 11:00:22 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2024:0750 0 None None None 2024-02-08 18:04:09 UTC
Red Hat Product Errata RHSA-2024:0751 0 None None None 2024-02-08 18:04:59 UTC
Red Hat Product Errata RHSA-2024:0768 0 None None None 2024-02-12 00:26:53 UTC
Red Hat Product Errata RHSA-2024:1686 0 None None None 2024-04-04 21:33:08 UTC

Description Guilherme de Almeida Suckevicz 2020-11-06 14:31:03 UTC
libmaxminddb before 1.4.3 has a heap-based buffer over-read in dump_entry_data_list in maxminddb.c.

Reference:
https://github.com/maxmind/libmaxminddb/issues/236

Upstream patch:
https://github.com/maxmind/libmaxminddb/pull/237

Comment 1 Guilherme de Almeida Suckevicz 2020-11-06 14:31:24 UTC
Created libmaxminddb tracking bugs for this issue:

Affects: epel-all [bug 1895381]
Affects: fedora-all [bug 1895380]

Comment 3 Mauro Matteo Cascella 2020-11-23 09:36:01 UTC
In case of NULL size, bytes_to_hex() allocates a heap chunk via malloc() without proper initialization. The pointer to this chunk (hex_string) is later passed as argument to fprintf, resulting in undefined behavior (possibly leading to crash, or unlikely heap buffer overflow). The upstream fix replaces malloc() with calloc(), thus always initializing memory regardless of whether the for loop in bytes_to_hex() is entered or not.

--- src/maxminddb.c
LOCAL char *bytes_to_hex(uint8_t *bytes, uint32_t size)
{
    char *hex_string;
    ...
    hex_string = malloc((size * 2) + 1);
    ...
    for (uint32_t i = 0; i < size; i++) {
        sprintf(hex_string + (2 * i), "%02X", bytes[i]);
    }
    return hex_string;
}

LOCAL MMDB_entry_data_list_s *dump_entry_data_list(...)
{
    ...
    case MMDB_DATA_TYPE_BYTES:
    {
        char *hex_string = bytes_to_hex((uint8_t *)entry_data_list->entry_data.bytes, 
                                        entry_data_list->entry_data.data_size);
        ...
        fprintf(stream, "%s <bytes>\n", hex_string);
    }
    ...
}

Comment 8 errata-xmlrpc 2024-02-08 18:04:07 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.8 Extended Update Support

Via RHSA-2024:0750 https://access.redhat.com/errata/RHSA-2024:0750

Comment 9 errata-xmlrpc 2024-02-08 18:04:57 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.6 Extended Update Support

Via RHSA-2024:0751 https://access.redhat.com/errata/RHSA-2024:0751

Comment 10 errata-xmlrpc 2024-02-12 00:26:52 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2024:0768 https://access.redhat.com/errata/RHSA-2024:0768

Comment 11 errata-xmlrpc 2024-04-04 21:33:06 UTC
This issue has been addressed in the following products:

  RHEL-8 based Middleware Containers

Via RHSA-2024:1686 https://access.redhat.com/errata/RHSA-2024:1686


Note You need to log in before you can comment on or make changes to this bug.