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.
Created attachment 362913 [details] Upstream patch for dbg_lvl permissions
dbg_lvl permission issue = CVE-2009-3889 poll_mode_io permission issue = CVE-2009-3939
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
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
both patches are present in the current RHEL6 git tree.
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>
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