CVE-2023-52629 sh: push-switch: Reorder cleanup operations to avoid use-after-free bug

High 8.4 Published Updated

A use-after-free vulnerability in the Linux kernel's sh: push-switch driver allows attackers to potentially execute arbitrary code or escalate privileges.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2023-52629?

CVE-2023-52629 is a high-severity use after free vulnerability in Linux kernel, published on 29 Mar 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

In the Linux kernel, the following vulnerability has been resolved:

sh: push-switch: Reorder cleanup operations to avoid use-after-free bug

The original code puts flush_work() before timer_shutdown_sync() in switch_drv_remove(). Although we use flush_work() to stop the worker, it could be rescheduled in switch_timer(). As a result, a use-after-free bug can occur. The details are shown below:

(cpu 0) | (cpu 1) switch_drv_remove() | flush_work() | ... | switch_timer // timer | schedule_work(&psw->work) timer_shutdown_sync() | ... | switch_work_handler // worker kfree(psw) // free | | psw->state = 0 // use

This patch puts timer_shutdown_sync() before flush_work() to mitigate the bugs. As a result, the worker and timer will be stopped safely before the deallocate operations.

Weakness: CWE-416

Which versions are affected by CVE-2023-52629?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2023-52629?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2023-52629 being exploited?

There is no known exploitation of CVE-2023-52629 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2023-52629, DEBIAN-CVE-2023-52629, GHSA-384v-9gx5-rmx4, ROOT-OS-DEBIAN-11-CVE-2023-52629, ROOT-OS-DEBIAN-12-CVE-2023-52629, UBUNTU-CVE-2023-52629.

Is CVE-2023-52629 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free