CVE-2025-38248

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-38248
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-38248.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-38248
Downstream
Related
Published
2025-07-09T10:42:29Z
Modified
2025-10-18T03:07:43.164641Z
Summary
bridge: mcast: Fix use-after-free during router port configuration
Details

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

bridge: mcast: Fix use-after-free during router port configuration

The bridge maintains a global list of ports behind which a multicast router resides. The list is consulted during forwarding to ensure multicast packets are forwarded to these ports even if the ports are not member in the matching MDB entry.

When per-VLAN multicast snooping is enabled, the per-port multicast context is disabled on each port and the port is removed from the global router port list:

# ip link add name br1 up type bridge vlanfiltering 1 mcastsnooping 1 # ip link add name dummy1 up master br1 type dummy # ip link set dev dummy1 type bridgeslave mcastrouter 2 $ bridge -d mdb show | grep router router ports on br1: dummy1 # ip link set dev br1 type bridge mcastvlansnooping 1 $ bridge -d mdb show | grep router

However, the port can be re-added to the global list even when per-VLAN multicast snooping is enabled:

# ip link set dev dummy1 type bridgeslave mcastrouter 0 # ip link set dev dummy1 type bridgeslave mcastrouter 2 $ bridge -d mdb show | grep router router ports on br1: dummy1

Since commit 4b30ae9adb04 ("net: bridge: mcast: re-implement brmulticast{enable, disable}_port functions"), when per-VLAN multicast snooping is enabled, multicast disablement on a port will disable the per-{port, VLAN} multicast contexts and not the per-port one. As a result, a port will remain in the global router port list even after it is deleted. This will lead to a use-after-free [1] when the list is traversed (when adding a new port to the list, for example):

# ip link del dev dummy1 # ip link add name dummy2 up master br1 type dummy # ip link set dev dummy2 type bridgeslave mcastrouter 2

Similarly, stale entries can also be found in the per-VLAN router port list. When per-VLAN multicast snooping is disabled, the per-{port, VLAN} contexts are disabled on each port and the port is removed from the per-VLAN router port list:

# ip link add name br1 up type bridge vlanfiltering 1 mcastsnooping 1 mcastvlansnooping 1 # ip link add name dummy1 up master br1 type dummy # bridge vlan add vid 2 dev dummy1 # bridge vlan global set vid 2 dev br1 mcastsnooping 1 # bridge vlan set vid 2 dev dummy1 mcastrouter 2 $ bridge vlan global show dev br1 vid 2 | grep router router ports: dummy1 # ip link set dev br1 type bridge mcastvlansnooping 0 $ bridge vlan global show dev br1 vid 2 | grep router

However, the port can be re-added to the per-VLAN list even when per-VLAN multicast snooping is disabled:

# bridge vlan set vid 2 dev dummy1 mcastrouter 0 # bridge vlan set vid 2 dev dummy1 mcastrouter 2 $ bridge vlan global show dev br1 vid 2 | grep router router ports: dummy1

When the VLAN is deleted from the port, the per-{port, VLAN} multicast context will not be disabled since multicast snooping is not enabled on the VLAN. As a result, the port will remain in the per-VLAN router port list even after it is no longer member in the VLAN. This will lead to a use-after-free [2] when the list is traversed (when adding a new port to the list, for example):

# ip link add name dummy2 up master br1 type dummy # bridge vlan add vid 2 dev dummy2 # bridge vlan del vid 2 dev dummy1 # bridge vlan set vid 2 dev dummy2 mcast_router 2

Fix these issues by removing the port from the relevant (global or per-VLAN) router port list in brmulticastportctxdeinit(). The function is invoked during port deletion with the per-port multicast context and during VLAN deletion with the per-{port, VLAN} multicast context.

Note that deleting the multicast router timer is not enough as it only takes care of the temporary multicast router states (1 or 3) and not the permanent one (2).

