linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] world-writable files in sysfs and debugfs
@ 2011-02-04 12:22 Vasiliy Kulikov
  2011-02-04 12:24 ` [PATCH 18/20] scsi: aic94xx: world-writable sysfs update_bios file Vasiliy Kulikov
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Vasiliy Kulikov @ 2011-02-04 12:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mike Christie, Srinidhi Kasagar, Tony Lindgren,
	platform-driver-x86, socketcan-core, Corentin Chary,
	James E.J. Bottomley, Julia Lawall, Russell King, Samuel Ortiz,
	linux-scsi, Karol Kozimor, Kevin Hilman, Luca Risolia, open-iscsi,
	Wolfgang Grandegger, Matthew Garrett, acpi4asus-user, rtc-linux,
	Carlos Corbacho, Mauro Carvalho Chehab, linux-omap,
	linux-arm-kernel

The search was made with trivial shell commands:

find | xargs grep S_IWUGO
find | xargs grep S_IWOTH

I didn't precisely investigate how exactly one may damage the
system/hardware because of issues number, maybe the harm is very limited
in case of some of these drivers.

One suspicious file is ./staging/speakup/speakup.h, but it explitly calls
macros as world-writable.  I didn't check what speakup's world-writable
files provide because it requires some knowledge about the hardware.


Vasiliy Kulikov (20):
  mach-omap2: mux: world-writable debugfs files
  mach-omap2: pm: world-writable debugfs timer files
  mach-omap2: smartreflex: world-writable debugfs voltage files
  mach-ux500: mbox-db5500: world-writable sysfs fifo file
  leds: lp5521: world-writable sysfs engine* files
  leds: lp5523: world-writable engine* sysfs files
  video: sn9c102: world-wirtable sysfs files
  mfd: ab3100: world-writable debugfs *_priv files
  mfd: ab3500: world-writable debugfs register-* files
  mfd: ab8500: world-writable debugfs register-* files
  misc: ep93xx_pwm: world-writable sysfs files
  net: can: at91_can: world-writable sysfs files
  net: can: janz-ican3: world-writable sysfs termination file
  platform: x86: acer-wmi: world-writable sysfs threeg file
  platform: x86: asus_acpi: world-writable procfs files
  platform: x86: tc1100-wmi: world-writable sysfs wireless and jogdial files
  rtc: rtc-ds1511: world-writable sysfs nvram file
  scsi: aic94xx: world-writable sysfs update_bios file
  scsi: iscsi: world-writable sysfs priv_sess file
  fs: ubifs: world-writable debugfs dump_* files

 arch/arm/mach-omap2/mux.c                  |    2 +-
 arch/arm/mach-omap2/pm-debug.c             |    8 ++++----
 arch/arm/mach-omap2/smartreflex.c          |    4 ++--
 arch/arm/mach-ux500/mbox-db5500.c          |    2 +-
 drivers/leds/leds-lp5521.c                 |   14 +++++++-------
 drivers/leds/leds-lp5523.c                 |   20 ++++++++++----------
 drivers/media/video/sn9c102/sn9c102_core.c |    6 +++---
 drivers/mfd/ab3100-core.c                  |    4 ++--
 drivers/mfd/ab3550-core.c                  |    6 +++---
 drivers/mfd/ab8500-debugfs.c               |    6 +++---
 drivers/misc/ep93xx_pwm.c                  |    6 +++---
 drivers/net/can/at91_can.c                 |    2 +-
 drivers/net/can/janz-ican3.c               |    2 +-
 drivers/platform/x86/acer-wmi.c            |    2 +-
 drivers/platform/x86/asus_acpi.c           |    8 +-------
 drivers/platform/x86/tc1100-wmi.c          |    2 +-
 drivers/rtc/rtc-ds1511.c                   |    2 +-
 drivers/scsi/aic94xx/aic94xx_init.c        |    2 +-
 drivers/scsi/scsi_transport_iscsi.c        |    2 +-
 fs/ubifs/debug.c                           |    6 +++---
 20 files changed, 50 insertions(+), 56 deletions(-)

--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 18/20] scsi: aic94xx: world-writable sysfs update_bios file
  2011-02-04 12:22 [PATCH 00/20] world-writable files in sysfs and debugfs Vasiliy Kulikov
@ 2011-02-04 12:24 ` Vasiliy Kulikov
  2011-02-04 12:24 ` [PATCH 19/20] scsi: iscsi: world-writable sysfs priv_sess file Vasiliy Kulikov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Vasiliy Kulikov @ 2011-02-04 12:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: security, James E.J. Bottomley, Andrew Morton, Julia Lawall,
	Tejun Heo, linux-scsi

Don't allow everybody to load firmware.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
---
 Compile tested only.

 drivers/scsi/aic94xx/aic94xx_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 3b7e83d..d5ff142 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -486,7 +486,7 @@ static ssize_t asd_show_update_bios(struct device *dev,
 			flash_error_table[i].reason);
 }
 
-static DEVICE_ATTR(update_bios, S_IRUGO|S_IWUGO,
+static DEVICE_ATTR(update_bios, S_IRUGO|S_IWUSR,
 	asd_show_update_bios, asd_store_update_bios);
 
 static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 19/20] scsi: iscsi: world-writable sysfs priv_sess file
  2011-02-04 12:22 [PATCH 00/20] world-writable files in sysfs and debugfs Vasiliy Kulikov
  2011-02-04 12:24 ` [PATCH 18/20] scsi: aic94xx: world-writable sysfs update_bios file Vasiliy Kulikov
