Bug 14852 - glibc nss_dns getnetbyname security issue CVE-2014-9402
Summary: glibc nss_dns getnetbyname security issue CVE-2014-9402
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Security (show other bugs)
Version: 4
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact: Sec team
URL: http://lwn.net/Vulnerabilities/627410/
Whiteboard: advisory has_procedure MGA4-64-OK MGA...
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2014-12-19 10:07 CET by Thomas Backlund
Modified: 2015-01-08 13:24 CET (History)
5 users (show)

See Also:
Source RPM: glibc
CVE:
Status comment:


Attachments

Description Thomas Backlund 2014-12-19 10:07:49 CET
Avoid infinite loop in nss_dns getnetbyname [BZ #17630] CVE-2014-9402

Also check:
CVE-2012-3406: Stack overflow in vfprintf [BZ #16617]
https://sourceware.org/git/?p=glibc.git;a=commit;h=a3a1f4163c4d0f9a36056c8640661a88674ae8a2

and lock elision disabling on mga4

Reproducible: 

Steps to Reproduce:
Thomas Backlund 2014-12-19 10:08:19 CET

Whiteboard: (none) => MGA4TOO

David Walser 2014-12-23 18:29:34 CET

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

Comment 1 Thomas Backlund 2014-12-23 22:25:54 CET
Cauldron patched.

Packages for mga4:

SRPMS:
glibc-2.18-9.8.mga4.src.rpm


i586:
glibc-2.18-9.8.mga4.i586.rpm
glibc-devel-2.18-9.8.mga4.i586.rpm
glibc-doc-2.18-9.8.mga4.noarch.rpm
glibc-i18ndata-2.18-9.8.mga4.i586.rpm
glibc-profile-2.18-9.8.mga4.i586.rpm
glibc-static-devel-2.18-9.8.mga4.i586.rpm
glibc-utils-2.18-9.8.mga4.i586.rpm
nscd-2.18-9.8.mga4.i586.rpm


x86_64:
glibc-2.18-9.8.mga4.x86_64.rpm
glibc-devel-2.18-9.8.mga4.x86_64.rpm
glibc-doc-2.18-9.8.mga4.noarch.rpm
glibc-i18ndata-2.18-9.8.mga4.x86_64.rpm
glibc-profile-2.18-9.8.mga4.x86_64.rpm
glibc-static-devel-2.18-9.8.mga4.x86_64.rpm
glibc-utils-2.18-9.8.mga4.x86_64.rpm
nscd-2.18-9.8.mga4.x86_64.rpm



Advisory:
The vfprintf function in stdio-common/vfprintf.c in GNU C Library (aka glibc)
2.5, 2.12, and probably other versions does not "properly restrict the use of"
the alloca function when allocating the SPECS array, which allows context-
dependent attackers to bypass the FORTIFY_SOURCE format-string protection
mechanism and cause a denial of service (crash) or possibly execute arbitrary
code via a crafted format string using positional parameters and a large
number of format specifiers (CVE-2012-3406).

The nss_dns implementation of getnetbyname could run into an infinite loop
if the DNS response contained a PTR record of an unexpected format
(CVE-2014-9402).

Also glibc lock elision (new feature in glibc 2.18) has been disabled
as it can break glibc at runtime on newer Intel hardware (due to hardware
bug)

Assignee: tmb => qa-bugs
Whiteboard: MGA4TOO => (none)
Version: Cauldron => 4

Comment 2 David Walser 2014-12-25 00:41:39 CET
The patch for CVE-2012-3406 contains testcases, but they don't build.

CVE-2014-9402 has a PoC here:
https://sourceware.org/bugzilla/show_bug.cgi?id=17630#c10

but that one always tells me the lookup failed (before or after the update).  I'm not sure why.

I have the update installed on my newer PogoLinux system at home on Mageia 4 i586 and don't notice any general problems.
Comment 3 Herman Viaene 2014-12-29 17:18:00 CET
MGA4-64 on HP Probook 6555b KDE
No installation issues.
I copied the PoC program from Comment 2 in a file, but when I try to compile it I get error
$ gcc glibcbug.c 
glibcbug.c: In function âmainâ:
glibcbug.c:15:5: error: âforâ loop initial declarations are only allowed in C99 mode
     for (char **p = ne->n_aliases; *p; ++p) {
     ^
glibcbug.c:15:5: note: use option -std=c99 or -std=gnu99 to compile your code

CC: (none) => herman.viaene

Comment 4 David Walser 2014-12-29 17:47:45 CET
(In reply to Herman Viaene from comment #3)
> MGA4-64 on HP Probook 6555b KDE
> No installation issues.
> I copied the PoC program from Comment 2 in a file, but when I try to compile
> it I get error
> $ gcc glibcbug.c 
> glibcbug.c: In function âmainâ:
> glibcbug.c:15:5: error: âforâ loop initial declarations are only allowed in
> C99 mode
>      for (char **p = ne->n_aliases; *p; ++p) {
>      ^
> glibcbug.c:15:5: note: use option -std=c99 or -std=gnu99 to compile your code

It tells you in the last line of output how to fix that.  gcc -std=c99 glibcbug.c
Comment 5 Herman Viaene 2014-12-29 21:45:30 CET
MGA4-64 on HP Probook 6555b KDE
At CLI:
$ gcc -std=c99 glibcbug.c -o glbc
[xxx@yyy ~]$ ./glbc 
Segmentation fault
Comment 6 Dave Hodgins 2014-12-30 15:47:12 CET
This version of glibc does not cause the 5 minute delay on my system, that the
prior updates testing version did, so it's ok by me, though more people should
test it before oking it.

CC: (none) => davidwhodgins

Comment 7 Thomas Backlund 2014-12-30 17:42:32 CET
(In reply to Dave Hodgins from comment #6)
> This version of glibc does not cause the 5 minute delay on my system, that
> the
> prior updates testing version did, 

I wonder if that actually was an glibc issue, or if you happend to install the dbus package with low timeouts we had in testing so people could confirm the timing issues and grab more verbose logs for Simon McVittie (upstream maintainer) as tracked on: https://bugs.mageia.org/show_bug.cgi?id=14249
Comment 8 Lewis Smith 2014-12-30 21:04:25 CET
MGA4 x64 real hardware

Can someone please explain the last part of: ânetworks: files dnsâ in
 /etc/nsswitch.conf
using the name â4.0.41.198.in-addr.arpa.â given in the PoC from Comment 2? i.e. Where to cite the given name string. That file currently has a
 networks:       files
line, OK one adds 'dns'. But the other goes where?
[Meanwhile, I got the same result as Herman in Comment 5].

CC: (none) => lewyssmith

Comment 9 David Walser 2014-12-30 21:47:06 CET
(In reply to Lewis Smith from comment #8)
> MGA4 x64 real hardware
> 
> Can someone please explain the last part of: ânetworks: files dnsâ in
>  /etc/nsswitch.conf
> using the name â4.0.41.198.in-addr.arpa.â given in the PoC from Comment 2?
> i.e. Where to cite the given name string. That file currently has a
>  networks:       files
> line, OK one adds 'dns'. But the other goes where?
> [Meanwhile, I got the same result as Herman in Comment 5].

Ahh, I hadn't edited my nsswitch.conf, so maybe that's why I couldn't get the PoC to work.  Anyway, the 4.0.41.198.in-addr.arpa. is supposed to be given as an argument to the PoC program when you run it.

CC: (none) => luigiwalser

Comment 10 Dave Hodgins 2014-12-31 18:54:56 CET
(In reply to Thomas Backlund from comment #7)
> (In reply to Dave Hodgins from comment #6)
> > This version of glibc does not cause the 5 minute delay on my system, that
> > the
> > prior updates testing version did, 
> 
> I wonder if that actually was an glibc issue, or if you happend to install
> the dbus package with low timeouts we had in testing so people could confirm
> the timing issues and grab more verbose logs for Simon McVittie (upstream
> maintainer) as tracked on: https://bugs.mageia.org/show_bug.cgi?id=14249

Downgrading just glibc fixed the problem, so I'm assuming
it was a glibc issue.
Comment 11 David Walser 2015-01-07 16:46:58 CET
Ideally this would have gone out with the kernel update we just pushed.  I think it has been long enough to OK and validate this one.
Comment 12 claire robinson 2015-01-07 16:51:10 CET
glibc, kernel and nvidia drivers at one time is likely asking for trouble. We'll try and get more testers for this in Thursday meeting.
Comment 13 David Walser 2015-01-07 16:52:44 CET
It's better to push glibc and kernel at the same time, so people installing updates only have to reboot once.  We've done it this way more often than not.
Comment 14 claire robinson 2015-01-07 16:56:34 CET
Not with updated nvidia driver at the same time. It would cause a large surface area for breakage with mirror syncs etc.
Comment 15 David Walser 2015-01-07 16:58:34 CET
I don't see the relevance of the nvidia driver.  I'd prefer to avoid the inconvenience for the users/sysadmins out there.
Comment 16 claire robinson 2015-01-07 17:04:36 CET
We're clearly viewing this from different angles. Let's ask Thomas.

What would you prefer Thomas? I'll upload the advisory so it can be validated if you give the OK.
Comment 17 claire robinson 2015-01-07 17:11:26 CET
Advisory uploaded.

Whiteboard: (none) => has_procedure advisory

Comment 18 Lewis Smith 2015-01-07 20:34:58 CET
MGA4 x64
At last re-doing the PoC test left at Comment 8 & Comment 9.
 glibc-2.18-9.8.mga4
 glibc-devel-2.18-9.8.mga4
i.e. only after the update, which I have been using without problems for some time.

 $ ./a.out 4.0.41.198.in-addr.arpa.
 a.out: getnetbyname(4.0.41.198.in-addr.arpa.) failed
I suppose this is correct; at least there is no loop (the bug, Comment 1) nor segfault (Comment 5).

Comment 11 - Comment 15 seem sensible: yes, push glibc with the kernels, and nvidia is not relevant here so should not be linked.
Comment 19 Herman Viaene 2015-01-08 09:55:40 CET
Lewis,
What did you change since Comment 8? Ik keep getting the segmentation fault.
Comment 20 Herman Viaene 2015-01-08 10:00:09 CET
Misread the PoC, I get the same result as Comment 18
Comment 21 Herman Viaene 2015-01-08 10:22:49 CET
MGA4-32 on AcerD620 Xfce
No installation issues. Confirm result as per Comment 18.

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

Comment 22 claire robinson 2015-01-08 13:14:33 CET
Validating.

Please push to 4 updates

Thanks

Keywords: (none) => validated_update
CC: (none) => sysadmin-bugs

Comment 23 Mageia Robot 2015-01-08 13:24:48 CET
An update for this issue has been pushed to Mageia Updates repository.

http://advisories.mageia.org/MGASA-2015-0013.html

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


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