CVE-2025-39917: bpf: Fix out-of-bounds dynptr write in bpf_crypto_crypt
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix out-of-bounds dynptr write in bpfcryptocrypt
Stanislav reported that in bpfcryptocrypt() the destination dynptr's size is not validated to be at least as large as the source dynptr's size before calling into the crypto backend with 'len = srclen'. This can result in an OOB write when the destination is smaller than the source.
Concretely, in mentioned function, psrc and pdst are both linear buffers fetched from each dynptr:
psrc = bpfdynptrdata(src, srclen); [...] pdst = bpfdynptrdatarw(dst, dstlen); [...] err = decrypt ? ctx->type->decrypt(ctx->tfm, psrc, pdst, srclen, piv) : ctx->type->encrypt(ctx->tfm, psrc, pdst, srclen, piv);
The crypto backend expects pdst to be large enough with a srclen length that can be written. Add an additional srclen > dstlen check and bail out if it's the case. Note that these kfuncs are accessible under root privileges only.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2025-39917?
CVE-2025-39917 is considered a medium severity vulnerability due to potential exploitation risks associated with out-of-bounds writes.
How do I fix CVE-2025-39917?
To fix CVE-2025-39917, you should update to the latest version of the Linux kernel where the vulnerability has been patched.
What systems are affected by CVE-2025-39917?
CVE-2025-39917 affects the Linux Kernel across various versions that include the bpf_crypto_crypt function.
What type of vulnerability is CVE-2025-39917?
CVE-2025-39917 is an out-of-bounds write vulnerability in the Linux kernel BPF subsystem.
When was CVE-2025-39917 disclosed?
CVE-2025-39917 was publicly disclosed in 2025 as part of ongoing security improvements in the Linux kernel.