security
security copied to clipboard
Roundup: [oss-security] jasper: heap-based buffer overflow in jpc_dec_tiledecode (jpc_dec.c)
Here is a report from the oss-security mailing list for Vulnerability Roundup 27.
Skip to First Email
Instructions:
Identification
Identify if we have the software, in 16.09, 17.03, and unstable. Then determine if we are vulnerable, and make a comment with your findings. It can also be helpful to specify if you think there is a patch, or if it can be fixed via a general update.
Example:
unstable: we are not vulnerable (link to the package)
17.03: we are vulnerable (link to the package)
16.09: we don't have it packaged
IMPORTANT: If you believe there are possibly related issues, bring them up on the parent issue!
Patching
Start by commenting on this issue saying you're working on a patch. This way, we don't duplicate work.
If you open a pull request, tag this issue and the master issue for the roundup.
If you commit the patch directly to a branch, please leave a comment on this issue with the branch and the commit hash, example:
fixed:
release-16.09: abc123
Skip to First Email
Upon Completion ...
- [ ] Update Graham's database
Info
Triage Indicator:
-needs-triage +roundup27 thread:0000000000002655
- File Search: https://search.nix.gsc.io/?q=jasper&i=fosho&repos=nixos-nixpkgs
- GitHub Search: https://github.com/NixOS/nixpkgs/search?utf8=%E2%9C%93&q=jasper+in%3Apath&type=Code
Should the search term be changed from jasper
? Suggest a new package search by commenting:
-suggested:jasper +suggested:correctPackageName thread:0000000000002655
Known CVEs: CVE-2016-10249
Skip to End
Sun, 23 Oct 2016 10:01:07 +0200 Agostino Sarubbo <ago-at-gentoo.org>, 295468895.Z3kUJlH9qt@arcadia
Description:
jasper is an open-source initiative to provide a free software-based reference
implementation of the codec specified in the JPEG-2000 Part-1 standard.
Another round of fuzzing on an updated version (1.900.10) a buffer over read
because of an integer overflow.
The complete ASan output:
# imginfo -f $FILE
warning: not enough tile data (9 bytes)
=================================================================
==15870==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x7f0c6a964770 at pc 0x7f0c729e93a4 bp 0x7ffd08758cf0 sp 0x7ffd08758ce8
READ of size 8 at 0x7f0c6a964770 thread T0
#0 0x7f0c729e93a3 in jpc_dec_tiledecode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:1126:43
#1 0x7f0c729d9567 in jpc_dec_process_eoc /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:1170:8
#2 0x7f0c729e20c4 in jpc_dec_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:390:10
#3 0x7f0c729e20c4 in jpc_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:254
#4 0x7f0c729afc41 in jp2_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jp2/jp2_dec.c:215:21
#5 0x7f0c7293fa29 in jas_image_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/base/jas_image.c:392:16
#6 0x4f1686 in main /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/appl/imginfo.c:188:16
#7 0x7f0c71a4c61f in __libc_start_main /var/tmp/portage/sys-
libs/glibc-2.22-r4/work/glibc-2.22/csu/libc-start.c:289
#8 0x418e68 in _init (/usr/bin/imginfo+0x418e68)
0x7f0c6a964770 is located 0 bytes to the right of 64749424-byte region
[0x7f0c66ba4800,0x7f0c6a964770)
allocated by thread T0 here:
#0 0x4c03b8 in malloc /var/tmp/portage/sys-devel/llvm-3.8.1-
r2/work/llvm-3.8.1.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52
#1 0x7f0c7297efbe in jas_malloc /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/base/jas_malloc.c:105:11
#2 0x7f0c7297efbe in jas_alloc2 /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/base/jas_malloc.c:136
#3 0x7f0c7297fb44 in jas_matrix_create /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/base/jas_seq.c:129:25
#4 0x7f0c7297f71b in jas_seq2d_create /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/base/jas_seq.c:90:17
#5 0x7f0c729d4280 in jpc_dec_tileinit /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:702:23
#6 0x7f0c729d4280 in jpc_dec_process_sod /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:559
#7 0x7f0c729e20c4 in jpc_dec_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:390:10
#8 0x7f0c729e20c4 in jpc_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:254
#9 0x7f0c729afc41 in jp2_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jp2/jp2_dec.c:215:21
#10 0x7f0c7293fa29 in jas_image_decode /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/base/jas_image.c:392:16
#11 0x4f1686 in main /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/appl/imginfo.c:188:16
#12 0x7f0c71a4c61f in __libc_start_main /var/tmp/portage/sys-
libs/glibc-2.22-r4/work/glibc-2.22/csu/libc-start.c:289
SUMMARY: AddressSanitizer: heap-buffer-overflow /tmp/portage/media-
libs/jasper-1.900.10/work/jasper-1.900.10/src/libjasper/jpc/jpc_dec.c:1126:43
in jpc_dec_tiledecode
Shadow bytes around the buggy address:
0x0fe20d524890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe20d5248a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe20d5248b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe20d5248c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe20d5248d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fe20d5248e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[fa]fa
0x0fe20d5248f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe20d524900: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe20d524910: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe20d524920: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe20d524930: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==15870==ABORTING
Affected version:
1.900.10
Fixed version:
1.900.12
Commit fix:
https://github.com/mdadams/jasper/commit/988f8365f7d8ad8073b6786e433d34c553ecf568
Credit:
This bug was discovered by Agostino Sarubbo of Gentoo.
CVE:
N/A
Reproducer:
https://github.com/asarubbo/poc/blob/master/00001-jasper-heapoverflow-jpc_dec_tiledecode
Timeline:
2016-10-22: bug discovered
2016-10-22: bug reported to upstream
2016-10-22: upstream released the patch
2016-10-23: upstream released 1.900.12
2016-10-23: blog post about the issue
Note:
This bug was found with American Fuzzy Lop.
Permalink:
https://blogs.gentoo.org/ago/2016/10/23/jasper-heap-based-buffer-overflow-in-jpc_dec_tiledecode-jpc_dec-c/
--
Agostino Sarubbo
Gentoo Linux Developer
Skip to End
Mon, 13 Mar 2017 11:35:12 +0100 Agostino Sarubbo <ago-at-gentoo.org>, 4644054.hoH7EUZc3H@blackgate
On Sunday 23 October 2016 10:01:07 Agostino Sarubbo
wrote:
> Permalink:
> https://blogs.gentoo.org/ago/2016/10/23/jasper-heap-based-buffer-overflow-in
> -jpc_dec_tiledecode-jpc_dec-c/
This is CVE-2016-10249
--
Agostino Sarubbo
Gentoo Linux Developer
Skip to End