Vulnerability · Published Mar 2, 2024 · Assigned by Linux

CVE-2023-52523bpf, sockmap: Reject sk_msg egress redirects to non-TCP sockets

High 7.8

In plain English

A high-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 15% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.2%top 85.3% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

In the Linux kernel, the following vulnerability has been resolved: bpf, sockmap: Reject sk_msg egress redirects to non-TCP sockets With a SOCKMAP/SOCKHASH map and an sk_msg program user can steer messages sent from one TCP socket (s1) to actually egress from another TCP socket (s2): tcp_bpf_sendmsg(s1) // = sk_prot->sendmsg tcp_bpf_send_verdict(s1) // __SK_REDIRECT case tcp_bpf_sendmsg_redir(s2) tcp_bpf_push_locked(s2) tcp_bpf_push(s2) tcp_rate_check_app_limited(s2) // expects tcp_sock tcp_sendmsg_locked(s2) // ditto There is a hard-coded assumption in the call-chain, that the egress socket (s2) is a TCP socket. However in commit 122e6c79efe1 ("sock_map: Update sock type checks for UDP") we have enabled redirects to non-TCP sockets. This was done for the sake of BPF sk_skb programs. There was no indention to support sk_msg send-to-egress use case. As a result, attempts to send-to-egress through a non-TCP socket lead to a crash due to invalid downcast from sock to tcp_sock: BUG: kernel NULL pointer dereference, address: 000000000000002f ... Call Trace: <TASK> ? show_regs+0x60/0x70 ? __die+0x1f/0x70 ? page_fault_oops+0x80/0x160 ? do_user_addr_fault+0x2d7/0x800 ? rcu_is_watching+0x11/0x50 ? exc_page_fault+0x70/0x1c0 ? asm_exc_page_fault+0x27/0x30 ? tcp_tso_segs+0x14/0xa0 tcp_write_xmit+0x67/0xce0 __tcp_push_pending_frames+0x32/0xf0 tcp_push+0x107/0x140 tcp_sendmsg_locked+0x99f/0xbb0 tcp_bpf_push+0x19d/0x3a0 tcp_bpf_sendmsg_redir+0x55/0xd0 tcp_bpf_send_verdict+0x407/0x550 tcp_bpf_sendmsg+0x1a1/0x390 inet_sendmsg+0x6a/0x70 sock_sendmsg+0x9d/0xc0 ? sockfd_lookup_light+0x12/0x80 __sys_sendto+0x10e/0x160 ? syscall_enter_from_user_mode+0x20/0x60 ? __this_cpu_preempt_check+0x13/0x20 ? lockdep_hardirqs_on+0x82/0x110 __x64_sys_sendto+0x1f/0x30 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd Reject selecting a non-TCP sockets as redirect target from a BPF sk_msg program to prevent the crash. When attempted, user will receive an EACCES error from send/sendto/sendmsg() syscall.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux6.1.64-1DEBIAN-CVE-2023-52523
Debian:13linux6.5.8-1DEBIAN-CVE-2023-52523
Debian:14linux6.5.8-1DEBIAN-CVE-2023-52523
Ubuntu:22.04:LTSlinux5.15.0-94.104UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-aws5.15.0-1053.58UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-azure5.15.0-1056.64UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1056.64.1UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-gcp5.15.0-1051.59UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-gcp-6.56.5.0-1013.13~22.04.1UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-gke5.15.0-1050.55UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1036.42UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-hwe-6.56.5.0-17.17~22.04.1UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-ibm5.15.0-1046.49UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1047.53UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-kvm5.15.0-1050.55UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-94.104UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.56.5.0-17.17.1.1.1~22.04.1UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1044.44UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-nvidia-6.56.5.0-1014.14UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-nvidia-tegra5.15.0-1022.22UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-nvidia-tegra-igx5.15.0-1009.9UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-oem-6.56.5.0-1014.15UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-oracle5.15.0-1051.57UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-oracle-6.56.5.0-1015.15~22.04.1UBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-raspi5.15.0-1046.49UBUNTU-CVE-2023-52523
Ubuntu:24.04:LTSlinux-raspi6.7.0-1001.1UBUNTU-CVE-2023-52523
Ubuntu:24.04:LTSlinux-raspi-realtimeno fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2023-52523
Ubuntu:22.04:LTSlinux-xilinx-zynqmp5.15.0-1027.31UBUNTU-CVE-2023-52523

Affected products (as reported)

VendorProductVersions
Linux Linux 122e6c79efe1c25816118aca9cfabe54e99c2432 – before bc8b89b6963803a123f64aa9494155a037b3d728122e6c79efe1c25816118aca9cfabe54e99c2432 – before b8f97e47b6fb84fcf2f5a22e725eefb6cf5070c2122e6c79efe1c25816118aca9cfabe54e99c2432 – before ded6e448028f0f91b6af35985afca01fa02a9089122e6c79efe1c25816118aca9cfabe54e99c2432 – before b80e31baa43614e086a9d29dc1151932b1bd7fc5
Linux Linux 5.13

References