Bug 984808 (CVE-2016-5320) - VUL-1: tiff: CVE-2016-5320: Out-of-bounds write in PixarLogDecode() function in tif_pixarlog.c
Summary: VUL-1: tiff: CVE-2016-5320: Out-of-bounds write in PixarLogDecode() function ...
Status: RESOLVED FIXED
Alias: CVE-2016-5320
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P4 - Low : Normal
Target Milestone: ---
Assignee: Fridrich Strba
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/170091/
Whiteboard: CVSSv2:SUSE:CVE-2016-5320:5.8:(AV:N/A...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-15 09:32 UTC by Marcus Meissner
Modified: 2018-05-30 14:43 UTC (History)
5 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
poc.tif (4.51 KB, application/octet-stream)
2016-06-16 13:19 UTC, Marcus Meissner
Details
Upstream patch that solves this problem (1.06 KB, patch)
2016-07-11 14:38 UTC, Fridrich Strba
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Meissner 2016-06-15 09:32:04 UTC
A vulnerability was found in libtiff. A maliciously crafted TIFF file could cause the application to crash or even enable RCE on vulnerable machine when using rgb2ycbcr command.

References:

http://seclists.org/oss-sec/2016/q2/551

Details
=======

Product: libtiff
Affected Versions: <= 4.0.6
Vulnerability Type: command excution
Vendor URL: http://www.remotesensing.org/libtiff/
CVE ID: CVE-2016-5320
Credit: Kaixiang Zhang of the Cloud Security Team, Qihoo 360


Introduction
=======

It was always corrupted when I use rgb2ycbcr command followed by a crafted TIFF image. The vulnerability of 
out-of-bound writes is in PixarLogDecode () function in tif_pixarlog.c, which cause the function pointer of vgetparent 
to be coverd with any data, command execution could be possible.
Tested system version:
       fedora23 64bit
       CentOS Linux release 7.1.1503 64bit
command :
        ./rgb2ycbcr poc.tif tmpout.tif

  Here is the stack info:
gdb –args ./rgb2ycbcr poc.tif tmpout.tif
--- ---
Program received signal SIGSEGV, Segmentation fault.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[registers]--
$rax     0x5e5e5e5e5e5e5e5e $rbx     0x0000000000608560 $rcx     0x0000000000608560 $rdx     0x00007fffffffd870 $rsp    
 0x00007fffffffd7e0 $rbp     0x00007fffffffd810 $rsi     0x000000000000010a
$rdi     0x0000000000608560 $rip     0x00007ffff7badecb $r8      0x00007ffff7b6be8e $r9      0x0000000000000001 $r10    
 0x00007fffffffd6d0 $r11     0x00007ffff7b685ab $r12     0x0000000000000020
$r13     0x0000000000000200 $r14     0x0000000000607010 $r15     0x0000000000000000 $cs      0x0000000000000033 $ss     
 0x000000000000002b $ds      0x0000000000000000 $es      0x0000000000000000
$fs      0x0000000000000000 $gs      0x0000000000000000 $eflags  [ CF AF SF IF RF ]
Flags: [ CARRY  parity  ADJUST  zero  SIGN  trap  INTERRUPT  direction  overflow  RESUME  virtualx86  identification ]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[stack]--
0x00007fffffffd7e0|+0x00: 0x0                  <- $sp
0x00007fffffffd7e8|+0x08: 0x00007fffffffd870 -> 0x3000000010
0x00007fffffffd7f0|+0x10: 0x10a00000000
0x00007fffffffd7f8|+0x18: 0x0000000000608560 -> 0x0000000000608998 -> "PredictorVGetField.tif"
0x00007fffffffd800|+0x20: 0x10600000000
0x00007fffffffd808|+0x28: 0x0000000000609160 -> "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[...]"
0x00007fffffffd810|+0x30: 0x00007fffffffd850 -> 0x00007fffffffd940 -> 0x10
0x00007fffffffd818|+0x38: 0x00007ffff7b6a880 -> <TIFFVGetField+149>: jmp 0x7ffff7b6a887 <TIFFVGetField+156>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[code:i386:x86-64]--
0x7ffff7badebd         <PredictorVGetField+224>  mov    rdx,QWORD PTR [rbp-0x28]
0x7ffff7badec1         <PredictorVGetField+228>  mov    esi,DWORD PTR [rbp-0x1c]
0x7ffff7badec4         <PredictorVGetField+231>  mov    rcx,QWORD PTR [rbp-0x18]
0x7ffff7badec8         <PredictorVGetField+235>  mov    rdi,rcx
0x7ffff7badecb        <PredictorVGetField+238>  call   rax                <- $pc
0x7ffff7badecd         <PredictorVGetField+240>  leave
0x7ffff7badece         <PredictorVGetField+241>  ret
0x7ffff7badecf <PredictorPrintDir>  push   rbp
0x7ffff7baded0         <PredictorPrintDir+1>  mov    rbp,rsp
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[source:tif_predict.c+706]--
702                case TIFFTAG_PREDICTOR:
703                         *va_arg(ap, uint16*) = (uint16)sp->predictor;
704                         break;
705                default:
706                         return (*sp->vgetparent)(tif, tag, ap);                    <- $pc     ; 
tif=0x00007fffffffd7f8 -> [...] -> "PredictorVGetField.tif", ap=0x00007fffffffd7e8 -> [...] -> 0x3000000010, 
sp=0x00007fffffffd808 -> [...] -> "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[...]"
707                }
708                return 1;
709         }
710
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[trace]--
#0  0x00007ffff7badecb in PredictorVGetField (tif=0x608560, tag=266, ap=0x7fffffffd870) at tif_predict.c:706
#1  0x00007ffff7b6a880 in TIFFVGetField (tif=0x608560, tag=266, ap=0x7fffffffd870) at tif_dir.c:1174
#2  0x00007ffff7b6a7dd in TIFFGetField (tif=0x608560, tag=266) at tif_dir.c:1158
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0x00007ffff7badecb in PredictorVGetField (tif=0x608560, tag=266, ap=0x7fffffffd870) at tif_predict.c:706
706                     return (*sp->vgetparent)(tif, tag, ap);
gef> bt
#0  0x00007ffff7badecb in PredictorVGetField (tif=0x608560, tag=266, ap=0x7fffffffd870) at tif_predict.c:706
#1  0x00007ffff7b6a880 in TIFFVGetField (tif=0x608560, tag=266, ap=0x7fffffffd870) at tif_dir.c:1174
#2  0x00007ffff7b6a7dd in TIFFGetField (tif=0x608560, tag=266) at tif_dir.c:1158
#3  0x0000000000403700 in tiffcvt (in=in@entry=0x608560, out=out@entry=0x607010) at rgb2ycbcr.c:328
#4  0x000000000040183b in main (argc=3, argv=0x7fffffffe328) at rgb2ycbcr.c:127
Comment 1 Marcus Meissner 2016-06-15 09:38:20 UTC
unclkear where the exact fix is though :(
Comment 2 Swamp Workflow Management 2016-06-15 22:01:10 UTC
bugbot adjusting priority
Comment 3 Marcus Meissner 2016-06-16 13:19:40 UTC
Created attachment 681029 [details]
poc.tif

QA REPRODUCER:

rgb2ycbcr poc.tif tmpout.tif


should not segfault
Comment 5 Fridrich Strba 2016-07-11 14:38:27 UTC
Created attachment 683745 [details]
Upstream patch that solves this problem
Comment 6 Swamp Workflow Management 2016-07-27 17:10:43 UTC
openSUSE-SU-2016:1889-1: An update that solves 5 vulnerabilities and has one errata is now available.

Category: security (moderate)
Bug References: 964225,984808,984831,984837,984842,987351
CVE References: CVE-2016-5314,CVE-2016-5316,CVE-2016-5317,CVE-2016-5320,CVE-2016-5875
Sources used:
openSUSE 13.2 (src):    tiff-4.0.6-10.26.1
Comment 7 Fridrich Strba 2016-09-06 07:46:08 UTC
Closing as fixed. Reopen if you think you need to.
Comment 9 Swamp Workflow Management 2016-09-09 10:11:28 UTC
SUSE-SU-2016:2271-1: An update that fixes 9 vulnerabilities is now available.

Category: security (moderate)
Bug References: 964225,973340,984808,984831,984837,984842,987351
CVE References: CVE-2015-8781,CVE-2015-8782,CVE-2015-8783,CVE-2016-3186,CVE-2016-5314,CVE-2016-5316,CVE-2016-5317,CVE-2016-5320,CVE-2016-5875
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP1 (src):    tiff-4.0.6-26.3
SUSE Linux Enterprise Server 12-SP1 (src):    tiff-4.0.6-26.3
SUSE Linux Enterprise Desktop 12-SP1 (src):    tiff-4.0.6-26.3
Comment 11 Swamp Workflow Management 2016-09-16 13:10:11 UTC
openSUSE-SU-2016:2321-1: An update that fixes 9 vulnerabilities is now available.

Category: security (moderate)
Bug References: 964225,973340,984808,984831,984837,984842,987351
CVE References: CVE-2015-8781,CVE-2015-8782,CVE-2015-8783,CVE-2016-3186,CVE-2016-5314,CVE-2016-5316,CVE-2016-5317,CVE-2016-5320,CVE-2016-5875
Sources used:
openSUSE Leap 42.1 (src):    tiff-4.0.6-6.1
Comment 12 Swamp Workflow Management 2016-09-25 10:09:43 UTC
openSUSE-SU-2016:2375-1: An update that fixes 9 vulnerabilities is now available.

Category: security (moderate)
Bug References: 974614,974618,975069,975070,984808,984831,984837,984842,987351
CVE References: CVE-2016-3623,CVE-2016-3945,CVE-2016-3990,CVE-2016-3991,CVE-2016-5314,CVE-2016-5316,CVE-2016-5317,CVE-2016-5320,CVE-2016-5875
Sources used:
openSUSE 13.1 (src):    tiff-4.0.6-8.25.1
Comment 14 Swamp Workflow Management 2016-10-13 15:12:01 UTC
SUSE-SU-2016:2527-1: An update that fixes 10 vulnerabilities is now available.

Category: security (moderate)
Bug References: 973340,974449,974614,974618,975069,984808,984831,984837,984842,987351
CVE References: CVE-2016-3186,CVE-2016-3622,CVE-2016-3623,CVE-2016-3945,CVE-2016-3990,CVE-2016-5314,CVE-2016-5316,CVE-2016-5317,CVE-2016-5320,CVE-2016-5875
Sources used:
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    tiff-3.8.2-141.168.1
SUSE Linux Enterprise Server 11-SP4 (src):    tiff-3.8.2-141.168.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    tiff-3.8.2-141.168.1
Comment 16 Swamp Workflow Management 2018-05-30 13:15:49 UTC
SUSE-SU-2018:1472-1: An update that solves 14 vulnerabilities and has two fixes is now available.

Category: security (moderate)
Bug References: 1017694,1031250,1031254,1033109,1033111,1033112,1033113,1033120,1033126,1033127,1033129,1074317,984808,984809,984831,987351
CVE References: CVE-2016-10267,CVE-2016-10269,CVE-2016-10270,CVE-2016-5314,CVE-2016-5315,CVE-2017-18013,CVE-2017-7593,CVE-2017-7595,CVE-2017-7596,CVE-2017-7597,CVE-2017-7599,CVE-2017-7600,CVE-2017-7601,CVE-2017-7602
Sources used:
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    tiff-3.8.2-141.169.6.1
SUSE Linux Enterprise Server 11-SP4 (src):    tiff-3.8.2-141.169.6.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    tiff-3.8.2-141.169.6.1