Bug 1485285 - There is a reachable assertion abort in function jpc_pi_nextrpcl() of JasPer that will lead to remote denial of service attack.
Summary: There is a reachable assertion abort in function jpc_pi_nextrpcl() of JasPer ...
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: jasper
Version: 7.5-Alt
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Josef Ridky
QA Contact: Desktop QE
URL:
Whiteboard:
Keywords: Security
Depends On:
Blocks: CVE-2017-13749
TreeView+ depends on / blocked
 
Reported: 2017-08-25 09:26 UTC by owl337
Modified: 2018-08-01 23:32 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed:


Attachments (Terms of Use)
Triggered by "./imginfo -f POC7" (241 bytes, application/x-rar)
2017-08-25 09:26 UTC, owl337
no flags Details

Description owl337 2017-08-25 09:26:07 UTC
Created attachment 1318070 [details]
Triggered by  "./imginfo -f POC7"

Description of problem:

There is a reachable assertion abort in function jpc_pi_nextrpcl() of JasPer that will lead to remote denial of service attack.


Version-Release number of selected component (if applicable):

<= latest version

How reproducible:

./imginfo -f POC7

Steps to Reproduce:

The output information is as follows:

$ ./imginfo -f POC7
warning: trailing garbage in marker segment (3 bytes)
warning: trailing garbage in marker segment (6 bytes)
imginfo: /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c:305: int jpc_pi_nextrpcl(jpc_pi_t *): Assertion `pi->prcno < pi->pirlvl->numprcs' failed.
Aborted (core dumped)

The gdb debugging information is listed below:
(gdb) set args POC6
(gdb) r 
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/icy/secreal/jasper/install/bin/imginfo -f  fuzz/output/crashes/id:000116,sig:06,src:002389,op:flip1,pos:210
warning: trailing garbage in marker segment (3 bytes)
warning: trailing garbage in marker segment (6 bytes)
imginfo: /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c:305: int jpc_pi_nextrpcl(jpc_pi_t *): Assertion `pi->prcno < pi->pirlvl->numprcs' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff71f8428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff71f8428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff71fa02a in __GI_abort () at abort.c:89
#2  0x00007ffff71f0bd7 in __assert_fail_base (fmt=<optimized out>, 
    assertion=assertion@entry=0x7ffff7bc23d2 "pi->prcno < pi->pirlvl->numprcs", 
    file=file@entry=0x7ffff7bc2364 "/home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c", 
    line=line@entry=305, function=function@entry=0x7ffff7bc2412 "int jpc_pi_nextrpcl(jpc_pi_t *)")
    at assert.c:92
#3  0x00007ffff71f0c82 in __GI___assert_fail (assertion=0x7ffff7bc23d2 "pi->prcno < pi->pirlvl->numprcs", 
    file=0x7ffff7bc2364 "/home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c", line=305, 
    function=0x7ffff7bc2412 "int jpc_pi_nextrpcl(jpc_pi_t *)") at assert.c:101
#4  0x00007ffff7b99c62 in jpc_pi_nextrpcl (pi=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c:305
#5  jpc_pi_next (pi=<optimized out>) at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c:117
#6  0x00007ffff7b9bf3f in jpc_dec_decodepkts (dec=<optimized out>, pkthdrstream=<optimized out>, 
    in=<optimized out>) at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2dec.c:441
#7  0x00007ffff7b44f46 in jpc_dec_process_sod (dec=<optimized out>, ms=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_dec.c:627
#8  0x00007ffff7b49ceb in jpc_dec_decode (dec=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_dec.c:424
#9  jpc_decode (in=<optimized out>, optstr=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_dec.c:261
#10 0x00007ffff7b059ce in jas_image_decode (in=<optimized out>, fmt=<optimized out>, optstr=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/base/jas_image.c:442
#11 0x0000000000401bab in main (argc=<optimized out>, argv=<optimized out>)
    at /home/icy/secreal/jasper/src/appl/imginfo.c:238
(gdb) b jpc_t2cod.c:305 
Breakpoint 9 at 0x7ffff7b986c8: file /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c, line 305.

Trigged in:
Breakpoint 8, calcstepsizes (refstepsize=<optimized out>, numrlvls=24, stepsizes=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_dec.c:1702
jpc_pi_nextrpcl (pi=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2cod.c:305
300							prcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y,
301							  pi->picomp->vsamp << r), pi->pirlvl->prcheightexpn) -
302							  JPC_FLOORDIVPOW2(try0, pi->pirlvl->prcheightexpn);
303							pi->prcno = prcvind * pi->pirlvl->numhprcs + prchind;
304	
305							assert(pi->prcno < pi->pirlvl->numprcs);
306							for (pi->lyrno = 0; pi->lyrno <
307							  pi->numlyrs && pi->lyrno < JAS_CAST(int,
308							  pchg->lyrnoend); ++pi->lyrno) {
309								prclyrno = &pi->pirlvl->prclyrnos[pi->prcno];


Actual results:

crash

Expected results:

crash

Additional info:

Credits:

This vulnerability is detected by team OWL337, with our custom fuzzer collAFL. Please contact ganshuitao@gmail.com   and chaoz@tsinghua.edu.cn if you need more info about the team, the tool or the vulnerability.

Comment 2 Josef Ridky 2017-08-25 10:37:29 UTC
Thank you for taking the time to report this issue to us. We appreciate the feedback and use reports such as this one to guide our efforts at improving our products. That being said, this bug tracking system is not a mechanism for requesting support, and we are not able to guarantee the timeliness or suitability of a resolution.

If this issue is critical or in any way time sensitive, please raise a ticket through the regular Red Hat support channels to ensure it receives the proper attention and prioritization to assure a timely resolution. 

For information on how to contact the Red Hat production support team, please visit:
    https://www.redhat.com/support/process/production/#howto

For proper identification of issue are required properly filled following information:

- Description of problem
- Version-Release number of selected component (if applicable)
- Steps to Reproduce
- Actual results
- Expected results
- Additional info


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