Bug 1537758 (CVE-2018-5785) - CVE-2018-5785 openjpeg: integer overflow in opj_j2k_setup_encoder function in openjp2/j2k.c
Summary: CVE-2018-5785 openjpeg: integer overflow in opj_j2k_setup_encoder function in...
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2018-5785
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1537759 1537760 1537761 1537762 1538556
Blocks: 1537764
TreeView+ depends on / blocked
 
Reported: 2018-01-23 19:56 UTC by Laura Pardo
Modified: 2021-11-09 17:55 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-08 03:38:04 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2021:4251 0 None None None 2021-11-09 17:55:55 UTC

Description Laura Pardo 2018-01-23 19:56:35 UTC
A flaw was found in OpenJPEG 2.3.0, there is an integer overflow caused by an out-of-bounds left shift in the opj_j2k_setup_encoder function (openjp2/j2k.c). Remote attackers could leverage this vulnerability to cause a denial of service via a crafted bmp file.

Reference:
https://github.com/uclouvain/openjpeg/issues/1057

Comment 1 Laura Pardo 2018-01-23 19:57:03 UTC
Created mingw-openjpeg2 tracking bugs for this issue:

Affects: fedora-all [bug 1537761]


Created openjpeg tracking bugs for this issue:

Affects: epel-all [bug 1537762]
Affects: fedora-all [bug 1537759]


Created openjpeg2 tracking bugs for this issue:

Affects: fedora-all [bug 1537760]

Comment 2 Huzaifa S. Sidhpurwala 2018-01-25 09:56:47 UTC
Analysis:

Running openjpeg compiled with UBSAN, i observe the following:

[huzaifas@babylon bin]$ ./opj_compress -n 1 -i /tmp/openjpeg_2-3_opj_compress_integer-overflow_opj_j2k_setup_encoder.bmp -o /tmp/null.j2k

/NotBackedUp/oss/openjpeg/src/lib/openjp2/j2k.c:7304:48: runtime error: shift exponent 4294967295 is too large for 32-bit type 'int'
[INFO] tile number 1 / 1
/NotBackedUp/oss/openjpeg/src/lib/openjp2/tcd.c:2382:32: runtime error: signed integer overflow: 0 - -2147483648 cannot be represented in type 'int [33]'
/NotBackedUp/oss/openjpeg/src/lib/openjp2/mct.c:109:31: runtime error: signed integer overflow: -2147483648 * 2 cannot be represented in type 'int'
/NotBackedUp/oss/openjpeg/src/lib/openjp2/mct.c:109:36: runtime error: signed integer overflow: -2147483648 + -2147483648 cannot be represented in type 'int'
[INFO] Generated outfile /tmp/null.j2k
encode time: 1 ms 


Which represents multiple integer overflow when converting from BMP to J2K format. However it seems that in the end the operation ends gracefully. There are no related buffer overflows etc.

The maximum security impact seems to be limited to invalid conversion to J2K format.

Comment 4 errata-xmlrpc 2021-11-09 17:55:54 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:4251 https://access.redhat.com/errata/RHSA-2021:4251


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