Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 42024 - Linux kernel do_mremap VMA limit local privilege escalation vulnerability
Summary: Linux kernel do_mremap VMA limit local privilege escalation vulnerability
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All All
: Highest critical (vote)
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
: 42031 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-18 05:11 UTC by Carsten Lohrke (RETIRED)
Modified: 2011-10-30 22:42 UTC (History)
6 users (show)

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


Attachments
Vicam USB driver patch for CAN-2004-0075 (vicam-CAN-2004-0075.patch,730 bytes, patch)
2004-02-18 14:02 UTC, antiher0
no flags Details | Diff
ncpfs patch for CAN-2004-0010 (ncpfs-CAN-2004-0010.patch,5.91 KB, patch)
2004-02-18 14:02 UTC, antiher0
no flags Details | Diff
Check limits in R128 DRI drivers. (CAN-2004-0003) (r128-CAN-2004-0003.patch,1.73 KB, patch)
2004-02-19 14:16 UTC, antiher0
no flags Details | Diff
Fix user/kernel copying in DRI GAMMA driver. (drm-gamma-redhat.patch,5.32 KB, patch)
2004-02-19 14:17 UTC, antiher0
no flags Details | Diff
mremap patch for kernel 2.4.19 (mremap-2.4.19-CAN-2004-0077.patch,814 bytes, patch)
2004-02-23 14:17 UTC, antiher0
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Lohrke (RETIRED) gentoo-dev 2004-02-18 05:11:28 UTC
affected versions: 2.2 up to 2.2.25, 2.4 up to 2.4.24, 2.6 up to 2.6.2

http://isec.pl/vulnerabilities/isec-0014-mremap-unmap.txt
Comment 1 Tim Yamin (RETIRED) gentoo-dev 2004-02-18 07:34:36 UTC
GLSA and what's already fixed status is available at http://dev.gentoo.org/~plasmaroo/glsa-test/frame-view.php?id=8db39c0bb16c6143fbb68985a47fdd6d
Comment 2 Michal Januszewski (RETIRED) gentoo-dev 2004-02-18 10:38:26 UTC
*** Bug 42031 has been marked as a duplicate of this bug. ***
Comment 3 antiher0 2004-02-18 14:00:40 UTC
Before you release that GLSA, there are a couple of other vulnerabilities to clear up.  I noticed in RedHat's advisory for this vuln, they also addressed 3 other vulns.  One (CAN-2004-0003) was fixed in 2.4.22.  The others (CAN-2004-0010 and CAN-2004-0075) are present in the gentoo-sources-2.4.22-r7 kernel that was just released.

CAN-2004-0003 is a vuln in ncpfs.  CAN-2004-0075 is a vuln in the Vicam USB driver.  They still show up as reserved at cve.mitre.org.

I will attach patches for both from the latest kernel (RedHat uses these same patches).  They both apply cleanly to the gentoo-sources-2.4.22-r7 kernel currently in Portage.  The ncpfs fix is not trivial but it works fine in my testing.  Sorry I haven't tried any other kernels.
Comment 4 antiher0 2004-02-18 14:02:00 UTC
Created attachment 25878 [details, diff]
Vicam USB driver patch for CAN-2004-0075

Vicam USB driver patch for CAN-2004-0075
Comment 5 antiher0 2004-02-18 14:02:31 UTC
Created attachment 25879 [details, diff]
ncpfs patch for CAN-2004-0010

