CVE-2025-68795
Description
In the Linux kernel, the following vulnerability has been resolved:
ethtool: Avoid overflowing userspace buffer on stats query
The ethtool -S command operates across three ioctl calls: ETHTOOL_GSSET_INFO for the size, ETHTOOL_GSTRINGS for the names, and ETHTOOL_GSTATS for the values.
If the number of stats changes between these calls (e.g., due to device reconfiguration), userspace's buffer allocation will be incorrect, potentially leading to buffer overflow.
Drivers are generally expected to maintain stable stat counts, but some drivers (e.g., mlx5, bnx2x, bna, ksz884x) use dynamic counters, making this scenario possible.
Some drivers try to handle this internally: - bnad_get_ethtool_stats() returns early in case stats.n_stats is not equal to the driver's stats count. - micrel/ksz884x also makes sure not to write anything beyond stats.n_stats and overflow the buffer.
However, both use stats.n_stats which is already assigned with the value returned from get_sset_count(), hence won't solve the issue described here.
Change ethtool_get_strings(), ethtool_get_stats(), ethtool_get_phy_stats() to not return anything in case of a mismatch between userspace's size and get_sset_size(), to prevent buffer overflow. The returned n_stats value will be equal to zero, to reflect that nothing has been returned.
This could result in one of two cases when using upstream ethtool, depending on when the size change is detected: 1. When detected in ethtool_get_strings(): # ethtool -S eth2 no stats available
- When detected in get stats, all stats will be reported as zero.
Both cases are presumably transient, and a subsequent ethtool call should succeed.
Other than the overflow avoidance, these two cases are very evident (no output/cleared stats), which is arguably better than presenting incorrect/shifted stats. I also considered returning an error instead of a "silent" response, but that seems more destructive towards userspace apps.
Notes: - This patch does not claim to fix the inherent race, it only makes sure that we do not overflow the userspace buffer, and makes for a more predictable behavior.
- RTNL lock is held during each ioctl, the race window exists between the separate ioctl calls when the lock is released.
- Userspace ethtool always fills stats.n_stats, but it is likely that these stats ioctls are implemented in other userspace applications which might not fill it. The added code checks that it's not zero, to prevent any regressions.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A race condition in the Linux kernel's ethtool stats query can overflow userspace buffer when the number of device stats changes between ioctl calls.
Vulnerability
In the Linux kernel, the ethtool -S command retrieves network device statistics via three sequential ioctl calls: ETHTOOL_GSSET_INFO to determine the number of stats, ETHTOOL_GSTRINGS to get the stat names, and ETHTOOL_GSTATS to obtain the values [1]. Most drivers maintain a stable stat count, but devices using dynamic counters (e.g., mlx5, bnx2x, bna, ksz884x) can change the number of stats between these calls. If userspace allocates a buffer based on the initial count and the count increases before the final call, the kernel may write beyond the allocated buffer, causing an overflow condition [1].
Exploitation
No special privileges are needed beyond the ability to issue ethtool commands, which typically requires CAP_NET_ADMIN. The attack surface is limited to systems where the attacker can trigger a device reconfiguration that changes the stat count (e.g., by modifying device settings or link state) concurrently with an ethtool -S request. The race window [1]. The prerequisite is a driver that implements dynamic stat counts and does not internally protect against the race; the referenced commit notes that even drivers like ksz884x that try to check stats.n_stats cannot prevent the overflow because that value is set from the (already stale) initial count [1].
Impact
Successful exploitation allows an attacker to overflow a userspace buffer, potentially corrupting adjacent memory. The kernel fix instead returns zero stats when a count mismatch is detected, avoiding the overflow at the cost of transient incomplete or all-zero statistics output [1]. This behavior turns the exploit into a denial of service for the stats reporting feature, but prevents memory corruption that could lead to arbitrary code execution or system compromise.
Mitigation
The vulnerability is fixed in Linux kernel commits [1]. Users should apply the latest stable kernel updates to receive the patch. No workaround is available beyond ensuring ethtool is not run concurrently with device reconfiguration, which is not practical in general systems.
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
7- git.kernel.org/stable/c/3df375a1e75483b7d973c3cc2e46aa374db8428bnvd
- git.kernel.org/stable/c/4066b5b546293f44cd6d0e84ece6e3ee7ff27093nvd
- git.kernel.org/stable/c/4afcb985355210e1688560dc47e64b94dad35d71nvd
- git.kernel.org/stable/c/7b07be1ff1cb6c49869910518650e8d0abc7d25fnvd
- git.kernel.org/stable/c/7bea09f60f2ad5d232e2db8f1c14e850fd3fd416nvd
- git.kernel.org/stable/c/ca9983bc3a1189bd72f9ae449d925a66b2616326nvd
- git.kernel.org/stable/c/f9dc0f45d2cd0189ce666288a29d2cc32c2e44d5nvd
News mentions
0No linked articles in our index yet.