CVE-2025-39986: can: sun4i_can: populate ndo_change_mtu() to prevent buffer overflow
In the Linux kernel, the following vulnerability has been resolved:
can: sun4i_can: populate ndo_change_mtu() to prevent buffer overflow
Sending an PF_PACKET allows to bypass the CAN framework logic and to
directly reach the xmit() function of a CAN driver. The only check
which is performed by the PF_PACKET framework is to make sure that
skb->len fits the interface's MTU.
Unfortunately, because the sun4i_can driver does not populate its
net_device_ops->ndo_change_mtu(), it is possible for an attacker to
configure an invalid MTU by doing, for example:
$ ip link set can0 mtu 9999
After doing so, the attacker could open a PF_PACKET socket using the
ETH_P_CANXL protocol:
socket(PF_PACKET, SOCK_RAW, htons(ETH_P_CANXL))
to inject a malicious CAN XL frames. For example:
struct canxl_frame frame = {
.flags = 0xff,
.len = 2048,
};
The CAN drivers' xmit() function are calling can_dev_dropped_skb() to
check that the skb is valid, unfortunately under above conditions, the
malicious packet is able to go through can_dev_dropped_skb() checks:
1. the skb->protocol is set to ETH_P_CANXL which is valid (the
function does not check the actual device capabilities).
2. the length is a valid CAN XL length.
And so, sun4ican_start_xmit() receives a CAN XL frame which it is not
able to correctly handle and will thus misinterpret it as a CAN frame.
This can result in a buffer overflow. The driver will consume cf->len
as-is with no further checks on this line:
dlc = cf->len;
Here, cf->len corresponds to the flags field of the CAN XL frame. In
our previous example, we set canxl_frame->flags to 0xff. Because the
maximum expected length is 8, a buffer overflow of 247 bytes occurs a
couple line below when doing:
for (i = 0; i < dlc; i++)
writel(cf->data[i], priv->base + (dreg + i * 4));
Populate net_device_ops->ndo_change_mtu() to ensure that the
interface's MTU can not be set to anything bigger than CAN_MTU. By
fixing the root cause, this prevents the buffer overflow.
Security readout for executives and security teams
Plain-English summary
A local, low-privileged attacker could abuse an enabled Allwinner sun4i CAN interface to send an oversized frame into a driver that expects much smaller data. The resulting overflow may compromise system confidentiality, integrity, and availability. Exposure is limited to Linux systems using this specific CAN driver and granting a local process the necessary networking permissions.
Executive priority
Prioritize affected embedded and operational-technology systems where local users, services, or containers have elevated networking permissions. Patch promptly during the next controlled maintenance window, accelerating remediation on multi-user or less-trusted systems. Systems without sun4i_can hardware or driver exposure are unlikely to be affected, but inventory evidence should support that conclusion.
Technical view
The sun4i_can driver lacked an ndo_change_mtu handler, allowing an invalid interface MTU. A permitted local process could then use a raw PF_PACKET socket to pass a CAN XL-sized frame through generic validation. sun4ican_start_xmit() misinterprets the frame as classic CAN and trusts an invalid length, causing an out-of-bounds operation. The fix restricts MTU changes to CAN_MTU.
Likely exposure
Most relevant to Linux-based embedded, automotive, industrial, or control systems using the sun4i_can driver. Affected kernel versions are listed in the CVE bundle, but the version data is ambiguous; confirm exposure through the deployed distribution's advisory and kernel configuration. Exploitation requires local access plus permission to alter the CAN interface and open the required raw socket.
Exploitation context
The CVSS 3.1 score is 7.8 with local attack vector, low complexity, low privileges, and no user interaction. The supplied record is not in CISA KEV and provides no evidence of active exploitation. The description demonstrates the vulnerable condition, but it does not establish reliable privilege escalation or exploitation in operational environments.
Researcher notes
The security boundary failure spans MTU configuration, generic PF_PACKET validation, and driver-specific frame parsing. The stable patches address the root cause by registering ndo_change_mtu and enforcing CAN_MTU. The bundle references eight stable commits but does not clearly map every affected or fixed release; assess vendor backports by patch presence rather than version strings alone.
Mitigation direction
Update to a vendor-supported kernel containing the applicable Linux stable fix commit.
Consult the Linux distribution or device vendor for precise fixed-version guidance.
Disable or unload sun4i_can where CAN functionality is unnecessary and operationally safe.
Restrict local access and permissions for CAN interface administration and raw packet sockets.
Validation and detection
Inventory systems with the sun4i_can driver built, loaded, or assigned to hardware.
Confirm deployed kernel packages contain the applicable stable fix or vendor backport.
Review which local users, services, and containers can administer CAN interfaces or use raw sockets.
After remediation, verify the CAN interface rejects MTU values exceeding classic CAN_MTU.
Monitor vendor advisories because the supplied affected-version list is not sufficiently precise.
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.
cve · low confidence lookup
CVE-2025-39986 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
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.
1CVSS vectors
3Timeline events
0ADP providers
9Source links
CVSS vector scores
1 official score
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.