Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 77025 - Kernel uselib() privilege elevation (CAN-2004-1235)
Summary: Kernel uselib() privilege elevation (CAN-2004-1235)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All All
: High critical (vote)
Assignee: Gentoo Security
URL: http://git.kernel.org/?p=linux/kernel...
Whiteboard: [linux <2.6.11]
Keywords:
: 76292 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-07 07:16 UTC by Thierry Carrez (RETIRED)
Modified: 2009-05-03 14:04 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
2.6.10-mm1-brk-locked.patch (2.6.10-mm1-brk-locked.patch,7.06 KB, patch)
2005-01-07 07:24 UTC, Thierry Carrez (RETIRED)
no flags Details | Diff
2.6 Patch (2.6.10-mm1-brk-locked-plasmaroo.patch,9.51 KB, patch)
2005-01-07 09:29 UTC, Tim Yamin (RETIRED)
no flags Details | Diff
2.4 Patch (2.4-brk-locked-plasmaroo.patch,8.08 KB, patch)
2005-01-07 12:43 UTC, Tim Yamin (RETIRED)
no flags Details | Diff
2.4 Patch (Use if kernel does not have PaX) (2.4-brk-locked-plasmaroo.patch,8.01 KB, patch)
2005-01-08 10:24 UTC, Tim Yamin (RETIRED)
no flags Details | Diff
2.4 Patch (Use if kernel does have PaX) (2.4-brk-locked-plasmaroo.PaX.patch,8.70 KB, patch)
2005-01-08 10:26 UTC, Tim Yamin (RETIRED)
no flags Details | Diff
<= 2.4.27 Patch (No PaX) (2.4.27-brk-locked-plasmaroo.patch,8.32 KB, patch)
2005-01-08 13:55 UTC, Tim Yamin (RETIRED)
no flags Details | Diff
<= 2.4.27 Patch (PaX) (2.4.27-brk-locked-plasmaroo.PaX.patch,8.65 KB, patch)
2005-01-08 13:56 UTC, Tim Yamin (RETIRED)
no flags Details | Diff
2.6.7 Patch (2.6.7-brk-locked.plasmaroo.patch,10.68 KB, patch)
2005-01-09 03:26 UTC, Tim Yamin (RETIRED)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Carrez (RETIRED) gentoo-dev 2005-01-07 07:16:12 UTC
It's public now :

===================================================================
Synopsis:  Linux kernel uselib() privilege elevation
Product:   Linux kernel
Version:   2.4 up to and including 2.4.29-rc2, 2.6 up to and including 2.6.10
Vendor:    http://www.kernel.org/
URL:       http://isec.pl/vulnerabilities/isec-0021-uselib.txt
CVE:       CAN-2004-1235
Author:    Paul Starzetz <ihaquer@isec.pl>
Date:      Jan 07, 2005

Issue:
======

Locally  exploitable  flaws  have  been found in the Linux binary format
loaders'  uselib()  functions  that  allow  local  users  to  gain  root
privileges.


Details:
========

The Linux kernel provides a binary format loader layer to load (execute)
programs of different binary formats like ELF or  a.out  and  more.  The
kernel   also   provides   a  function  named  sys_uselib()  to  load  a
corresponding library.  This  function  is  dispatched  to  the  current
process's  binary  format  handler  and is basically a simplified mmap()
coupled with some header parsing code.

An analyze of the uselib function load_elf_library()  from  binfmt_elf.c
revealed a flaw in the handling of the library's brk segment (VMA). That
segment is created with the  current->mm->mmap_sem  semaphore  NOT  held
while  modifying  the  memory layout of the calling process. This can be
used to disturb the memory management and gain elevated privileges. Also
the binfmt_aout binary format loader code is affected in the same way.
=======================================================================
Comment 1 Thierry Carrez (RETIRED) gentoo-dev 2005-01-07 07:24:06 UTC
Created attachment 47851 [details, diff]
2.6.10-mm1-brk-locked.patch

Patch from Marcelo Tossati.
He said it was not very tested.
Comment 2 Thierry Carrez (RETIRED) gentoo-dev 2005-01-07 07:24:41 UTC
2.4 patch at http://linux.bkbits.net:8080/linux-2.4/patch@1.1551
Comment 3 Thierry Carrez (RETIRED) gentoo-dev 2005-01-07 07:45:49 UTC
*** Bug 76292 has been marked as a duplicate of this bug. ***
Comment 4 Tim Yamin (RETIRED) gentoo-dev 2005-01-07 09:29:35 UTC
Created attachment 47865 [details, diff]
2.6 Patch
Comment 5 Christian Birchinger (RETIRED) gentoo-dev 2005-01-07 09:50:04 UTC
The linked 2.4 patch doesn't apply here. Does it depend on another patch which i missed?

No other patch in 2.4.28 here seems to touch the failing binfmt_elf.c

vma patch is only for binfmt_elf32.c and the binfmt_a.out patch is for
binfmt_aout.c

so binfmt_elf.c seems to be vanilla here and the patch still fails.

