Bug 651147 (CVE-2010-4157)

Summary: CVE-2010-4157 kernel: gdth: integer overflow in ioc_general()
Product: [Other] Security Response Reporter: Petr Matousek <pmatouse>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: bhu, dhoward, jkacur, jolsa, lgoncalv, mjc, plyons, rkhan, vdanen, vgoyal, williams
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-19 09:16:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 651172, 651173, 651174, 651175, 651176    
Bug Blocks:    

Description Petr Matousek 2010-11-08 21:43:20 UTC
Description of problem:
gdth_ioctl_alloc() takes the size variable as an int. copy_from_user() takes the size variable as an unsigned long. gen.data_len and gen.sense_len are unsigned longs. On x86_64 longs are 64 bit and ints are 32 bit.

We could pass in a very large number and the allocation would truncate the size to 32 bits and allocate a small buffer.  Then when we do the copy_from_user(), it would result in a memory corruption.

Reference:
http://ns3.spinics.net/lists/linux-scsi/msg47361.html

Upstream:
http://git.kernel.org/linus/f63ae56e4e97fb12053590e41a4fa59e7daa74a4

Comment 1 Petr Matousek 2010-11-08 22:14:37 UTC
Affects only 64 bit installations with GDT ISA/EISA/PCI Disk Array Controllers as the driver scans buses for aforementioned devices before creating /dev/gdth which the affected IOCTL is to be called against. Also, /dev/gdth has to be accessible for non-root users.

Comment 2 Petr Matousek 2010-11-08 22:17:35 UTC
Statement:

The Linux kernel as shipped with Red Hat Enterprise Linux 3 did not include the vulnerable code, and therefore is not affected by this issue. Future kernel updates in Red Hat Enterprise Linux 4, 5 and Red Hat Enterprise MRG may address this flaw.

Comment 4 Kurt Seifried 2010-11-09 01:40:38 UTC
http://seclists.org/oss-sec/2010/q4/136

From: Dan Rosenberg <dan.j.rosenberg () gmail com>
Date: Mon, 8 Nov 2010 19:47:29 -0500

This is not actually a security issue.  See the code:

...
if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len,
                                     FALSE, &paddr)))
            return -EFAULT;
if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general),
                           gen.data_len + gen.sense_len)) {
...

If gen.data_len + gen.sense_len > UINT_MAX, then a small buffer will
be allocated.  But then the copy_from_user() will always fault before
copying any data over because the access_ok() check will fail on sizes

Comment 6 Vincent Danen 2010-11-10 21:50:26 UTC
This has been assigned the name CVE-2010-4157.

Comment 7 errata-xmlrpc 2010-12-08 19:09:33 UTC
This issue has been addressed in following products:

  MRG for RHEL-5

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

Comment 8 errata-xmlrpc 2011-01-04 16:52:58 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2011:0004 https://rhn.redhat.com/errata/RHSA-2011-0004.html

Comment 9 errata-xmlrpc 2011-01-18 17:45:22 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 4

Via RHSA-2011:0162 https://rhn.redhat.com/errata/RHSA-2011-0162.html