Bug 1140205 (CVE-2018-20846)

Summary: VUL-0: CVE-2018-20846: openjpeg,openjpeg2: Out-of-bounds accesses in pi_next_lrcp, pi_next_rlcp, pi_next_rpcl, pi_next_pcrl, pi_next_rpcl, and pi_next_cprl in openmj2/pi.c
Product: [Novell Products] SUSE Security Incidents Reporter: Wolfgang Frisch <wolfgang.frisch>
Component: IncidentsAssignee: Hans Petter Jansson <hpj>
Status: IN_PROGRESS --- QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P4 - Low CC: atoptsoglou, hpj, smash_bz, tchvatal, thomas.leroy
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://smash.suse.de/issue/235744/
Whiteboard: CVSSv3:SUSE:CVE-2018-20846:5.5:(AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H) maint:planned:update
Found By: Security Response Team Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Wolfgang Frisch 2019-07-03 09:18:36 UTC
CVE-2018-20846

Out-of-bounds accesses in the functions pi_next_lrcp, pi_next_rlcp,
pi_next_rpcl, pi_next_pcrl, pi_next_rpcl, and pi_next_cprl in openmj2/pi.c in
OpenJPEG through 2.3.0 allow remote attackers to cause a denial of service
(application crash).

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-20846
http://people.canonical.com/~ubuntu-security/cve/2018/CVE-2018-20846.html
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20846
https://github.com/uclouvain/openjpeg/pull/1168/commits/c277159986c80142180fbe5efb256bbf3bdf3edc
Comment 1 Hans Petter Jansson 2022-03-31 01:48:45 UTC
Our openjpeg2 in SUSE:SLE-15:Update has a fix, apparently from the 2.3.0 tarball, that looks somewhat like this:

https://github.com/rouault/openjpeg/commit/80818c39f5bfbac37768fcee95b0ffeceaa77264

The one in SUSE:SLE-12-SP2:Update does not have bounds checking, but it doesn't store the length of the array in the struct, so there is nothing to validate against.

I suggest we close this as invalid or fixed.
Comment 2 Hans Petter Jansson 2022-03-31 02:07:25 UTC
I managed to adapt the patch for 2.1.0 and add/init the include_size field, so we should be good for SLE 12 too now.
Comment 4 Hans Petter Jansson 2022-04-01 21:31:35 UTC
Done, reassigning to security-team.
Comment 5 Swamp Workflow Management 2022-04-07 19:17:55 UTC
SUSE-SU-2022:1129-1: An update that fixes 13 vulnerabilities is now available.

Category: security (important)
Bug References: 1102016,1106881,1106882,1140130,1140205,1162090,1173578,1180457,1184774,1197738,971617,980504
CVE References: CVE-2016-1924,CVE-2016-3183,CVE-2016-4797,CVE-2018-14423,CVE-2018-16375,CVE-2018-16376,CVE-2018-20845,CVE-2018-20846,CVE-2020-15389,CVE-2020-27823,CVE-2020-8112,CVE-2021-29338,CVE-2022-1122
JIRA References: 
Sources used:
SUSE OpenStack Cloud Crowbar 9 (src):    openjpeg2-2.1.0-4.15.1
SUSE OpenStack Cloud Crowbar 8 (src):    openjpeg2-2.1.0-4.15.1
SUSE OpenStack Cloud 9 (src):    openjpeg2-2.1.0-4.15.1
SUSE OpenStack Cloud 8 (src):    openjpeg2-2.1.0-4.15.1
SUSE Linux Enterprise Server for SAP 12-SP4 (src):    openjpeg2-2.1.0-4.15.1
SUSE Linux Enterprise Server for SAP 12-SP3 (src):    openjpeg2-2.1.0-4.15.1
SUSE Linux Enterprise Server 12-SP5 (src):    openjpeg2-2.1.0-4.15.1
SUSE Linux Enterprise Server 12-SP4-LTSS (src):    openjpeg2-2.1.0-4.15.1
SUSE Linux Enterprise Server 12-SP3-LTSS (src):    openjpeg2-2.1.0-4.15.1
SUSE Linux Enterprise Server 12-SP3-BCL (src):    openjpeg2-2.1.0-4.15.1
SUSE Linux Enterprise Server 12-SP2-BCL (src):    openjpeg2-2.1.0-4.15.1
HPE Helion Openstack 8 (src):    openjpeg2-2.1.0-4.15.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 6 Thomas Leroy 2022-04-14 12:51:12 UTC
@Hans, is SUSE:SLE-15:Update/openjpeg affected here?
Comment 7 Hans Petter Jansson 2022-04-20 21:59:58 UTC
(In reply to Thomas Leroy from comment #6)
> @Hans, is SUSE:SLE-15:Update/openjpeg affected here?

Hmmm, looking at this again it seems like there's a chance a bad index could slip through. Like 2.1.0, openjpeg 1 doesn't track the array size at all either.

I'll revisit this when I have time and submit another update, if that's ok.