I also did a generic grep "binfmt_elf.c" on all patches ... none touches that file.
Comment 6 Tim Yamin (RETIRED) gentoo-dev 2005-01-07 12:43:50 UTC
Created attachment 47891 [details, diff]
2.4 Patch
Comment 7 Niels Laukens 2005-01-08 01:39:48 UTC
Just to note, there is also a forum topic about this: http://forums.gentoo.org/viewtopic.php?t=276357

quotes:
* 2.6.10-gentoo-dev-sources-r3 has the fix for this vulnerability.
* The grsec team has posted a set of cummulative patches that
should fix this as far as I can tell. http://www.grsecurity.net/download.php

What about the hardened{,-dev}-sources?
Comment 8 Christian Birchinger (RETIRED) gentoo-dev 2005-01-08 03:41:34 UTC
Fixed in sparc-sources-2.4.28-r4
Comment 9 Tim Yamin (RETIRED) gentoo-dev 2005-01-08 10:24:21 UTC
Created attachment 47953 [details, diff]
2.4 Patch (Use if kernel does not have PaX)
Comment 10 Tim Yamin (RETIRED) gentoo-dev 2005-01-08 10:26:47 UTC
Created attachment 47955 [details, diff]
2.4 Patch (Use if kernel does have PaX)
Comment 11 solar (RETIRED) gentoo-dev 2005-01-08 12:27:34 UTC
grsec-sources patched with the attachment #47955 [details, diff]. -* masked while testing and getting gradm pkg together. 
Comment 12 Tim Yamin (RETIRED) gentoo-dev 2005-01-08 13:55:56 UTC
Created attachment 47970 [details, diff]
<= 2.4.27 Patch (No PaX)
Comment 13 Tim Yamin (RETIRED) gentoo-dev 2005-01-08 13:56:18 UTC
Created attachment 47971 [details, diff]
<= 2.4.27 Patch (PaX)
Comment 14 Tony Vroon (RETIRED) gentoo-dev 2005-01-08 16:56:43 UTC
Security bump; development-sources 2.6.10-r1, arches please mark stable.
Comment 15 Tim Yamin (RETIRED) gentoo-dev 2005-01-09 03:26:54 UTC
Created attachment 48007 [details, diff]
2.6.7 Patch
Comment 16 Tom Martin (RETIRED) gentoo-dev 2005-01-09 05:28:32 UTC
2.6.10-r1 stable on amd64, thanks.
Comment 17 Daniel Drake (RETIRED) gentoo-dev 2005-01-09 08:33:12 UTC
gentoo-dev-sources done
Comment 18 Tim Yamin (RETIRED) gentoo-dev 2005-01-09 13:31:32 UTC
All done, following externally maintained sources still need fixing:

hardened-(dev-)sources -- Adding hardened herd...
hppa-sources -- Adding GMSoft...
mips-sources -- Adding Kumba...
openmosix-sources -- Adding cluster herd...
pegasos-dev-sources -- Adding dholm...
rsbac-(dev-)sources -- Adding kang...
sparc-sources -- Adding Joker (Update with attachment #47953 [details, diff])...
Comment 19 David Holm (RETIRED) gentoo-dev 2005-01-09 13:36:18 UTC
pegasos-dev-sources has already been fixed
Comment 20 Christian Birchinger (RETIRED) gentoo-dev 2005-01-09 13:45:27 UTC
patch updated on sparc
Comment 21 Guy Martin (RETIRED) gentoo-dev 2005-01-10 09:46:22 UTC
Done in hppa-sources-2.6.10_p10.
Comment 22 Konstantin Arkhipov (RETIRED) gentoo-dev 2005-01-10 09:52:57 UTC
done for openMo6-sources.
Comment 23 Adam Mondl (RETIRED) gentoo-dev 2005-01-11 20:45:32 UTC
~x86 hardened-dev-sources-2.6.10 patched
Comment 24 Tony Vroon (RETIRED) gentoo-dev 2005-01-12 12:45:46 UTC
Development-sources now done. Vulnerable ebuilds purged.
Comment 25 Guillaume Destuynder (RETIRED) gentoo-dev 2005-01-13 15:55:27 UTC
rsbac-sources 2.6 tree patched
Comment 26 Adam Mondl (RETIRED) gentoo-dev 2005-01-13 19:13:39 UTC
~x86 hardened-sources-2.4.28-r2 fixed
Comment 27 Daniel Drake (RETIRED) gentoo-dev 2005-01-17 07:27:44 UTC
gentoo-dev-sources is done
Comment 28 Joshua Kinard gentoo-dev 2005-01-18 19:00:37 UTC
mips-sources patched
Comment 29 Guillaume Destuynder (RETIRED) gentoo-dev 2005-01-21 05:35:20 UTC
rsbac-sources 2.4 is also fixed in ~x86
Comment 30 Thierry Carrez (RETIRED) gentoo-dev 2005-03-16 03:16:25 UTC
Mass-Ccing kern-sec@gentoo.org to make sure Kernel Security guys know about all
of these...
Comment 31 Tim Yamin (RETIRED) gentoo-dev 2005-03-29 05:44:19 UTC
All fixed, closing bug.