Bug 60904 (CVE-2004-1190)

Summary: VUL-0: CVE-2004-1190: Kernel: SG_IO allows privileged/raw operations on cdrom drives
Product: [Novell Products] SUSE Security Incidents Reporter: Thomas Biege <thomas>
Component: IncidentsAssignee: Marcus Meissner <meissner>
Status: RESOLVED FIXED QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P3 - Medium CC: aj, ihno, kde-maintainers, mfrueh, nadvornik, patch-request, security-team, wolfgang.engel
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: CVE-2004-1190: CVSS v2 Base Score: 2.1 (AV:L/AC:L/Au:N/C:N/I:P/A:N)
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: add struct file argument to block device ioctl
Add permission based command table to scsi_ioctl.c

Description Thomas Biege 2004-09-23 20:16:32 UTC
Hello. 
on LKML a missing privilege check for IDE read-only cdrom drives was 
discussed. As a result of the missing check the firmware may be overwritten. 
 
http://lkml.org/lkml/2004/7/30/147 
 
Jens <axboe@> is working on a patch for us. 
 
CAN-2004-0813
Comment 1 Thomas Biege 2004-09-23 20:16:32 UTC
<!-- SBZ_reproduce  -->
-
Comment 2 Jens Axboe 2004-09-23 20:56:55 UTC
Created attachment 23858 [details]
add struct file argument to block device ioctl

This is a prereq for doing read/write permission checks in SG_IO
Comment 3 Jens Axboe 2004-09-23 20:57:37 UTC
Created attachment 23859 [details]
Add permission based command table to scsi_ioctl.c

Add current list of commands that are allowed for read open, write open, or
only users with CAP_SYS_RAWIO.
Comment 4 Jens Axboe 2004-09-23 20:58:48 UTC
These are the two patches against SLES9-GA kernel. Please note that we also need
to update the cd burning programs at the same time, at least a few of them were
buggy in that they only opened the device O_RDONLY while they should have
acquired write permission. This wasn't a problem before this patch was added to
the kernel.
Comment 5 Thomas Biege 2004-09-24 15:16:09 UTC
Thanks Jens for the fixes! 
 
Does it just affect cdrecord? Or do you know about others? 
Comment 6 Thomas Biege 2004-09-24 15:32:28 UTC
Added on request from Jens: 
 
cdrecord should be ok, but k3b is not. dvd+rw-tools might need checking, 
too. and not just burning programs, also programs that use SG_IO for 
anything else - you need write permission for any command that transfers 
data to the drive, not just WRITE_* commands. 
 
SL92-beta should have these issues fixed, since that kernel already 
contains the extended command permission table 
Comment 7 Thomas Biege 2004-09-24 15:35:08 UTC
I added the maintainers of k3b (AFAIK just a frontend for the command-line 
tools), dvd+rw-tools, and cdrdao to this bug. 
 
I think you are all aware of the changes needed for 9.2 because it's kernel 
already includes this patch. 
 
Does your code need patching for 9.1? 
Comment 8 Vladimir Nadvornik 2004-09-24 16:02:42 UTC
cdrdao uses scsi library from cdrecord, so it is OK too. 
Comment 9 Adrian Schröter 2004-09-24 16:04:53 UTC
our version k3b should not have these issues anymore. 
 
jfyi, k3b uses the tools, but it does also open the devices for detecting the 
drives. 
Comment 10 Thomas Biege 2004-09-24 19:41:27 UTC
Adrian, 
so after updating the kernel with Jens' patches k3b would still run or do we 
have to release a new k3b package for 9.1? 
Comment 11 Adrian Schröter 2004-09-24 20:31:10 UTC
we will make an official kernel update containing these changes for 9.1 ? 
 
yes, we would need definitive a new k3b than. 
Comment 12 Kurt Garloff 2004-09-24 20:36:16 UTC
Please, let's do some extensive testing. Last k3b version that I checked 
(~ 5 weeks ago) did not recognize the CD Recorder ... I believe this has 
been fixed since, but I must have missed the update package for SL91. 
Comment 13 Adrian Schröter 2004-09-24 20:43:36 UTC
please, talk we about 9.1 with an official kernel update which will break k3b  
or do we speek about 9.2 ? 
 
k3b on 9.2 does definitive work in general. Maybe not all flavors like CD-RW / 
DVD-RW and so on, but that should maybe get tested by our QA. 
 
Marco, did you tested all kind of medias ? 
Comment 14 Jens Axboe 2004-09-27 15:34:50 UTC
Adrian never entered this for me on friday, so here it is:

We just need to provide updated packages with the kernel security
update. For the programs that have this bug, it's a one-liner fix. The
problem is not the fix, it's checking that all programs do the correct
thing and open the device O_RDWR for issuing SG_IO commands that write
to the device as well. Even things like controlling the volume on the
drive requires write permissions now.
Comment 15 Hubert Mantel 2004-10-05 18:46:11 UTC
I just was bitten by this problem myself now. It was solved by using the latest
kernel from SL 9.2. What exactly do we need to do to solve the problem for 9.1?
Comment 16 Jens Axboe 2004-10-05 18:49:39 UTC
Hubert, what problem?
Comment 17 Jens Axboe 2004-10-06 04:24:07 UTC
Ehm forgot to cc hubert. Please see comment #16.
Comment 18 Marcus Meissner 2004-10-13 22:42:38 UTC
the patch appears not to be in the SLES9-GA branch 
Comment 19 Marcus Meissner 2004-10-18 17:30:36 UTC
CAN-2004-0813 
Comment 20 Jens Axboe 2004-10-18 18:12:37 UTC
I haven't added it, should I?
Comment 21 Hubert Mantel 2004-10-19 15:48:05 UTC
Yes, please go ahead ;)
Comment 22 Jens Axboe 2004-10-20 15:27:22 UTC
The two patches are committed to -GA now. Who should I assign this security
issue to for further processing?

Also note that the subject of the bug isn't entirely correct - this issue
affects not just cdrom devices, but also SCSI drives of any kind.
Comment 23 Marcus Meissner 2004-12-01 21:32:27 UTC
GA branch update released. 
 
this just leaves the 2.4 kernels affected and I am not sure if we want to 
update those. 
Comment 24 Jens Axboe 2004-12-01 21:33:32 UTC
2.4 kernels aren't affected through SG_IO. CDROM_SEND_PACKET is, though. But
that only works on CDROMs, not on hard drives and other SCSI devices.
Comment 25 Marcus Meissner 2004-12-01 21:40:04 UTC
i think in this case we can lay this issue at rest and leave 
the 2.4 kernels as-is and mark this issue fixed. 
Comment 26 Ludwig Nussel 2006-01-17 16:08:41 UTC
CVE-2004-1190
Comment 27 Thomas Biege 2009-10-13 19:50:55 UTC
CVE-2004-1190: CVSS v2 Base Score: 2.1 (AV:L/AC:L/Au:N/C:N/I:P/A:N)