@ 2011-02-04 12:24 ` Vasiliy Kulikov
       [not found]   ` <1ca8a99eaadde79e662573d89e4f17a20457fba0.1296818921.git.segoon-cxoSlKxDwOJWk0Htik3J/w@public.gmane.org>
  2011-02-04 13:11 ` [rtc-linux] [PATCH 00/20] world-writable files in sysfs and debugfs Linus Walleij
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Vasiliy Kulikov @ 2011-02-04 12:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: security, Mike Christie, James E.J. Bottomley, open-iscsi,
	linux-scsi

Don't allow everybody to change iSCSI settings.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
---
 Compile tested only.

 drivers/scsi/scsi_transport_iscsi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index f905ecb..01543d2 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1847,7 +1847,7 @@ store_priv_session_##field(struct device *dev,				\
 #define iscsi_priv_session_rw_attr(field, format)			\
 	iscsi_priv_session_attr_show(field, format)			\
 	iscsi_priv_session_attr_store(field)				\
-static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO | S_IWUGO,		\
+static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO | S_IWUSR,		\
 			show_priv_session_##field,			\
 			store_priv_session_##field)
 iscsi_priv_session_rw_attr(recovery_tmo, "%d");
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [rtc-linux] [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-02-04 12:22 [PATCH 00/20] world-writable files in sysfs and debugfs Vasiliy Kulikov
  2011-02-04 12:24 ` [PATCH 18/20] scsi: aic94xx: world-writable sysfs update_bios file Vasiliy Kulikov
  2011-02-04 12:24 ` [PATCH 19/20] scsi: iscsi: world-writable sysfs priv_sess file Vasiliy Kulikov
@ 2011-02-04 13:11 ` Linus Walleij
  2011-03-12 20:23 ` Vasiliy Kulikov
       [not found] ` <AANLkTikE-A=Fe-yRrN0opWwJGQ0f4uOzkyB3XCcEUrFE@mail.gmail.com>
  4 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2011-02-04 13:11 UTC (permalink / raw)
  To: rtc-linux
  Cc: Mike Christie, Srinidhi Kasagar, Tony Lindgren,
	platform-driver-x86, socketcan-core, Corentin Chary,
	James E.J. Bottomley, Julia Lawall, Russell King, Samuel Ortiz,
	linux-scsi, Karol Kozimor, Kevin Hilman, Luca Risolia, open-iscsi,
	Wolfgang Grandegger, Matthew Garrett, acpi4asus-user,
	Carlos Corbacho, Mauro Carvalho Chehab, linux-omap,
	linux-arm-kernel, Alessandro Zummo <a.zummo@

2011/2/4 Vasiliy Kulikov <segoon@openwall.com>:

