Lucene search

K
vulnrichmentLinuxVULNRICHMENT:CVE-2023-52843
HistoryMay 21, 2024 - 3:31 p.m.

CVE-2023-52843 llc: verify mac len before reading mac header

2024-05-2115:31:41
Linux
github.com
1
linux kernel
vulnerability resolved
llc
eth_hdr
skb
tun device
kmsan
net/llc
macro_len test
include/net/llc_pdu.h
eth_p_802_2
llc_fixup_skb
llc code
802.2 llc
ethernet header
token ring
cve-2023-52843

6.7 Medium

AI Score

Confidence

Low

0.0004 Low

EPSS

Percentile

13.2%

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

llc: verify mac len before reading mac header

LLC reads the mac header with eth_hdr without verifying that the skb
has an Ethernet header.

Syzbot was able to enter llc_rcv on a tun device. Tun can insert
packets without mac len and with user configurable skb->protocol
(passing a tun_pi header when not configuring IFF_NO_PI).

BUG: KMSAN: uninit-value in llc_station_ac_send_test_r net/llc/llc_station.c:81 [inline]
BUG: KMSAN: uninit-value in llc_station_rcv+0x6fb/0x1290 net/llc/llc_station.c:111
llc_station_ac_send_test_r net/llc/llc_station.c:81 [inline]
llc_station_rcv+0x6fb/0x1290 net/llc/llc_station.c:111
llc_rcv+0xc5d/0x14a0 net/llc/llc_input.c:218
__netif_receive_skb_one_core net/core/dev.c:5523 [inline]
__netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5637
netif_receive_skb_internal net/core/dev.c:5723 [inline]
netif_receive_skb+0x58/0x660 net/core/dev.c:5782
tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555
tun_get_user+0x54c5/0x69c0 drivers/net/tun.c:2002

Add a mac_len test before all three eth_hdr(skb) calls under net/llc.

There are further uses in include/net/llc_pdu.h. All these are
protected by a test skb->protocol == ETH_P_802_2. Which does not
protect against this tun scenario.

But the mac_len test added in this patch in llc_fixup_skb will
indirectly protect those too. That is called from llc_rcv before any
other LLC code.

It is tempting to just add a blanket mac_len check in llc_rcv, but
not sure whether that could break valid LLC paths that do not assume
an Ethernet header. 802.2 LLC may be used on top of non-802.3
protocols in principle. The below referenced commit shows that used
to, on top of Token Ring.

At least one of the three eth_hdr uses goes back to before the start
of git history. But the one that syzbot exercises is introduced in
this commit. That commit is old enough (2008), that effectively all
stable kernels should receive this.

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "net/llc/llc_input.c",
      "net/llc/llc_s_ac.c",
      "net/llc/llc_station.c"
    ],
    "versions": [
      {
        "version": "f83f1768f833",
        "lessThan": "900a4418e3f6",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "9a3f9054a522",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "cbdcdf42d15d",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "3a2653828ffc",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "352887b3edd0",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "f980e9a57dfb",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "0a720d0259ad",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "ff5cb6a4f0c6",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "f83f1768f833",
        "lessThan": "7b3ba18703a6",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "net/llc/llc_input.c",
      "net/llc/llc_s_ac.c",
      "net/llc/llc_station.c"
    ],
    "versions": [
      {
        "version": "2.6.25",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "2.6.25",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "4.14.330",
        "lessThanOrEqual": "4.14.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "4.19.299",
        "lessThanOrEqual": "4.19.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.4.261",
        "lessThanOrEqual": "5.4.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.10.201",
        "lessThanOrEqual": "5.10.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.15.139",
        "lessThanOrEqual": "5.15.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.1.63",
        "lessThanOrEqual": "6.1.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.5.12",
        "lessThanOrEqual": "6.5.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.6.2",
        "lessThanOrEqual": "6.6.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.7",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

6.7 Medium

AI Score

Confidence

Low

0.0004 Low

EPSS

Percentile

13.2%

Related for VULNRICHMENT:CVE-2023-52843