Bug 526068 (CVE-2009-3889, CVE-2009-3939) - CVE-2009-3889 CVE-2009-3939 kernel: megaraid_sas permissions in sysfs
Summary: CVE-2009-3889 CVE-2009-3939 kernel: megaraid_sas permissions in sysfs
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2009-3889, CVE-2009-3939
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Casey Dahlin
QA Contact:
URL:
Whiteboard:
Depends On: 537309 537310 537311 537312 537313 537314
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-09-28 16:23 UTC by Bryn M. Reeves
Modified: 2019-09-29 12:32 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-23 23:47:05 UTC
Embargoed:


Attachments (Terms of Use)
Upstream patch for dbg_lvl permissions (1.22 KB, patch)
2009-09-28 16:27 UTC, Bryn M. Reeves
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:1635 0 normal SHIPPED_LIVE Important: kernel-rt security, bug fix, and enhancement update 2009-12-03 11:27:50 UTC
Red Hat Product Errata RHSA-2010:0046 0 normal SHIPPED_LIVE Important: kernel security and bug fix update 2010-01-19 23:36:43 UTC
Red Hat Product Errata RHSA-2010:0076 0 normal SHIPPED_LIVE Important: kernel security and bug fix update 2010-02-02 20:41:06 UTC

Description Bryn M. Reeves 2009-09-28 16:23:45 UTC
Description of problem:
The megaraid_sas driver exposes a number of driver attributes in sysfs. Many of these are read-only, just export information from the driver and are world-readable.

A couple of attributes are writable and may be used to change the behaviour of the driver (e.g. setting debug logging levels, selecting poll vs. interrupt I/O mode etc).

Some of these writable attributes are mistakenly created with world-writable permissions, e.g. dbg_lvl and poll_mode_io:

rw-rw-rw- root root  /sys/bus/pci/drivers/megaraid_sas/dbg_lvl
rw-rw-rw- root root  /sys/bus/pci/drivers/megaraid_sas/poll_mode_io

$ grep 'DRIVER_ATTR.*S_IWUGO' drivers/scsi/megaraid/megaraid_sas.c 
static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUGO, megasas_sysfs_show_dbg_lvl,
static DRIVER_ATTR(poll_mode_io, S_IRUGO|S_IWUGO,

This would allow an unprivileged user to affect kernel driver behaviour and logging level.

Version-Release number of selected component (if applicable):
2.6.18-*.el5

How reproducible:
100%

Steps to Reproduce:
(On a system with megaraid_sas loaded)
1. ls -l /sys/bus/pci/drivers/megaraid_sas/dbg_lvl
2. ls -l /sys/bus/pci/drivers/megaraid_sas/poll_mode_io

  
Actual results:
rw-rw-rw- root root  /sys/bus/pci/drivers/megaraid_sas/dbg_lvl
rw-rw-rw- root root  /sys/bus/pci/drivers/megaraid_sas/poll_mode_io

Expected results:
rw------- root root  /sys/bus/pci/drivers/megaraid_sas/dbg_lvl
rw------- root root  /sys/bus/pci/drivers/megaraid_sas/poll_mode_io

Additional info:

Upstream made the dbd_lvl permissions more restrictive:

commit 66dca9b8c50b5e59d3bea8b21cee5c6dae6c9c46
Author: Joe Malicki <jmalicki>
Date:   Thu Aug 14 17:14:48 2008 -0400

    [SCSI] megaraid_sas: remove sysfs dbg_lvl world writeable permissions
    
    /sys/bus/pci/drivers/megaraid_sas/dbg_lvl defaults to being
    world-writable, which seems bad (letting any user affect kernel driver
    behavior and logging level).
    
    This turns off group and user write permissions, so that on typical
    production systems only root can write to it.
    
    [jejb: fix up rejections]
    Signed-off-by: Joseph Malicki <jmalicki>
    Acked-by: "Yang, Bo" <Bo.Yang>
    Signed-off-by: James Bottomley <James.Bottomley>

The poll_mode_io pseudofile still has world-writable permissions upstream.

Comment 1 Bryn M. Reeves 2009-09-28 16:27:39 UTC
Created attachment 362913 [details]
Upstream patch for dbg_lvl permissions

Comment 7 Eugene Teo (Security Response) 2009-11-18 11:54:34 UTC
dbg_lvl permission issue = CVE-2009-3889
poll_mode_io permission issue = CVE-2009-3939

Comment 13 errata-xmlrpc 2009-12-03 11:28:17 UTC
This issue has been addressed in following products:

  MRG for RHEL-5

Via RHSA-2009:1635 https://rhn.redhat.com/errata/RHSA-2009-1635.html

Comment 15 errata-xmlrpc 2010-01-19 23:38:38 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2010:0046 https://rhn.redhat.com/errata/RHSA-2010-0046.html

Comment 17 Aristeu Rozanski 2010-01-26 13:05:07 UTC
both patches are present in the current RHEL6 git tree.

Comment 18 Bryn M. Reeves 2010-01-27 12:56:10 UTC
Picked up in Linus' tree a couple of weeks ago:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bb7d3f24c71e528989501617651b669fbed798cb

author	Bryn M. Reeves <bmr>	
	Thu, 12 Nov 2009 18:31:54 +0000 (18:31 +0000)
committer	Linus Torvalds <torvalds>	
	Wed, 13 Jan 2010 05:12:36 +0000 (21:12 -0800)
commit	bb7d3f24c71e528989501617651b669fbed798cb
tree	b94c2c2fcaaaf005cc7d9e78583df3131c437280	tree | snapshot
parent	90aeb7c01c2da631cb611871a50980cbb6ca7149	commit | diff
[SCSI] megaraid_sas: remove sysfs poll_mode_io world writeable permissions

/sys/bus/pci/drivers/megaraid_sas/poll_mode_io defaults to being
world-writable, which seems bad (letting any user affect kernel driver
behavior).

This turns off group and user write permissions, so that on typical
production systems only root can write to it.

Signed-off-by: Bryn M. Reeves <bmr>
Signed-off-by: Linus Torvalds <torvalds>

Comment 19 errata-xmlrpc 2010-02-02 20:41:42 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 4

Via RHSA-2010:0076 https://rhn.redhat.com/errata/RHSA-2010-0076.html


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