> The search was made with trivial shell commands:
>
> find | xargs grep S_IWUGO
> find | xargs grep S_IWOTH

We only use our debugfs entries as root so it shouldn't matter much, this
is way better, thanks for fixing.

>  mach-ux500: mbox-db5500: world-writable sysfs fifo file
>  mfd: ab3100: world-writable debugfs *_priv files
>  mfd: ab3500: world-writable debugfs register-* files
>  mfd: ab8500: world-writable debugfs register-* files

Acked-by: Linus Walleij <linus.walleij@stericsson.com>

For these.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-02-04 12:22 [PATCH 00/20] world-writable files in sysfs and debugfs Vasiliy Kulikov
                   ` (2 preceding siblings ...)
  2011-02-04 13:11 ` [rtc-linux] [PATCH 00/20] world-writable files in sysfs and debugfs Linus Walleij
@ 2011-03-12 20:23 ` Vasiliy Kulikov
       [not found] ` <AANLkTikE-A=Fe-yRrN0opWwJGQ0f4uOzkyB3XCcEUrFE@mail.gmail.com>
  4 siblings, 0 replies; 14+ messages in thread
From: Vasiliy Kulikov @ 2011-03-12 20:23 UTC (permalink / raw)
  To: linux-kernel, linux-omap, linux-arm-kernel, linux-usb,
	linux-media, platform-driver-x86

> Vasiliy Kulikov (20):
>  mach-ux500: mbox-db5500: world-writable sysfs fifo file
>  leds: lp5521: world-writable sysfs engine* files
>  leds: lp5523: world-writable engine* sysfs files
>  misc: ep93xx_pwm: world-writable sysfs files
>  rtc: rtc-ds1511: world-writable sysfs nvram file
>  scsi: aic94xx: world-writable sysfs update_bios file
>  scsi: iscsi: world-writable sysfs priv_sess file

These are still not merged :(
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 19/20] scsi: iscsi: world-writable sysfs priv_sess file
       [not found]   ` <1ca8a99eaadde79e662573d89e4f17a20457fba0.1296818921.git.segoon-cxoSlKxDwOJWk0Htik3J/w@public.gmane.org>
@ 2011-03-13  8:28     ` Mike Christie
  0 siblings, 0 replies; 14+ messages in thread
From: Mike Christie @ 2011-03-13  8:28 UTC (permalink / raw)
  To: Vasiliy Kulikov
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	security-DgEjT+Ai2ygdnm+yROfE0A, James E.J. Bottomley,
	open-iscsi-/JYPxA39Uh5TLH3MbocFFw,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA

On 02/04/2011 06:24 AM, Vasiliy Kulikov wrote:
> Don't allow everybody to change iSCSI settings.
>
> Signed-off-by: Vasiliy Kulikov<segoon-cxoSlKxDwOJWk0Htik3J/w@public.gmane.org>
> ---
>   Compile tested only.
>
>   drivers/scsi/scsi_transport_iscsi.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index f905ecb..01543d2 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -1847,7 +1847,7 @@ store_priv_session_##field(struct device *dev,				\
>   #define iscsi_priv_session_rw_attr(field, format)			\
>   	iscsi_priv_session_attr_show(field, format)			\
>   	iscsi_priv_session_attr_store(field)				\
> -static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO | S_IWUGO,		\
> +static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO | S_IWUSR,		\
>   			show_priv_session_##field,			\
>   			store_priv_session_##field)
>   iscsi_priv_session_rw_attr(recovery_tmo, "%d");


Sorry for the late reply. Messed up on my side. Patch is correct and ok 
with me. Tested here.

Acked-by: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

