CVE-2025-39901: i40e: remove read access to debugfs files
In the Linux kernel, the following vulnerability has been resolved:
i40e: remove read access to debugfs files
The 'command' and 'netdev_ops' debugfs files are a legacy debugging
interface supported by the i40e driver since its early days by commit
02e9c290814c ("i40e: debugfs interface").
Both of these debugfs files provide a read handler which is mostly useless,
and which is implemented with questionable logic. They both use a static
256 byte buffer which is initialized to the empty string. In the case of
the 'command' file this buffer is literally never used and simply wastes
space. In the case of the 'netdev_ops' file, the last command written is
saved here.
On read, the files contents are presented as the name of the device
followed by a colon and then the contents of their respective static
buffer. For 'command' this will always be "<device>: ". For 'netdev_ops',
this will be "<device>: <last command written>". But note the buffer is
shared between all devices operated by this module. At best, it is mostly
meaningless information, and at worse it could be accessed simultaneously
as there doesn't appear to be any locking mechanism.
We have also recently received multiple reports for both read functions
about their use of snprintf and potential overflow that could result in
reading arbitrary kernel memory. For the 'command' file, this is definitely
impossible, since the static buffer is always zero and never written to.
For the 'netdev_ops' file, it does appear to be possible, if the user
carefully crafts the command input, it will be copied into the buffer,
which could be large enough to cause snprintf to truncate, which then
causes the copy_to_user to read beyond the length of the buffer allocated
by kzalloc.
A minimal fix would be to replace snprintf() with scnprintf() which would
cap the return to the number of bytes written, preventing an overflow. A
more involved fix would be to drop the mostly useless static buffers,
saving 512 bytes and modifying the read functions to stop needing those as
input.
Instead, lets just completely drop the read access to these files. These
are debug interfaces exposed as part of debugfs, and I don't believe that
dropping read access will break any script, as the provided output is
pretty useless. You can find the netdev name through other more standard
interfaces, and the 'netdev_ops' interface can easily result in garbage if
you issue simultaneous writes to multiple devices at once.
In order to properly remove the i40e_dbg_netdev_ops_buf, we need to
refactor its write function to avoid using the static buffer. Instead, use
the same logic as the i40e_dbg_command_write, with an allocated buffer.
Update the code to use this instead of the static buffer, and ensure we
free the buffer on exit. This fixes simultaneous writes to 'netdev_ops' on
multiple devices, and allows us to remove the now unused static buffer
along with removing the read access.
Security readout for executives and security teams
Plain-English summary
A local user may abuse legacy i40e network-driver debug files to make the Linux kernel return data beyond an allocated buffer. This could expose kernel memory or disrupt the system. The issue does not appear remotely reachable by itself and requires access to the affected debugfs interface.
Executive priority
Treat as a high-priority local exposure, especially on shared or multi-tenant Linux hosts using i40e. It is less urgent than an unauthenticated remote flaw, but potential kernel-memory disclosure and system disruption justify prompt branch-specific patch verification and deployment.
Technical view
The i40e debugfs netdev_ops read handler uses snprintf’s would-have-written length when copying data to userspace. Crafted prior input can trigger truncation, causing copy_to_user to read beyond a kzalloc buffer. The kernel fix removes read access and replaces the shared static write buffer with allocated storage. Confidentiality and availability are affected; integrity is not identified.
Likely exposure
Exposure is limited to Linux systems using an affected i40e driver version where a local user can access the legacy command or netdev_ops debugfs interfaces. The supplied version data spans multiple kernel branches but is not sufficiently structured for precise package-level conclusions; verify the fix against each deployed distribution kernel.
Exploitation context
The CVSS vector is local, low complexity, low privilege, and requires no user interaction. The supplied record is not in KEV and provides no evidence of active exploitation. It describes a carefully crafted command as necessary for the netdev_ops condition; the command read handler is stated not to be vulnerable.
Researcher notes
CWE-125 fits the reported out-of-bounds read. The vulnerable path is netdev_ops: truncation can make snprintf return a length larger than the allocated output, followed by an oversized copy_to_user. Shared static state also allowed cross-device races. The selected remediation removes the unnecessary read surface rather than merely substituting scnprintf.
Mitigation direction
Update to a vendor kernel containing the applicable referenced stable fix.
Confirm the update removes read access from the affected i40e debugfs files.
Prioritize multi-user systems where untrusted local users can reach debugfs.
Consult the Linux distribution’s advisory for package-specific fixed versions.
Validation and detection
Inventory deployed kernels and identify systems using the i40e driver.
Determine whether debugfs and the legacy i40e interfaces are accessible to local users.
Verify the distribution kernel contains the applicable referenced fix commit.
After updating, confirm command and netdev_ops no longer provide read access.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-125: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-125 · source CWE mapping
Out-of-bounds Read
Out-of-bounds Read represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.