lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5j+kg8WXMwW-Sd5GYWxpmwhtRfUnHEVyrNTim2PfKoD67w@mail.gmail.com>
Date:   Thu, 31 Aug 2017 23:44:37 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Dison River <pwn2river@...il.com>
Cc:     sathya.prakash@...adcom.com, chaitra.basappa@...adcom.com,
        suganath-prabu.subramani@...adcom.com,
        MPT-FusionLinux.pdl@...adcom.com,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "security@...nel.org" <security@...nel.org>
Subject: Re: Buffer overflow in the mptctl_replace_fw() function in linux
 kernel MPT ioctl driver

On Thu, Aug 31, 2017 at 11:00 PM, Dison River <pwn2river@...il.com> wrote:
> Hi:
> Buffer overflow in the mptctl_replace_fw() function in linux kernel
> MPT ioctl driver.
>
> In mptctl_replace_fw function, kernel didn't check the size of
> "newFwSize" variable allows attackers to cause a denial of service via
> unspecified vectors that trigger copy_from_user function calls with
> improper length arguments.

Is there a specific path you see to trigger this?

>
>
> static int
> mptctl_replace_fw (unsigned long arg)
> {
> ......
>     if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
>         printk(KERN_ERR MYNAM "%s@%d::mptctl_replace_fw - "
>             "Unable to read in mpt_ioctl_replace_fw struct @ %p\n",
>                 __FILE__, __LINE__, uarg);
>         return -EFAULT;
>     }
>
> ......
>
>     mpt_free_fw_memory(ioc);

This frees ioc->cached_fw.

>
>     /* Allocate memory for the new FW image
>      */
>     newFwSize = ALIGN(karg.newImageSize, 4);
>
>     mpt_alloc_fw_memory(ioc, newFwSize);

This allocates ioc->cached_fw to newFwSize.

> ......
>
>     if (copy_from_user(ioc->cached_fw, uarg->newImage, newFwSize)) {

This copies newFwSize bytes into a buffer that is allocated to newFwSize bytes.

What am I missing? I see some games getting played in
mpt_alloc_fw_memory(), but they seem to be covered due to the earlier
call to mpt_free_fw_memory()...

-Kees

> ///------->newFwSize can control in userspace
>         printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_replace_fw - "
>                 "Unable to read in mpt_ioctl_replace_fw image "
>                 "@ %p\n", ioc->name, __FILE__, __LINE__, uarg);
>         mpt_free_fw_memory(ioc);
>         return -EFAULT;
>     }
>
> ......
>
>     return 0;
> }

-Kees

-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