Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1173157 - (CVE-2014-8137) CVE-2014-8137 jasper: double-free in in jas_iccattrval_destroy() (oCERT-2014-012)
CVE-2014-8137 jasper: double-free in in jas_iccattrval_destroy() (oCERT-2014-...
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20141218,reported=2...
: Security
Depends On: 1173566 1173567 1173568 1173569 1175761 1175762 1175763 1175764 1185248 1185249 1188086
Blocks: 1167538 1206715
  Show dependency treegraph
 
Reported: 2014-12-11 09:54 EST by Tomas Hoger
Modified: 2016-11-23 17:55 EST (History)
19 users (show)

See Also:
Fixed In Version: jasper 1.900.3
Doc Type: Bug Fix
Doc Text:
A double free flaw was found in the way JasPer parsed ICC color profiles in JPEG 2000 image files. A specially crafted file could cause an application using JasPer to crash or, possibly, execute arbitrary code.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-18 09:25:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Possible patch - variant 1 (3.22 KB, patch)
2014-12-11 10:23 EST, Tomas Hoger
no flags Details | Diff
Possible patch - variant 2 (910 bytes, patch)
2014-12-11 10:28 EST, Tomas Hoger
no flags Details | Diff
Additional fix to avoid assert() abort (637 bytes, patch)
2014-12-11 10:31 EST, Tomas Hoger
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Novell 909474 None None None Never
Red Hat Product Errata RHSA-2014:2021 normal SHIPPED_LIVE Important: jasper security update 2014-12-18 18:31:00 EST
Red Hat Product Errata RHSA-2015:0698 normal SHIPPED_LIVE Important: rhevm-spice-client security, bug fix, and enhancement update 2015-03-18 12:11:47 EDT
Red Hat Product Errata RHSA-2015:1713 normal SHIPPED_LIVE Important: rhev-hypervisor security, bug fix, and enhancement update 2015-09-03 17:08:30 EDT

  None (edit)
Description Tomas Hoger 2014-12-11 09:54:47 EST
oCERT reports a double-free issue in jas_iccattrval_destroy() in jasper:

  In jas_icctxt_input() if there's an error, there's a call to
  jas_free(txt->string) which is freeing attrval->data.txt, but later on
  jas_iccattrval_destroy it tries to call free on it again.

Acknowledgements:

Red Hat would like to thank oCERT for reporting these issues. oCERT acknowledges Jose Duart of the Google Security Team as the original reporter.
Comment 2 Tomas Hoger 2014-12-11 10:23:30 EST
Created attachment 967282 [details]
Possible patch - variant 1

This uses somewhat conservative approach.  It changes iccattrvalinfo destroy ops functions to set variables to NULL after free(), so even if called repeatedly, double-free is avoided.  It also changes jas_icctxt_input() to call jas_icctxt_destroy() on error, rather than performing memory freeing directly.
Comment 3 Tomas Hoger 2014-12-11 10:28:12 EST
Created attachment 967283 [details]
Possible patch - variant 2

This removes jas_icc*_destroy() calls from error code paths in iccattrvalinfo input ops functions (jas_icc*_input()).  This should not introduce any memory leak, as input ops functions only seem to be called from jas_iccprof_load(), and if they return error, jas_iccattrval_destroy() gets called, which leads to destroy op call.

        if ((*attrval->ops->input)(attrval, in, len)) {
            goto error;
        }

  ...

error:
  ...
    if (attrval)
        jas_iccattrval_destroy(attrval);
Comment 4 Tomas Hoger 2014-12-11 10:31:03 EST
Created attachment 967284 [details]
Additional fix to avoid assert() abort

If one of the above patches is applied, assert(iccprof) is triggered in jp2_decode(), aborting application using jasper.  This fix makes jasper fail more gracefully.
Comment 5 Jiri Popelka 2014-12-11 12:17:53 EST
All patches look good to me. I have no problem with the 'not so conservative' patch (variant 2). It doesn't seem to cause any leaks.
Comment 6 Tomas Hoger 2014-12-11 14:57:39 EST
Ack, thank you for review.  I also view the second variant as preferred.
Comment 9 Tomas Hoger 2014-12-18 09:15:24 EST
Public now via oCERT-2014-012 advisory.

External References:

http://www.ocert.org/advisories/ocert-2014-012.html
Comment 10 Tomas Hoger 2014-12-18 09:18:42 EST
Created mingw-jasper tracking bugs for this issue:

Affects: fedora-all [bug 1175762]
Affects: epel-7 [bug 1175764]
Comment 11 Tomas Hoger 2014-12-18 09:18:44 EST
Created jasper tracking bugs for this issue:

Affects: fedora-all [bug 1175761]
Affects: epel-5 [bug 1175763]
Comment 13 errata-xmlrpc 2014-12-18 13:31:46 EST
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7
  Red Hat Enterprise Linux 6

Via RHSA-2014:2021 https://rhn.redhat.com/errata/RHSA-2014-2021.html
Comment 14 Fedora Update System 2014-12-29 04:55:01 EST
mingw-jasper-1.900.1-25.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2014-12-29 04:55:15 EST
mingw-jasper-1.900.1-25.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 16 Fedora Update System 2014-12-29 05:01:49 EST
mingw-jasper-1.900.1-25.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 17 Fedora Update System 2015-01-02 19:13:19 EST
mingw-jasper-1.900.1-25.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 18 Fedora Update System 2015-01-06 01:04:35 EST
jasper-1.900.1-27.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 19 Fedora Update System 2015-01-06 01:07:15 EST
jasper-1.900.1-26.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 20 Fedora Update System 2015-01-06 01:10:27 EST
jasper-1.900.1-29.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 23 errata-xmlrpc 2015-03-18 08:12:40 EDT
This issue has been addressed in the following products:

  RHEV Manager version 3.5

Via RHSA-2015:0698 https://rhn.redhat.com/errata/RHSA-2015-0698.html
Comment 24 Fedora Update System 2015-05-10 20:53:14 EDT
jasper-1.900.1-15.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 25 errata-xmlrpc 2015-09-03 13:08:49 EDT
This issue has been addressed in the following products:

  RHEV-H and Agents for RHEL-6
  RHEV-H and Agents for RHEL-7

Via RHSA-2015:1713 https://rhn.redhat.com/errata/RHSA-2015-1713.html
Comment 26 Tomas Hoger 2016-11-23 17:55:54 EST
Fixed upstream in version 1.900.3:

https://github.com/mdadams/jasper/commit/4bb93a6c49da7c1b6ad2acb60b18954a6547c637

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