Bug 16949 - optipng new security issues CVE-2015-7802 and CVE-2016-2191
Summary: optipng new security issues CVE-2015-7802 and CVE-2016-2191
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Security (show other bugs)
Version: 5
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact: Sec team
URL: http://lwn.net/Vulnerabilities/682567/
Whiteboard: has_procedure advisory MGA5-64-OK MGA...
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2015-10-12 20:37 CEST by David Walser
Modified: 2016-04-18 19:14 CEST (History)
2 users (show)

See Also:
Source RPM: optipng-0.7.5-3.mga5.src.rpm
CVE:
Status comment:


Attachments
Test image to verify CVE-2016-2191 (164 bytes, image/bmp)
2016-04-09 14:33 CEST, Dan Fandrich
Details

Description David Walser 2015-10-12 20:37:57 CEST
A CVE has been assigned for a security issue in optipng 0.7.5:
http://openwall.com/lists/oss-security/2015/10/10/2

Upstream has been notified, but I don't believe a fix is available yet.  A PoC is attached to the initial report:
http://seclists.org/oss-sec/2015/q3/632

Mageia 5 is also affected.

Reproducible: 

Steps to Reproduce:
David Walser 2015-10-12 20:38:07 CEST

Whiteboard: (none) => MGA5TOO

Comment 1 Dan Fandrich 2015-11-28 22:54:35 CET
According to https://sourceforge.net/p/optipng/bugs/53/, this isn't actually a security issue. I've submitted the patch there to Cauldron, but it doesn't appear that a release to mga5 is warranted.
Comment 2 David Walser 2015-11-28 23:02:47 CET
Looks like only Debian-LTS issued an update for the equivalent issue in 0.6.4:
http://lwn.net/Vulnerabilities/661902/

I guess we could just check the patch into Mageia 5 SVN just in case there are any future issues.

Version: Cauldron => 5
Whiteboard: MGA5TOO => (none)

Comment 3 Dan Fandrich 2015-11-28 23:49:27 CET
Done.
Comment 4 David Walser 2016-04-04 22:35:15 CEST
Another security issue in optipng has been announced today (April 4):
http://openwall.com/lists/oss-security/2016/04/04/2

I don't know for sure if it affects 0.6.4, but there is information about the security vulnerability in the code and reproducer information available in the message linked above.  The issue is fixed upstream in 0.7.6, which I just uploaded for Cauldron.

Summary: optipng new security issue CVE-2015-7802 => optipng new security issues CVE-2015-7802 and CVE-2016-2191

David Walser 2016-04-05 19:24:01 CEST

URL: (none) => http://lwn.net/Vulnerabilities/682567/

Comment 5 Dan Fandrich 2016-04-09 14:16:48 CEST
The 0.7.6 changelog lists only bug fixes from 0.7.5 (the version we have in mga5) so I'm going to bump the version there to fix this.

Here's a test:

(curl http://openwall.com/lists/oss-security/2016/04/04/2 | sed -n -e '1,/^oob\.bmp/d' -e 's/^| //p' ; echo -e '#include <stdio.h>\nmain(){fwrite(bmp,sizeof(bmp),1,fopen("CVE-2016-2191.bmp","w"));}') > CVE-2016-2191.c
# Manually check the file CVE-2016-2191.c for sanity here, since the source
# code has been transferred over an unauthenticated connection
gcc -o CVE-2016-2191 CVE-2016-2191.c
./CVE-2016-2191
optipng CVE-2016-2191.bmp

A susceptible optipng will segfault and print the "Segmentation fault". A fixed optipng will print a bunch of stuff and end with "Output file size = 84 bytesâ¦"

Status: NEW => ASSIGNED

Comment 6 Dan Fandrich 2016-04-09 14:33:47 CEST
Created attachment 7641 [details]
Test image to verify CVE-2016-2191

http://openwall.com/lists/oss-security/2016/04/04/2
Comment 7 Dan Fandrich 2016-04-09 14:56:35 CEST
An update candidate optipng-0.7.6 is now available in updates_testing. Here's a simpler test procedure. Download attachment 7641 [details] and run:

optipng CVE-2016-2191.bmp

Verification is as in comment #5 (i.e. should not segfault).

Advisory:
========================
An updated optipng package fixes a number of bugs and security vulnerabilities.

CVE-2015-7802 - Buffer over-read issue
CVE-2016-2191 - An invalid write and segmentation fault may occur while processing bitmap images

References:
https://sourceforge.net/p/optipng/bugs/53/
http://openwall.com/lists/oss-security/2016/04/04/2
http://optipng.sourceforge.net/history.txt

Updated packages in core/updates_testing:
========================
optipng-0.7.6-1.mga5

from optipng-0.7.6-1.mga5.src.rpm
Dan Fandrich 2016-04-09 14:59:46 CEST

Assignee: dan => qa-bugs

Comment 8 Len Lawrence 2016-04-11 20:00:30 CEST
Tested this on x86_64 machine.

Before the update optipng segfaulted on the test file.
After update:
$ optipng CVE-2016-2191.bmp
** Processing: CVE-2016-2191.bmp
Importing BMP
1x2086 pixels, 4 bits/pixel, grayscale
Input file size = 164 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 0		IDAT size = 27
  zc = 9  zm = 8  zs = 1  f = 0		IDAT size = 27
  zc = 9  zm = 8  zs = 3  f = 0		IDAT size = 27
  zc = 9  zm = 8  zs = 0  f = 5		IDAT size = 27
  zc = 9  zm = 8  zs = 1  f = 5		IDAT size = 27
  zc = 9  zm = 8  zs = 3  f = 5		IDAT size = 27

Selecting parameters:
  zc = 9  zm = 8  zs = 3  f = 0		IDAT size = 27

Output file: CVE-2016-2191.png

Output IDAT size = 27 bytes
Output file size = 84 bytes (80 bytes = 48.78% decrease)

$ ls -l *.png
-rw-r--r-- 1 lcl lcl    84 Apr 11 18:55 CVE-2016-2191.png

In eom it displayed as a black image measuring 1x2086.

CC: (none) => tarazed25

Len Lawrence 2016-04-11 20:01:06 CEST

Whiteboard: (none) => has_procedure MGA5-64-OK

Comment 9 Len Lawrence 2016-04-11 20:10:33 CEST
Ran this in a 32-bit virtualbox and confirmed the before and after behaviour for the test image.

Validating this.
Len Lawrence 2016-04-11 20:11:01 CEST

Keywords: (none) => validated_update
Whiteboard: has_procedure MGA5-64-OK => has_procedure MGA5-64-OK MGA5-32-OK
CC: (none) => sysadmin-bugs

Comment 10 claire robinson 2016-04-13 18:40:48 CEST
David, do you want to flesh out this advisory?
Comment 11 claire robinson 2016-04-13 18:43:58 CEST
Advisory uploaded from comment 7.
claire robinson 2016-04-13 18:44:15 CEST

Whiteboard: has_procedure MGA5-64-OK MGA5-32-OK => has_procedure advisory MGA5-64-OK MGA5-32-OK

Comment 12 Mageia Robot 2016-04-13 19:39:56 CEST
An update for this issue has been pushed to the Mageia Updates repository.

http://advisories.mageia.org/MGASA-2016-0135.html

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED

Comment 13 David Walser 2016-04-14 18:11:17 CEST
LWN reference for CVE-2015-7802:
http://lwn.net/Vulnerabilities/683844/
Comment 14 David Walser 2016-04-18 19:14:41 CEST
CVE-2016-3981 CVE-2016-3982 also fixed in this update:
http://lwn.net/Vulnerabilities/684236/

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