ncpfs patch for CAN-2004-0010
Comment 6 Tim Yamin (RETIRED) gentoo-dev 2004-02-18 14:07:38 UTC
Brian, could you please put these other two patches in -r8 whenever you'll release it? Thanks.
Comment 7 antiher0 2004-02-19 14:15:57 UTC
Wheee!  More security patches to throw at you. :(

After digging through the source, I've found that CAN-2004-0003 is incorrect when it states that the Rage 128 DRM driver vuln was fixed in 2.4.22.  It was really fixed in the latest 2.4.25 kernel.  In other words, the latest gentoo-sources-2.4.22-r7 is vulnerable.  I will attach the patch used by both the mainline kernel and RedHat, made to apply against gentoo-sources-2.4.22-r7.

Also, the latest RedHat kernel fixed a copy_from_user (or lack thereof) vuln in the 3DLabs Gamma DRM driver.  This patch doesn't appear to be in the mainline kernel.  I've worked it up to apply against gentoo-sources-2.4.22-r7 and will attach it also.

In both patches, the DRM-4.1 and DRM-4.0 drivers are updated.  The patches will need to be modifed for any kernels that don't provide both.

Also, yesterday I meant to say CAN-2004-0010 is a vuln in ncpfs, not CAN-2004-0003 (X copy and paste is a little too easy sometimes).  And if these need to go under a new bug, let me know.  Thanks!
Comment 8 antiher0 2004-02-19 14:16:34 UTC
Created attachment 25949 [details, diff]
Check limits in R128 DRI drivers. (CAN-2004-0003)
Comment 9 antiher0 2004-02-19 14:17:02 UTC
Created attachment 25950 [details, diff]
Fix user/kernel copying in DRI GAMMA driver.
Comment 10 Thomas Bullinger 2004-02-21 06:05:06 UTC
Will there be a fix for 2.4.19?
Comment 11 solar (RETIRED) gentoo-dev 2004-02-21 10:36:12 UTC
plasmaroo,

sysctl -w vm.max_map_count=1000000

This seems to work around Christophe Devine's POC code for this bug.
http://marc.theaimsgroup.com/?l=full-disclosure&m=107711498300202&w=2
Comment 12 antiher0 2004-02-23 14:16:31 UTC
Thomas,

Here is the mremap patch made to apply against gentoo-sources-2.4.19-r10.  It is subtly different than the patch for newer kernels and will NOT apply to kernels newer than 2.4.19.
Comment 13 antiher0 2004-02-23 14:17:26 UTC
Created attachment 26198 [details, diff]
mremap patch for kernel 2.4.19

Will NOT apply to kernels newer than 2.4.19.
Comment 14 Tim Yamin (RETIRED) gentoo-dev 2004-02-23 15:04:42 UTC
OK, gentoo-sources-2.4.19-r11 is now in CVS. For reference, the attached patch does not apply, but the one in files/ which I used for 2.4.20 applied fine.
Comment 15 antiher0 2004-02-24 12:05:35 UTC
That's because there is an error in the 2.4.19-r11 ebuild that is causing none of the patches to get applied.  On my box, I get:

>>> Unpacking linux-2.4.19.tar.bz2 to /var/tmp/portage/gentoo-sources-2.4.19-r11/work
>>> Unpacking patches-2.4.19-gentoo-r10.tar.bz2 to /var/tmp/portage/gentoo-sources-2.4.19-r11/work
patching file arch/i386/kernel/entry.S
patching file drivers/char/drm/i810_dma.c
patching file drivers/char/drm-4.0/i810_dma.c
RUNNING FROM extra_functions.sh
 * Applying do_brk_fix.patch...                                                     [ ok ]
RUNNING FROM extra_functions.sh
 * Applying gentoo-sources-2.4.20-munmap.patch...                                   [ ok ]
/usr/sbin/ebuild.sh: line 53: cd: 2.4.19-gentoo-r11: No such file or directory
rm: cannot remove `*xfs*': No such file or directory
rm: cannot remove `70*': No such file or directory
Current kernel version is 2.4.19
Scanning patch directory: '.'
ls: *_*: No such file or directory

during the unpack.  This is, I think, because the ebuild is looking for the patch directory in work/2.4.19-gentoo-r11 ( cd ${KV} ) but it was extracted to work/2.4.19-r10.

The patch I attached yesterday applies to 2.4.19-r10 because the 06_vm-strict-overcommit patch adds a ",1" to the do_munmap() calls.  The -r11 isn't applying the 06_vm-strict-overcommit patch hence the standard kernel patch for this vuln applies to it.  If the ebuild is fixed, the patch I made will work, I think.  But I'm not claiming to be an expert, just trying to help.
Comment 16 Tim Yamin (RETIRED) gentoo-dev 2004-03-28 03:14:54 UTC
Hmmm. This was fixed and a GLSA was released but this bug was never closed, closing the bug.