Lucene search

K
cve416baaa9-dc9f-4396-8d5f-8c081fb06d67CVE-2024-27415
HistoryMay 17, 2024 - 12:15 p.m.

CVE-2024-27415

2024-05-1712:15:12
416baaa9-dc9f-4396-8d5f-8c081fb06d67
web.nvd.nist.gov
32
linux kernel
netfilter bridge
vulnerability resolved
multicast packets
conntrack nf_confirm logic
cloned skbs
nf_conn entry
macvlan
broadcast packet
conntrack table
eb/ip/nftables rules
nat transformation
locking
physdev
snat
conntrack bypass

6.8 Medium

AI Score

Confidence

Low

0.0004 Low

EPSS

Percentile

15.5%

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

netfilter: bridge: confirm multicast packets before passing them up the stack

conntrack nf_confirm logic cannot handle cloned skbs referencing
the same nf_conn entry, which will happen for multicast (broadcast)
frames on bridges.

Example:
macvlan0
|
br0
/
ethX ethY

ethX (or Y) receives a L2 multicast or broadcast packet containing
an IP packet, flow is not yet in conntrack table.

  1. skb passes through bridge and fake-ip (br_netfilter)Prerouting.
    -> skb->_nfct now references a unconfirmed entry

  2. skb is broad/mcast packet. bridge now passes clones out on each bridge
    interface.

  3. skb gets passed up the stack.

  4. In macvlan case, macvlan driver retains clone(s) of the mcast skb
    and schedules a work queue to send them out on the lower devices.

    The clone skb->_nfct is not a copy, it is the same entry as the
    original skb. The macvlan rx handler then returns RX_HANDLER_PASS.

  5. Normal conntrack hooks (in NF_INET_LOCAL_IN) confirm the orig skb.

The Macvlan broadcast worker and normal confirm path will race.

This race will not happen if step 2 already confirmed a clone. In that
case later steps perform skb_clone() with skb->_nfct already confirmed (in
hash table). This works fine.

But such confirmation won’t happen when eb/ip/nftables rules dropped the
packets before they reached the nf_confirm step in postrouting.

Pablo points out that nf_conntrack_bridge doesn’t allow use of stateful
nat, so we can safely discard the nf_conn entry and let inet call
conntrack again.

This doesn’t work for bridge netfilter: skb could have a nat
transformation. Also bridge nf prevents re-invocation of inet prerouting
via ‘sabotage_in’ hook.

Work around this problem by explicit confirmation of the entry at LOCAL_IN
time, before upper layer has a chance to clone the unconfirmed entry.

The downside is that this disables NAT and conntrack helpers.

Alternative fix would be to add locking to all code parts that deal with
unconfirmed packets, but even if that could be done in a sane way this
opens up other problems, for example:

-m physdev --physdev-out eth0 -j SNAT --snat-to 1.2.3.4
-m physdev --physdev-out eth1 -j SNAT --snat-to 1.2.3.5

For multicast case, only one of such conflicting mappings will be
created, conntrack only handles 1:1 NAT mappings.

Users should set create a setup that explicitly marks such traffic
NOTRACK (conntrack bypass) to avoid this, but we cannot auto-bypass
them, ruleset might have accept rules for untracked traffic already,
so user-visible behaviour would change.

Affected configurations

Vulners
Node
linuxlinux_kernelRange2.6.125.15.151
OR
linuxlinux_kernelRange5.16.06.1.81
OR
linuxlinux_kernelRange6.2.06.6.21
OR
linuxlinux_kernelRange6.7.06.7.9
OR
linuxlinux_kernelRange6.8.0
VendorProductVersionCPE
linuxlinux_kernel*cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
linuxlinux_kernel*cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
linuxlinux_kernel*cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
linuxlinux_kernel*cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
linuxlinux_kernel*cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "include/linux/netfilter.h",
      "net/bridge/br_netfilter_hooks.c",
      "net/bridge/netfilter/nf_conntrack_bridge.c",
      "net/netfilter/nf_conntrack_core.c"
    ],
    "versions": [
      {
        "version": "1da177e4c3f4",
        "lessThan": "7c3f28599652",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "2b1414d5e94e",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "80cd0487f630",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "cb734975b0ff",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "62e7151ae3eb",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "include/linux/netfilter.h",
      "net/bridge/br_netfilter_hooks.c",
      "net/bridge/netfilter/nf_conntrack_bridge.c",
      "net/netfilter/nf_conntrack_core.c"
    ],
    "versions": [
      {
        "version": "2.6.12",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "2.6.12",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.15.151",
        "lessThanOrEqual": "5.15.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.1.81",
        "lessThanOrEqual": "6.1.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.6.21",
        "lessThanOrEqual": "6.6.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.7.9",
        "lessThanOrEqual": "6.7.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.8",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

6.8 Medium

AI Score

Confidence

Low

0.0004 Low

EPSS

Percentile

15.5%