CVE-2022-49290
Published: 26 February 2025
Description
In the Linux kernel, the following vulnerability has been resolved: mac80211: fix potential double free on mesh join While commit 6a01afcf8468 ("mac80211: mesh: Free ie data when leaving mesh") fixed a memory leak on mesh leave / teardown it introduced a potential memory corruption caused by a double free when rejoining the mesh: ieee80211_leave_mesh() -> kfree(sdata->u.mesh.ie); ... ieee80211_join_mesh() -> copy_mesh_setup() -> old_ie = ifmsh->ie; -> kfree(old_ie); This double free / kernel panics can be reproduced by using wpa_supplicant with an encrypted mesh (if set up without encryption via "iw" then ifmsh->ie is always NULL, which avoids this issue). And then calling: $ iw dev mesh0 mesh leave $ iw dev mesh0 mesh join my-mesh Note that typically these commands are not used / working when using wpa_supplicant. And it seems that wpa_supplicant or wpa_cli are going through a NETDEV_DOWN/NETDEV_UP cycle between a mesh leave and mesh join where the NETDEV_UP resets the mesh.ie to NULL via a memcpy of default_mesh_setup in cfg80211_netdev_notifier_call, which then avoids the memory corruption, too. The issue was first observed in an application which was not using wpa_supplicant but "Senf" instead, which implements its own calls to nl80211. Fixing the issue by removing the kfree()'ing of the mesh IE in the mesh join function and leaving it solely up to the mesh leave to free the mesh IE.
Security Summary
CVE-2022-49290 is a double free vulnerability in the Linux kernel's mac80211 subsystem, specifically affecting mesh networking functionality. The issue stems from commit 6a01afcf8468, which fixed a memory leak during mesh leave or teardown but introduced a potential double free when rejoining a mesh network. This occurs because ieee80211_leave_mesh() frees sdata->u.mesh.ie, and a subsequent ieee80211_join_mesh() call via copy_mesh_setup() frees the same pointer (old_ie = ifmsh->ie). The vulnerability is classified under CWE-415 with a CVSS v3.1 base score of 7.8 (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
A local attacker with low privileges can exploit this vulnerability by triggering a mesh leave followed by a mesh join operation, such as using wpa_supplicant with an encrypted mesh or tools like "iw" (e.g., "iw dev mesh0 mesh leave" then "iw dev mesh0 mesh join my-mesh"). This leads to memory corruption or kernel panic due to the double free. While wpa_supplicant typically avoids the issue through a NETDEV_DOWN/NETDEV_UP cycle that resets mesh.ie to NULL, direct nl80211 calls (e.g., via the "Senf" application) can reliably trigger it, enabling high-impact disruption to confidentiality, integrity, and availability.
Kernel patches addressing this vulnerability are available in stable releases via the referenced commits, including 12e407a8ef17623823fd0c066fbd7f103953d28d, 273ebddc5fda2967492cb0b6cdd7d81cfb821b76, 3bbd0000d012f92aec423b224784fbf0f7bf40f8, 46bb87d40683337757a2f902fcd4244b32bb4e86, and 4a2d4496e15ea5bb5c8e83b94ca8ca7fb045e7d3. The fix removes the kfree() of the mesh IE in the join function, relying solely on the leave function for freeing, preventing the double free. Security practitioners should ensure affected Linux kernels are updated to incorporate these stable patches.
Details
- CWE(s)