-- 
You received this message because you are subscribed to the Google Groups "open-iscsi" group.
To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Security] [PATCH 00/20] world-writable files in sysfs and debugfs
       [not found] ` <AANLkTikE-A=Fe-yRrN0opWwJGQ0f4uOzkyB3XCcEUrFE@mail.gmail.com>
@ 2011-03-14 22:18   ` Andrew Morton
  2011-03-15  2:26   ` James Bottomley
  1 sibling, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2011-03-14 22:18 UTC (permalink / raw)
  To: Vasiliy Kulikov
  Cc: linux-kernel, linux-omap, linux-arm-kernel, linux-usb,
	linux-media, platform-driver-x86, acpi4asus-user, rtc-linux,
	linux-scsi, open-iscsi, security

On Sat, 12 Mar 2011 23:23:06 +0300
Vasiliy Kulikov <segoon@openwall.com> wrote:

> > Vasiliy Kulikov (20):
> >  mach-ux500: mbox-db5500: world-writable sysfs fifo file
> >  leds: lp5521: world-writable sysfs engine* files
> >  leds: lp5523: world-writable engine* sysfs files
> >  misc: ep93xx_pwm: world-writable sysfs files
> >  rtc: rtc-ds1511: world-writable sysfs nvram file
> >  scsi: aic94xx: world-writable sysfs update_bios file
> >  scsi: iscsi: world-writable sysfs priv_sess file
> 
> These are still not merged :(

I grabbed them and shall merge some and send others at relevant
maintainers, thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/20] world-writable files in sysfs and debugfs
       [not found] ` <AANLkTikE-A=Fe-yRrN0opWwJGQ0f4uOzkyB3XCcEUrFE@mail.gmail.com>
  2011-03-14 22:18   ` [Security] " Andrew Morton
@ 2011-03-15  2:26   ` James Bottomley
  2011-03-15  3:09     ` [Security] " Greg KH
  1 sibling, 1 reply; 14+ messages in thread
From: James Bottomley @ 2011-03-15  2:26 UTC (permalink / raw)
  To: Vasiliy Kulikov
  Cc: linux-kernel, linux-omap, linux-arm-kernel, linux-usb,
	linux-media, platform-driver-x86, acpi4asus-user, rtc-linux,
	linux-scsi, open-iscsi, security

On Sat, 2011-03-12 at 23:23 +0300, Vasiliy Kulikov wrote:
> > Vasiliy Kulikov (20):
> >  mach-ux500: mbox-db5500: world-writable sysfs fifo file
> >  leds: lp5521: world-writable sysfs engine* files
> >  leds: lp5523: world-writable engine* sysfs files
> >  misc: ep93xx_pwm: world-writable sysfs files
> >  rtc: rtc-ds1511: world-writable sysfs nvram file
> >  scsi: aic94xx: world-writable sysfs update_bios file
> >  scsi: iscsi: world-writable sysfs priv_sess file
> 
> These are still not merged :(

OK, so I've not been tracking where we are in the dizzying ride on
security systems.  However, I thought we landed up in the privilege
separation arena using capabilities.  That means that world writeable
files aren't necessarily a problem as long as the correct capabilities
checks are in place, right?

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Security] [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-03-15  2:26   ` James Bottomley
@ 2011-03-15  3:09     ` Greg KH
  2011-03-15 11:50       ` James Bottomley
  0 siblings, 1 reply; 14+ messages in thread
From: Greg KH @ 2011-03-15  3:09 UTC (permalink / raw)
  To: James Bottomley
  Cc: Vasiliy Kulikov, security, acpi4asus-user, linux-scsi, rtc-linux,
	linux-usb, linux-kernel, platform-driver-x86, open-iscsi,
	linux-omap, linux-arm-kernel, linux-media

