The Linux kernel is a critical component of many computing systems, providing the necessary foundation for executing programs, managing resources, and enabling various hardware features. In this post, we will delve into the details of a newly discovered vulnerability found in the Linux kernel. The vulnerability in question is CVE-2023-23454, which allows an attacker to cause a denial of service (slab-out-of-bounds read) via the cbq_classify function. As part of our analysis, we will review code snippets, original references, and exploit details to better understand the scope and impact of this issue.

CVE-2023-23454: The Vulnerability

The issue resides in the cbq_classify function within the net/sched/sch_cbq.c file in the Linux kernel, ranging from version .1 to 6.1.4 (inclusive). The core of the problem is the type confusion that arises in handling non-negative numbers. Normally, these numbers indicate valid classification results; however, they can occasionally display a TC_ACT_SHOT condition. This is problematic as it can allow an attacker to cause a denial of service.

Let's examine the root cause by looking at the cbq_classify function in net/sched/sch_cbq.c

static int cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
{
    int cl = TC_H_MIN(skb->priority);
    struct cbq_sched_data *q = qdisc_priv(sch);
    struct cbq_class *cl;
    ...
    if (cl && (unsigned long)cl != TC_ACT_SHOT) {
        ...
        return cl->qdrv;
    }
    ...
}

In this piece of code, cl contains the classification result, which should be a non-negative number. However, due to type confusion, when cl takes a non-negative value, it is interpreted as a TC_ACT_SHOT condition. The check (unsigned long)cl != TC_ACT_SHOT leads to an incorrect bypass of the expected flow. This issue was initially reported here.

Exploitation Details

Exploiting this bug might not be trivial since the exact behavior of cbq_classify highly depends on the networking environment and the state of the kernel. In most cases, an attacker would need to control the classification result to direct execution flow toward the tc_action_exec function. From the attacker's point of view, the goal is to manipulate the classification result in such a way that it resembles TC_ACT_SHOT in order to trigger an out-of-bounds read.

Mitigation

Fortunately, the Linux kernel developers have already acknowledged this issue and submitted a patch to resolve it. The patch changes the return type of cbq_classify from a signed integer to an unsigned integer, effectively eliminating any negative numbers that could be interpreted as TC_ACT_SHOT. You can find the patch here.

To protect your system, we highly recommend updating the Linux kernel to the latest available version, which includes the aforementioned patch. As a general best practice, it is essential to keep your operating systems and software up-to-date to minimize the attack surface and stay safe from threats.

Conclusion

CVE-2023-23454 is a notable Linux kernel vulnerability that could potentially cause a denial of service due to an out-of-bounds read stemming from type confusion. Although exploitation may not be straightforward, ensuring that your system is protected against this vulnerability is crucial. By understanding the technical details and potential impact of CVE-2023-23454, you can take the necessary steps to safeguard your system against potential attacks.

Timeline

Published on: 01/12/2023 07:15:00 UTC
Last modified on: 03/03/2023 01:15:00 UTC