Bug 2585324 (CVE-2026-137727)
| Summary: | CVE-2026-137727 tnef: Tnef <= 1.4.18 Heap OOB Read in MAPI MIME Tag and Content ID Printing | ||
|---|---|---|---|
| Product: | [Other] Security Response | Reporter: | OSIDB Bzimport <bzimport> |
| Component: | vulnerability | Assignee: | Product Security DevOps Team <prodsec-dev> |
| Status: | NEW --- | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | unspecified | Keywords: | Security |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | --- | |
| Doc Text: |
A flaw was found in tnef. When parsing Messaging Application Programming Interface (MAPI) attachment attributes, the application fails to properly terminate copied text strings in memory. A remote attacker could exploit this vulnerability by supplying a specially crafted file, triggering an out-of-bounds read beyond allocated heap buffers. This flaw can lead to unauthorized information disclosure or cause the application to crash, resulting in a Denial of Service (DoS).
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | --- | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | 2585481 | ||
| Bug Blocks: | |||
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.