CVE-2021-47281 ALSA: seq: Fix race of snd_seq_timer_open()

High 7.8 Published Updated

A race condition in the Linux kernel ALSA sequencer allows local attackers to trigger a use-after-free, potentially leading to code execution or privilege escalation.

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

What is CVE-2021-47281?

CVE-2021-47281 is a high-severity use after free vulnerability in Linux kernel, published on 21 May 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:

ALSA: seq: Fix race of snd_seq_timer_open()

The timer instance per queue is exclusive, and snd_seq_timer_open() should have managed the concurrent accesses. It looks as if it's checking the already existing timer instance at the beginning, but it's not right, because there is no protection, hence any later concurrent call of snd_seq_timer_open() may override the timer instance easily. This may result in UAF, as the leftover timer instance can keep running while the queue itself gets closed, as spotted by syzkaller recently.

For avoiding the race, add a proper check at the assignment of tmr->timeri again, and return -EBUSY if it's been already registered.

Weakness: CWE-416

Which versions are affected by CVE-2021-47281?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2021-47281?

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-2021-47281 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as DEBIAN-CVE-2021-47281, GHSA-fj34-p4r2-ghh5, UBUNTU-CVE-2021-47281.

Is CVE-2021-47281 in your software?

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

Check your SBOMs for free