Bug 1905201 (CVE-2020-27828)

Summary: CVE-2020-27828 jasper: Heap-based buffer overflow in cp_create() in jpc_enc.c
Product: [Other] Security Response Reporter: Guilherme de Almeida Suckevicz <gsuckevi>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: erik-fedora, jridky, manisandro, mike, rh-spice-bugs, rjones, yozone
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: jasper 2.0.23 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the Jasper tool’s jpc encoder. This flaw allows an attacker to craft input provided to Jasper, causing an arbitrary out-of-bounds write. The highest threat from this vulnerability is to confidentiality, integrity, as well as system availability.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-02 18:00:06 UTC 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: 1905202, 1905203, 1905692, 1905693, 1910574    
Bug Blocks: 1903611    

Description Guilherme de Almeida Suckevicz 2020-12-07 17:41:11 UTC
Heap buffer overflow to out of bounds write in the jpc encoder's cp_create() routine when resolution levels are greater than max.

Reference:
https://github.com/jasper-software/jasper/issues/252

Upstream patch:
https://github.com/jasper-software/jasper/pull/253

Comment 1 Guilherme de Almeida Suckevicz 2020-12-07 17:41:36 UTC
Created jasper tracking bugs for this issue:

Affects: fedora-all [bug 1905202]


Created mingw-jasper tracking bugs for this issue:

Affects: fedora-all [bug 1905203]

Comment 2 Todd Cullum 2020-12-07 23:26:00 UTC
Flaw summary:

It's possible that an image processed by jasper along with crafted rlvl input could set resolution levels above max, which could cause a heap buffer overflow in the loop near `tccp->prcwidthexpns[rlvlno] = prcwidthexpn;` in the `cp_create()` routine of /src/libjasper/jpc/jpc_enc.c. Because `prcwidthexpn` and `prcheightexpn` can also be controlled by data obtained from the crafted input, it leaves potential for exploitation surrounding arbitrary writes.

Comment 3 Todd Cullum 2020-12-08 00:37:04 UTC
The above flaw is mostly caused by improper input validation where the provided rlvl value is trusted by default.

Comment 10 Todd Cullum 2020-12-08 21:36:38 UTC
Acknowledgments:

Name: zodf0055980

Comment 11 RaTasha Tillery-Smith 2020-12-15 15:41:24 UTC
Mitigation:

This flaw can be mitigated for the Jasper tool by not accepting untrusted inputs to be processed by Jasper or constraining rlevels on those inputs from outside of Jasper.

Comment 13 errata-xmlrpc 2021-11-09 17:51:45 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

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