Bug 526068 - (CVE-2009-3889, CVE-2009-3939) CVE-2009-3889 CVE-2009-3939 kernel: megaraid_sas permissions in sysfs
CVE-2009-3889 CVE-2009-3939 kernel: megaraid_sas permissions in sysfs
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Casey Dahlin
impact=moderate,reported=20091113,pub...
: Security
Depends On: 537309 537310 537311 537312 537313 537314
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-28 12:23 EDT by Bryn M. Reeves
Modified: 2015-02-16 10:44 EST (History)
16 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-23 19:47:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Bryn M. Reeves 2009-09-28 12:23:45 EDT
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@metacarta.com>
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@metacarta.com>
    Acked-by: "Yang, Bo" <Bo.Yang@lsi.com>
    Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

The poll_mode_io pseudofile still has world-writable permissions upstream.
Comment 1 Bryn M. Reeves 2009-09-28 12:27:39 EDT
Created attachment 362913 [details]
Upstream patch for dbg_lvl permissions
Comment 7 Eugene Teo (Security Response) 2009-11-18 06:54:34 EST
dbg_lvl permission issue = CVE-2009-3889
poll_mode_io permission issue = CVE-2009-3939
Comment 13 errata-xmlrpc 2009-12-03 06:28:17 EST
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 18:38:38 EST
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 08:05:07 EST
both patches are present in the current RHEL6 git tree.
Comment 18 Bryn M. Reeves 2010-01-27 07:56:10 EST
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@redhat.com>	
	Thu, 12 Nov 2009 18:31:54 +0000 (18:31 +0000)
committer	Linus Torvalds <torvalds@linux-foundation.org>	
	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@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Comment 19 errata-xmlrpc 2010-02-02 15:41:42 EST
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.