CVE-2024-57996 in Linuxinfo

Summary

by MITRE • 02/27/2025

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

net_sched: sch_sfq: don't allow 1 packet limit

The current implementation does not work correctly with a limit of 1. iproute2 actually checks for this and this patch adds the check in kernel as well.

This fixes the following syzkaller reported crash:

UBSAN: array-index-out-of-bounds in net/sched/sch_sfq.c:210:6 index 65535 is out of range for type 'struct sfq_head[128]'
CPU: 0 PID: 2569 Comm: syz-executor101 Not tainted 5.10.0-smp-DEV #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x125/0x19f lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:148 [inline]
__ubsan_handle_out_of_bounds+0xed/0x120 lib/ubsan.c:347 sfq_link net/sched/sch_sfq.c:210 [inline]
sfq_dec+0x528/0x600 net/sched/sch_sfq.c:238 sfq_dequeue+0x39b/0x9d0 net/sched/sch_sfq.c:500 sfq_reset+0x13/0x50 net/sched/sch_sfq.c:525 qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026 tbf_reset+0x3d/0x100 net/sched/sch_tbf.c:319 qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026 dev_reset_queue+0x8c/0x140 net/sched/sch_generic.c:1296 netdev_for_each_tx_queue include/linux/netdevice.h:2350 [inline]
dev_deactivate_many+0x6dc/0xc20 net/sched/sch_generic.c:1362 __dev_close_many+0x214/0x350 net/core/dev.c:1468 dev_close_many+0x207/0x510 net/core/dev.c:1506 unregister_netdevice_many+0x40f/0x16b0 net/core/dev.c:10738 unregister_netdevice_queue+0x2be/0x310 net/core/dev.c:10695 unregister_netdevice include/linux/netdevice.h:2893 [inline]
__tun_detach+0x6b6/0x1600 drivers/net/tun.c:689 tun_detach drivers/net/tun.c:705 [inline]
tun_chr_close+0x104/0x1b0 drivers/net/tun.c:3640 __fput+0x203/0x840 fs/file_table.c:280 task_work_run+0x129/0x1b0 kernel/task_work.c:185 exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0x5ce/0x2200 kernel/exit.c:931 do_group_exit+0x144/0x310 kernel/exit.c:1046 __do_sys_exit_group kernel/exit.c:1057 [inline]
__se_sys_exit_group kernel/exit.c:1055 [inline]
__x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1055 do_syscall_64+0x6c/0xd0 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fe5e7b52479 Code: Unable to access opcode bytes at RIP 0x7fe5e7b5244f. RSP: 002b:00007ffd3c800398 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe5e7b52479 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 00007fe5e7bcd2d0 R08: ffffffffffffffb8 R09: 0000000000000014 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe5e7bcd2d0 R13: 0000000000000000 R14: 00007fe5e7bcdd20 R15: 00007fe5e7b24270

The crash can be also be reproduced with the following (with a tc recompiled to allow for sfq limits of 1):

tc qdisc add dev dummy0 handle 1: root tbf rate 1Kbit burst 100b lat 1s ../iproute2-6.9.0/tc/tc qdisc add dev dummy0 handle 2: parent 1:10 sfq limit 1 ifconfig dummy0 up ping -I dummy0 -f -c2 -W0.1 8.8.8.8 sleep 1

Scenario that triggers the crash:

* the first packet is sent and queued in TBF and SFQ; qdisc qlen is 1

* TBF dequeues: it peeks from SFQ which moves the packet to the gso_skb list and keeps qdisc qlen set to 1. TBF is out of tokens so it schedules itself for later.

* the second packet is sent and TBF tries to queues it to SFQ. qdisc qlen is now 2 and because the SFQ limit is 1 the packet is dropped by SFQ. At this point qlen is 1, and all of the SFQ slots are empty, however q->tail is not NULL.

At this point, assuming no more packets are queued, when sch_dequeue runs again it will decrement the qlen for the current empty slot causing an underflow and the subsequent out of bounds access.

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 05/24/2026

The vulnerability described in CVE-2024-57996 resides within the Linux kernel's traffic control subsystem, specifically in the Stochastic Fairness Queuing (SFQ) qdisc implementation. This flaw manifests as an out-of-bounds memory access when the SFQ qdisc is configured with a packet limit of one, a scenario that is technically invalid and unsupported but was not properly validated in kernel space. The issue was identified through systematic fuzzing by syzkaller, which uncovered a critical memory corruption pattern that leads to a kernel panic or potential code execution. The underlying technical root cause lies in the improper handling of queue state management when the limit is set to one, causing a mismatch between the actual queue length and the internal data structures used to track packet positions.

The technical flaw occurs in the net/sched/sch_sfq.c file where the sfq_link function attempts to access an array index that exceeds the allocated bounds. Specifically, when the limit is set to one, the SFQ implementation fails to properly handle the case where a packet is dequeued and the queue state becomes inconsistent. The kernel's UBSAN (Undefined Behavior Sanitizer) detects the out-of-bounds access at line 210 in the sfq_link function, where an index of 65535 attempts to access a struct sfq_head array of only 128 elements. This condition arises from a race between the TBF (Token Bucket Filter) qdisc and the SFQ qdisc during packet queuing and dequeuing operations, where the state management becomes corrupted due to improper limit enforcement.

The operational impact of this vulnerability is significant as it can lead to kernel crashes, system instability, and potential denial of service conditions. The vulnerability is triggered through a specific sequence involving TBF and SFQ qdisc interaction, where a dummy network interface is configured with a TBF qdisc and an SFQ qdisc with a limit of one. When network traffic is generated through ping commands, the inconsistent queue state causes a memory corruption that manifests as an array index out-of-bounds error. This vulnerability affects systems running Linux kernel versions that include the SFQ implementation and are configured with traffic control policies that use SFQ qdisc with a limit parameter set to one.

This vulnerability aligns with CWE-129, which describes improper validation of array indices, and represents a classic case of insufficient input validation in kernel space. The flaw demonstrates the importance of proper boundary checking in kernel data structures and the need for comprehensive validation of user-provided parameters in system-level components. From an ATT&CK perspective, this vulnerability could be leveraged in a privilege escalation or denial of service attack, particularly in environments where unprivileged users can configure network traffic control policies. The mitigation strategy involves implementing kernel-level validation to prevent the configuration of SFQ qdisc with a limit of one, as this value is invalid and leads to the described memory corruption. Administrators should ensure that network traffic control policies do not configure SFQ qdisc with invalid limits and should apply the relevant kernel patch that adds this validation check, which prevents the problematic configuration from being accepted at the kernel level rather than allowing it to proceed and cause a crash. The fix ensures that the kernel performs the same validation that iproute2 already enforces, thereby maintaining consistency and preventing the exploitation of this memory corruption vulnerability.

Responsible

Linux

Reservation

02/27/2025

Disclosure

02/27/2025

Moderation

accepted

CPE

ready

EPSS

0.00229

KEV

no

Activities

very low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!