CyberSecBulletin
CVE-2025-21731NVD status: Modified

Linux: Use After Free

CVE-2025-21731 is a high-severity use after free vulnerability in Linux, with a CVSS 3.1 base score of 7.8 out of 10. It can be exploited with local access to the system by an attacker with a low-privileged account, without any action from a user. The record lists versions e70a578487a47d7cf058904141e586684d1c3381, 6bef6222a3f6c7adb6396f77f25a3579d821b09a, e3be8862d73cac833e0fb7602636c19c6cb94b11 as the first without the flaw, so updating Linux to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.24% chance of exploitation within 30 days, which is low compared with other CVEs.

Next patch cycle

High severity with no evidence of exploitation so far.

What to do

  1. Update Linux to e70a578487a47d7cf058904141e586684d1c3381 or 6bef6222a3f6c7adb6396f77f25a3579d821b09a or e3be8862d73cac833e0fb7602636c19c6cb94b11 or e7343fa33751cb07c1c56b666bf37cfca357130e, whichever matches your release line, or a later version.
  2. Update Linux Kernel to 5.4.291 or 5.10.235 or 5.15.179 or 6.1.129, whichever matches your release line, or a later version.

Affected products and versions

VendorProductAffected versionsFixed in
LinuxLinuxb7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, e70a578487a47d7cf058904141e586684d1c3381; b7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, 6bef6222a3f6c7adb6396f77f25a3579d821b09a; b7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, e3be8862d73cac833e0fb7602636c19c6cb94b11; b7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, e7343fa33751cb07c1c56b666bf37cfca357130e; b7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, d208d2c52b652913b5eefc8ca434b0d6b757f68f; b7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739; b7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, 9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302; b7aa3d39385dc2d95899f9e379623fef446a2acd up to, but not including, 844b8cdc681612ff24df62cdefddeab5772fadf1; and 1 more rangese70a578487a47d7cf058904141e586684d1c3381, 6bef6222a3f6c7adb6396f77f25a3579d821b09a, e3be8862d73cac833e0fb7602636c19c6cb94b11, e7343fa33751cb07c1c56b666bf37cfca357130e, d208d2c52b652913b5eefc8ca434b0d6b757f68f, a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739
SiemensSIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AB0)V3.1.6 and later; V3.1.7 and laterNot stated
SiemensSIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AC0)V3.1.6 and later; V3.1.7 and laterNot stated
SiemensSIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AB0)V3.1.6 and later; V3.1.7 and laterNot stated
SiemensSIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AC0)V3.1.6 and later; V3.1.7 and laterNot stated
SiemensSIMATIC S7-1500 TM MFP - GNU/Linux subsystemall versionsNot stated
SiemensSIPLUS S7-1500 CPU 1518-4 PN/DP MFP (6AG1518-4AX00-4AC0)V3.1.6 and later; V3.1.7 and laterNot stated
LinuxLinux Kernel4.12 up to, but not including, 5.4.291; 5.5 up to, but not including, 5.10.235; 5.11 up to, but not including, 5.15.179; 5.16 up to, but not including, 6.1.129; 6.2 up to, but not including, 6.6.76; 6.7 up to, but not including, 6.12.13; 6.13 up to, but not including, 6.13.25.4.291, 5.10.235, 5.15.179, 6.1.129, 6.6.76, 6.12.13

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
LocalThe attacker needs local access or must trick a user into running something.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
LowA basic user account is enough.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. Scored by CISA (ADP).

Official description

In the Linux kernel, the following vulnerability has been resolved: nbd: don't allow reconnect after disconnect Following process can cause nbd_config UAF: 1) grab nbd_config temporarily; 2) nbd_genl_disconnect() flush all recv_work() and release the initial reference: nbd_genl_disconnect nbd_disconnect_and_put nbd_disconnect flush_workqueue(nbd->recv_workq) if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, ...)) nbd_config_put -> due to step 1), reference is still not zero 3) nbd_genl_reconfigure() queue recv_work() again; nbd_genl_reconfigure config = nbd_get_config_unlocked(nbd) if (!config) -> succeed if (!test_bit(NBD_RT_BOUND, ...)) -> succeed nbd_reconnect_socket queue_work(nbd->recv_workq, &args->work) 4) step 1) release the reference; 5) Finially, recv_work() will trigger UAF: recv_work nbd_config_put(nbd) -> nbd_config is freed atomic_dec(&config->recv_threads) -> UAF Fix the problem by clearing NBD_RT_BOUND in nbd_genl_disconnect(), so that nbd_genl_reconfigure() will fail.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Use After Free

The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory belongs to the code that operates on the new pointer.

How developers prevent this class of flaw

  • Choose a language that provides automatic memory management.
  • When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.

More Use After Free vulnerabilities (CWE-416)

Timeline

  1. CVE record published.
  2. CISA published its SSVC assessment (exploitation: none, automatable: no, technical impact: total).
  3. Record last changed materially (score, affected products, status or references).

References

Recent Use After Free vulnerabilities

Spotted an error? Tell us.