On Mon, Mar 14, 2011 at 10:26:05PM -0400, James Bottomley wrote:
> On Sat, 2011-03-12 at 23:23 +0300, Vasiliy Kulikov wrote:
> > > Vasiliy Kulikov (20):
> > >  mach-ux500: mbox-db5500: world-writable sysfs fifo file
> > >  leds: lp5521: world-writable sysfs engine* files
> > >  leds: lp5523: world-writable engine* sysfs files
> > >  misc: ep93xx_pwm: world-writable sysfs files
> > >  rtc: rtc-ds1511: world-writable sysfs nvram file
> > >  scsi: aic94xx: world-writable sysfs update_bios file
> > >  scsi: iscsi: world-writable sysfs priv_sess file
> > 
> > These are still not merged :(
> 
> OK, so I've not been tracking where we are in the dizzying ride on
> security systems.  However, I thought we landed up in the privilege
> separation arena using capabilities.  That means that world writeable
> files aren't necessarily a problem as long as the correct capabilities
> checks are in place, right?

There are no capability checks on sysfs files right now, so these all
need to be fixed.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Security] [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-03-15  3:09     ` [Security] " Greg KH
@ 2011-03-15 11:50       ` James Bottomley
  2011-03-15 14:18         ` Greg KH
  2011-03-15 16:08         ` Vasiliy Kulikov
  0 siblings, 2 replies; 14+ messages in thread
From: James Bottomley @ 2011-03-15 11:50 UTC (permalink / raw)
  To: Greg KH
  Cc: Vasiliy Kulikov, security, acpi4asus-user, linux-scsi, rtc-linux,
	linux-usb, linux-kernel, platform-driver-x86, open-iscsi,
	linux-omap, linux-arm-kernel, linux-media

On Mon, 2011-03-14 at 20:09 -0700, Greg KH wrote:
> On Mon, Mar 14, 2011 at 10:26:05PM -0400, James Bottomley wrote:
> > On Sat, 2011-03-12 at 23:23 +0300, Vasiliy Kulikov wrote:
> > > > Vasiliy Kulikov (20):
> > > >  mach-ux500: mbox-db5500: world-writable sysfs fifo file
> > > >  leds: lp5521: world-writable sysfs engine* files
> > > >  leds: lp5523: world-writable engine* sysfs files
> > > >  misc: ep93xx_pwm: world-writable sysfs files
> > > >  rtc: rtc-ds1511: world-writable sysfs nvram file
> > > >  scsi: aic94xx: world-writable sysfs update_bios file
> > > >  scsi: iscsi: world-writable sysfs priv_sess file
> > > 
> > > These are still not merged :(
> > 
> > OK, so I've not been tracking where we are in the dizzying ride on
> > security systems.  However, I thought we landed up in the privilege
> > separation arena using capabilities.  That means that world writeable
> > files aren't necessarily a problem as long as the correct capabilities
> > checks are in place, right?
> 
> There are no capability checks on sysfs files right now, so these all
> need to be fixed.

That statement is true but irrelevant, isn't it?  There can't be
capabilities within sysfs files because the system that does them has no
idea what the capabilities would be.  If there were capabilities checks,
they'd have to be in the implementing routines.

I think the questions are twofold:

     1. Did anyone actually check for capabilities before assuming world
        writeable files were wrong?
     2. Even if there aren't any capabilities checks in the implementing
        routines, should there be (are we going the separated
        capabilities route vs the monolithic root route)?

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Security] [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-03-15 11:50       ` James Bottomley
@ 2011-03-15 14:18         ` Greg KH
  2011-03-15 14:25           ` James Bottomley
  2011-03-15 16:08         ` Vasiliy Kulikov
  1 sibling, 1 reply; 14+ messages in thread
From: Greg KH @ 2011-03-15 14:18 UTC (permalink / raw)
  To: James Bottomley
  Cc: Vasiliy Kulikov, security, acpi4asus-user, linux-scsi, rtc-linux,
	linux-usb, linux-kernel, platform-driver-x86, open-iscsi,
	linux-omap, linux-arm-kernel, linux-media

On Tue, Mar 15, 2011 at 07:50:28AM -0400, James Bottomley wrote:
> On Mon, 2011-03-14 at 20:09 -0700, Greg KH wrote:
> > On Mon, Mar 14, 2011 at 10:26:05PM -0400, James Bottomley wrote:
> > > On Sat, 2011-03-12 at 23:23 +0300, Vasiliy Kulikov wrote:
> > > > > Vasiliy Kulikov (20):
> > > > >  mach-ux500: mbox-db5500: world-writable sysfs fifo file
> > > > >  leds: lp5521: world-writable sysfs engine* files
> > > > >  leds: lp5523: world-writable engine* sysfs files
> > > > >  misc: ep93xx_pwm: world-writable sysfs files
> > > > >  rtc: rtc-ds1511: world-writable sysfs nvram file
> > > > >  scsi: aic94xx: world-writable sysfs update_bios file
> > > > >  scsi: iscsi: world-writable sysfs priv_sess file
> > > > 
> > > > These are still not merged :(
> > > 
> > > OK, so I've not been tracking where we are in the dizzying ride on
> > > security systems.  However, I thought we landed up in the privilege
> > > separation arena using capabilities.  That means that world writeable
> > > files aren't necessarily a problem as long as the correct capabilities
> > > checks are in place, right?
> > 
> > There are no capability checks on sysfs files right now, so these all
> > need to be fixed.
> 
> That statement is true but irrelevant, isn't it?  There can't be
> capabilities within sysfs files because the system that does them has no
> idea what the capabilities would be.  If there were capabilities checks,
> they'd have to be in the implementing routines.

Ah, you are correct, sorry for the misunderstanding.

> I think the questions are twofold:
> 
>      1. Did anyone actually check for capabilities before assuming world
>         writeable files were wrong?

I do not think so as the majority (i.e. all the ones that I looked at)
did no such checks.

>      2. Even if there aren't any capabilities checks in the implementing
>         routines, should there be (are we going the separated
>         capabilities route vs the monolithic root route)?

I think the general consensus is that we go the monolithic root route
for sysfs files in that we do not allow them to be world writable.

Do you have any exceptions that you know of that do these checks?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Security] [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-03-15 14:18         ` Greg KH
@ 2011-03-15 14:25           ` James Bottomley
  0 siblings, 0 replies; 14+ messages in thread
From: James Bottomley @ 2011-03-15 14:25 UTC (permalink / raw)
  To: Greg KH
  Cc: Vasiliy Kulikov, security, acpi4asus-user, linux-scsi, rtc-linux,
	linux-usb, linux-kernel, platform-driver-x86, open-iscsi,
	linux-omap, linux-arm-kernel, linux-media

On Tue, 2011-03-15 at 07:18 -0700, Greg KH wrote:
> On Tue, Mar 15, 2011 at 07:50:28AM -0400, James Bottomley wrote:
> > On Mon, 2011-03-14 at 20:09 -0700, Greg KH wrote:
> > > There are no capability checks on sysfs files right now, so these all
> > > need to be fixed.
> > 
> > That statement is true but irrelevant, isn't it?  There can't be
> > capabilities within sysfs files because the system that does them has no
> > idea what the capabilities would be.  If there were capabilities checks,
> > they'd have to be in the implementing routines.
> 
> Ah, you are correct, sorry for the misunderstanding.
> 
> > I think the questions are twofold:
> > 
> >      1. Did anyone actually check for capabilities before assuming world
> >         writeable files were wrong?
> 
> I do not think so as the majority (i.e. all the ones that I looked at)
> did no such checks.

OK, as long as someone checked, I'm happy.

> >      2. Even if there aren't any capabilities checks in the implementing
> >         routines, should there be (are we going the separated
> >         capabilities route vs the monolithic root route)?
> 
> I think the general consensus is that we go the monolithic root route
> for sysfs files in that we do not allow them to be world writable.
> 
> Do you have any exceptions that you know of that do these checks?

Heh, I didn't call our security vacillations a dizzying ride for
nothing.  I know the goal once was to try to run a distro without root
daemons (which is what required the capabilities stuff).  I'm actually
trying to avoid the issue ... I just want to make sure that people who
care aren't all moving in different directions.

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Security] [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-03-15 11:50       ` James Bottomley
  2011-03-15 14:18         ` Greg KH
@ 2011-03-15 16:08         ` Vasiliy Kulikov
  2011-03-15 16:32           ` James Bottomley
  1 sibling, 1 reply; 14+ messages in thread
From: Vasiliy Kulikov @ 2011-03-15 16:08 UTC (permalink / raw)
  To: James Bottomley
  Cc: Greg KH, security, acpi4asus-user, linux-scsi, rtc-linux,
	linux-usb, linux-kernel, platform-driver-x86, open-iscsi,
	linux-omap, linux-arm-kernel, linux-media

On Tue, Mar 15, 2011 at 07:50 -0400, James Bottomley wrote:
>      1. Did anyone actually check for capabilities before assuming world
>         writeable files were wrong?

I didn't check all these files as I haven't got these hardware :-)  But
as I can "chmod a+w" all sysfs files on my machine and they all become
sensible to nonroot writes, I suppose there is nothing preventing
nonroot users from writing to these buggy sysfs files.  As you can see,
there are no capable() checks in these drivers in open() or write().

>      2. Even if there aren't any capabilities checks in the implementing
>         routines, should there be (are we going the separated
>         capabilities route vs the monolithic root route)?

IMO, In any case old good DAC security model must not be obsoleted just
because someone thinks that MAC or anything else is more convenient for
him.  If sysfs is implemented via filesystem then it must support POSIX
permissions semantic.  MAC is very good in _some_ cases, but not instead
of DAC.

Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Security] [PATCH 00/20] world-writable files in sysfs and debugfs
  2011-03-15 16:08         ` Vasiliy Kulikov
@ 2011-03-15 16:32           ` James Bottomley
  0 siblings, 0 replies; 14+ messages in thread
From: James Bottomley @ 2011-03-15 16:32 UTC (permalink / raw)
  To: Vasiliy Kulikov
  Cc: Greg KH, security-DgEjT+Ai2ygdnm+yROfE0A,
	acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA,
	open-iscsi-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-media-u79uwXL29TY76Z2rM5mHXA

On Tue, 2011-03-15 at 19:08 +0300, Vasiliy Kulikov wrote:
> On Tue, Mar 15, 2011 at 07:50 -0400, James Bottomley wrote:
> >      1. Did anyone actually check for capabilities before assuming world
> >         writeable files were wrong?
> 
> I didn't check all these files as I haven't got these hardware :-)

