Bug 19063 - flex new security issue CVE-2016-6354
Summary: flex new security issue CVE-2016-6354
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Security (show other bugs)
Version: 5
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact: Sec team
URL: http://lwn.net/Vulnerabilities/696808/
Whiteboard: advisory MGA5-32-OK MGA5-64-OK
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2016-07-27 16:19 CEST by David Walser
Modified: 2016-11-23 12:11 CET (History)
5 users (show)

See Also:
Source RPM: flex-2.5.39-3.mga5.src.rpm
CVE:
Status comment:


Attachments
2 little flex scripts (984 bytes, text/plain)
2016-11-22 21:52 CET, Lewis Smith
Details

Description David Walser 2016-07-27 16:19:26 CEST
A CVE has been assigned for an issue fixed in flex 2.6.1:
http://openwall.com/lists/oss-security/2016/07/26/12

The fix was patch #2 linked in the message above.

We already have 2.6.1 in Cauldron.  However, it says that to fully fix this, software built with flex versions containing the bug may need to be rebuilt.  We updated flex in Cauldron after the mass rebuild and there are a large number of packages that BR flex.
Comment 1 David Walser 2016-07-27 16:20:19 CEST
I have checked the patch into Mageia 5 SVN.

Assignee: bugsquad => shlomif

Comment 2 David Walser 2016-08-09 20:13:09 CEST
Fedora has issued an advisory for this on August 8:
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/thread/KZDEYNSCYVEMOKRO6EJOUZS7WM5WB43M/

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

Comment 3 Nicolas Lécureuil 2016-11-18 09:23:09 CET
uploaded:

SRPMS:   flex-2.5.39-3.1.mga5

CC: (none) => mageia
Assignee: shlomif => qa-bugs

Comment 4 David Walser 2016-11-18 15:15:32 CET
Nicolas, are we going to rebuild any of the affected packages that were built using the vulnerable flex?

Advisory:
========================

Updated flex packages fix security vulnerability:

It was found that flex incorrectly resized the num_to_read variable in
yy_get_next_buffer. The buffer is resized if this value is less or equal to
zero. With special crafted input it is possible, that the buffer is not resized
if the input is larger than the default buffer size of 16k. This allows a heap
buffer overflow. It may be possible to exploit this remotely, depending on the
application that is built using flex (CVE-2016-6354).

Note that any affected applications would need to be rebuilt with the updated
flex to fully fix this issue.

References:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6354
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/thread/KZDEYNSCYVEMOKRO6EJOUZS7WM5WB43M/
========================

Updated packages in core/updates_testing:
========================
flex-2.5.39-3.1.mga5

from flex-2.5.39-3.1.mga5.src.rpm
Comment 5 Nicolas Lécureuil 2016-11-18 15:40:21 CET
is it needed ?
Comment 6 David Walser 2016-11-18 16:04:15 CET
(In reply to Nicolas Lécureuil from comment #5)
> is it needed ?

To actually fix the issue, it is, unfortunately.
Comment 7 Dave Hodgins 2016-11-21 21:23:20 CET
$ urpmq --whatrequires flex|sort -u
dkms-libafs
flex
php-devel
task-c-devel

Are there other packages that have flex as a build requires, and if so, a way
to list them?

CC: (none) => davidwhodgins
Whiteboard: (none) => advisory

Comment 8 David Walser 2016-11-21 21:24:57 CET
Yeah the issue is really with ones that have it as a BuildRequires (although if it's being used for buliding, as is probably the case in dkms-libafs, that counts too).  I think the only way to get urpmq to show those is if the Sources repository is enabled.

You can also use the Sophie IRC bot:
:what r -s -d Mageia -r 5 flex
Comment 9 Herman Viaene 2016-11-22 14:07:59 CET
MGA5-32 on AcerD620 Xfce
No installation issues
Followed testcase as per flex tutorial http://alumni.cs.ucr.edu/~lgao/teaching/flex.html
So, downloaded it's sample1.lex file and it CLI
$ flex sample1.lex -- this created the lex.yy.c file
$ gcc lex.yy.c -lfl -- results in a.out file
$ ./a.out -- first line herafter is my input, second line is output
username
tester5
terminate with Ctrl-D

CC: (none) => herman.viaene
Whiteboard: advisory => advisory MGA5-32-OK

Comment 10 Lewis Smith 2016-11-22 21:45:30 CET
Testing M5-64 real h/w
Using the two miniscripts from :-
 http://alumni.cs.ucr.edu/~lgao/teaching/flex/sample1.lex
 http://alumni.cs.ucr.edu/~lgao/teaching/flex/sample2.lex
and doing for each one, following their instructions:
 $ flex sample[1|2].lex
 $ gcc lex.yy.c -lfl
 $ ./a.out

Sample1 is slightly enigmatic:
I/P: the literal string 'username', NOT your username.
O/P: your Unix username.
^D to end.

Sample2: just type anything, multiple lines. End with ^D yields e.g.
# of lines = 3, # of chars = 94

BEFORE the update: flex-2.5.39-3.mga5
 Both tests work.

AFTER update: flex-2.5.39-3.1.mga5
 Same.

The update is OK. Validating. Thanks Herman for the lead link. I shall add the two scripts as an attachment for future use.

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

Comment 11 Lewis Smith 2016-11-22 21:52:13 CET
Created attachment 8692 [details]
2 little flex scripts

Both scripts tell how to deploy them; end with ^D .
sample1 : input literal 'username', it returns your actual Unix username.
sample2 : type anything on several lines, after ^D it outputs line/char counts.
Comment 12 Mageia Robot 2016-11-23 12:11:48 CET
An update for this issue has been pushed to the Mageia Updates repository.

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

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


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