[1] BUG: KASAN: slab-out-of-bounds in brmulticastaddrouter.part.0+0x3f1/0x560 Write of size 8 at addr ffff888004a67328 by task ip/384 [...] Call Trace: <TASK> dumpstack ---truncated---

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
2796d846d74a18cc6563e96eff8bf28c5e06f912
Fixed
f05a4f9e959e0fc098046044c650acf897ea52d2
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
2796d846d74a18cc6563e96eff8bf28c5e06f912
Fixed
7544f3f5b0b58c396f374d060898b5939da31709

Affected versions

v5.*

v5.14
v5.14-rc7
v5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rc6
v6.2-rc7
v6.2-rc8
v6.3
v6.3-rc1
v6.3-rc2
v6.3-rc3
v6.3-rc4
v6.3-rc5
v6.3-rc6
v6.3-rc7
v6.4
v6.4-rc1
v6.4-rc2
v6.4-rc3
v6.4-rc4
v6.4-rc5
v6.4-rc6
v6.4-rc7
v6.5
v6.5-rc1
v6.5-rc2
v6.5-rc3
v6.5-rc4
v6.5-rc5
v6.5-rc6
v6.5-rc7
v6.6
v6.6-rc1
v6.6-rc2
v6.6-rc3
v6.6-rc4
v6.6-rc5
v6.6-rc6
v6.6-rc7
v6.7
v6.7-rc1
v6.7-rc2
v6.7-rc3
v6.7-rc4
v6.7-rc5
v6.7-rc6
v6.7-rc7
v6.7-rc8
v6.8
v6.8-rc1
v6.8-rc2
v6.8-rc3
v6.8-rc4
v6.8-rc5
v6.8-rc6
v6.8-rc7
v6.9
v6.9-rc1
v6.9-rc2
v6.9-rc3
v6.9-rc4
v6.9-rc5
v6.9-rc6
v6.9-rc7

Database specific

vanir_signatures

[
    {
        "digest": {
            "length": 165.0,
            "function_hash": "133387904403372069623815993370239934964"
        },
        "signature_type": "Function",
        "target": {
            "function": "br_multicast_port_ctx_deinit",
            "file": "net/bridge/br_multicast.c"
        },
        "deprecated": false,
        "signature_version": "v1",
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7544f3f5b0b58c396f374d060898b5939da31709",
        "id": "CVE-2025-38248-06e0d88d"
    },
    {
        "digest": {
            "threshold": 0.9,
            "line_hashes": [
                "18255824204074679595161511280927985181",
                "103713960993500898722344549881537227914",
                "201853636338361807667147312140513460828",
                "197685339346835261992740043919861303503",
                "283616792624632096852988538075052733618",
                "168996817461736588823816171149796017968",
                "217738787463727613501073983289671775563",
                "311432459482170755610292409504602985608"
            ]
        },
        "signature_type": "Line",
        "target": {
            "file": "net/bridge/br_multicast.c"
        },
        "deprecated": false,
        "signature_version": "v1",
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7544f3f5b0b58c396f374d060898b5939da31709",
        "id": "CVE-2025-38248-323f9a0e"
    },
    {
        "digest": {
            "length": 165.0,
            "function_hash": "133387904403372069623815993370239934964"
        },
        "signature_type": "Function",
        "target": {
            "function": "br_multicast_port_ctx_deinit",
            "file": "net/bridge/br_multicast.c"
        },
        "deprecated": false,
        "signature_version": "v1",
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f05a4f9e959e0fc098046044c650acf897ea52d2",
        "id": "CVE-2025-38248-51474d99"
    },
    {
        "digest": {
            "threshold": 0.9,
            "line_hashes": [
                "18255824204074679595161511280927985181",
                "103713960993500898722344549881537227914",
                "201853636338361807667147312140513460828",
                "197685339346835261992740043919861303503",
                "283616792624632096852988538075052733618",
                "168996817461736588823816171149796017968",
                "217738787463727613501073983289671775563",
                "311432459482170755610292409504602985608"
            ]
        },
        "signature_type": "Line",
        "target": {
            "file": "net/bridge/br_multicast.c"
        },
        "deprecated": false,
        "signature_version": "v1",
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f05a4f9e959e0fc098046044c650acf897ea52d2",
        "id": "CVE-2025-38248-a2861d81"
    }
]

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.15.0
Fixed
6.15.5