7.2
CWE
264 863
Advisory Published
CVE Published
CVE Published
Updated

CVE-2009-4131

First published: Fri Dec 04 2009(Updated: )

Description of problem: <span class="quote">&gt;From 910123ba363623f15ffb5d05dd87bdf06d08c609 Mon Sep 17 00:00:00 2001</span> From: Akira Fujita &lt;a-fujita.nec.com&gt; Date: Sun, 6 Dec 2009 23:38:31 -0500 Subject: [PATCH] ext4: Fix insufficient checks in EXT4_IOC_MOVE_EXT This patch fixes three problems in the handling of the EXT4_IOC_MOVE_EXT ioctl: 1. In current EXT4_IOC_MOVE_EXT, there are read access mode checks for original and donor files, but they allow the illegal write access to donor file, since donor file is overwritten by original file data. To fix this problem, change access mode checks of original (r-&gt;r/w) and donor (r-&gt;w) files. 2. Disallow the use of donor files that have a setuid or setgid bits. 3. Call mnt_want_write() and mnt_drop_write() before and after ext4_move_extents() calling to get write access to a mount. Signed-off-by: Akira Fujita &lt;a-fujita.nec.com&gt; Signed-off-by: "Theodore Ts'o" &lt;tytso&gt; --- fs/ext4/ioctl.c | 30 ++++++++++++++++++------------ fs/ext4/move_extent.c | 7 +++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 31e5ee0..b63d193 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -221,32 +221,38 @@ setversion_out: struct file *donor_filp; int err; + if (!(filp-&gt;f_mode &amp; FMODE_READ) || + !(filp-&gt;f_mode &amp; FMODE_WRITE)) + return -EBADF; + if (copy_from_user(&amp;me, (struct move_extent __user *)arg, sizeof(me))) return -EFAULT; + me.moved_len = 0; donor_filp = fget(me.donor_fd); if (!donor_filp) return -EBADF; - if (!capable(CAP_DAC_OVERRIDE)) { - if ((current-&gt;real_cred-&gt;fsuid != inode-&gt;i_uid) || - !(inode-&gt;i_mode &amp; S_IRUSR) || - !(donor_filp-&gt;f_dentry-&gt;d_inode-&gt;i_mode &amp; - S_IRUSR)) { - fput(donor_filp); - return -EACCES; - } + if (!(donor_filp-&gt;f_mode &amp; FMODE_WRITE)) { + err = -EBADF; + goto mext_out; } - me.moved_len = 0; + err = mnt_want_write(filp-&gt;f_path.mnt); + if (err) + goto mext_out; + err = ext4_move_extents(filp, donor_filp, me.orig_start, me.donor_start, me.len, &amp;me.moved_len); - fput(donor_filp); + mnt_drop_write(filp-&gt;f_path.mnt); + if (me.moved_len &gt; 0) + file_remove_suid(donor_filp); if (copy_to_user((struct move_extent *)arg, &amp;me, sizeof(me))) - return -EFAULT; - + err = -EFAULT; +mext_out: + fput(donor_filp); return err; } diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index cad1e2e..82c415b 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -957,6 +957,13 @@ mext_check_arguments(struct inode *orig_inode, return -EINVAL; } + if (donor_inode-&gt;i_mode &amp; (S_ISUID|S_ISGID)) { + ext4_debug("ext4 move extent: suid or sgid is set" + " to donor file [ino:orig %lu, donor %lu]\n", + orig_inode-&gt;i_ino, donor_inode-&gt;i_ino); + return -EINVAL; + } + /* Ext4 move extent does not support swapfile */ if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) { ext4_debug("ext4 move extent: The argument files should " -- 1.6.5.216.g5288a.dirty

Credit: secalert@redhat.com

Affected SoftwareAffected VersionHow to fix
Linux Linux kernel=2.6.27.29
Linux Linux kernel=2.6.27.12
Linux Linux kernel=2.6.20.6
Linux Linux kernel=2.6.20.9
Linux Linux kernel=2.6.11
Linux Linux kernel=2.6.23.4
Linux Linux kernel=2.6.22.15
Linux Linux kernel=2.6.16.16
Linux Linux kernel=2.6.18.7
Linux Linux kernel=2.6.17.12
Linux Linux kernel=2.6.16.39
Linux Linux kernel=2.6.27.3
Linux Linux kernel=2.6.31
Linux Linux kernel=2.6.29.3
Linux Linux kernel=2.6.21
Linux Linux kernel=2.6.16.9
Linux Linux kernel=2.6.31-rc4
Linux Linux kernel=2.6.17.9
Linux Linux kernel=2.6.32-rc1
Linux Linux kernel=2.6.11.2
Linux Linux kernel=2.6.27.1
Linux Linux kernel=2.6.5
Linux Linux kernel=2.6.32-rc5
Linux Linux kernel=2.6.15.3
Linux Linux kernel=2.6.27.30
Linux Linux kernel=2.6.11.10
Linux Linux kernel=2.6.24.7
Linux Linux kernel=2.6.1
Linux Linux kernel=2.6.16.43
Linux Linux kernel=2.6.16.6
Linux Linux kernel=2.6.31.3
Linux Linux kernel=2.6.16.8
Linux Linux kernel=2.6.20.13
Linux Linux kernel=2.6.22.4
Linux Linux kernel=2.6.14.7
Linux Linux kernel=2.6.27.18
Linux Linux kernel=2.6.13
Linux Linux kernel=2.6.17.2
Linux Linux kernel=2.6.13.3
Linux Linux kernel=2.6.23.13
Linux Linux kernel=2.6.11.8
Linux Linux kernel=2.6.24.2
Linux Linux kernel=2.6.26.5
Linux Linux kernel=2.6.16.34
Linux Linux kernel=2.6.25.20
Linux Linux kernel=2.6.27.21
Linux Linux kernel=2.6.23.7
Linux Linux kernel=2.6.17.8
Linux Linux kernel=2.6.14.4
Linux Linux kernel=2.6.14
Linux Linux kernel=2.6.25.5
Linux Linux kernel=2.6.17.4
Linux Linux kernel=2.6.16.18
Linux Linux kernel=2.6.27.27
Linux Linux kernel=2.6.17.14
Linux Linux kernel=2.6.10
Linux Linux kernel=2.6.23.8
Linux Linux kernel=2.6.16.45
Linux Linux kernel=2.6.22.12
Linux Linux kernel=2.6.25.18
Linux Linux kernel=2.6.14.3
Linux Linux kernel=2.6.29
Linux Linux kernel=2.6.18.3
Linux Linux kernel=2.6.16.37
Linux Linux kernel=2.6.11.6
Linux Linux kernel=2.6.16.48
Linux Linux kernel=2.6.11.11
Linux Linux kernel=2.6.16.13
Linux Linux kernel=2.6.27.10
Linux Linux kernel=2.6.3
Linux Linux kernel=2.6.31.4
Linux Linux kernel=2.6.32
Linux Linux kernel=2.6.21.6
Linux Linux kernel=2.6.26.6
Linux Linux kernel=2.6.22.1
Linux Linux kernel=2.6.27.17
Linux Linux kernel=2.6.16.4
Linux Linux kernel=2.6.23.16
Linux Linux kernel=2.6.31.6
Linux Linux kernel=2.6.17.3
Linux Linux kernel=2.6.24.1
Linux Linux kernel=2.6.20.5
Linux Linux kernel=2.6.22
Linux Linux kernel=2.6.28.4
Linux Linux kernel=2.6.4
Linux Linux kernel=2.6.27.16
Linux Linux kernel=2.6.26
Linux Linux kernel=2.6.16.15
Linux Linux kernel=2.6.27.20
Linux Linux kernel=2.6.15.6
Linux Linux kernel=2.6.26.3
Linux Linux kernel=2.6.20.16
Linux Linux kernel=2.6.15.1
Linux Linux kernel=2.6.11.5
Linux Linux kernel=2.6.28.2
Linux Linux kernel=2.6.25.9
Linux Linux kernel=2.6.19.3
Linux Linux kernel=2.6.27.4
Linux Linux kernel=2.6.27
Linux Linux kernel=2.6.19.4
Linux Linux kernel=2.6.25.13
Linux Linux kernel=2.6.28.5
Linux Linux kernel=2.6.19.1
Linux Linux kernel=2.6.18.4
Linux Linux kernel=2.6.16.1
Linux Linux kernel=2.6.18.1
Linux Linux kernel=2.6.20.21
Linux Linux kernel=2.6.31-rc1
Linux Linux kernel=2.6.27.13
Linux Linux kernel=2.6.23.1
Linux Linux kernel=2.6.2
Linux Linux kernel=2.6.14.5
Linux Linux kernel=2.6.13.2
Linux Linux kernel=2.6.17.5
Linux Linux kernel=2.6.18.5
Linux Linux kernel=2.6.21.1
Linux Linux kernel=2.6.16.32
Linux Linux kernel=2.6.13.5
Linux Linux kernel=2.6.16.57
Linux Linux kernel=2.6.16.49
Linux Linux kernel=2.6.25.3
Linux Linux kernel=2.6.17
Linux Linux kernel=2.6.24
Linux Linux kernel=2.6.31-rc6
Linux Linux kernel=2.6.31.1
Linux Linux kernel=2.6.19.2
Linux Linux kernel=2.6.26.2
Linux Linux kernel=2.6.21.4
Linux Linux kernel=2.6.16.11
Linux Linux kernel=2.6.20.17
Linux Linux kernel=2.6.16.14
Linux Linux kernel=2.6.20.12
Linux Linux kernel=2.6.16.25
Linux Linux kernel=2.6.27.15
Linux Linux kernel=2.6.16.21
Linux Linux kernel=2.6.16.33
Linux Linux kernel=2.6.30.7
Linux Linux kernel=2.6.8
Linux Linux kernel=2.6.16.28
Linux Linux kernel=2.6.17.10
Linux Linux kernel=2.6.21.5
Linux Linux kernel=2.6.25.15
Linux Linux kernel=2.6.14.1
Linux Linux kernel=2.6.23.15
Linux Linux kernel=2.6.16.23
Linux Linux kernel<=2.6.32
Linux Linux kernel=2.6.29.4
Linux Linux kernel=2.6.12.5
Linux Linux kernel=2.6.15.7
Linux Linux kernel=2.6.20
Linux Linux kernel=2.6.23.10
Linux Linux kernel=2.6.22.7
Linux Linux kernel=2.6.27.26
Linux Linux kernel=2.6.16.3
Linux Linux kernel=2.6.27.8
Linux Linux kernel=2.6.26.1
Linux Linux kernel=2.6.25.19
Linux Linux kernel=2.6.20.20
Linux Linux kernel=2.6.16.36
Linux Linux kernel=2.6.30.8
Linux Linux kernel=2.6.14.6
Linux Linux kernel=2.6.12.1
Linux Linux kernel=2.6.27.9
Linux Linux kernel=2.6.11.9
Linux Linux kernel=2.6.16.46
Linux Linux kernel=2.6.17.1
Linux Linux kernel=2.6.20.8
Linux Linux kernel=2.6.27.25
Linux Linux kernel=2.6.30.9
Linux Linux kernel=2.6.20.15
Linux Linux kernel=2.6.22.18
Linux Linux kernel=2.6.0
Linux Linux kernel=2.6.25.8
Linux Linux kernel=2.6.16.54
Linux Linux kernel=2.6.32-rc4
Linux Linux kernel=2.6.13.4
Linux Linux kernel=2.6.20.18
Linux Linux kernel=2.6.23.9
Linux Linux kernel=2.6.22.6
Linux Linux kernel=2.6.23.3
Linux Linux kernel=2.6.18.8
Linux Linux kernel=2.6.22.3
Linux Linux kernel=2.6.12.2
Linux Linux kernel=2.6.16.31
Linux Linux kernel=2.6.16.26
Linux Linux kernel=2.6.16.62
Linux Linux kernel=2.6.18.2
Linux Linux kernel=2.6.28.8
Linux Linux kernel=2.6.31-rc5
Linux Linux kernel=2.6.16.29
Linux Linux kernel=2.6.29.1
Linux Linux kernel=2.6.24.4
Linux Linux kernel=2.6.27.19
Linux Linux kernel=2.6.25.16
Linux Linux kernel=2.6.22.9
Linux Linux kernel=2.6.25.17
Linux Linux kernel=2.6.20.11
Linux Linux kernel=2.6.19
Linux Linux kernel=2.6.20.3
Linux Linux kernel=2.6.16
Linux Linux kernel=2.6.30.4
Linux Linux kernel=2.6.28.3
Linux Linux kernel=2.6.22.13
Linux Linux kernel=2.6.19.7
Linux Linux kernel=2.6.21.3
Linux Linux kernel=2.6.27.28
Linux Linux kernel=2.6.24.5
Linux Linux kernel=2.6.16.51
Linux Linux kernel=2.6.15.2
Linux Linux kernel=2.6.20.19
Linux Linux kernel=2.6.16.22
Linux Linux kernel=2.6.22.17
Linux Linux kernel=2.6.16.58
Linux Linux kernel=2.6.16.40
Linux Linux kernel=2.6.32-rc7
Linux Linux kernel=2.6.16.47
Linux Linux kernel=2.6.16.42
Linux Linux kernel=2.6.27.22
Linux Linux kernel=2.6.23.14
Linux Linux kernel=2.6.17.11
Linux Linux kernel=2.6.16.10
Linux Linux kernel=2.6.12.4
Linux Linux kernel=2.6.16.41
Linux Linux kernel=2.6.16.52
Linux Linux kernel=2.6.11.3
Linux Linux kernel=2.6.20.10
Linux Linux kernel=2.6.16.24
Linux Linux kernel=2.6.31-rc7
Linux Linux kernel=2.6.25.10
Linux Linux kernel=2.6.22.11
Linux Linux kernel=2.6.16.55
Linux Linux kernel=2.6.23
Linux Linux kernel=2.6.12.3
Linux Linux kernel=2.6.22.10
Linux Linux kernel=2.6.29.6
Linux Linux kernel=2.6.23.17
Linux Linux kernel=2.6.27.5
Linux Linux kernel=2.6.23.2
Linux Linux kernel=2.6.25.1
Linux Linux kernel=2.6.25.4
Linux Linux kernel=2.6.28.9
Linux Linux kernel=2.6.30.2
Linux Linux kernel=2.6.7
Linux Linux kernel=2.6.21.7
Linux Linux kernel=2.6.30.6
Linux Linux kernel=2.6.16.30
Linux Linux kernel=2.6.21.2
Linux Linux kernel=2.6.15.4
Linux Linux kernel=2.6.27.7
Linux Linux kernel=2.6.16.59
Linux Linux kernel=2.6.30.1
Linux Linux kernel=2.6.16.38
Linux Linux kernel=2.6.16.17
Linux Linux kernel=2.6.26.8
Linux Linux kernel=2.6.20.2
Linux Linux kernel=2.6.28.6
Linux Linux kernel=2.6.16.12
Linux Linux kernel=2.6.31.5
Linux Linux kernel=2.6.16.27
Linux Linux kernel=2.6.16.53
Linux Linux kernel=2.6.28.7
Linux Linux kernel=2.6.12.6
Linux Linux kernel=2.6.31-rc8
Linux Linux kernel=2.6.17.7
Linux Linux kernel=2.6.20.1
Linux Linux kernel=2.6.11.7
Linux Linux kernel=2.6.16.2
Linux Linux kernel=2.6.24.6
Linux Linux kernel=2.6.31-rc3
Linux Linux kernel=2.6.18.6
Linux Linux kernel=2.6.15
Linux Linux kernel=2.6.16.44
Linux Linux kernel=2.6.23.12
Linux Linux kernel=2.6.16.35
Linux Linux kernel=2.6.19.6
Linux Linux kernel=2.6.16.50
Linux Linux kernel=2.6.25.11
Linux Linux kernel=2.6.27.31
Linux Linux kernel=2.6.29.2
Linux Linux kernel=2.6.23.5
Linux Linux kernel=2.6.22.8
Linux Linux kernel=2.6.14.2
Linux Linux kernel=2.6.16.61
Linux Linux kernel=2.6.31-rc2
Linux Linux kernel=2.6.19.5
Linux Linux kernel=2.6.18
Linux Linux kernel=2.6.27.24
Linux Linux kernel=2.6.20.4
Linux Linux kernel=2.6.17.6
Linux Linux kernel=2.6.23.6
Linux Linux kernel=2.6.27.2
Linux Linux kernel=2.6.16.7
Linux Linux kernel=2.6.17.13
Linux Linux kernel=2.6.16.60
Linux Linux kernel=2.6.22.2
Linux Linux kernel=2.6.8.1
Linux Linux kernel=2.6.27.11
Linux Linux kernel=2.6.16.56
Linux Linux kernel=2.6.22.19
Linux Linux kernel=2.6.24.3
Linux Linux kernel=2.6.31.2
Linux Linux kernel=2.6.25
Linux Linux kernel=2.6.20.14
Linux Linux kernel=2.6.25.2
Linux Linux kernel=2.6.32-rc8
Linux Linux kernel=2.6.22.5
Linux Linux kernel=2.6.32-rc3
Linux Linux kernel=2.6.25.7
Linux Linux kernel=2.6.30.5
Linux Linux kernel<=2.6.32
Linux Linux kernel=2.6.25.14
Linux Linux kernel=2.6.20.7
Linux Linux kernel=2.6.28.1
Linux Linux kernel=2.6.16.5
Linux Linux kernel=2.6.30
Linux Linux kernel=2.6.11.4
Linux Linux kernel=2.6.26.4
Linux Linux kernel=2.6.25.12
Linux Linux kernel=2.6.16.19
Linux Linux kernel=2.6.27.6
Linux Linux kernel=2.6.26.7
Linux Linux kernel=2.6.25.6
Linux Linux kernel=2.6.11.12
Linux Linux kernel=2.6.16.20
Linux Linux kernel=2.6.15.5
Linux Linux kernel=2.6.30-rc7-git6
Linux Linux kernel=2.6.28.10
Linux Linux kernel=2.6.22.16
Linux Linux kernel=2.6.11.1
Linux Linux kernel=2.6.30.3
Linux Linux kernel=2.6.9
Linux Linux kernel=2.6.27.23
Linux Linux kernel=2.6.13.1
Linux Linux kernel=2.6.23.11
Linux Linux kernel=2.6.27.14
Linux Linux kernel=2.6.28
Linux Linux kernel=2.6.29.5
Linux Linux kernel=2.6.22.14
Linux Linux kernel=2.6.6
Linux Linux kernel=2.6.12

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203