You don't need the hardware to check ... the question becomes is a
capabilities test sitting in the implementation or not.

>   But
> as I can "chmod a+w" all sysfs files on my machine and they all become
> sensible to nonroot writes, I suppose there is nothing preventing
> nonroot users from writing to these buggy sysfs files.  As you can see,
> there are no capable() checks in these drivers in open() or write().
> 
> >      2. Even if there aren't any capabilities checks in the implementing
> >         routines, should there be (are we going the separated
> >         capabilities route vs the monolithic root route)?
> 
> IMO, In any case old good DAC security model must not be obsoleted just
> because someone thinks that MAC or anything else is more convenient for
> him.  If sysfs is implemented via filesystem then it must support POSIX
> permissions semantic.  MAC is very good in _some_ cases, but not instead
> of DAC.

Um, I'm not sure that's even an issue.  capabilities have CAP_ADMIN
which is precisely the same check as owner == root.  We use this a lot
because ioctls ignore the standard unix DAC model.

James



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-03-15 16:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-04 12:22 [PATCH 00/20] world-writable files in sysfs and debugfs Vasiliy Kulikov
2011-02-04 12:24 ` [PATCH 18/20] scsi: aic94xx: world-writable sysfs update_bios file Vasiliy Kulikov
2011-02-04 12:24 ` [PATCH 19/20] scsi: iscsi: world-writable sysfs priv_sess file Vasiliy Kulikov
     [not found]   ` <1ca8a99eaadde79e662573d89e4f17a20457fba0.1296818921.git.segoon-cxoSlKxDwOJWk0Htik3J/w@public.gmane.org>
2011-03-13  8:28     ` Mike Christie
2011-02-04 13:11 ` [rtc-linux] [PATCH 00/20] world-writable files in sysfs and debugfs Linus Walleij
2011-03-12 20:23 ` Vasiliy Kulikov
     [not found] ` <AANLkTikE-A=Fe-yRrN0opWwJGQ0f4uOzkyB3XCcEUrFE@mail.gmail.com>
2011-03-14 22:18   ` [Security] " Andrew Morton
2011-03-15  2:26   ` James Bottomley
2011-03-15  3:09     ` [Security] " Greg KH
2011-03-15 11:50       ` James Bottomley
2011-03-15 14:18         ` Greg KH
2011-03-15 14:25           ` James Bottomley
2011-03-15 16:08         ` Vasiliy Kulikov
2011-03-15 16:32           ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).