Bug 2585481 - CVE-2026-137727 tnef: Tnef <= 1.4.18 Heap OOB Read in MAPI MIME Tag and Content ID Printing [fedora-all]
Summary: CVE-2026-137727 tnef: Tnef <= 1.4.18 Heap OOB Read in MAPI MIME Tag and Conte...
Keywords:
Status: ON_QA
Alias: None
Product: Fedora
Classification: Fedora
Component: tnef
Version: rawhide
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Artur Frenszek-Iwicki
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: {"flaws": ["65f1bd69-149f-40b8-8536-c...
Depends On:
Blocks: CVE-2026-137727
TreeView+ depends on / blocked
 
Reported: 2026-11-27 14:44 UTC by gkamathe
Modified: 2026-11-28 04:21 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description gkamathe 2026-11-27 14:44:16 UTC
Disclaimer: Community trackers are created by Red Hat Product Security team on a best effort basis. Package maintainers are required to ascertain if the flaw indeed affects their package, before starting the update process.

file_add_mapi_attrs() copies MAPI attachment MIME tags and content IDs into buffers sized from the raw property length, without ensuring that the copied string is NUL-terminated. Printing either field with --list-with-mime-types or -v can read beyond the heap allocation.

Root-Cause Analysis

src/mapi_attr.c:308-322 leaves v->len as the raw MAPI length. For ordinary strings it allocates v->len + 1 and appends a NUL; for Unicode strings it converts the raw bytes to UTF-8 without updating v->len:
v->len = GETINT32(buf+idx);
if (a->type == szMAPI_UNICODE_STRING)
    v->data.buf = (unsigned char*)unicode_to_utf8(v->len, buf+idx);
else {
    v->data.buf = CHECKED_XMALLOC_ADDNULL(unsigned char, v->len);
    memmove(v->data.buf, buf+idx, v->len);
    v->data.buf[v->len] = '\0';
}

src/file.c:196-207 copies exactly a->values[0].len bytes into an equally sized buffer for both MAPI_ATTACH_MIME_TAG and MAPI_ATTACH_CONTENT_ID, discarding any terminator at or beyond that length:
file->mime_type = CHECKED_XMALLOC(char, a->values[0].len);
memmove(file->mime_type, a->values[0].data.buf, a->values[0].len);

The content-ID branch performs the same allocation and copy. src/file.c:159-163 then prints each buffer with %s. A valid UTF-16 value consisting of two U+0800 units and a NUL has raw length 6 but decodes to six non-NUL UTF-8 bytes followed by a NUL at index 6; the six-byte destination lacks that terminator. Conversely, a valid ASCII UTF-16 value such as AB\\0 decodes to AB\\0 in a larger raw-malloc buffer, so copying the raw six-byte length includes three uninitialized bytes after the NUL. 
Steps to Reproduce

    Build tnef with AddressSanitizer:

autoreconf -fi
CC=clang CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" ./configure
make

    Create a proof-of-concept TNEF file using the script poc_mapi_metadata_overread.py

python3 poc_mapi_metadata_overread.py mime unicode-wide poc-mime-valid.tnef

    Run tnef by feeding the resulting TNEF file:

tnef --list-with-mime-types poc-mime-valid.tnef

    Observe an AddressSanitizer reporting a heap-buffer-overflow, READ of size 5.

Comment 1 Fedora Update System 2026-11-27 20:23:23 UTC
FEDORA-2026-479c3c18e2 (tnef-1.5.0-1.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-479c3c18e2

Comment 2 Fedora Update System 2026-11-27 20:33:52 UTC
FEDORA-2026-ebd2692f11 (tnef-1.5.0-1.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-ebd2692f11

Comment 3 Fedora Update System 2026-11-28 04:01:24 UTC
FEDORA-2026-479c3c18e2 has been pushed to the Fedora 45 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-479c3c18e2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-479c3c18e2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2026-11-28 04:21:43 UTC
FEDORA-2026-ebd2692f11 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-ebd2692f11`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-ebd2692f11

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.


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