Skip to content
Race condition Write-up Advanced

(CVE-2025-37797) Linux Kernel hfsc_change_class TOCTOU Leading to Use-After-Free and Local Privilege Escalation

A time-of-check to time-of-use flaw in the Linux kernel's HFSC network scheduler lets an empty class be inserted into the vttree, which leads to a use-after-free. A local unprivileged attacker could exploit this to escalate privileges on the host.

starlabs.sg

Published on starlabs.sg

A use-after-free vulnerability in the Linux Kernel net scheduler subsystem can be exploited to achieve local privilege escalation. In the hfscchangeclass routine, it is possible to peek and empty a child qdisc.

The author, on starlabs.sg

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a race between the check and use of a class in hfsc_change_class, allowing an empty class into the vttree and a later use-after-free.

Impact

A local unprivileged attacker could achieve local privilege escalation with high confidentiality, integrity and availability impact.

What the attacker needed

Local access to the host; unprivileged user account

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The kernel's network traffic scheduler (HFSC) keeps a sorted list of classes. A race between two operations means the kernel can check a class is fine, then something changes before it is used, so it ends up holding a reference to memory that has already been freed. A local user with normal rights could then abuse that freed memory to run code with higher privileges.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.