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] [day] [month] [year] [list]
Message-ID: <cbf22030-8068-4eda-96ad-b2e6f3ba01c7@intel.com>
Date: Tue, 27 May 2025 08:52:57 -0700
From: Tony Nguyen <anthony.l.nguyen@...el.com>
To: Mikael Wessel <post@...aelkw.online>, <netdev@...r.kernel.org>
CC: <intel-wired-lan@...ts.osuosl.org>, <torvalds@...uxfoundation.org>,
	<przemyslaw.kitszel@...el.com>, <andrew@...n.ch>, <kuba@...nel.org>,
	<pabeni@...hat.com>, <security@...nel.org>, <stable@...r.kernel.org>,
	<davem@...emloft.net>, <edumazet@...gle.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] e1000e: fix heap overflow in e1000_set_eeprom()



On 5/27/2025 1:56 AM, Mikael Wessel wrote:
> The ETHTOOL_SETEEPROM ioctl copies user data into a kmalloc'ed buffer
> without validating eeprom->len and eeprom->offset.  A CAP_NET_ADMIN
> user can overflow the heap and crash the kernel or gain code execution.
> 
> Validate length and offset before memcpy().
> 
> Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
> Reported-by: Mikael Wessel <post@...aelkw.online>
> Signed-off-by: Mikael Wessel <post@...aelkw.online>
> Cc: stable@...r.kernel.org
> ---
>   drivers/net/ethernet/intel/e1000e/ethtool.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
> index 9364bc2b4eb1..98e541e39730 100644
> --- a/drivers/net/ethernet/intel/e1000e/ethtool.c
> +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
> @@ -596,6 +596,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
>   	for (i = 0; i < last_word - first_word + 1; i++)
>   		le16_to_cpus(&eeprom_buff[i]);
>   
> +        if (eeprom->len > max_len ||
> +            eeprom->offset > max_len - eeprom->len)
> +                return -EINVAL;

This is going to cause 'eeprom_buff' to leak. You should use the goto 
out, however, seems like these checks can be moved up before the 
allocation is done. Also, indentation looks off.

Thanks,
Tony

>   	memcpy(ptr, bytes, eeprom->len);
>   
>   	for (i = 0; i < last_word - first_word + 1; i++)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