HIGH
bluetooth L2CAP ECRED OOB
CVE-2026-31513
CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
KernelScan AI8.1HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: Bluetooth: L2CAP: Fix stack-out-of-bounds read in l2cap_ecred_conn_req Syzbot reported a KASAN stack-out-of-bounds read in l2cap_build_cmd() that is triggered by a malformed Enhanced Credit Based Connection Request. The vulnerability stems from l2cap_ecred_conn_req(). The function allocates a local stack buffer (`pdu`) designed to hold a maximum of 5 Source Channel IDs (SCIDs), totaling 18 bytes. When an attacker sends a request with more than 5 SCIDs, the function calculates `rsp_len` based on this unvalidated `cmd_len` before checking if the number of SCIDs exceeds L2CAP_ECRED_MAX_CID. If the SCID count is too high, the function correctly jumps to the `response` label to reject the packet, but `rsp_len` retains the attacker's oversized value. Consequently, l2cap_send_cmd() is instructed to read past the end of the 18-byte `pdu` buffer, triggering a KASAN panic. Fix this by moving the assignment of `rsp_len` to after the `num_scid` boundary check. If the packet is rejected, `rsp_len` will safely remain 0, and the error response will only read the 8-byte base header from the stack.
02KernelScan AI Analysis
Risk summary
An attacker can cause a kernel crash by sending a specially crafted Bluetooth L2CAP packet with too many Source Channel IDs. This triggers a stack buffer overflow read that can crash the system or potentially leak kernel memory contents. The vulnerability affects any system with Bluetooth enabled and can be exploited remotely by nearby attackers within Bluetooth range.
Vulnerability analysis
Root Cause: In l2cap_ecred_conn_req(), the function calculates rsp_len based on unvalidated cmd_len before checking if the number of Source Channel IDs (SCIDs) exceeds L2CAP_ECRED_MAX_CID. When an attacker sends a malformed Enhanced Credit Based Connection Request with more than 5 SCIDs, rsp_len retains the oversized value even after the function correctly rejects the packet and jumps to the response label.
Attack Surface: Network-accessible via Bluetooth L2CAP protocol. An attacker can trigger this vulnerability by sending a malformed Enhanced Credit Based Connection Request packet with more than 5 Source Channel IDs over an established Bluetooth connection. No special privileges are required beyond the ability to send L2CAP packets.
Fix Mechanism: The patch moves the assignment of rsp_len to after the num_scid boundary check. If the packet is rejected due to too many SCIDs, rsp_len safely remains 0, ensuring that l2cap_send_cmd() only reads the 8-byte base header from the stack buffer instead of attempting to read past the 18-byte pdu buffer boundary.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 6.12 | 6.12.80 | c8e1a27edb8b |
| 6.18 | 6.18.21 | 5b35f8211a91 |
| 6.19 | 6.19.11 | a3d9c50d6978 |